aboutsummaryrefslogtreecommitdiff
path: root/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-02 17:35:38 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-02 17:35:38 +0000
commit31b798197e441533b78fd9da1463dc38555a2fe1 (patch)
treec8c1bac968c53ad33de2ddd9c6d6e0493495066c /tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
parent12c99d8160bbc4426feb09a6c020d3ba45ed4f06 (diff)
Fixed handling of -c option.wq
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74711 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp')
-rw-r--r--tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp b/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
index 09fb9695e9..21a25b3f73 100644
--- a/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
+++ b/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp
@@ -1,5 +1,9 @@
#include "AutoGenerated.inc"
+
#include "llvm/System/Path.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
namespace llvmc {
extern char *ProgramName;
@@ -11,19 +15,23 @@ static std::string GetDirSeparator(void) {
}
namespace hooks {
+// Get the dir where c16 executables reside.
std::string GetBinDir (void) {
// Construct a Path object from the program name.
- llvm::sys::Path ProgramFullName(llvmc::ProgramName,
- strlen(llvmc::ProgramName));
+ void *P = (void*) (intptr_t) GetBinDir;
+ sys::Path ProgramFullPath
+ = sys::Path::GetMainExecutable(llvmc::ProgramName, P);
// Get the dir name for the program. It's last component should be 'bin'.
- std::string BinDir = ProgramFullName.getDirname();
+ std::string BinDir = ProgramFullPath.getDirname();
+ // llvm::errs() << "BinDir: " << BinDir << '\n';
return BinDir + GetDirSeparator();
}
+// Get the Top-level Installation dir for c16.
std::string GetInstallDir (void) {
- llvm::sys::Path BinDirPath = llvm::sys::Path(GetBinDir());
+ sys::Path BinDirPath = sys::Path(GetBinDir());
// Go one more level up to get the install dir.
std::string InstallDir = BinDirPath.getDirname();
@@ -31,17 +39,22 @@ std::string GetInstallDir (void) {
return InstallDir + GetDirSeparator();
}
+// Get the dir where the c16 header files reside.
std::string GetStdHeadersDir (void) {
return GetInstallDir() + "include";
}
+// Get the dir where the assembler header files reside.
std::string GetStdAsmHeadersDir (void) {
return GetInstallDir() + "inc";
}
+
+// Get the dir where the linker scripts reside.
std::string GetStdLinkerScriptsDir (void) {
return GetInstallDir() + "lkr";
}
+// Get the dir where startup code, intrinsics and lib reside.
std::string GetStdLibsDir (void) {
return GetInstallDir() + "lib";
}