From 6d87ce8bd59a2b2e96fa418c4f5605cb8deda809 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Wed, 22 Oct 2014 19:34:25 +0000 Subject: [PATCH] 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 --- clang/lib/Basic/SanitizerBlacklist.cpp | 2 +- clang/test/CodeGen/address-safety-attr.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/clang/lib/Basic/SanitizerBlacklist.cpp b/clang/lib/Basic/SanitizerBlacklist.cpp index c894129..ea5b8d0 100644 --- a/clang/lib/Basic/SanitizerBlacklist.cpp +++ b/clang/lib/Basic/SanitizerBlacklist.cpp @@ -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); } diff --git a/clang/test/CodeGen/address-safety-attr.cpp b/clang/test/CodeGen/address-safety-attr.cpp index 0d585c7..031d013 100644 --- a/clang/test/CodeGen/address-safety-attr.cpp +++ b/clang/test/CodeGen/address-safety-attr.cpp @@ -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]] -- 2.7.4