summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-26 05:03:40 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-26 05:03:40 +0000
commitac1db6b2bde50e9a0f3846243f654f6c13682725 (patch)
tree63876607cd633b9a02b2ddda3b39754d9f400269 /examples
parent48955f8119261c47cac564d1b6976c8f6441800a (diff)
Use llvm::sys::fs::getMainExecutable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r--examples/clang-interpreter/main.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/clang-interpreter/main.cpp b/examples/clang-interpreter/main.cpp
index ff86d2b368..028b9cc34f 100644
--- a/examples/clang-interpreter/main.cpp
+++ b/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