[cfe-commits] r42411 - in /cfe/trunk: Lex/IdentifierTable.cpp include/clang/Lex/IdentifierTable.h
Steve Naroff
snaroff at apple.com
Thu Sep 27 11:52:21 PDT 2007
Author: snaroff
Date: Thu Sep 27 13:52:21 2007
New Revision: 42411
URL: http://llvm.org/viewvc/llvm-project?rev=42411&view=rev
Log:
Fix bug in SelectorInfo::getName() - method buffer needs to be passed by reference.
Modified:
cfe/trunk/Lex/IdentifierTable.cpp
cfe/trunk/include/clang/Lex/IdentifierTable.h
Modified: cfe/trunk/Lex/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/IdentifierTable.cpp?rev=42411&r1=42410&r2=42411&view=diff
==============================================================================
--- cfe/trunk/Lex/IdentifierTable.cpp (original)
+++ cfe/trunk/Lex/IdentifierTable.cpp Thu Sep 27 13:52:21 2007
@@ -33,23 +33,25 @@
return specId ? specId->getObjCKeywordID() : tok::objc_not_keyword;
}
-char *SelectorInfo::getName(llvm::SmallString<128> methodName) {
+char *SelectorInfo::getName(llvm::SmallVectorImpl<char> &methodName) {
int len=0;
methodName[0] = '\0';
if (NumArgs) {
keyword_iterator KeyIter = keyword_begin();
for (unsigned int i = 0; i < NumArgs; i++) {
if (KeyIter[i]) {
- methodName += KeyIter[i]->getName();
- len += strlen(KeyIter[i]->getName());
+ unsigned KeyLen = strlen(KeyIter[i]->getName());
+ methodName.append(KeyIter[i]->getName(), KeyIter[i]->getName()+KeyLen);
+ len += KeyLen;
}
- methodName += ":";
+ methodName.push_back(':');
len++;
}
} else {
IdentifierInfo **UnaryInfo = reinterpret_cast<IdentifierInfo **>(this+1);
- methodName += UnaryInfo[0]->getName();
- len += strlen(UnaryInfo[0]->getName());
+ unsigned NameLen = strlen(UnaryInfo[0]->getName());
+ methodName.append(UnaryInfo[0]->getName(), UnaryInfo[0]->getName()+NameLen);
+ len += NameLen;
}
methodName[len] = '\0';
return &methodName[0];
Modified: cfe/trunk/include/clang/Lex/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/IdentifierTable.h?rev=42411&r1=42410&r2=42411&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/IdentifierTable.h (original)
+++ cfe/trunk/include/clang/Lex/IdentifierTable.h Thu Sep 27 13:52:21 2007
@@ -194,7 +194,8 @@
}
// Derive the full selector name, placing the result into methodBuffer.
// As a convenience, a pointer to the first character is returned.
- char *getName(llvm::SmallString<128> methodBuffer);
+ // Example usage: llvm::SmallString<128> mbuf; Selector->getName(mbuf);
+ char *getName(llvm::SmallVectorImpl<char> &methodBuffer);
unsigned getNumArgs() const { return NumArgs; }
More information about the cfe-commits
mailing list