From cb2379e8917d88d53c9f71edcd2418aab26b6bd0 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 20 Sep 2019 12:59:29 +0000 Subject: [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372386 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/StaticAnalyzer/Core/AnalyzerOptions.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h index 04d611a94a..ce16095e10 100644 --- a/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h +++ b/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h @@ -278,13 +278,13 @@ public: // Create an array of all -analyzer-config command line options. Sort it in // the constructor. - std::vector AnalyzerConfigCmdFlags = { + std::vector 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::getUserMode() const { inline std::vector 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(bool IncludeExperimental) { inline std::vector 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 -- cgit v1.2.1