diff options
author | Charles Davis <cdavis5x@gmail.com> | 2015-09-17 20:55:33 +0000 |
---|---|---|
committer | Charles Davis <cdavis5x@gmail.com> | 2015-09-17 20:55:33 +0000 |
commit | c7d5c94f78c71d7369c5e3a55daf4d819943c15b (patch) | |
tree | 699d74797a9eb67c9d86736b349df7eb84c3d929 /clang/lib/AST/ASTContext.cpp | |
parent | 1bbfa7f9d7e33babe186b046b6719da55deaf4af (diff) | |
download | bcm5719-llvm-c7d5c94f78c71d7369c5e3a55daf4d819943c15b.tar.gz bcm5719-llvm-c7d5c94f78c71d7369c5e3a55daf4d819943c15b.zip |
Support __builtin_ms_va_list.
Summary:
This change adds support for `__builtin_ms_va_list`, a GCC extension for
variadic `ms_abi` functions. The existing `__builtin_va_list` support is
inadequate for this because `va_list` is defined differently in the Win64
ABI vs. the System V/AMD64 ABI.
Depends on D1622.
Reviewers: rsmith, rnk, rjmccall
CC: cfe-commits
Differential Revision: http://reviews.llvm.org/D1623
llvm-svn: 247941
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index e5511cbd616..3e0d6d1144b 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -733,8 +733,9 @@ ASTContext::ASTContext(LangOptions &LOpts, SourceManager &SM, SubstTemplateTemplateParmPacks(this_()), GlobalNestedNameSpecifier(nullptr), Int128Decl(nullptr), UInt128Decl(nullptr), Float128StubDecl(nullptr), - BuiltinVaListDecl(nullptr), ObjCIdDecl(nullptr), ObjCSelDecl(nullptr), - ObjCClassDecl(nullptr), ObjCProtocolClassDecl(nullptr), BOOLDecl(nullptr), + BuiltinVaListDecl(nullptr), BuiltinMSVaListDecl(nullptr), + ObjCIdDecl(nullptr), ObjCSelDecl(nullptr), ObjCClassDecl(nullptr), + ObjCProtocolClassDecl(nullptr), BOOLDecl(nullptr), CFConstantStringTypeDecl(nullptr), ObjCInstanceTypeDecl(nullptr), FILEDecl(nullptr), jmp_bufDecl(nullptr), sigjmp_bufDecl(nullptr), ucontext_tDecl(nullptr), BlockDescriptorType(nullptr), @@ -6039,10 +6040,19 @@ ObjCInterfaceDecl *ASTContext::getObjCProtocolDecl() const { // __builtin_va_list Construction Functions //===----------------------------------------------------------------------===// -static TypedefDecl *CreateCharPtrBuiltinVaListDecl(const ASTContext *Context) { - // typedef char* __builtin_va_list; +static TypedefDecl *CreateCharPtrNamedVaListDecl(const ASTContext *Context, + StringRef Name) { + // typedef char* __builtin[_ms]_va_list; QualType T = Context->getPointerType(Context->CharTy); - return Context->buildImplicitTypedef(T, "__builtin_va_list"); + return Context->buildImplicitTypedef(T, Name); +} + +static TypedefDecl *CreateMSVaListDecl(const ASTContext *Context) { + return CreateCharPtrNamedVaListDecl(Context, "__builtin_ms_va_list"); +} + +static TypedefDecl *CreateCharPtrBuiltinVaListDecl(const ASTContext *Context) { + return CreateCharPtrNamedVaListDecl(Context, "__builtin_va_list"); } static TypedefDecl *CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context) { @@ -6378,6 +6388,13 @@ Decl *ASTContext::getVaListTagDecl() const { return VaListTagDecl; } +TypedefDecl *ASTContext::getBuiltinMSVaListDecl() const { + if (!BuiltinMSVaListDecl) + BuiltinMSVaListDecl = CreateMSVaListDecl(this); + + return BuiltinMSVaListDecl; +} + void ASTContext::setObjCConstantStringInterface(ObjCInterfaceDecl *Decl) { assert(ObjCConstantStringType.isNull() && "'NSConstantString' type already set!"); |