Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Unified Diff: tools/clang/plugins/ChromeClassTester.cpp

Issue 1504033010: Follow macro invocations when checking if a violation happened in a .cc file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/clang/plugins/FindBadConstructsAction.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/plugins/ChromeClassTester.cpp
diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp
index b0bc8d50dd6c3e2d140f3c4e7b86cc4a9c80a082..256fb8596e82d1173dc5827a9ff86d98ec490961 100644
--- a/tools/clang/plugins/ChromeClassTester.cpp
+++ b/tools/clang/plugins/ChromeClassTester.cpp
@@ -188,6 +188,12 @@ std::string ChromeClassTester::GetNamespace(const Decl* record) {
}
bool ChromeClassTester::InImplementationFile(SourceLocation record_location) {
+ if (options_.follow_macro_expansion) {
+ // If |record_location| is a macro, check where it was called.
+ const SourceManager& source_manager = instance_.getSourceManager();
+ record_location = source_manager.getExpansionRange(record_location).first;
Jeffrey Yasskin 2015/12/10 04:19:20 I thought I could just go to the outermost macro a
+ }
+
std::string filename;
if (!GetFilename(record_location, &filename))
return false;
« no previous file with comments | « no previous file | tools/clang/plugins/FindBadConstructsAction.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698