diff --git a/tools/llvmc/examples/mcc16/Hooks.cpp b/tools/llvmc/examples/mcc16/Hooks.cpp index 95158efeece..bbb8438bc37 100644 --- a/tools/llvmc/examples/mcc16/Hooks.cpp +++ b/tools/llvmc/examples/mcc16/Hooks.cpp @@ -3,9 +3,10 @@ #include "llvm/Support/raw_ostream.h" #include +#include namespace llvmc { - extern char *ProgramName; + extern const char *ProgramName; namespace autogenerated { extern llvm::cl::opt Parameter_p; @@ -31,6 +32,7 @@ namespace hooks { // It is __partname format in lower case. std::string GetLowerCasePartDefine(void) { + std::locale loc; std::string Partname; if (autogenerated::Parameter_p.empty()) { Partname = "16f1xxx"; @@ -40,7 +42,7 @@ GetLowerCasePartDefine(void) { std::string LowerCase; for (unsigned i = 0; i < Partname.size(); i++) { - LowerCase.push_back(std::tolower(Partname[i])); + LowerCase.push_back(std::tolower(Partname[i], loc)); } return "__" + LowerCase; @@ -48,6 +50,7 @@ GetLowerCasePartDefine(void) { std::string GetUpperCasePartDefine(void) { + std::locale loc; std::string Partname; if (autogenerated::Parameter_p.empty()) { Partname = "16f1xxx"; @@ -57,7 +60,7 @@ GetUpperCasePartDefine(void) { std::string UpperCase; for (unsigned i = 0; i < Partname.size(); i++) { - UpperCase.push_back(std::toupper(Partname[i])); + UpperCase.push_back(std::toupper(Partname[i], loc)); } return "__" + UpperCase;