/// FindFunctionNamed - Search all of the active modules to find the function that
/// defines FnName. This is very slow operation and shouldn't be used for
/// general code.
- virtual Function *FindFunctionNamed(const char *FnName);
+ virtual Function *FindFunctionNamed(StringRef FnName);
/// FindGlobalVariableNamed - Search all of the active modules to find the global variable
/// that defines Name. This is very slow operation and shouldn't be used for
/// general code.
- virtual GlobalVariable *FindGlobalVariableNamed(const char *Name, bool AllowInternal = false);
+ virtual GlobalVariable *FindGlobalVariableNamed(StringRef Name, bool AllowInternal = false);
/// runFunction - Execute the specified function with the specified arguments,
/// and return the result.
return false;
}
-Function *ExecutionEngine::FindFunctionNamed(const char *FnName) {
+Function *ExecutionEngine::FindFunctionNamed(StringRef FnName) {
for (unsigned i = 0, e = Modules.size(); i != e; ++i) {
Function *F = Modules[i]->getFunction(FnName);
if (F && !F->isDeclaration())
return nullptr;
}
-GlobalVariable *ExecutionEngine::FindGlobalVariableNamed(const char *Name, bool AllowInternal) {
+GlobalVariable *ExecutionEngine::FindGlobalVariableNamed(StringRef Name, bool AllowInternal) {
for (unsigned i = 0, e = Modules.size(); i != e; ++i) {
GlobalVariable *GV = Modules[i]->getGlobalVariable(Name,AllowInternal);
if (GV && !GV->isDeclaration())
void ExecutionEngine::runStaticConstructorsDestructors(Module &module,
bool isDtors) {
- const char *Name = isDtors ? "llvm.global_dtors" : "llvm.global_ctors";
+ StringRef Name(isDtors ? "llvm.global_dtors" : "llvm.global_ctors");
GlobalVariable *GV = module.getNamedGlobal(Name);
// If this global has internal linkage, or if it has a use, then it must be
// NoFramePointerElim.
for (auto &F : *Mod) {
auto Attrs = F.getAttributes();
- auto Value = options.NoFramePointerElim ? "true" : "false";
+ StringRef Value(options.NoFramePointerElim ? "true" : "false");
Attrs = Attrs.addAttribute(F.getContext(), AttributeSet::FunctionIndex,
"no-frame-pointer-elim", Value);
F.setAttributes(Attrs);
isDtors, OwnedModules.begin_finalized(), OwnedModules.end_finalized());
}
-Function *MCJIT::FindFunctionNamedInModulePtrSet(const char *FnName,
+Function *MCJIT::FindFunctionNamedInModulePtrSet(StringRef FnName,
ModulePtrSet::iterator I,
ModulePtrSet::iterator E) {
for (; I != E; ++I) {
return nullptr;
}
-GlobalVariable *MCJIT::FindGlobalVariableNamedInModulePtrSet(const char *Name,
+GlobalVariable *MCJIT::FindGlobalVariableNamedInModulePtrSet(StringRef Name,
bool AllowInternal,
ModulePtrSet::iterator I,
ModulePtrSet::iterator E) {
}
-Function *MCJIT::FindFunctionNamed(const char *FnName) {
+Function *MCJIT::FindFunctionNamed(StringRef FnName) {
Function *F = FindFunctionNamedInModulePtrSet(
FnName, OwnedModules.begin_added(), OwnedModules.end_added());
if (!F)
return F;
}
-GlobalVariable *MCJIT::FindGlobalVariableNamed(const char *Name, bool AllowInternal) {
+GlobalVariable *MCJIT::FindGlobalVariableNamed(StringRef Name, bool AllowInternal) {
GlobalVariable *GV = FindGlobalVariableNamedInModulePtrSet(
Name, AllowInternal, OwnedModules.begin_added(), OwnedModules.end_added());
if (!GV)
// perform lookup of pre-compiled code to avoid re-compilation.
ObjectCache *ObjCache;
- Function *FindFunctionNamedInModulePtrSet(const char *FnName,
+ Function *FindFunctionNamedInModulePtrSet(StringRef FnName,
ModulePtrSet::iterator I,
ModulePtrSet::iterator E);
- GlobalVariable *FindGlobalVariableNamedInModulePtrSet(const char *Name,
+ GlobalVariable *FindGlobalVariableNamedInModulePtrSet(StringRef Name,
bool AllowInternal,
ModulePtrSet::iterator I,
ModulePtrSet::iterator E);
/// FindFunctionNamed - Search all of the active modules to find the function that
/// defines FnName. This is very slow operation and shouldn't be used for
/// general code.
- Function *FindFunctionNamed(const char *FnName) override;
+ Function *FindFunctionNamed(StringRef FnName) override;
/// FindGlobalVariableNamed - Search all of the active modules to find the
/// global variable that defines Name. This is very slow operation and
/// shouldn't be used for general code.
- GlobalVariable *FindGlobalVariableNamed(const char *Name,
+ GlobalVariable *FindGlobalVariableNamed(StringRef Name,
bool AllowInternal = false) override;
/// Sets the object manager that MCJIT should use to avoid compilation.