diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-17 01:09:29 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-17 01:09:29 +0000 |
commit | 31180bbfb4da2e3e7bf1d7dc4d72b9decf9dcd78 (patch) | |
tree | 2cf8024d885cf7ac77720eaac9598cae212e0404 /clang/lib/Sema/Sema.h | |
parent | 264ec4f2377624a9ef3418d40de67b7579b5c5f5 (diff) | |
download | bcm5719-llvm-31180bbfb4da2e3e7bf1d7dc4d72b9decf9dcd78.tar.gz bcm5719-llvm-31180bbfb4da2e3e7bf1d7dc4d72b9decf9dcd78.zip |
Make PragmaPackStack be a private class in SemaAttr and make its
instance in Sema be a pimpl.
llvm-svn: 64718
Diffstat (limited to 'clang/lib/Sema/Sema.h')
-rw-r--r-- | clang/lib/Sema/Sema.h | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index 2e457156d1e..067c7a57df4 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -78,37 +78,6 @@ namespace clang { class BasePaths; class MemberLookupCriteria; -/// PragmaPackStack - Simple class to wrap the stack used by #pragma -/// pack. -class PragmaPackStack { - typedef std::vector< std::pair<unsigned, IdentifierInfo*> > stack_ty; - - /// Alignment - The current user specified alignment. - unsigned Alignment; - - /// Stack - Entries in the #pragma pack stack, consisting of saved - /// alignments and optional names. - stack_ty Stack; - -public: - PragmaPackStack(unsigned A) : Alignment(A) {} - - void setAlignment(unsigned A) { Alignment = A; } - unsigned getAlignment() { return Alignment; } - - /// push - Push the current alignment onto the stack, optionally - /// using the given \arg Name for the record, if non-zero. - void push(IdentifierInfo *Name) { - Stack.push_back(std::make_pair(Alignment, Name)); - } - - /// pop - Pop a record from the stack and restore the current - /// alignment to the previous value. If \arg Name is non-zero then - /// the first such named record is popped, otherwise the top record - /// is popped. Returns true if the pop succeeded. - bool pop(IdentifierInfo *Name); -}; - /// Sema - This implements semantic analysis and AST building for C. class Sema : public Action { Sema(const Sema&); // DO NOT IMPLEMENT @@ -134,7 +103,7 @@ public: /// PackContext - Manages the stack for #pragma pack. An alignment /// of 0 indicates default alignment. - PragmaPackStack PackContext; + void *PackContext; // Really a "PragmaPackStack*" /// LabelMap - This is a mapping from label identifiers to the LabelStmt for /// it (which acts like the label decl in some ways). Forward referenced @@ -231,6 +200,9 @@ public: llvm::DenseMap<Selector, ObjCMethodList> FactoryMethodPool; public: Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer); + ~Sema() { + if (PackContext) FreePackedContext(); + } const LangOptions &getLangOptions() const { return LangOpts; } Diagnostic &getDiagnostics() const { return Diags; } @@ -1706,6 +1678,13 @@ public: SourceLocation PragmaLoc, SourceLocation LParenLoc, SourceLocation RParenLoc); + + /// getPragmaPackAlignment() - Return the current alignment as specified by + /// the current #pragma pack directive, or 0 if none is currently active. + unsigned getPragmaPackAlignment() const; + + /// FreePackedContext - Deallocate and null out PackContext. + void FreePackedContext(); /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit /// cast. If there is already an implicit cast, merge into the existing one. |