aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Parse/Parser.cpp')
-rw-r--r--lib/Parse/Parser.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 797de9284e..800be8dd01 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -15,6 +15,7 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Parse/Scope.h"
+#include "ParsePragma.h"
using namespace clang;
Parser::Parser(Preprocessor &pp, Action &actions)
@@ -24,6 +25,13 @@ Parser::Parser(Preprocessor &pp, Action &actions)
NumCachedScopes = 0;
ParenCount = BracketCount = BraceCount = 0;
ObjCImpDecl = 0;
+
+ // Add #pragma handlers. These are removed and destroyed in the
+ // destructor.
+ PackHandler =
+ new PragmaPackHandler(&PP.getIdentifierTable().get("pack"), actions);
+ PP.AddPragmaHandler(0, PackHandler);
+
// Instantiate a LexedMethodsForTopClass for all the non-nested classes.
PushTopClassStack();
}
@@ -233,6 +241,10 @@ Parser::~Parser() {
// Free the scope cache.
for (unsigned i = 0, e = NumCachedScopes; i != e; ++i)
delete ScopeCache[i];
+
+ // Remove the pragma handlers we installed.
+ PP.RemovePragmaHandler(0, PackHandler);
+ delete PackHandler;
}
/// Initialize - Warm up the parser.