[clang-tools-extra] df9a51d - Remove global std::strings. NFCI.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 17 05:29:59 PDT 2020
Author: Benjamin Kramer
Date: 2020-06-17T14:29:42+02:00
New Revision: df9a51dab3512f61d7f26c16fd1358bf99c266e1
URL: https://github.com/llvm/llvm-project/commit/df9a51dab3512f61d7f26c16fd1358bf99c266e1
DIFF: https://github.com/llvm/llvm-project/commit/df9a51dab3512f61d7f26c16fd1358bf99c266e1.diff
LOG: Remove global std::strings. NFCI.
Added:
Modified:
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
clang-tools-extra/clangd/index/remote/server/Server.cpp
llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
llvm/lib/Target/BPF/BPFCORE.h
llvm/lib/Target/BPF/BPFPreserveDIType.cpp
llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
index a784fe47ccb4..3e25da385d7a 100644
--- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -32,7 +32,7 @@ llvm::cl::opt<std::string> IndexLocation(
llvm::cl::opt<std::string>
ExecCommand("c", llvm::cl::desc("Command to execute and then exit"));
-static const std::string Overview = R"(
+static constexpr char Overview[] = R"(
This is an **experimental** interactive tool to process user-provided search
queries over given symbol collection obtained via clangd-indexer. The
tool can be used to evaluate search quality of existing index implementations
diff --git a/clang-tools-extra/clangd/index/remote/server/Server.cpp b/clang-tools-extra/clangd/index/remote/server/Server.cpp
index 871affe6c47c..4d84eb17210e 100644
--- a/clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ b/clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -23,7 +23,7 @@ namespace clangd {
namespace remote {
namespace {
-static const std::string Overview = R"(
+static constexpr char Overview[] = R"(
This is an experimental remote index implementation. The server opens Dex and
awaits gRPC lookup requests from the client.
)";
diff --git a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
index 0e943aa07a3b..b213b1579661 100644
--- a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
+++ b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
@@ -92,7 +92,7 @@
#define DEBUG_TYPE "bpf-abstract-member-access"
namespace llvm {
-const std::string BPFCoreSharedInfo::AmaAttr = "btf_ama";
+constexpr StringRef BPFCoreSharedInfo::AmaAttr;
} // namespace llvm
using namespace llvm;
diff --git a/llvm/lib/Target/BPF/BPFCORE.h b/llvm/lib/Target/BPF/BPFCORE.h
index f29c879518ab..af6425b16fa0 100644
--- a/llvm/lib/Target/BPF/BPFCORE.h
+++ b/llvm/lib/Target/BPF/BPFCORE.h
@@ -9,6 +9,8 @@
#ifndef LLVM_LIB_TARGET_BPF_BPFCORE_H
#define LLVM_LIB_TARGET_BPF_BPFCORE_H
+#include "llvm/ADT/StringRef.h"
+
namespace llvm {
class BPFCoreSharedInfo {
@@ -34,9 +36,9 @@ class BPFCoreSharedInfo {
};
/// The attribute attached to globals representing a field access
- static const std::string AmaAttr;
+ static constexpr StringRef AmaAttr = "btf_ama";
/// The attribute attached to globals representing a type id
- static const std::string TypeIdAttr;
+ static constexpr StringRef TypeIdAttr = "btf_type_id";
};
} // namespace llvm
diff --git a/llvm/lib/Target/BPF/BPFPreserveDIType.cpp b/llvm/lib/Target/BPF/BPFPreserveDIType.cpp
index a3f30beda6cd..c3cb7647aa79 100644
--- a/llvm/lib/Target/BPF/BPFPreserveDIType.cpp
+++ b/llvm/lib/Target/BPF/BPFPreserveDIType.cpp
@@ -26,7 +26,7 @@
#define DEBUG_TYPE "bpf-preserve-di-type"
namespace llvm {
-const std::string BPFCoreSharedInfo::TypeIdAttr = "btf_type_id";
+constexpr StringRef BPFCoreSharedInfo::TypeIdAttr;
} // namespace llvm
using namespace llvm;
diff --git a/llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp b/llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
index fe2706117453..a7546d2be5d8 100644
--- a/llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
+++ b/llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
@@ -244,10 +244,10 @@ INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass)
INITIALIZE_PASS_END(PPCLoopInstrFormPrep, DEBUG_TYPE, name, false, false)
-static const std::string PHINodeNameSuffix = ".phi";
-static const std::string CastNodeNameSuffix = ".cast";
-static const std::string GEPNodeIncNameSuffix = ".inc";
-static const std::string GEPNodeOffNameSuffix = ".off";
+static constexpr StringRef PHINodeNameSuffix = ".phi";
+static constexpr StringRef CastNodeNameSuffix = ".cast";
+static constexpr StringRef GEPNodeIncNameSuffix = ".inc";
+static constexpr StringRef GEPNodeOffNameSuffix = ".off";
FunctionPass *llvm::createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM) {
return new PPCLoopInstrFormPrep(TM);
@@ -263,7 +263,7 @@ static bool IsPtrInBounds(Value *BasePtr) {
return false;
}
-static std::string getInstrName(const Value *I, const std::string Suffix) {
+static std::string getInstrName(const Value *I, StringRef Suffix) {
assert(I && "Invalid paramater!");
if (I->hasName())
return (I->getName() + Suffix).str();
More information about the cfe-commits
mailing list