aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-09-28 05:54:29 +0000
committerChris Lattner <sabre@nondot.org>2008-09-28 05:54:29 +0000
commitbd7eb1c3b2af5cd0a7540c79da85e2ce15a893f4 (patch)
tree0d9614c6368ac79cb22ec737c2c4469d3bf9e6d9
parentf7037b1c3be02fdc901862641d93118ea812e5f8 (diff)
Replace a comparison with a static list of builtins that was wrong (it
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
-rw-r--r--include/clang/AST/Builtins.h6
-rw-r--r--lib/Sema/SemaDecl.cpp5
2 files changed, 7 insertions, 4 deletions
diff --git a/include/clang/AST/Builtins.h b/include/clang/AST/Builtins.h
index d645de593f..0deaca6a68 100644
--- a/include/clang/AST/Builtins.h
+++ b/include/clang/AST/Builtins.h
@@ -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:
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index db1a7aef8b..9d3947bfcd 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -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);