Chromium Code Reviews| Index: tools/clang/plugins/FindBadConstructsConsumer.cpp |
| diff --git a/tools/clang/plugins/FindBadConstructsConsumer.cpp b/tools/clang/plugins/FindBadConstructsConsumer.cpp |
| index a7b75198f53375197dfe14d88284ed0e1f3b8255..a5d12b88cdfd5ff765f72b79eafe76ee8826260d 100644 |
| --- a/tools/clang/plugins/FindBadConstructsConsumer.cpp |
| +++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp |
| @@ -508,9 +508,27 @@ void FindBadConstructsConsumer::CheckVirtualBodies( |
| if (method->hasBody() && method->hasInlineBody()) { |
| if (CompoundStmt* cs = dyn_cast<CompoundStmt>(method->getBody())) { |
| if (cs->size()) { |
| - emitWarning(cs->getLBracLoc(), |
| - "virtual methods with non-empty bodies shouldn't be " |
| - "declared inline."); |
| + SourceLocation loc = cs->getLBracLoc(); |
| + // CR_BEGIN_MSG_MAP_EX and BEGIN_SAFE_MSG_MAP_EX try to be compatible |
| + // to BEGIN_MSG_MAP(_EX). So even though they are in chrome code, |
| + // we can't easily fix them, so explicilty whitelist them here. |
|
scottmg
2015/05/07 22:43:30
"explicitly"
Nico
2015/05/07 22:50:31
Done.
|
| + bool emit = true; |
| + if (loc.isMacroID()) { |
| + SourceManager& manager = instance().getSourceManager(); |
| + if (InBannedDirectory(manager.getSpellingLoc(loc))) |
| + emit = false; |
| + else { |
| + StringRef name = Lexer::getImmediateMacroName( |
| + loc, manager, instance().getLangOpts()); |
| + if (name == "CR_BEGIN_MSG_MAP_EX" || |
| + name == "BEGIN_SAFE_MSG_MAP_EX") |
| + emit = false; |
| + } |
| + } |
| + if (emit) |
| + emitWarning(cs->getLBracLoc(), |
|
dcheng
2015/05/07 22:43:14
Nit: loc?
Nico
2015/05/07 22:50:31
Done.
|
| + "virtual methods with non-empty bodies shouldn't be " |
| + "declared inline."); |
| } |
| } |
| } |