[cfe-commits] r64945 - /cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Wed Feb 18 11:56:27 PST 2009
Author: snaroff
Date: Wed Feb 18 13:56:26 2009
New Revision: 64945
URL: http://llvm.org/viewvc/llvm-project?rev=64945&view=rev
Log:
Fix <rdar://problem/6598682> clang ObjC rewriter: Rewritten protocol-compliant ivar causes C++ compile error.
Modified:
cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp?rev=64945&r1=64944&r2=64945&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp Wed Feb 18 13:56:26 2009
@@ -380,6 +380,14 @@
To += From[i];
}
}
+ void QuoteDoublequotes(std::string &From, std::string &To) {
+ for(unsigned i = 0; i < From.length(); i++) {
+ if (From[i] == '"')
+ To += "\\\"";
+ else
+ To += From[i];
+ }
+ }
};
}
@@ -3195,8 +3203,9 @@
Result += "\t,{{\"";
Result += (*IVI)->getNameAsString();
Result += "\", \"";
- std::string StrEncoding;
- Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding, *IVI);
+ std::string TmpString, StrEncoding;
+ Context->getObjCEncodingForType((*IVI)->getType(), TmpString, *IVI);
+ QuoteDoublequotes(TmpString, StrEncoding);
Result += StrEncoding;
Result += "\", ";
SynthesizeIvarOffsetComputation(IDecl, *IVI, Result);
@@ -3205,8 +3214,9 @@
Result += "\t ,{\"";
Result += (*IVI)->getNameAsString();
Result += "\", \"";
- std::string StrEncoding;
+ std::string TmpString, StrEncoding;
Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding, *IVI);
+ QuoteDoublequotes(TmpString, StrEncoding);
Result += StrEncoding;
Result += "\", ";
SynthesizeIvarOffsetComputation(IDecl, (*IVI), Result);
More information about the cfe-commits
mailing list