diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-06-01 05:25:02 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-06-01 05:25:02 +0000 |
commit | 2a1c363f38e59a5044fc349aa7e538a50954c244 (patch) | |
tree | a0fb324775573ed4cd50f35464f98ae0ac80b15c /lib/Lex/PPExpressions.cpp | |
parent | 852d63b806c5cbd730c6b9d696e2e27d02546b49 (diff) |
PR4283: Don't truncate multibyte character constants in the
preprocessor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPExpressions.cpp')
-rw-r--r-- | lib/Lex/PPExpressions.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp index 47c3f8d1c7..709e316b80 100644 --- a/lib/Lex/PPExpressions.cpp +++ b/lib/Lex/PPExpressions.cpp @@ -221,8 +221,12 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT, // Character literals are always int or wchar_t, expand to intmax_t. TargetInfo &TI = PP.getTargetInfo(); - unsigned NumBits = TI.getCharWidth(Literal.isWide()); - + unsigned NumBits; + if (Literal.isMultiChar()) + NumBits = TI.getIntWidth(); + else + NumBits = TI.getCharWidth(Literal.isWide()); + // Set the width. llvm::APSInt Val(NumBits); // Set the value. |