diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/ASTContext.h | 17 | ||||
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 29 | ||||
-rw-r--r-- | include/clang/Serialization/ASTBitCodes.h | 27 |
3 files changed, 51 insertions, 22 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 079c1c3f9c..cb2f694c97 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -198,10 +198,9 @@ class ASTContext : public RefCountedBase<ASTContext> { /// \brief The typedef for the __uint128_t type. mutable TypedefDecl *UInt128Decl; - /// BuiltinVaListType - built-in va list type. - /// This is initially null and set by Sema::LazilyCreateBuiltin when - /// a builtin that takes a valist is encountered. - QualType BuiltinVaListType; + /// \brief The typedef for the target specific predefined + /// __builtin_va_list type. + mutable TypedefDecl *BuiltinVaListDecl; /// \brief The typedef for the predefined 'id' type. mutable TypedefDecl *ObjCIdDecl; @@ -1153,8 +1152,14 @@ public: return getObjCInterfaceType(getObjCProtocolDecl()); } - void setBuiltinVaListType(QualType T); - QualType getBuiltinVaListType() const { return BuiltinVaListType; } + /// \brief Retrieve the C type declaration corresponding to the predefined + /// __builtin_va_list type. + TypedefDecl *getBuiltinVaListDecl() const; + + /// \brief Retrieve the type of the __builtin_va_list type. + QualType getBuiltinVaListType() const { + return getTypeDeclType(getBuiltinVaListDecl()); + } /// getCVRQualifiedType - Returns a type with additional const, /// volatile, or restrict qualifiers. diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 15e29c3d9a..aaf8cfe47c 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -128,6 +128,29 @@ public: LongDouble }; + /// BuiltinVaListKind - The different kinds of __builtin_va_list types + /// defined by the target implementation. + enum BuiltinVaListKind { + /// typedef char* __builtin_va_list; + CharPtrBuiltinVaList = 0, + + /// typedef void* __builtin_va_list; + VoidPtrBuiltinVaList, + + /// __builtin_va_list as defined by the PNaCl ABI: + /// http://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Machine-Types + PNaClABIBuiltinVaList, + + /// __builtin_va_list as defined by the Power ABI: + /// https://www.power.org + /// /resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Embedded.pdf + PowerABIBuiltinVaList, + + /// __builtin_va_list as defined by the x86-64 ABI: + /// http://www.x86-64.org/documentation/abi.pdf + X86_64ABIBuiltinVaList + }; + protected: IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType, WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType; @@ -379,9 +402,9 @@ public: /// idea to avoid optimizing based on that undef behavior. virtual bool isCLZForZeroUndef() const { return true; } - /// getVAListDeclaration - Return the declaration to use for - /// __builtin_va_list, which is target-specific. - virtual const char *getVAListDeclaration() const = 0; + /// getBuiltinVaListKind - Returns the kind of __builtin_va_list + /// type that should be used with this target. + virtual BuiltinVaListKind getBuiltinVaListKind() const = 0; /// isValidClobber - Returns whether the passed in string is /// a valid clobber in an inline asm statement. This is used by diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index ce60578834..42d0ad2467 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -738,28 +738,26 @@ namespace clang { /// The constants in this enumeration are indices into the /// SPECIAL_TYPES record. enum SpecialTypeIDs { - /// \brief __builtin_va_list - SPECIAL_TYPE_BUILTIN_VA_LIST = 0, /// \brief CFConstantString type - SPECIAL_TYPE_CF_CONSTANT_STRING = 1, + SPECIAL_TYPE_CF_CONSTANT_STRING = 0, /// \brief C FILE typedef type - SPECIAL_TYPE_FILE = 2, + SPECIAL_TYPE_FILE = 1, /// \brief C jmp_buf typedef type - SPECIAL_TYPE_JMP_BUF = 3, + SPECIAL_TYPE_JMP_BUF = 2, /// \brief C sigjmp_buf typedef type - SPECIAL_TYPE_SIGJMP_BUF = 4, + SPECIAL_TYPE_SIGJMP_BUF = 3, /// \brief Objective-C "id" redefinition type - SPECIAL_TYPE_OBJC_ID_REDEFINITION = 5, + SPECIAL_TYPE_OBJC_ID_REDEFINITION = 4, /// \brief Objective-C "Class" redefinition type - SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 6, + SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 5, /// \brief Objective-C "SEL" redefinition type - SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 7, + SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 6, /// \brief C ucontext_t typedef type - SPECIAL_TYPE_UCONTEXT_T = 8 + SPECIAL_TYPE_UCONTEXT_T = 7 }; /// \brief The number of special type IDs. - const unsigned NumSpecialTypeIDs = 9; + const unsigned NumSpecialTypeIDs = 8; /// \brief Predefined declaration IDs. /// @@ -793,14 +791,17 @@ namespace clang { PREDEF_DECL_UNSIGNED_INT_128_ID = 7, /// \brief The internal 'instancetype' typedef. - PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8 + PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8, + + /// \brief The internal '__builtin_va_list' typedef. + PREDEF_DECL_BUILTIN_VA_LIST_ID = 9 }; /// \brief The number of declaration IDs that are predefined. /// /// For more information about predefined declarations, see the /// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants. - const unsigned int NUM_PREDEF_DECL_IDS = 9; + const unsigned int NUM_PREDEF_DECL_IDS = 10; /// \brief Record codes for each kind of declaration. /// |