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

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

Issue 2749043004: Clang plugin: Support for Blink in web/. (Closed)
Patch Set: namespace approach Created 3 years, 8 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 | « tools/clang/plugins/FindBadConstructsConsumer.h ('k') | no next file » | 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 629090c557ab1e05b678b36b6f83d5565f0a32c6..633e2ed58caf90b26fecf3a35fd1239cad0ac402 100644
--- a/tools/clang/plugins/FindBadConstructsConsumer.cpp
+++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp
@@ -460,9 +460,10 @@ bool FindBadConstructsConsumer::IsMethodInBannedOrTestingNamespace(
SuppressibleDiagnosticBuilder
FindBadConstructsConsumer::ReportIfSpellingLocNotIgnored(
SourceLocation loc,
+ const Decl* record,
unsigned diagnostic_id) {
- LocationType type =
- ClassifyLocation(instance().getSourceManager().getSpellingLoc(loc));
+ LocationType type = ClassifyLocation(
+ instance().getSourceManager().getSpellingLoc(loc), record);
bool ignored =
type == LocationType::kThirdParty || type == LocationType::kBlink;
return SuppressibleDiagnosticBuilder(&diagnostic(), loc, diagnostic_id,
@@ -534,7 +535,7 @@ void FindBadConstructsConsumer::CheckVirtualSpecifiers(
// Note this is just an educated guess: the assumption here is that any
// macro for declaring methods will probably be at the start of the method's
// source range.
- ReportIfSpellingLocNotIgnored(method->getLocStart(),
+ ReportIfSpellingLocNotIgnored(method->getLocStart(), method,
diag_redundant_virtual_specifier_)
<< "'virtual'"
<< (override_attr ? static_cast<Attr*>(override_attr) : final_attr)
@@ -585,23 +586,23 @@ void FindBadConstructsConsumer::CheckVirtualSpecifiers(
// Again, only emit the warning if it doesn't originate from a macro in
// a system header.
if (loc.isValid()) {
- ReportIfSpellingLocNotIgnored(loc, diag_method_requires_override_)
+ ReportIfSpellingLocNotIgnored(loc, method, diag_method_requires_override_)
<< FixItHint::CreateInsertion(loc, " override");
} else {
- ReportIfSpellingLocNotIgnored(range.getBegin(),
+ ReportIfSpellingLocNotIgnored(range.getBegin(), method,
diag_method_requires_override_);
}
}
if (final_attr && override_attr) {
- ReportIfSpellingLocNotIgnored(override_attr->getLocation(),
+ ReportIfSpellingLocNotIgnored(override_attr->getLocation(), method,
diag_redundant_virtual_specifier_)
<< override_attr << final_attr
<< FixItHint::CreateRemoval(override_attr->getRange());
}
if (final_attr && !is_override) {
- ReportIfSpellingLocNotIgnored(method->getLocStart(),
+ ReportIfSpellingLocNotIgnored(method->getLocStart(), method,
diag_base_method_virtual_and_final_)
<< FixItRemovalForVirtual(manager, lang_opts, method)
<< FixItHint::CreateRemoval(final_attr->getRange());
@@ -622,7 +623,8 @@ void FindBadConstructsConsumer::CheckVirtualBodies(
bool emit = true;
if (loc.isMacroID()) {
SourceManager& manager = instance().getSourceManager();
- LocationType type = ClassifyLocation(manager.getSpellingLoc(loc));
+ LocationType type =
+ ClassifyLocation(manager.getSpellingLoc(loc), method);
if (type == LocationType::kThirdParty || type == LocationType::kBlink)
emit = false;
else {
@@ -1013,7 +1015,7 @@ void FindBadConstructsConsumer::CheckVarDecl(clang::VarDecl* var_decl) {
// should be fewer auto types than banned namespace/directory types,
// so check this last.
LocationType location_type =
- ClassifyLocation(var_decl->getLocStart());
+ ClassifyLocation(var_decl->getLocStart(), var_decl);
if (!InBannedNamespace(var_decl) &&
location_type != LocationType::kThirdParty) {
// The range starts from |var_decl|'s loc start, which is the
@@ -1026,7 +1028,7 @@ void FindBadConstructsConsumer::CheckVarDecl(clang::VarDecl* var_decl) {
clang::SourceRange range(
var_decl->getLocStart(),
var_decl->getTypeSourceInfo()->getTypeLoc().getLocEnd());
- ReportIfSpellingLocNotIgnored(range.getBegin(),
+ ReportIfSpellingLocNotIgnored(range.getBegin(), var_decl,
diag_auto_deduced_to_a_pointer_type_)
<< FixItHint::CreateReplacement(
range,
« no previous file with comments | « tools/clang/plugins/FindBadConstructsConsumer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698