diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-11-19 10:32:38 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-11-19 10:32:38 +0000 |
commit | af7efa695c5c775dbe33a69c3b69c994a4fbaf2c (patch) | |
tree | d93879f22c53661c6c3757b44fd402fca0cdf84c | |
parent | 9b1335eca844fb364e78f5de1f5efa968900a120 (diff) | |
download | bcm5719-llvm-af7efa695c5c775dbe33a69c3b69c994a4fbaf2c.tar.gz bcm5719-llvm-af7efa695c5c775dbe33a69c3b69c994a4fbaf2c.zip |
Fix silly code, use IdentifierInfo* instead of std::string in
PragmaPackStack. Thanks Chris!
llvm-svn: 59616
-rw-r--r-- | clang/lib/Sema/Sema.h | 11 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index 7890070945c..29994d41c30 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -71,12 +71,13 @@ namespace clang { /// PragmaPackStack - Simple class to wrap the stack used by #pragma /// pack. class PragmaPackStack { - typedef std::vector< std::pair<unsigned, std::string> > stack_ty; + typedef std::vector< std::pair<unsigned, IdentifierInfo*> > stack_ty; /// Alignment - The current user specified alignment. unsigned Alignment; - /// Stack - Entries in the #pragma pack stack. + /// Stack - Entries in the #pragma pack stack, consisting of saved + /// alignments and optional names. stack_ty Stack; public: @@ -86,11 +87,9 @@ public: unsigned getAlignment() { return Alignment; } /// push - Push the current alignment onto the stack, optionally - /// using the given \arg Name for the record, if non-zero, + /// using the given \arg Name for the record, if non-zero. void push(IdentifierInfo *Name) { - // FIXME: Why does this push 'Name' as an std::string?? - Stack.push_back(std::make_pair(Alignment, - std::string(Name ? Name->getName() : ""))); + Stack.push_back(std::make_pair(Alignment, Name)); } /// pop - Pop a record from the stack and restore the current diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index f9d946e5468..d6d9845af79 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3197,7 +3197,7 @@ bool PragmaPackStack::pop(IdentifierInfo *Name) { // Otherwise, find the named record. for (unsigned i = Stack.size(); i != 0; ) { --i; - if (Name->isName(Stack[i].second.c_str())) { + if (Stack[i].second == Name) { // Found it, pop up to and including this record. Alignment = Stack[i].first; Stack.erase(Stack.begin() + i, Stack.end()); |