r372386 - [StaticAnalyzer] Use llvm::StringLiteral instead of StringRef in few places
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 20 05:59:29 PDT 2019
Author: d0k
Date: Fri Sep 20 05:59:29 2019
New Revision: 372386
URL: http://llvm.org/viewvc/llvm-project?rev=372386&view=rev
Log:
[StaticAnalyzer] Use llvm::StringLiteral instead of StringRef in few places
StringRef's constexpr constructor seems to be extremely slow in MSVC
2017, so don't use it for generated tables. Should make PR43369 a bit
better, no functionality change.
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=372386&r1=372385&r2=372386&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Fri Sep 20 05:59:29 2019
@@ -278,13 +278,13 @@ public:
// Create an array of all -analyzer-config command line options. Sort it in
// the constructor.
- std::vector<StringRef> AnalyzerConfigCmdFlags = {
+ std::vector<llvm::StringLiteral> AnalyzerConfigCmdFlags = {
#define ANALYZER_OPTION_DEPENDS_ON_USER_MODE(TYPE, NAME, CMDFLAG, DESC, \
SHALLOW_VAL, DEEP_VAL) \
ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, SHALLOW_VAL)
#define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL) \
- CMDFLAG,
+ llvm::StringLiteral(CMDFLAG),
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.def"
#undef ANALYZER_OPTION
@@ -415,9 +415,10 @@ inline UserModeKind AnalyzerOptions::get
inline std::vector<StringRef>
AnalyzerOptions::getRegisteredCheckers(bool IncludeExperimental) {
- static const StringRef StaticAnalyzerCheckerNames[] = {
+ static constexpr llvm::StringLiteral StaticAnalyzerCheckerNames[] = {
#define GET_CHECKERS
-#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) FULLNAME,
+#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) \
+ llvm::StringLiteral(FULLNAME),
#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
#undef CHECKER
#undef GET_CHECKERS
@@ -433,9 +434,9 @@ AnalyzerOptions::getRegisteredCheckers(b
inline std::vector<StringRef>
AnalyzerOptions::getRegisteredPackages(bool IncludeExperimental) {
- static const StringRef StaticAnalyzerPackageNames[] = {
+ static constexpr llvm::StringLiteral StaticAnalyzerPackageNames[] = {
#define GET_PACKAGES
-#define PACKAGE(FULLNAME) FULLNAME,
+#define PACKAGE(FULLNAME) llvm::StringLiteral(FULLNAME),
#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
#undef PACKAGE
#undef GET_PACKAGES
More information about the cfe-commits
mailing list