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

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

Issue 2490473007: Improved check for trivial templates. (Closed)
Patch Set: atomic_int is not necessary called that at this point in the check. Created 4 years, 1 month 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 | 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 3c12e9f50c77668ee862b6d27e778064c39eab45..c19b66b614a2f2829d5139513bb783c212b40399 100644
--- a/tools/clang/plugins/FindBadConstructsConsumer.cpp
+++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp
@@ -650,6 +650,7 @@ void FindBadConstructsConsumer::CountType(const Type* type,
TemplateName name =
dyn_cast<TemplateSpecializationType>(type)->getTemplateName();
bool whitelisted_template = false;
+ bool trivial_template = false;
// HACK: I'm at a loss about how to get the syntax checker to get
// whether a template is externed or not. For the first pass here,
@@ -660,11 +661,17 @@ void FindBadConstructsConsumer::CountType(const Type* type,
// fix. https://bugs.chromium.org/p/chromium/issues/detail?id=663463
if (TemplateDecl* decl = name.getAsTemplateDecl()) {
std::string base_name = decl->getNameAsString();
- if (base_name == "basic_string" || base_name == "atomic_int")
+ if (base_name == "basic_string")
whitelisted_template = true;
+ else if (base_name == "__atomic_int" || base_name == "atomic_int" ||
+ base_name == "__atomic_base") {
dcheng 2016/11/09 06:33:45 I'm wondering if we should just intercept this in
hans 2016/11/09 16:48:00 (Actually, the standard says atomic_int is either
palmer 2016/11/10 00:25:22 Done (and that resulted in a smaller diff, which i
+ trivial_template = true;
+ }
}
- if (whitelisted_template)
+ if (trivial_template)
+ (*trivial_member)++;
+ else if (whitelisted_template)
(*non_trivial_member)++;
else
(*templated_non_trivial_member)++;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698