Commit 362c69d2 authored by danakj's avatar danakj Committed by Commit bot

rewrite_to_chrome_style: Use constexpr as backdoor to get consistency

In the last cases of inconsistent evaluation of compile-time-constants
just make them constexpr and then ensure we always see constexpr things
as compile-time constants. Actually compiling figures this out even
though from the AST we see unresolved things that make this hard.

R=dcheng
BUG=677285

Review-Url: https://codereview.chromium.org/2626923004
Cr-Commit-Position: refs/heads/master@{#443115}
parent 21d2ea5e
......@@ -690,9 +690,9 @@ struct TraceInCollectionTrait<WeakHandlingInCollections,
// key-value entry is leaked. To avoid unexpected leaking, we disallow
// this case, but if you run into this assert, please reach out to Blink
// reviewers, and we may relax it.
const bool keyIsWeak =
constexpr bool keyIsWeak =
Traits::KeyTraits::weakHandlingFlag == WeakHandlingInCollections;
const bool valueIsWeak =
constexpr bool valueIsWeak =
Traits::ValueTraits::weakHandlingFlag == WeakHandlingInCollections;
const bool keyHasStrongRefs =
IsTraceableInCollectionTrait<typename Traits::KeyTraits>::value;
......
......@@ -475,6 +475,9 @@ bool IsProbablyConst(const clang::VarDecl& decl,
if (type.isVolatileQualified())
return false;
if (decl.isConstexpr())
return true;
// Parameters should not be renamed to |kFooBar| style (even if they are
// const and have an initializer (aka default value)).
if (clang::isa<clang::ParmVarDecl>(&decl))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment