[cfe-commits] r42830 - in /cfe/trunk: Lex/Preprocessor.cpp Parse/Parser.cpp clang.xcodeproj/project.pbxproj include/clang/Basic/TargetInfo.h

Chris Lattner sabre at nondot.org
Wed Oct 10 10:48:53 PDT 2007


Author: lattner
Date: Wed Oct 10 12:48:53 2007
New Revision: 42830

URL: http://llvm.org/viewvc/llvm-project?rev=42830&view=rev
Log:
resolve a fixme, by moving __builtin_va_list to a more logical
place and making it correctly parameterized on the target.

Modified:
    cfe/trunk/Lex/Preprocessor.cpp
    cfe/trunk/Parse/Parser.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/trunk/include/clang/Basic/TargetInfo.h

Modified: cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/Preprocessor.cpp?rev=42830&r1=42829&r2=42830&view=diff

==============================================================================
--- cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/Lex/Preprocessor.cpp Wed Oct 10 12:48:53 2007
@@ -376,6 +376,12 @@
     Buf.insert(Buf.end(), IDTypedef, IDTypedef+strlen(IDTypedef));
   }
 
+  // Add __builtin_va_list typedef.
+  {
+    const char *VAList = PP.getTargetInfo().getVAListDeclaration();
+    Buf.insert(Buf.end(), VAList, VAList+strlen(VAList));
+    Buf.push_back('\n');
+  }
   
   // Get the target #defines.
   PP.getTargetInfo().getTargetDefines(Buf);

Modified: cfe/trunk/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/Parser.cpp?rev=42830&r1=42829&r2=42830&view=diff

==============================================================================
--- cfe/trunk/Parse/Parser.cpp (original)
+++ cfe/trunk/Parse/Parser.cpp Wed Oct 10 12:48:53 2007
@@ -230,25 +230,6 @@
   EnterScope(Scope::DeclScope);
   Actions.ActOnTranslationUnitScope(Tok.getLocation(), CurScope);
   
-  // Install builtin types.
-  // TODO: Move this someplace more useful.
-  {
-    const char *Dummy;
-    
-    //__builtin_va_list
-    DeclSpec DS;
-    bool Error = DS.SetStorageClassSpec(DeclSpec::SCS_typedef, SourceLocation(),
-                                        Dummy);
-    
-    // TODO: add a 'TST_builtin' type?
-    Error |= DS.SetTypeSpecType(DeclSpec::TST_int, SourceLocation(), Dummy);
-    assert(!Error && "Error setting up __builtin_va_list!");
-    
-    Declarator D(DS, Declarator::FileContext);
-    D.SetIdentifier(PP.getIdentifierInfo("__builtin_va_list"),SourceLocation());
-    Actions.ActOnDeclarator(CurScope, D, 0);
-  }
-  
   if (Tok.is(tok::eof) &&
       !getLang().CPlusPlus)  // Empty source file is an extension in C
     Diag(Tok, diag::ext_empty_source_file);

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=42830&r1=42829&r2=42830&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Wed Oct 10 12:48:53 2007
@@ -237,7 +237,7 @@
 		84AF36A00CB17A3B00C820A5 /* DeclObjC.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = DeclObjC.h; path = clang/AST/DeclObjC.h; sourceTree = "<group>"; };
 		84D9A8870C1A57E100AC7ABC /* AttributeList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = AttributeList.cpp; path = Parse/AttributeList.cpp; sourceTree = "<group>"; };
 		84D9A88B0C1A581300AC7ABC /* AttributeList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AttributeList.h; path = clang/Parse/AttributeList.h; sourceTree = "<group>"; };
-		8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
+		8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
 		DE01DA480B12ADA300AC22CE /* PPCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PPCallbacks.h; sourceTree = "<group>"; };
 		DE06756B0C051CFE00EBBFD8 /* ParseExprCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ParseExprCXX.cpp; path = Parse/ParseExprCXX.cpp; sourceTree = "<group>"; };
 		DE06B73D0A8307640050E87E /* LangOptions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LangOptions.h; sourceTree = "<group>"; };

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=42830&r1=42829&r2=42830&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Wed Oct 10 12:48:53 2007
@@ -183,6 +183,12 @@
   void getTargetBuiltins(const Builtin::Info *&Records, unsigned &NumRecords,
                          std::vector<const char *> &NonPortableBuiltins) const;
 
+  /// getVAListDeclaration - Return the declaration to use for
+  /// __builtin_va_list, which is target-specific.
+  const char *getVAListDeclaration() const {
+    // FIXME: dispatch to target impl.
+    return "typedef int __builtin_va_list;";
+  }
   ///===---- Some helper methods ------------------------------------------===//
 
   unsigned getCharWidth(SourceLocation Loc) {





More information about the cfe-commits mailing list