[PATCH] D57860: [analyzer] Validate checker option names and values
Whisperity via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 12 06:21:48 PDT 2019
whisperity added inline comments.
================
Comment at: lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp:325
+ std::string FullOption =
+ (llvm::Twine() + FullName + ":" + OptionName).str();
+
----------------
baloghadamsoftware wrote:
> Is this the most efficient way to concatenate `StringRef`s?
> @baloghadamsoftware
> Is this the most efficient way to concatenate `StringRef`s?
`Twine` is specifically designed for that, yes.
You can't evade the final "copy", although most likely there'll be a RVO taking place.
However, the *first* `Twine` could be initialised from the `FullName` variable, as opposed to empty node.
And you could use single characters as characters, as opposed to strings, i.e. `(Twine(FullName) + ':' + OptionName).str()`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57860/new/
https://reviews.llvm.org/D57860
More information about the cfe-commits
mailing list