diff options
author | Steve Naroff <snaroff@apple.com> | 2007-12-07 22:15:58 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-12-07 22:15:58 +0000 |
commit | 75ae77646637bf2a72a820ae126d6f2eafdad255 (patch) | |
tree | abe0362c7fcacb2bb3c6318bf0249dd54ad99ccd | |
parent | 7dd82836dca87cf828ce994f161b53a34f6cdb7e (diff) |
Omit the field name when including the super class structure template.
This allows us to access a superclasses ivars without deriving the absolute path.
The comments below say a bit more...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44688 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/RewriteTest.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp index 2a189ad85b..3ec5a10b2c 100644 --- a/Driver/RewriteTest.cpp +++ b/Driver/RewriteTest.cpp @@ -1648,8 +1648,11 @@ void RewriteTest::SynthesizeObjcInternalStruct(ObjcInterfaceDecl *CDecl, if (RCDecl && ObjcSynthesizedStructs.count(RCDecl)) { Result = "\n struct "; Result += RCDecl->getName(); - Result += " _"; - Result += RCDecl->getName(); + // Note: We don't name the field decl. This simplifies the "codegen" for + // accessing a superclasses instance variables (and is similar to what gcc + // does internally). The unnamed struct field feature is enabled with + // -fms-extensions. If the struct definition were "inlined", we wouldn't + // need to use this switch. That said, I don't want to inline the def. Result += ";\n"; // insert the super class structure definition. @@ -1692,8 +1695,11 @@ void RewriteTest::SynthesizeObjcInternalStruct(ObjcInterfaceDecl *CDecl, endBuf += Lexer::MeasureTokenLength(LocEnd, *SM); Result += " {\n struct "; Result += RCDecl->getName(); - Result += " _"; - Result += RCDecl->getName(); + // Note: We don't name the field decl. This simplifies the "codegen" for + // accessing a superclasses instance variables (and is similar to what gcc + // does internally). The unnamed struct field feature is enabled with + // -fms-extensions. If the struct definition were "inlined", we wouldn't + // need to use this switch. That said, I don't want to inline the def. Result += ";\n};\n"; Rewrite.ReplaceText(LocStart, endBuf-startBuf, Result.c_str(), Result.size()); |