r220407 - Fixup for r220403: Use getFileLoc() instead of getSpellingLoc() in SanitizerBlacklist.
Alexey Samsonov
vonosmas at gmail.com
Wed Oct 22 12:34:25 PDT 2014
Author: samsonov
Date: Wed Oct 22 14:34:25 2014
New Revision: 220407
URL: http://llvm.org/viewvc/llvm-project?rev=220407&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Basic/SanitizerBlacklist.cpp
cfe/trunk/test/CodeGen/address-safety-attr.cpp
Modified: cfe/trunk/lib/Basic/SanitizerBlacklist.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SanitizerBlacklist.cpp?rev=220407&r1=220406&r2=220407&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SanitizerBlacklist.cpp (original)
+++ cfe/trunk/lib/Basic/SanitizerBlacklist.cpp Wed Oct 22 14:34:25 2014
@@ -41,6 +41,6 @@ bool SanitizerBlacklist::isBlacklistedFi
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);
}
Modified: cfe/trunk/test/CodeGen/address-safety-attr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/address-safety-attr.cpp?rev=220407&r1=220406&r2=220407&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/address-safety-attr.cpp (original)
+++ cfe/trunk/test/CodeGen/address-safety-attr.cpp Wed Oct 22 14:34:25 2014
@@ -66,13 +66,19 @@ int BlacklistedFunction(int *a) { return
#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]]
More information about the cfe-commits
mailing list