From: Daniel Dunbar Date: Thu, 12 Feb 2009 19:31:53 +0000 (+0000) Subject: Fix assertion when input is an empty string. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82320e94606cfb0f68c6049c070c3600f8df9081;p=clang Fix assertion when input is an empty string. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64397 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp index 4648ac8ee4..0cd17e74a4 100644 --- a/lib/Lex/PTHLexer.cpp +++ b/lib/Lex/PTHLexer.cpp @@ -721,7 +721,7 @@ IdentifierInfo* PTHManager::LazilyCreateIdentifierInfo(unsigned PersistentID) { 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?