Depends on D84185
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Ready for a review.
clang/lib/Frontend/CompilerInvocation.cpp | ||
---|---|---|
261 | We should keep an eye on the number of instantiations of this function template (and normalizeStringIntegral). If it grows, we can employ the SFINAE trick used for makeFlagToValueNormalizer. |
clang/lib/Frontend/CompilerInvocation.cpp | ||
---|---|---|
261 | Does it work to take the parameter as a Twine to avoid the template? static void denormalizeString(SmallVectorImpl<const char *> &Args, const char *Spelling, CompilerInvocation::StringAllocator SA, unsigned, Twine Value) { Args.push_back(Spelling); Args.push_back(SA(Value)); } |
clang/lib/Frontend/CompilerInvocation.cpp | ||
---|---|---|
261 | In general no. The Twine constructor is explicit for some types (integers, chars, etc.). |
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h | ||
---|---|---|
261–263 ↗ | (On Diff #311527) | Hmm, I wonder if this is entirely better. It's not obvious at all, looking at the code here, whether InlineMaxStackDepth can be used without getting initialized at all. I agree we should have the default value in two places -- I think removing assignment to 5 is the right thing to do -- but I'm not sure leaving this entirely uninitialized is a good thing. WDYT of initializing it to 0? |
clang/lib/Frontend/CompilerInvocation.cpp | ||
261 | Okay, then I suggest at least handling the ones that are convertible separately (without the template): static void denormalizeString(..., Twine Value) { Args.push_back(Spelling); Args.push_back(SA(Value)); } template <class T, std::enable_if_t<!std::is_convertible<T, Twine>::value && std::is_constructible<Twine, T>::value, bool> = false> static void denormalizeString(..., T Value) { denormalizeString(..., Twine(Value)); } | |
263–264 | I think it'd be better to reduce the overload set using std::enable_if than to add a static_assert here. |
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h | ||
---|---|---|
261–263 ↗ | (On Diff #311527) | I think leaving this uninitialized communicates the fact that it will be initialized somewhere else. If I saw unsigned InlineMacStackDepth = 0; and then observed it changing to 5 without passing -analyzer-inline-max-stack-depth=5, I'd be surprised. |
clang/lib/Frontend/CompilerInvocation.cpp | ||
261 | That looks good, thanks. |
LGTM.
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h | ||
---|---|---|
261–263 ↗ | (On Diff #311527) | Okay, that's fair. |
We should keep an eye on the number of instantiations of this function template (and normalizeStringIntegral).
If it grows, we can employ the SFINAE trick used for makeFlagToValueNormalizer.