]> granicus.if.org Git - clang/commitdiff
Replace a comparison with a static list of builtins that was wrong (it
authorChris Lattner <sabre@nondot.org>
Sun, 28 Sep 2008 05:54:29 +0000 (05:54 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 28 Sep 2008 05:54:29 +0000 (05:54 +0000)
wasn't covering checking builtins like __builtin___vsnprintf_chk) with
a check that won't get out of date.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56767 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Builtins.h
lib/Sema/SemaDecl.cpp

index d645de593f4689df31c0181bdccf63d314efcca9..0deaca6a68c00650d2af7e5c2a3e73af93abb6de 100644 (file)
@@ -78,6 +78,12 @@ public:
     return strchr(GetRecord(ID).Attributes, 'F') != 0;
   }
   
+  /// hasVAListUse - Return true of the specified builtin uses __builtin_va_list
+  /// as an operand or return type.
+  bool hasVAListUse(unsigned ID) const {
+    return strchr(GetRecord(ID).Type, 'a') != 0;
+  }
+  
   /// GetBuiltinType - Return the type for the specified builtin.
   QualType GetBuiltinType(unsigned ID, ASTContext &Context) const;
 private:
index db1a7aef8b141afa3a4757ceb6fc8274b33e202b..9d3947bfcdd8f647b0bdb2c369f51a339e458c66 100644 (file)
@@ -194,10 +194,7 @@ ScopedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid,
                                       Scope *S) {
   Builtin::ID BID = (Builtin::ID)bid;
 
-  if (BID == Builtin::BI__builtin_va_start ||
-      BID == Builtin::BI__builtin_va_copy ||
-      BID == Builtin::BI__builtin_va_end ||
-      BID == Builtin::BI__builtin_stdarg_start)
+  if (Context.BuiltinInfo.hasVAListUse(BID))
     InitBuiltinVaListType();
     
   QualType R = Context.BuiltinInfo.GetBuiltinType(BID, Context);