From 82320e94606cfb0f68c6049c070c3600f8df9081 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 12 Feb 2009 19:31:53 +0000 Subject: [PATCH] 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 --- lib/Lex/PTHLexer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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? -- 2.40.0