[cfe-commits] r59616 - in /cfe/trunk/lib/Sema: Sema.h SemaDecl.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 19 02:32:40 PST 2008
Author: ddunbar
Date: Wed Nov 19 04:32:38 2008
New Revision: 59616
URL: http://llvm.org/viewvc/llvm-project?rev=59616&view=rev
Log:
Fix silly code, use IdentifierInfo* instead of std::string in
PragmaPackStack. Thanks Chris!
Modified:
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=59616&r1=59615&r2=59616&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Nov 19 04:32:38 2008
@@ -71,12 +71,13 @@
/// 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 @@
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
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=59616&r1=59615&r2=59616&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Nov 19 04:32:38 2008
@@ -3197,7 +3197,7 @@
// 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());
More information about the cfe-commits
mailing list