forked from OSchip/llvm-project
SanitizerBlacklist: Use spelling location for blacklisting purposes.
When SanitizerBlacklist decides if the SourceLocation is blacklisted, we need to first turn it into a SpellingLoc before fetching the filename and scanning "src:" entries. Otherwise we will fail to fecth the correct filename for function definitions coming from macro expansion. llvm-svn: 220403
This commit is contained in:
parent
64313c94ae
commit
fa7a8569bb
|
@ -40,6 +40,7 @@ bool SanitizerBlacklist::isBlacklistedFile(StringRef FileName,
|
|||
|
||||
bool SanitizerBlacklist::isBlacklistedLocation(SourceLocation Loc,
|
||||
StringRef Category) const {
|
||||
return !Loc.isInvalid() && isBlacklistedFile(SM.getFilename(Loc), Category);
|
||||
return !Loc.isInvalid() &&
|
||||
isBlacklistedFile(SM.getFilename(SM.getSpellingLoc(Loc)), Category);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,15 @@ int AddressSafetyOk(int *a) { return *a; }
|
|||
// ASAN: BlacklistedFunction{{.*}}) [[WITH]]
|
||||
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)
|
||||
|
||||
// WITHOUT: TemplateAddressSafetyOk{{.*}}) [[NOATTR]]
|
||||
// BLFILE: TemplateAddressSafetyOk{{.*}}) [[NOATTR]]
|
||||
// BLFUNC: TemplateAddressSafetyOk{{.*}}) [[WITH]]
|
||||
|
|
Loading…
Reference in New Issue