From: Benjamin Kramer Date: Sun, 22 Apr 2012 20:43:30 +0000 (+0000) Subject: Remove unnecessary StringRef->char*->StringRef conversion, which read uninitialized... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0eb7526cd2524af78fb9a2a2522045fb25fc3d27;p=clang Remove unnecessary StringRef->char*->StringRef conversion, which read uninitialized memory if the input wasn't 0-terminated. Found by valgrind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155323 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index c391782dca..771388fd60 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -2847,7 +2847,7 @@ IdentifierInfo *Parser::TryParseCXX11AttributeIdentifier(SourceLocation &Loc) { 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; }