diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-05-03 16:53:59 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-05-03 16:53:59 +0000 |
commit | 6b9a6e390fbb92c40eb9c6ac9e7abbd88dd7a767 (patch) | |
tree | 2e51705e103e92c7be1b21e8bd8ffd5b5d0e4d52 /include/clang/Basic | |
parent | dbe13110f59f48b4dbb7552b3ac2935acdeece7f (diff) | |
download | src-6b9a6e390fbb92c40eb9c6ac9e7abbd88dd7a767.tar.gz src-6b9a6e390fbb92c40eb9c6ac9e7abbd88dd7a767.zip |
Vendor import of clang release_31 branch r155985:vendor/clang/clang-release_31-r155985
Notes
Notes:
svn path=/vendor/clang/dist/; revision=234973
svn path=/vendor/clang/clang-release_31-r155985/; revision=234974; tag=vendor/clang/clang-release_31-r155985
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/BuiltinsX86.def | 6 | ||||
-rw-r--r-- | include/clang/Basic/ConvertUTF.h | 2 | ||||
-rw-r--r-- | include/clang/Basic/DelayedCleanupPool.h | 110 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 2 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 23 | ||||
-rw-r--r-- | include/clang/Basic/ExceptionSpecificationType.h | 18 | ||||
-rw-r--r-- | include/clang/Basic/OnDiskHashTable.h | 33 | ||||
-rw-r--r-- | include/clang/Basic/StmtNodes.td | 1 | ||||
-rw-r--r-- | include/clang/Basic/TargetInfo.h | 15 | ||||
-rw-r--r-- | include/clang/Basic/TokenKinds.def | 1 |
10 files changed, 72 insertions, 139 deletions
diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index f44aed6f9548..4aea980a9d5c 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -412,6 +412,9 @@ BUILTIN(__builtin_ia32_cvtps2pd256, "V4dV4f", "") BUILTIN(__builtin_ia32_cvttpd2dq256, "V4iV4d", "") BUILTIN(__builtin_ia32_cvtpd2dq256, "V4iV4d", "") BUILTIN(__builtin_ia32_cvttps2dq256, "V8iV8f", "") +BUILTIN(__builtin_ia32_vperm2f128_pd256, "V4dV4dV4dIc", "") +BUILTIN(__builtin_ia32_vperm2f128_ps256, "V8fV8fV8fIc", "") +BUILTIN(__builtin_ia32_vperm2f128_si256, "V8iV8iV8iIc", "") BUILTIN(__builtin_ia32_vinsertf128_pd256, "V4dV4dV2dIc", "") BUILTIN(__builtin_ia32_vinsertf128_ps256, "V8fV8fV4fIc", "") BUILTIN(__builtin_ia32_vinsertf128_si256, "V8iV8iV4iIc", "") @@ -560,9 +563,8 @@ BUILTIN(__builtin_ia32_pbroadcastw128, "V8sV8s", "") BUILTIN(__builtin_ia32_pbroadcastd128, "V4iV4i", "") BUILTIN(__builtin_ia32_pbroadcastq128, "V2LLiV2LLi", "") BUILTIN(__builtin_ia32_permvarsi256, "V8iV8iV8i", "") -BUILTIN(__builtin_ia32_permdf256, "V4dV4dIc", "") BUILTIN(__builtin_ia32_permvarsf256, "V8fV8fV8f", "") -BUILTIN(__builtin_ia32_permdi256, "V4LLiV4LLiIc", "") +BUILTIN(__builtin_ia32_permti256, "V4LLiV4LLiV4LLiIc", "") BUILTIN(__builtin_ia32_extract128i256, "V2LLiV4LLiIc", "") BUILTIN(__builtin_ia32_insert128i256, "V4LLiV4LLiV2LLiIc", "") BUILTIN(__builtin_ia32_maskloadd256, "V8iV8iC*V8i", "") diff --git a/include/clang/Basic/ConvertUTF.h b/include/clang/Basic/ConvertUTF.h index ec6b973e6a7f..7fb587402712 100644 --- a/include/clang/Basic/ConvertUTF.h +++ b/include/clang/Basic/ConvertUTF.h @@ -151,9 +151,9 @@ ConversionResult ConvertUTF16toUTF32 ( ConversionResult ConvertUTF32toUTF16 ( const UTF32** sourceStart, const UTF32* sourceEnd, UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); +#endif Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd); -#endif Boolean isLegalUTF8String(const UTF8 *source, const UTF8 *sourceEnd); diff --git a/include/clang/Basic/DelayedCleanupPool.h b/include/clang/Basic/DelayedCleanupPool.h deleted file mode 100644 index 8575bc21113f..000000000000 --- a/include/clang/Basic/DelayedCleanupPool.h +++ /dev/null @@ -1,110 +0,0 @@ -//=== DelayedCleanupPool.h - Delayed Clean-up Pool Implementation *- C++ -*===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines a facility to delay calling cleanup methods until specific -// points. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_BASIC_DELAYEDCLEANUPPOOL_H -#define LLVM_CLANG_BASIC_DELAYEDCLEANUPPOOL_H - -#include "clang/Basic/LLVM.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/SmallVector.h" - -namespace clang { - -/// \brief Gathers pairs of pointer-to-object/pointer-to-cleanup-function -/// allowing the cleanup functions to get called (with the pointer as parameter) -/// at specific points. -/// -/// The use case is to simplify clean-up of certain resources that, while their -/// lifetime is well-known and restricted, cleaning them up manually is easy to -/// miss and cause a leak. -/// -/// The same pointer can be added multiple times; its clean-up function will -/// only be called once. -class DelayedCleanupPool { -public: - typedef void (*CleanupFn)(void *ptr); - - /// \brief Adds a pointer and its associated cleanup function to be called - /// at a later point. - /// - /// \returns false if the pointer is already added, true otherwise. - bool delayCleanup(void *ptr, CleanupFn fn) { - assert(ptr && "Expected valid pointer to object"); - assert(fn && "Expected valid pointer to function"); - - CleanupFn &mapFn = Ptrs[ptr]; - assert((!mapFn || mapFn == fn) && - "Adding a pointer with different cleanup function!"); - - if (!mapFn) { - mapFn = fn; - Cleanups.push_back(std::make_pair(ptr, fn)); - return true; - } - - return false; - } - - template <typename T> - bool delayDelete(T *ptr) { - return delayCleanup(ptr, cleanupWithDelete<T>); - } - - template <typename T, void (T::*Fn)()> - bool delayMemberFunc(T *ptr) { - return delayCleanup(ptr, cleanupWithMemberFunc<T, Fn>); - } - - void doCleanup() { - for (SmallVector<std::pair<void *, CleanupFn>, 8>::reverse_iterator - I = Cleanups.rbegin(), E = Cleanups.rend(); I != E; ++I) - I->second(I->first); - Cleanups.clear(); - Ptrs.clear(); - } - - ~DelayedCleanupPool() { - doCleanup(); - } - -private: - llvm::DenseMap<void *, CleanupFn> Ptrs; - SmallVector<std::pair<void *, CleanupFn>, 8> Cleanups; - - template <typename T> - static void cleanupWithDelete(void *ptr) { - delete static_cast<T *>(ptr); - } - - template <typename T, void (T::*Fn)()> - static void cleanupWithMemberFunc(void *ptr) { - (static_cast<T *>(ptr)->*Fn)(); - } -}; - -/// \brief RAII object for triggering a cleanup of a DelayedCleanupPool. -class DelayedCleanupPoint { - DelayedCleanupPool &Pool; - -public: - DelayedCleanupPoint(DelayedCleanupPool &pool) : Pool(pool) { } - - ~DelayedCleanupPoint() { - Pool.doCleanup(); - } -}; - -} // end namespace clang - -#endif diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index c183da7a6ac9..957f05b66426 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -410,6 +410,8 @@ def ext_ellipsis_exception_spec : Extension< "exception specification of '...' is a Microsoft extension">; def err_dynamic_and_noexcept_specification : Error< "cannot have both throw() and noexcept() clause on the same function">; +def err_except_spec_unparsed : Error< + "unexpected end of exception specification">; def warn_cxx98_compat_noexcept_decl : Warning< "noexcept specifications are incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index e553740ab1df..0614adee85b8 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -231,9 +231,13 @@ def err_using_decl_can_not_refer_to_namespace : Error< "using declaration can not refer to namespace">; def err_using_decl_constructor : Error< "using declaration can not refer to a constructor">; -def warn_cxx98_compat_using_decl_constructor : Warning< - "inherited constructors are incompatible with C++98">, - InGroup<CXX98Compat>, DefaultIgnore; +def err_using_decl_constructor_unsupported : Error< + "inheriting constructors are not supported">; +// FIXME: Replace the above error with this warning if support for +// inheriting constructors is implemented. +//def warn_cxx98_compat_using_decl_constructor : Warning< +// "inheriting constructors are incompatible with C++98">, +// InGroup<CXX98Compat>, DefaultIgnore; def err_using_decl_destructor : Error< "using declaration can not refer to a destructor">; def err_using_decl_template_id : Error< @@ -1547,9 +1551,6 @@ def warn_objc_redundant_literal_use : Warning< "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>; } -def warn_bool_for_boolean_literal : Warning< - "BOOL of type %0 is non-intergal and unsuitable for a " - "boolean literal - ignored">, InGroup<DiagGroup<"numeric-literals">>; def err_only_annotate_after_access_spec : Error< "access specifier can only have annotation attributes">; def err_attribute_section_invalid_for_target : Error< @@ -1563,6 +1564,9 @@ def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning< def warn_attribute_ignored : Warning<"%0 attribute ignored">; def warn_unknown_attribute_ignored : Warning< "unknown attribute %0 ignored">, InGroup<UnknownAttributes>; +def warn_attribute_invalid_on_stmt : Warning< + "attribute %0 cannot be specified on a statement">, + InGroup<IgnoredAttributes>; def warn_declspec_attribute_ignored : Warning< "attribute %0 is ignored, place it after \"%select{class|struct|union|enum}1\" to apply attribute to type declaration">, InGroup<IgnoredAttributes>; def warn_attribute_precede_definition : Warning< @@ -2583,6 +2587,8 @@ def note_template_enum_def_here : Note< "in instantiation of enumeration %q0 requested here">; def note_template_type_alias_instantiation_here : Note< "in instantiation of template type alias %0 requested here">; +def note_template_exception_spec_instantiation_here : Note< + "in instantiation of exception specification for %0 requested here">; def note_default_arg_instantiation_here : Note< "in instantiation of default argument for '%0' required here">; @@ -3798,6 +3804,9 @@ def warn_null_in_comparison_operation : Warning< def err_invalid_this_use : Error< "invalid use of 'this' outside of a non-static member function">; +def err_this_static_member_func : Error< + "'this' cannot be%select{| implicitly}0 used in a static member function " + "declaration">; def err_invalid_member_use_in_static_method : Error< "invalid use of member %0 in static member function">; def err_invalid_qualified_function_type : Error< @@ -3907,7 +3916,7 @@ def err_nosetter_property_incdec : Error< def err_nogetter_property_compound_assignment : Error< "a getter method is needed to perform a compound assignment on a property">; def err_nogetter_property_incdec : Error< - "no getter method %1 for %select{increment|decrement} of property">; + "no getter method %1 for %select{increment|decrement}0 of property">; def error_no_subobject_property_setting : Error< "expression is not assignable">; def err_qualified_objc_access : Error< diff --git a/include/clang/Basic/ExceptionSpecificationType.h b/include/clang/Basic/ExceptionSpecificationType.h index 98cfd297addf..e911bde1910a 100644 --- a/include/clang/Basic/ExceptionSpecificationType.h +++ b/include/clang/Basic/ExceptionSpecificationType.h @@ -16,7 +16,7 @@ namespace clang { -/// \brief The various types of exception specifications that exist in C++0x. +/// \brief The various types of exception specifications that exist in C++11. enum ExceptionSpecificationType { EST_None, ///< no exception specification EST_DynamicNone, ///< throw() @@ -24,7 +24,8 @@ enum ExceptionSpecificationType { EST_MSAny, ///< Microsoft throw(...) extension EST_BasicNoexcept, ///< noexcept EST_ComputedNoexcept, ///< noexcept(expression) - EST_Delayed ///< not known yet + EST_Delayed, ///< not known yet + EST_Uninstantiated ///< not instantiated yet }; inline bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType) { @@ -35,6 +36,19 @@ inline bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType) { return ESpecType == EST_BasicNoexcept || ESpecType == EST_ComputedNoexcept; } +/// \brief Possible results from evaluation of a noexcept expression. +enum CanThrowResult { + CT_Cannot, + CT_Dependent, + CT_Can +}; + +inline CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2) { + // CanThrowResult constants are ordered so that the maximum is the correct + // merge result. + return CT1 > CT2 ? CT1 : CT2; +} + } // end namespace clang #endif // LLVM_CLANG_BASIC_EXCEPTIONSPECIFICATIONTYPE_H diff --git a/include/clang/Basic/OnDiskHashTable.h b/include/clang/Basic/OnDiskHashTable.h index 8028a73326c3..b92f1cf9c6ae 100644 --- a/include/clang/Basic/OnDiskHashTable.h +++ b/include/clang/Basic/OnDiskHashTable.h @@ -132,7 +132,7 @@ class OnDiskChainedHashTableGenerator { class Bucket { public: io::Offset off; - Item* head; + Item* head; unsigned length; Bucket() {} @@ -201,6 +201,7 @@ public: // Write out the number of items in the bucket. Emit16(out, B.length); + assert(B.length != 0 && "Bucket has a head but zero length?"); // Write out the entries in the bucket. for (Item *I = B.head; I ; I = I->next) { @@ -398,31 +399,30 @@ public: } key_iterator key_end() { return key_iterator(); } - /// \brief Iterates over all the entries in the table, returning - /// a key/data pair. - class item_iterator { + /// \brief Iterates over all the entries in the table, returning the data. + class data_iterator { const unsigned char* Ptr; unsigned NumItemsInBucketLeft; unsigned NumEntriesLeft; Info *InfoObj; public: - typedef std::pair<external_key_type, data_type> value_type; + typedef data_type value_type; - item_iterator(const unsigned char* const Ptr, unsigned NumEntries, + data_iterator(const unsigned char* const Ptr, unsigned NumEntries, Info *InfoObj) : Ptr(Ptr), NumItemsInBucketLeft(0), NumEntriesLeft(NumEntries), InfoObj(InfoObj) { } - item_iterator() + data_iterator() : Ptr(0), NumItemsInBucketLeft(0), NumEntriesLeft(0), InfoObj(0) { } - bool operator==(const item_iterator& X) const { + bool operator==(const data_iterator& X) const { return X.NumEntriesLeft == NumEntriesLeft; } - bool operator!=(const item_iterator& X) const { + bool operator!=(const data_iterator& X) const { return X.NumEntriesLeft != NumEntriesLeft; } - item_iterator& operator++() { // Preincrement + data_iterator& operator++() { // Preincrement if (!NumItemsInBucketLeft) { // 'Items' starts with a 16-bit unsigned integer representing the // number of items in this bucket. @@ -438,8 +438,8 @@ public: --NumEntriesLeft; return *this; } - item_iterator operator++(int) { // Postincrement - item_iterator tmp = *this; ++*this; return tmp; + data_iterator operator++(int) { // Postincrement + data_iterator tmp = *this; ++*this; return tmp; } value_type operator*() const { @@ -454,15 +454,14 @@ public: // Read the key. const internal_key_type& Key = InfoObj->ReadKey(LocalPtr, L.first); - return std::make_pair(InfoObj->GetExternalKey(Key), - InfoObj->ReadData(Key, LocalPtr + L.first, L.second)); + return InfoObj->ReadData(Key, LocalPtr + L.first, L.second); } }; - item_iterator item_begin() { - return item_iterator(Base + 4, getNumEntries(), &InfoObj); + data_iterator data_begin() { + return data_iterator(Base + 4, getNumEntries(), &InfoObj); } - item_iterator item_end() { return item_iterator(); } + data_iterator data_end() { return data_iterator(); } Info &getInfoObj() { return InfoObj; } diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td index 67d71e44c0a4..e7718cd80cb3 100644 --- a/include/clang/Basic/StmtNodes.td +++ b/include/clang/Basic/StmtNodes.td @@ -12,6 +12,7 @@ class DStmt<Stmt base, bit abstract = 0> : Stmt<abstract> { def NullStmt : Stmt; def CompoundStmt : Stmt; def LabelStmt : Stmt; +def AttributedStmt : Stmt; def IfStmt : Stmt; def SwitchStmt : Stmt; def WhileStmt : Stmt; diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index bbd376a82415..a03cf83ff7db 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -132,6 +132,11 @@ protected: IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType, WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType; + /// Flag whether the Objective-C built-in boolean type should be signed char. + /// Otherwise, when this flag is not set, the normal built-in boolean type is + /// used. + unsigned UseSignedCharForObjCBool : 1; + /// Control whether the alignment of bit-field types is respected when laying /// out structures. If true, then the alignment of the bit-field type will be /// used to (a) impact the alignment of the containing structure, and (b) @@ -299,6 +304,16 @@ public: return MCountName; } + /// useSignedCharForObjCBool - Check if the Objective-C built-in boolean + /// type should be signed char. Otherwise, if this returns false, the + /// normal built-in boolean type should also be used for Objective-C. + bool useSignedCharForObjCBool() const { + return UseSignedCharForObjCBool; + } + void noSignedCharForObjCBool() { + UseSignedCharForObjCBool = false; + } + /// useBitFieldTypeAlignment() - Check whether the alignment of bit-field /// types is respected when laying out structures. bool useBitFieldTypeAlignment() const { diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index 2e4d34dff0ba..fe0ef3068167 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -105,6 +105,7 @@ TOK(eod) // End of preprocessing directive (end of line inside a // directive). TOK(code_completion) // Code completion marker TOK(cxx_defaultarg_end) // C++ default argument end marker +TOK(cxx_exceptspec_end) // C++ exception-specification end marker // C99 6.4.9: Comments. TOK(comment) // Comment (only in -E -C[C] mode) |