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;
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
/// @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);
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);
}
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;
}
}
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.
}
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) {
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()) {