[cfe-commits] r44688 - /cfe/trunk/Driver/RewriteTest.cpp

Steve Naroff snaroff at apple.com
Fri Dec 7 14:15:58 PST 2007


Author: snaroff
Date: Fri Dec  7 16:15:58 2007
New Revision: 44688

URL: http://llvm.org/viewvc/llvm-project?rev=44688&view=rev
Log:

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...


Modified:
    cfe/trunk/Driver/RewriteTest.cpp

Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=44688&r1=44687&r2=44688&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Fri Dec  7 16:15:58 2007
@@ -1648,8 +1648,11 @@
     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 @@
     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());





More information about the cfe-commits mailing list