diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-26 05:03:40 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-26 05:03:40 +0000 |
| commit | 9678d27140554f7ae0dbb674c5e5325ccdbc5bfa (patch) | |
| tree | 7a048ff148b95bceb31cc9a8d0d13ee739d6d833 /clang/examples | |
| parent | e03dfd9b0a176d1f7cb0c662263a13a9c7c30b7e (diff) | |
| download | bcm5719-llvm-9678d27140554f7ae0dbb674c5e5325ccdbc5bfa.tar.gz bcm5719-llvm-9678d27140554f7ae0dbb674c5e5325ccdbc5bfa.zip | |
Use llvm::sys::fs::getMainExecutable.
llvm-svn: 184915
Diffstat (limited to 'clang/examples')
| -rw-r--r-- | clang/examples/clang-interpreter/main.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/examples/clang-interpreter/main.cpp b/clang/examples/clang-interpreter/main.cpp index ff86d2b368e..028b9cc34fd 100644 --- a/clang/examples/clang-interpreter/main.cpp +++ b/clang/examples/clang-interpreter/main.cpp @@ -21,6 +21,7 @@ #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/JIT.h" #include "llvm/IR/Module.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Host.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Path.h" @@ -35,11 +36,11 @@ using namespace clang::driver; // GetMainExecutable (since some platforms don't support taking the // address of main, and some platforms can't implement GetMainExecutable // without being given the address of a function in the main executable). -llvm::sys::Path GetExecutablePath(const char *Argv0) { +std::string GetExecutablePath(const char *Argv0) { // This just needs to be some symbol in the binary; C++ doesn't // allow taking the address of ::main however. void *MainAddr = (void*) (intptr_t) GetExecutablePath; - return llvm::sys::Path::GetMainExecutable(Argv0, MainAddr); + return llvm::sys::fs::getMainExecutable(Argv0, MainAddr); } static int Execute(llvm::Module *Mod, char * const *envp) { @@ -68,14 +69,14 @@ static int Execute(llvm::Module *Mod, char * const *envp) { int main(int argc, const char **argv, char * const *envp) { void *MainAddr = (void*) (intptr_t) GetExecutablePath; - llvm::sys::Path Path = GetExecutablePath(argv[0]); + std::string Path = GetExecutablePath(argv[0]); IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions(); TextDiagnosticPrinter *DiagClient = new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts); IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient); - Driver TheDriver(Path.str(), llvm::sys::getProcessTriple(), "a.out", Diags); + Driver TheDriver(Path, llvm::sys::getProcessTriple(), "a.out", Diags); TheDriver.setTitle("clang interpreter"); // FIXME: This is a hack to try to force the driver to do something we can |

