Fixup for r220403: Use getFileLoc() instead of getSpellingLoc() in SanitizerBlacklist.

This also handles the case where function name (not its body)
is obtained from macro expansion.

llvm-svn: 220407
This commit is contained in:
Alexey Samsonov 2014-10-22 19:34:25 +00:00
parent 13491c4f24
commit 6d87ce8bd5
2 changed files with 8 additions and 2 deletions

View File

@ -41,6 +41,6 @@ bool SanitizerBlacklist::isBlacklistedFile(StringRef FileName,
bool SanitizerBlacklist::isBlacklistedLocation(SourceLocation Loc,
StringRef Category) const {
return !Loc.isInvalid() &&
isBlacklistedFile(SM.getFilename(SM.getSpellingLoc(Loc)), Category);
isBlacklistedFile(SM.getFilename(SM.getFileLoc(Loc)), Category);
}

View File

@ -66,13 +66,19 @@ int BlacklistedFunction(int *a) { return *a; }
#define GENERATE_FUNC(name) \
int name(int *a) { return *a; }
// WITHOUT: GeneratedFunction{{.*}}) [[NOATTR]]
// BLFILE: GeneratedFunction{{.*}}) [[NOATTR]]
// BLFUNC: GeneratedFunction{{.*}}) [[WITH]]
// ASAN: GeneratedFunction{{.*}}) [[WITH]]
GENERATE_FUNC(GeneratedFunction)
#define GENERATE_NAME(name) name##_generated
// WITHOUT: Function_generated{{.*}}) [[NOATTR]]
// BLFILE: Function_generated{{.*}}) [[NOATTR]]
// BLFUNC: Function_generated{{.*}}) [[WITH]]
// ASAN: Function_generated{{.*}}) [[WITH]]
int GENERATE_NAME(Function)(int *a) { return *a; }
// WITHOUT: TemplateAddressSafetyOk{{.*}}) [[NOATTR]]
// BLFILE: TemplateAddressSafetyOk{{.*}}) [[NOATTR]]
// BLFUNC: TemplateAddressSafetyOk{{.*}}) [[WITH]]