diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-13 09:07:17 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-13 09:07:17 +0000 |
commit | 9b36c3f0de0105e903130bbda3c4aea7d792c0af (patch) | |
tree | 66f0c582d3ebf63b52b90596156e3ddf75814a4f /lib/Parse/Parser.cpp | |
parent | de80ec1fa947855d2e53722a8cd71367ff513481 (diff) |
Modify the pragma handlers to accept and use StringRefs instead of IdentifierInfos.
When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded).
We can avoid this if we just use StringRefs for the pragmas.
As a bonus, since we don't have to create and pass IdentifierInfos, the pragma interfaces get a bit more simplified.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r-- | lib/Parse/Parser.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 02fac16905..ac78f114a9 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -33,23 +33,17 @@ Parser::Parser(Preprocessor &pp, Action &actions) // Add #pragma handlers. These are removed and destroyed in the // destructor. - OptionsHandler.reset(new - PragmaOptionsHandler(&PP.getIdentifierTable().get("options"), - actions)); - PP.AddPragmaHandler(0, OptionsHandler.get()); - - PackHandler.reset(new - PragmaPackHandler(&PP.getIdentifierTable().get("pack"), actions)); - PP.AddPragmaHandler(0, PackHandler.get()); - - UnusedHandler.reset(new - PragmaUnusedHandler(&PP.getIdentifierTable().get("unused"), actions, - *this)); - PP.AddPragmaHandler(0, UnusedHandler.get()); - - WeakHandler.reset(new - PragmaWeakHandler(&PP.getIdentifierTable().get("weak"), actions)); - PP.AddPragmaHandler(0, WeakHandler.get()); + OptionsHandler.reset(new PragmaOptionsHandler(actions)); + PP.AddPragmaHandler(OptionsHandler.get()); + + PackHandler.reset(new PragmaPackHandler(actions)); + PP.AddPragmaHandler(PackHandler.get()); + + UnusedHandler.reset(new PragmaUnusedHandler(actions, *this)); + PP.AddPragmaHandler(UnusedHandler.get()); + + WeakHandler.reset(new PragmaWeakHandler(actions)); + PP.AddPragmaHandler(WeakHandler.get()); } /// If a crash happens while the parser is active, print out a line indicating @@ -304,13 +298,13 @@ Parser::~Parser() { delete ScopeCache[i]; // Remove the pragma handlers we installed. - PP.RemovePragmaHandler(0, OptionsHandler.get()); + PP.RemovePragmaHandler(OptionsHandler.get()); OptionsHandler.reset(); - PP.RemovePragmaHandler(0, PackHandler.get()); + PP.RemovePragmaHandler(PackHandler.get()); PackHandler.reset(); - PP.RemovePragmaHandler(0, UnusedHandler.get()); + PP.RemovePragmaHandler(UnusedHandler.get()); UnusedHandler.reset(); - PP.RemovePragmaHandler(0, WeakHandler.get()); + PP.RemovePragmaHandler(WeakHandler.get()); WeakHandler.reset(); } |