Fix a string over-run detected by ASAN.

llvm-svn: 148375
This commit is contained in:
Nick Lewycky 2012-01-18 03:41:19 +00:00
parent 9cf080fba3
commit 9ed5b156a2
1 changed files with 3 additions and 2 deletions

View File

@ -883,8 +883,9 @@ namespace {
unsigned BuiltinID = FD->getBuiltinID();
if (!BuiltinID)
return true;
const char *BuiltinName = BI.GetName(BuiltinID) + strlen("__builtin_");
if (Name == BuiltinName) {
StringRef BuiltinName = BI.GetName(BuiltinID);
if (BuiltinName.startswith("__builtin_") &&
Name == BuiltinName.slice(strlen("__builtin_"), StringRef::npos)) {
Result = true;
return false;
}