[cfe-commits] r143769 - /cfe/trunk/lib/Lex/LiteralSupport.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Nov 4 17:41:04 PDT 2011
Author: efriedma
Date: Fri Nov 4 19:41:04 2011
New Revision: 143769
URL: http://llvm.org/viewvc/llvm-project?rev=143769&view=rev
Log:
Fix one last place where we weren't writing into a string literal consistently.
Modified:
cfe/trunk/lib/Lex/LiteralSupport.cpp
Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=143769&r1=143768&r2=143769&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Fri Nov 4 19:41:04 2011
@@ -1112,8 +1112,20 @@
}
if (Pascal) {
- ResultBuf[0] = ResultPtr-&ResultBuf[0]-1;
- ResultBuf[0] /= CharByteWidth;
+ if (CharByteWidth == 4) {
+ // FIXME: Make the type of the result buffer correct instead of
+ // using reinterpret_cast.
+ UTF32 *ResultWidePtr = reinterpret_cast<UTF32*>(ResultBuf.data());
+ ResultWidePtr[0] = GetNumStringChars() - 1;
+ } else if (CharByteWidth == 2) {
+ // FIXME: Make the type of the result buffer correct instead of
+ // using reinterpret_cast.
+ UTF16 *ResultWidePtr = reinterpret_cast<UTF16*>(ResultBuf.data());
+ ResultWidePtr[0] = GetNumStringChars() - 1;
+ } else {
+ assert(CharByteWidth == 1 && "Unexpected char width");
+ ResultBuf[0] = GetNumStringChars() - 1;
+ }
// Verify that pascal strings aren't too large.
if (GetStringLength() > 256) {
More information about the cfe-commits
mailing list