]> granicus.if.org Git - clang/commitdiff
resolve a fixme, by moving __builtin_va_list to a more logical
authorChris Lattner <sabre@nondot.org>
Wed, 10 Oct 2007 17:48:53 +0000 (17:48 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 10 Oct 2007 17:48:53 +0000 (17:48 +0000)
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

Lex/Preprocessor.cpp
Parse/Parser.cpp
clang.xcodeproj/project.pbxproj
include/clang/Basic/TargetInfo.h

index 7deea405485fde518a3126117d535feaa8a15a9b..78e4496a5d55946599b7998f3286a85b2126c497 100644 (file)
@@ -376,6 +376,12 @@ static void InitializePredefinedMacros(Preprocessor &PP,
     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);
index fc5c4ae4f7143d91792fad713c10889fc38364d2..543aed8855d74caaeda90179cc9320304b66f367 100644 (file)
@@ -230,25 +230,6 @@ void Parser::Initialize() {
   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);
index 0db725b41a97ce57758bab90d06c7cc95fc64475..b5cf88f72c9ec1467023ec917411ee3b9a655754 100644 (file)
                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>"; };
index d0b0434d85191c48edad645c7b5fce493e4d0212..e161e65ef3ffbcab4ccf8158071bbe09343c398a 100644 (file)
@@ -183,6 +183,12 @@ public:
   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) {