forked from OSchip/llvm-project
Fixed a rewrite bug in class synthesis (which I first thought was a rewrite API bug).
llvm-svn: 44335
This commit is contained in:
parent
e01743a3a3
commit
96502afb6f
|
@ -1318,8 +1318,6 @@ void RewriteTest::SynthesizeObjcInternalStruct(ObjcInterfaceDecl *CDecl,
|
||||||
// If no ivars and no root or if its root, directly or indirectly,
|
// If no ivars and no root or if its root, directly or indirectly,
|
||||||
// have no ivars (thus not synthesized) then no need to synthesize this class.
|
// have no ivars (thus not synthesized) then no need to synthesize this class.
|
||||||
if (NumIvars <= 0 && (!RCDecl || !ObjcSynthesizedStructs.count(RCDecl))) {
|
if (NumIvars <= 0 && (!RCDecl || !ObjcSynthesizedStructs.count(RCDecl))) {
|
||||||
//FIXME: This does not replace @interface class-name with the
|
|
||||||
//Result text. Could be a bug in ReplaceText API.
|
|
||||||
endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
|
endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
|
||||||
Rewrite.ReplaceText(LocStart, endBuf-startBuf,
|
Rewrite.ReplaceText(LocStart, endBuf-startBuf,
|
||||||
Result.c_str(), Result.size());
|
Result.c_str(), Result.size());
|
||||||
|
@ -1756,8 +1754,12 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl,
|
||||||
int NumIvars = IDecl->getImplDeclNumIvars() > 0
|
int NumIvars = IDecl->getImplDeclNumIvars() > 0
|
||||||
? IDecl->getImplDeclNumIvars()
|
? IDecl->getImplDeclNumIvars()
|
||||||
: (CDecl ? CDecl->getNumInstanceVariables() : 0);
|
: (CDecl ? CDecl->getNumInstanceVariables() : 0);
|
||||||
|
// Explictly declared @interface's are already synthesized.
|
||||||
SynthesizeObjcInternalStruct(CDecl, Result);
|
if (CDecl->ImplicitInterfaceDecl()) {
|
||||||
|
// FIXME: Implementation of a class with no @interface (legacy) doese not
|
||||||
|
// produce correct synthesis as yet.
|
||||||
|
SynthesizeObjcInternalStruct(CDecl, Result);
|
||||||
|
}
|
||||||
|
|
||||||
if (NumIvars > 0) {
|
if (NumIvars > 0) {
|
||||||
static bool objc_ivar = false;
|
static bool objc_ivar = false;
|
||||||
|
|
Loading…
Reference in New Issue