[llvm] r283016 - Use StringRef instead of raw pointer in ExecutionEngine
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 30 23:22:05 PDT 2016
Author: mehdi_amini
Date: Sat Oct 1 01:22:04 2016
New Revision: 283016
URL: http://llvm.org/viewvc/llvm-project?rev=283016&view=rev
Log:
Use StringRef instead of raw pointer in ExecutionEngine
Modified:
llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp
llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=283016&r1=283015&r2=283016&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Sat Oct 1 01:22:04 2016
@@ -205,12 +205,12 @@ public:
/// 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.
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=283016&r1=283015&r2=283016&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Sat Oct 1 01:22:04 2016
@@ -155,7 +155,7 @@ bool ExecutionEngine::removeModule(Modul
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())
@@ -164,7 +164,7 @@ Function *ExecutionEngine::FindFunctionN
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())
@@ -370,7 +370,7 @@ void *ArgvArray::reset(LLVMContext &C, E
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
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=283016&r1=283015&r2=283016&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp Sat Oct 1 01:22:04 2016
@@ -187,7 +187,7 @@ LLVMBool LLVMCreateMCJITCompilerForModul
// 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);
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=283016&r1=283015&r2=283016&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Sat Oct 1 01:22:04 2016
@@ -446,7 +446,7 @@ void MCJIT::runStaticConstructorsDestruc
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) {
@@ -457,7 +457,7 @@ Function *MCJIT::FindFunctionNamedInModu
return nullptr;
}
-GlobalVariable *MCJIT::FindGlobalVariableNamedInModulePtrSet(const char *Name,
+GlobalVariable *MCJIT::FindGlobalVariableNamedInModulePtrSet(StringRef Name,
bool AllowInternal,
ModulePtrSet::iterator I,
ModulePtrSet::iterator E) {
@@ -470,7 +470,7 @@ GlobalVariable *MCJIT::FindGlobalVariabl
}
-Function *MCJIT::FindFunctionNamed(const char *FnName) {
+Function *MCJIT::FindFunctionNamed(StringRef FnName) {
Function *F = FindFunctionNamedInModulePtrSet(
FnName, OwnedModules.begin_added(), OwnedModules.end_added());
if (!F)
@@ -482,7 +482,7 @@ Function *MCJIT::FindFunctionNamed(const
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)
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h?rev=283016&r1=283015&r2=283016&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h Sat Oct 1 01:22:04 2016
@@ -194,11 +194,11 @@ class MCJIT : public ExecutionEngine {
// 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);
@@ -221,12 +221,12 @@ public:
/// 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.
More information about the llvm-commits
mailing list