| Index: tools/clang/plugins/ChromeClassTester.cpp
|
| diff --git a/tools/clang/plugins/ChromeClassTester.cpp b/tools/clang/plugins/ChromeClassTester.cpp
|
| index 8d0b22d0cce786dc2953c4fadf6647a59debbbc5..b39e14a0e2b08cfa8de907a4894c7af244cf1973 100644
|
| --- a/tools/clang/plugins/ChromeClassTester.cpp
|
| +++ b/tools/clang/plugins/ChromeClassTester.cpp
|
| @@ -189,12 +189,31 @@ std::string ChromeClassTester::GetNamespace(const Decl* record) {
|
|
|
| bool ChromeClassTester::InImplementationFile(SourceLocation record_location) {
|
| std::string filename;
|
| - if (!GetFilename(record_location, &filename))
|
| - return false;
|
|
|
| - if (ends_with(filename, ".cc") || ends_with(filename, ".cpp") ||
|
| - ends_with(filename, ".mm")) {
|
| - return true;
|
| + if (options_.follow_macro_expansion) {
|
| + // If |record_location| is a macro, check the whole chain of expansions.
|
| + const SourceManager& source_manager = instance_.getSourceManager();
|
| + while (true) {
|
| + if (GetFilename(record_location, &filename)) {
|
| + if (ends_with(filename, ".cc") || ends_with(filename, ".cpp") ||
|
| + ends_with(filename, ".mm")) {
|
| + return true;
|
| + }
|
| + }
|
| + if (!record_location.isMacroID()) {
|
| + break;
|
| + }
|
| + record_location =
|
| + source_manager.getImmediateExpansionRange(record_location).first;
|
| + }
|
| + } else {
|
| + if (!GetFilename(record_location, &filename))
|
| + return false;
|
| +
|
| + if (ends_with(filename, ".cc") || ends_with(filename, ".cpp") ||
|
| + ends_with(filename, ".mm")) {
|
| + return true;
|
| + }
|
| }
|
|
|
| return false;
|
|
|