[cfe-commits] r86105 - in /cfe/trunk: include/clang/Lex/Preprocessor.h lib/Lex/Preprocessor.cpp

Daniel Dunbar daniel at zuster.org
Wed Nov 4 17:53:40 PST 2009


Author: ddunbar
Date: Wed Nov  4 19:53:39 2009
New Revision: 86105

URL: http://llvm.org/viewvc/llvm-project?rev=86105&view=rev
Log:
StringRefize Preprocessor::getIdentifierInfo.

Modified:
    cfe/trunk/include/clang/Lex/Preprocessor.h
    cfe/trunk/lib/Lex/Preprocessor.cpp

Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=86105&r1=86104&r2=86105&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Wed Nov  4 19:53:39 2009
@@ -296,12 +296,8 @@
   /// pointers is preferred unless the identifier is already available as a
   /// string (this avoids allocation and copying of memory to construct an
   /// std::string).
-  IdentifierInfo *getIdentifierInfo(const char *NameStart,
-                                    const char *NameEnd) {
-    return &Identifiers.get(NameStart, NameEnd);
-  }
-  IdentifierInfo *getIdentifierInfo(const char *NameStr) {
-    return getIdentifierInfo(NameStr, NameStr+strlen(NameStr));
+  IdentifierInfo *getIdentifierInfo(llvm::StringRef Name) {
+    return &Identifiers.get(Name);
   }
 
   /// AddPragmaHandler - Add the specified pragma handler to the preprocessor.

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=86105&r1=86104&r2=86105&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Wed Nov  4 19:53:39 2009
@@ -409,14 +409,14 @@
   IdentifierInfo *II;
   if (BufPtr && !Identifier.needsCleaning()) {
     // No cleaning needed, just use the characters from the lexed buffer.
-    II = getIdentifierInfo(BufPtr, BufPtr+Identifier.getLength());
+    II = getIdentifierInfo(llvm::StringRef(BufPtr, Identifier.getLength()));
   } else {
     // Cleaning needed, alloca a buffer, clean into it, then use the buffer.
     llvm::SmallVector<char, 64> IdentifierBuffer;
     IdentifierBuffer.resize(Identifier.getLength());
     const char *TmpBuf = &IdentifierBuffer[0];
     unsigned Size = getSpelling(Identifier, TmpBuf);
-    II = getIdentifierInfo(TmpBuf, TmpBuf+Size);
+    II = getIdentifierInfo(llvm::StringRef(TmpBuf, Size));
   }
   Identifier.setIdentifierInfo(II);
   return II;





More information about the cfe-commits mailing list