diff options
author | Guy Benyei <guy.benyei@intel.com> | 2013-02-12 21:21:59 +0000 |
---|---|---|
committer | Guy Benyei <guy.benyei@intel.com> | 2013-02-12 21:21:59 +0000 |
commit | 87d0b9ed1462705dd9bf1cb7f67d0bf03af776c8 (patch) | |
tree | 54c1b122b1f937a363b1ce4a1e091e795d575785 /lib/MC | |
parent | 5f3c4a39109479e81238ce28e91e5dcc565f068c (diff) | |
download | external_llvm-87d0b9ed1462705dd9bf1cb7f67d0bf03af776c8.zip external_llvm-87d0b9ed1462705dd9bf1cb7f67d0bf03af776c8.tar.gz external_llvm-87d0b9ed1462705dd9bf1cb7f67d0bf03af776c8.tar.bz2 |
Add static cast to unsigned char whenever a character classification function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 9 | ||||
-rw-r--r-- | lib/MC/MCSectionMachO.cpp | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index c01ea33..bd2c65e 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -1622,7 +1622,8 @@ void AsmParser::DiagHandler(const SMDiagnostic &Diag, void *Context) { // we can't do that. AsmLexer.cpp should probably be changed to handle // '@' as a special case when needed. static bool isIdentifierChar(char c) { - return isalnum(c) || c == '_' || c == '$' || c == '.'; + return isalnum(static_cast<unsigned char>(c)) || c == '_' || c == '$' || + c == '.'; } bool AsmParser::expandMacro(raw_svector_ostream &OS, StringRef Body, @@ -1646,7 +1647,8 @@ bool AsmParser::expandMacro(raw_svector_ostream &OS, StringRef Body, continue; char Next = Body[Pos + 1]; - if (Next == '$' || Next == 'n' || isdigit(Next)) + if (Next == '$' || Next == 'n' || + isdigit(static_cast<unsigned char>(Next))) break; } else { // This macro has parameters, look for \foo, \bar, etc. @@ -3094,7 +3096,8 @@ void AsmParser::CheckForBadMacro(SMLoc DirectiveLoc, StringRef Name, if (Body[Pos] != '$' || Pos + 1 == End) continue; char Next = Body[Pos + 1]; - if (Next == '$' || Next == 'n' || isdigit(Next)) + if (Next == '$' || Next == 'n' || + isdigit(static_cast<unsigned char>(Next))) break; } diff --git a/lib/MC/MCSectionMachO.cpp b/lib/MC/MCSectionMachO.cpp index e771556..fc32315 100644 --- a/lib/MC/MCSectionMachO.cpp +++ b/lib/MC/MCSectionMachO.cpp @@ -165,9 +165,9 @@ bool MCSectionMachO::isVirtualSection() const { /// StripSpaces - This removes leading and trailing spaces from the StringRef. static void StripSpaces(StringRef &Str) { - while (!Str.empty() && isspace(Str[0])) + while (!Str.empty() && isspace(static_cast<unsigned char>(Str[0]))) Str = Str.substr(1); - while (!Str.empty() && isspace(Str.back())) + while (!Str.empty() && isspace(static_cast<unsigned char>(Str.back()))) Str = Str.substr(0, Str.size()-1); } |