diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-27 02:25:27 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-27 02:25:27 +0000 |
commit | ae2232b9957302374ee8d8626aeedcb4e4c0441e (patch) | |
tree | 6dcb8cb978a73e4c13f89c320aaed534d2c9e6be /lib/Sema/SemaAttr.cpp | |
parent | e03d99247412702660c9c8b8b9b98a1def8a2195 (diff) |
Sema: Factor out struct for alignment stack entries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaAttr.cpp')
-rw-r--r-- | lib/Sema/SemaAttr.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Sema/SemaAttr.cpp b/lib/Sema/SemaAttr.cpp index ee6aef0629..2075f9aa93 100644 --- a/lib/Sema/SemaAttr.cpp +++ b/lib/Sema/SemaAttr.cpp @@ -24,10 +24,15 @@ using namespace clang; //===----------------------------------------------------------------------===// namespace { + struct PackStackEntry { + unsigned Alignment; + IdentifierInfo *Name; + }; + /// PragmaPackStack - Simple class to wrap the stack used by #pragma /// pack. class PragmaPackStack { - typedef std::vector< std::pair<unsigned, IdentifierInfo*> > stack_ty; + typedef std::vector<PackStackEntry> stack_ty; /// Alignment - The current user specified alignment. unsigned Alignment; @@ -45,7 +50,8 @@ namespace { /// 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)); + PackStackEntry PSE = { Alignment, Name }; + Stack.push_back(PSE); } /// pop - Pop a record from the stack and restore the current @@ -62,7 +68,7 @@ bool PragmaPackStack::pop(IdentifierInfo *Name) { // If name is empty just pop top. if (!Name) { - Alignment = Stack.back().first; + Alignment = Stack.back().Alignment; Stack.pop_back(); return true; } @@ -70,9 +76,9 @@ bool PragmaPackStack::pop(IdentifierInfo *Name) { // Otherwise, find the named record. for (unsigned i = Stack.size(); i != 0; ) { --i; - if (Stack[i].second == Name) { + if (Stack[i].Name == Name) { // Found it, pop up to and including this record. - Alignment = Stack[i].first; + Alignment = Stack[i].Alignment; Stack.erase(Stack.begin() + i, Stack.end()); return true; } |