[cfe-commits] r155323 - /cfe/trunk/lib/Parse/ParseDeclCXX.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sun Apr 22 13:43:30 PDT 2012
Author: d0k
Date: Sun Apr 22 15:43:30 2012
New Revision: 155323
URL: http://llvm.org/viewvc/llvm-project?rev=155323&view=rev
Log:
Remove unnecessary StringRef->char*->StringRef conversion, which read uninitialized memory if the input wasn't 0-terminated.
Found by valgrind.
Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=155323&r1=155322&r2=155323&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sun Apr 22 15:43:30 2012
@@ -2847,7 +2847,7 @@
StringRef Spelling = PP.getSpelling(Tok.getLocation(), SpellingBuf);
if (std::isalpha(Spelling[0])) {
Loc = ConsumeToken();
- return &PP.getIdentifierTable().get(Spelling.data());
+ return &PP.getIdentifierTable().get(Spelling);
}
return 0;
}
More information about the cfe-commits
mailing list