Add Parser support for #pragma pack
- Uses Action::ActOnPragmaPack
- Test case is XFAIL pending verifier fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57066 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 797de92..800be8d 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 @@
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 @@
// 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.