resolve a fixme, by moving __builtin_va_list to a more logical
place and making it correctly parameterized on the target.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42830 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Lex/Preprocessor.cpp b/Lex/Preprocessor.cpp
index 7deea40..78e4496 100644
--- a/Lex/Preprocessor.cpp
+++ b/Lex/Preprocessor.cpp
@@ -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);
diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp
index fc5c4ae..543aed8 100644
--- a/Parse/Parser.cpp
+++ b/Parse/Parser.cpp
@@ -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);
diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj
index 0db725b..b5cf88f 100644
--- a/clang.xcodeproj/project.pbxproj
+++ b/clang.xcodeproj/project.pbxproj
@@ -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>"; };
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index d0b0434..e161e65 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -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) {