summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-10-01 07:08:23 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-10-01 07:08:23 +0000
commit9af9a9d5f93b617a8d3c7ce75812acf6386d6051 (patch)
tree321e657b44742b8cb9e057372764184379288a35
parent36d33fc1098a2377bf6b5a20e98351c06db0cfe1 (diff)
downloadbcm5719-llvm-9af9a9d5f93b617a8d3c7ce75812acf6386d6051.tar.gz
bcm5719-llvm-9af9a9d5f93b617a8d3c7ce75812acf6386d6051.zip
Revert "Use StringRef instead of raw pointer in TargetRegistry API (NFC)"
This reverts commit r283017. Creates an infinite loop somehow. llvm-svn: 283019
-rw-r--r--llvm/include/llvm/Support/TargetRegistry.h12
-rw-r--r--llvm/lib/Support/TargetRegistry.cpp12
-rw-r--r--llvm/lib/Target/TargetMachineC.cpp4
-rw-r--r--llvm/tools/llc/llc.cpp2
4 files changed, 15 insertions, 15 deletions
diff --git a/llvm/include/llvm/Support/TargetRegistry.h b/llvm/include/llvm/Support/TargetRegistry.h
index 9966ec97d78..99d679a31c0 100644
--- a/llvm/include/llvm/Support/TargetRegistry.h
+++ b/llvm/include/llvm/Support/TargetRegistry.h
@@ -165,10 +165,10 @@ private:
ArchMatchFnTy ArchMatchFn;
/// Name - The target name.
- StringRef Name;
+ const char *Name;
/// ShortDesc - A short description of the target.
- StringRef ShortDesc;
+ const char *ShortDesc;
/// HasJIT - Whether this target supports the JIT.
bool HasJIT;
@@ -262,10 +262,10 @@ public:
const Target *getNext() const { return Next; }
/// getName - Get the target name.
- StringRef getName() const { return Name; }
+ const char *getName() const { return Name; }
/// getShortDescription - Get a short description of the target.
- StringRef getShortDescription() const { return ShortDesc; }
+ const char *getShortDescription() const { return ShortDesc; }
/// @}
/// @name Feature Predicates
@@ -624,7 +624,7 @@ struct TargetRegistry {
/// @param ArchMatchFn - The arch match checking function for this target.
/// @param HasJIT - Whether the target supports JIT code
/// generation.
- static void RegisterTarget(Target &T, StringRef Name, StringRef ShortDesc,
+ static void RegisterTarget(Target &T, const char *Name, const char *ShortDesc,
Target::ArchMatchFnTy ArchMatchFn,
bool HasJIT = false);
@@ -857,7 +857,7 @@ struct TargetRegistry {
template <Triple::ArchType TargetArchType = Triple::UnknownArch,
bool HasJIT = false>
struct RegisterTarget {
- RegisterTarget(Target &T, StringRef Name, StringRef Desc) {
+ RegisterTarget(Target &T, const char *Name, const char *Desc) {
TargetRegistry::RegisterTarget(T, Name, Desc, &getArchMatch, HasJIT);
}
diff --git a/llvm/lib/Support/TargetRegistry.cpp b/llvm/lib/Support/TargetRegistry.cpp
index 1b8ad3a0103..bed9ed64f80 100644
--- a/llvm/lib/Support/TargetRegistry.cpp
+++ b/llvm/lib/Support/TargetRegistry.cpp
@@ -78,8 +78,8 @@ const Target *TargetRegistry::lookupTarget(const std::string &TT,
auto J = std::find_if(std::next(I), targets().end(), ArchMatch);
if (J != targets().end()) {
- Error = ("Cannot choose between targets \"" + I->Name +
- "\" a nd \"" + J->Name + "\"").str();
+ Error = std::string("Cannot choose between targets \"") + I->Name +
+ "\" and \"" + J->Name + "\"";
return nullptr;
}
@@ -87,16 +87,16 @@ const Target *TargetRegistry::lookupTarget(const std::string &TT,
}
void TargetRegistry::RegisterTarget(Target &T,
- StringRef Name,
- StringRef ShortDesc,
+ const char *Name,
+ const char *ShortDesc,
Target::ArchMatchFnTy ArchMatchFn,
bool HasJIT) {
- assert(!Name.empty() && !ShortDesc.empty() && ArchMatchFn &&
+ assert(Name && ShortDesc && ArchMatchFn &&
"Missing required target information!");
// Check if this target has already been initialized, we allow this as a
// convenience to some clients.
- if (!T.Name.empty())
+ if (T.Name)
return;
// Add to the list of targets.
diff --git a/llvm/lib/Target/TargetMachineC.cpp b/llvm/lib/Target/TargetMachineC.cpp
index b20012fba32..5fb5b022780 100644
--- a/llvm/lib/Target/TargetMachineC.cpp
+++ b/llvm/lib/Target/TargetMachineC.cpp
@@ -81,11 +81,11 @@ LLVMBool LLVMGetTargetFromTriple(const char* TripleStr, LLVMTargetRef *T,
}
const char * LLVMGetTargetName(LLVMTargetRef T) {
- return unwrap(T)->getName().data();
+ return unwrap(T)->getName();
}
const char * LLVMGetTargetDescription(LLVMTargetRef T) {
- return unwrap(T)->getShortDescription().data();
+ return unwrap(T)->getShortDescription();
}
LLVMBool LLVMTargetHasJIT(LLVMTargetRef T) {
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 2c64cf33f59..1a6ff63b118 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -159,7 +159,7 @@ static cl::opt<RunPassOption, true, cl::parser<std::string>> RunPass(
static int compileModule(char **, LLVMContext &);
static std::unique_ptr<tool_output_file>
-GetOutputStream(StringRef TargetName, Triple::OSType OS,
+GetOutputStream(const char *TargetName, Triple::OSType OS,
const char *ProgName) {
// If we don't yet have an output filename, make one.
if (OutputFilename.empty()) {
OpenPOWER on IntegriCloud