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

Unified Diff: tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp

Issue 1645243002: rewrite_to_chrome_style: Avoid asserts when checking for const-ness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/rewrite_to_chrome_style/tests/template-expected.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
diff --git a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
index 9123f5527b8b6411a510dda0371e251cb9248078..c261f252a9e55248ac6b7e61ef39b972682b55e4 100644
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
@@ -150,6 +150,15 @@ bool IsProbablyConst(const clang::VarDecl& decl,
if (!initializer)
return false;
+ // If the expression is dependent on a template input, then we are not
+ // sure if it can be compile-time generated as calling isEvaluatable() is
+ // not valid on |initializer|.
+ // TODO(crbug.com/581218): We could probably look at each compiled
+ // instantiation of the template and see if they are all compile-time
+ // isEvaluable().
+ if (initializer->isInstantiationDependent())
+ return false;
+
// If the expression can be evaluated at compile time, then it should have a
// kFoo style name. Otherwise, not.
return initializer->isEvaluatable(context);
« no previous file with comments | « no previous file | tools/clang/rewrite_to_chrome_style/tests/template-expected.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698