diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-01-20 07:46:22 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-01-20 07:46:22 +0000 |
commit | 6597f985156b3a24c0a9db1e01eeec85714c4a8d (patch) | |
tree | cfed15374eb0f085e30f24ffa08393f2c2a041bc /lib/AST/Builtins.cpp | |
parent | 4e3d7626e479866182d1a2d1b138813cf2d7adb1 (diff) |
Fix for PR3350: add special-casing for "references" to va_lists in
builtins.
Also, a minor tweak to va_copy for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62574 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Builtins.cpp')
-rw-r--r-- | lib/AST/Builtins.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/AST/Builtins.cpp b/lib/AST/Builtins.cpp index a721c6ea8c..b675c72973 100644 --- a/lib/AST/Builtins.cpp +++ b/lib/AST/Builtins.cpp @@ -142,6 +142,23 @@ static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context, Type = Context.getBuiltinVaListType(); assert(!Type.isNull() && "builtin va list type not initialized!"); break; + case 'A': + // This is a "reference" to a va_list; however, what exactly + // this means depends on how va_list is defined. There are two + // different kinds of va_list: ones passed by value, and ones + // passed by reference. An example of a by-value va_list is + // x86, where va_list is a char*. An example of by-ref va_list + // is x86-64, where va_list is a __va_list_tag[1]. For x86, + // we want this argument to be a char*&; for x86-64, we want + // it to be a __va_list_tag*. + Type = Context.getBuiltinVaListType(); + assert(!Type.isNull() && "builtin va list type not initialized!"); + if (Type->isArrayType()) { + Type = Context.getArrayDecayedType(Type); + } else { + Type = Context.getReferenceType(Type); + } + break; case 'V': { char *End; |