diff options
author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2010-02-08 05:56:37 +0000 |
---|---|---|
committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2010-02-08 05:56:37 +0000 |
commit | 90f4c914b8391ed8e54ac952d441313376acbb9a (patch) | |
tree | 1ce4c6dbad793b6c12790c2c7b2f73b77687a537 /tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp | |
parent | 337c6a8edd6acd6560f8f09f1372d7eca6d8f262 (diff) |
Add uppercase and lowercase part defines in driver.
Use a temp dir with a unique name in the current dir itself.
Use forward_value instead of unpack_values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95530 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.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp b/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp index a6d2ff6b1a..9b2f9fc544 100644 --- a/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp +++ b/tools/llvmc/example/mcc16/plugins/PIC16Base/PluginMain.cpp @@ -9,6 +9,8 @@ namespace llvmc { extern char *ProgramName; } + + // Returns the platform specific directory separator via #ifdefs. // FIXME: This currently work on linux and windows only. It does not // work on other unices. @@ -21,6 +23,43 @@ static std::string GetDirSeparator() { } namespace hooks { +// Get preprocessor define for the part. +// It is __partname format in lower case. +std::string +GetLowerCasePartDefine(void) { + std::string Partname; + if (AutoGeneratedParameter_p.empty()) { + Partname = "16f1xxx"; + } else { + Partname = AutoGeneratedParameter_p; + } + + std::string LowerCase; + for (unsigned i = 0; i <= Partname.size(); i++) { + LowerCase.push_back(std::tolower(Partname[i])); + } + + return "__" + LowerCase; +} + +std::string +GetUpperCasePartDefine(void) { + std::string Partname; + if (AutoGeneratedParameter_p.empty()) { + Partname = "16f1xxx"; + } else { + Partname = AutoGeneratedParameter_p; + } + + std::string UpperCase; + for (unsigned i = 0; i <= Partname.size(); i++) { + UpperCase.push_back(std::toupper(Partname[i])); + } + + return "__" + UpperCase; +} + + // Get the dir where c16 executables reside. std::string GetBinDir() { // Construct a Path object from the program name. |