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

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

Issue 1129093002: plugin: Do not warn on virtual/override stuff coming from macros in system headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: actual change Created 5 years, 7 months 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/tests/system/windows.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/plugins/FindBadConstructsConsumer.cpp
diff --git a/tools/clang/plugins/FindBadConstructsConsumer.cpp b/tools/clang/plugins/FindBadConstructsConsumer.cpp
index 4dc305e4a4e3d61bd751ce65f44812348e8335bc..ce44aeb595bf3890c54a0b8bc0460ff6ce37400d 100644
--- a/tools/clang/plugins/FindBadConstructsConsumer.cpp
+++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp
@@ -471,22 +471,30 @@ void FindBadConstructsConsumer::CheckVirtualSpecifiers(
}
}
}
+ // Again, only emit the warning if it doesn't originate from a macro in
hans 2015/05/06 22:47:42 Silly question: what does "Again" refer to here?
+ // a system header.
if (loc.isValid()) {
- diagnostic().Report(loc, diag_method_requires_override_)
- << FixItHint::CreateInsertion(loc, " override");
+ if (!InBannedDirectory(manager.getSpellingLoc(loc))) {
dcheng 2015/05/06 22:44:26 It almost feels like this should be a helper. rep
Nico 2015/05/06 22:49:24 I considered that, but it's really only this funct
+ diagnostic().Report(loc, diag_method_requires_override_)
+ << FixItHint::CreateInsertion(loc, " override");
+ }
} else {
- diagnostic().Report(range.getBegin(), diag_method_requires_override_);
+ if (!InBannedDirectory(manager.getSpellingLoc(range.getBegin())))
+ diagnostic().Report(range.getBegin(), diag_method_requires_override_);
}
}
- if (final_attr && override_attr) {
+ if (final_attr && override_attr &&
+ !InBannedDirectory(
+ manager.getSpellingLoc(override_attr->getLocation()))) {
diagnostic().Report(override_attr->getLocation(),
diag_redundant_virtual_specifier_)
<< override_attr << final_attr
<< FixItHint::CreateRemoval(override_attr->getRange());
}
- if (final_attr && !is_override) {
+ if (final_attr && !is_override &&
+ !InBannedDirectory(manager.getSpellingLoc(method->getLocStart()))) {
diagnostic().Report(method->getLocStart(),
diag_base_method_virtual_and_final_)
<< FixItRemovalForVirtual(manager, method)
« no previous file with comments | « no previous file | tools/clang/plugins/tests/system/windows.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698