aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-10-04 19:21:03 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-10-04 19:21:03 +0000
commitfcdd8fe26de3eee44927600bf1853e21bd90dd84 (patch)
treea8219fdefd72e2998c0940cf0a73e17fb10ec839 /lib/Parse/Parser.cpp
parent4095080aff204008eefb26b100906c6ca2bc4bb6 (diff)
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
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.