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

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

Issue 2624253002: rewrite_to_chrome_style: Make const decisions aware of const variables (Closed)
Patch Set: consistent-consts-3: Created 3 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 5141ccf6bda64f71f78f291fa5f2cba57a88a038..4014d97e902b92bfb5b410f313831660b31aa915 100644
--- a/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
+++ b/tools/clang/rewrite_to_chrome_style/RewriteToChromeStyle.cpp
@@ -409,8 +409,11 @@ bool CanBeEvaluatedAtCompileTime(const clang::Stmt* stmt,
case clang::Stmt::DeclRefExprClass: {
auto* declref = clang::dyn_cast<clang::DeclRefExpr>(expr);
auto* decl = declref->getDecl();
- if (clang::dyn_cast<clang::VarDecl>(decl))
+ if (auto* vardecl = clang::dyn_cast<clang::VarDecl>(decl)) {
+ if (auto* initializer = vardecl->getInit())
+ return CanBeEvaluatedAtCompileTime(initializer, context);
return false;
+ }
break;
}
« 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