change the StringLiteral AST node to track all of the SourceLocations of
the various PPTokens that are pasted together to make it. In the course
of working on this, I discovered ParseObjCStringLiteral which needs some
work. I'll tackle it next.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64892 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 3e99482..b0b5367 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -29,10 +29,12 @@
unsigned Length = 0;
for (unsigned i = 0; i < NumStrings; i++)
Length += static_cast<StringLiteral *>(Strings[i])->getByteLength();
- char *strBuf = new char [Length];
+
+ // FIXME: This should not be allocated by SEMA!
+ char *strBuf = new char[Length];
char *p = strBuf;
bool isWide = false;
- for (unsigned i = 0; i < NumStrings; i++) {
+ for (unsigned i = 0; i != NumStrings; ++i) {
S = static_cast<StringLiteral *>(Strings[i]);
if (S->isWide())
isWide = true;
@@ -40,9 +42,10 @@
p += S->getByteLength();
S->Destroy(Context);
}
- S = new (Context, 8) StringLiteral(Context, strBuf, Length, isWide,
- Context.getPointerType(Context.CharTy),
- AtLoc, EndLoc);
+ // FIXME: PASS LOCATIONS PROPERLY.
+ S = new (Context) StringLiteral(Context, strBuf, Length, isWide,
+ Context.getPointerType(Context.CharTy),
+ AtLoc);
}
if (CheckBuiltinCFStringArgument(S))