[cfe-commits] r64397 - /cfe/trunk/lib/Lex/PTHLexer.cpp

Daniel Dunbar daniel at zuster.org
Thu Feb 12 11:31:53 PST 2009


Author: ddunbar
Date: Thu Feb 12 13:31:53 2009
New Revision: 64397

URL: http://llvm.org/viewvc/llvm-project?rev=64397&view=rev
Log:
Fix assertion when input is an empty string.

Modified:
    cfe/trunk/lib/Lex/PTHLexer.cpp

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

==============================================================================
--- cfe/trunk/lib/Lex/PTHLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PTHLexer.cpp Thu Feb 12 13:31:53 2009
@@ -721,7 +721,7 @@
 IdentifierInfo* PTHManager::get(const char *NameStart, const char *NameEnd) {
   PTHStringIdLookup& SL = *((PTHStringIdLookup*)StringIdLookup);
   // Double check our assumption that the last character isn't '\0'.
-  assert(NameStart[NameEnd-NameStart-1] != '\0');
+  assert(NameEnd==NameStart || NameStart[NameEnd-NameStart-1] != '\0');
   PTHStringIdLookup::iterator I = SL.find(std::make_pair(NameStart,
                                                          NameEnd - NameStart));
   if (I == SL.end()) // No identifier found?





More information about the cfe-commits mailing list