diff options
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 6 | ||||
-rw-r--r-- | include/clang/Basic/IdentifierTable.h | 27 |
2 files changed, 33 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index ad996b7eeb..a040d3532a 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -226,6 +226,8 @@ def err_template_spec_syntax_non_template : Error< "template|<unused>|refers to a template template parameter}1">; def err_id_after_template_in_nested_name_spec : Error< "expected template name after 'template' keyword in nested name specifier">; +def err_id_after_template_in_typename_spec : Error< + "expected template name after 'template' keyword in typename specifier">; def err_less_after_template_name_in_nested_name_spec : Error< "expected '<' after 'template %0' in nested name specifier">; def err_two_right_angle_brackets_need_space : Error< @@ -236,6 +238,10 @@ def warn_cxx0x_right_shift_in_template_arg : Warning< def err_expected_qualified_after_typename : Error< "expected a qualified name after 'typename'">; +def err_typename_refers_to_non_type_template : Error< + "typename specifier refers to a non-template">; +def err_expected_type_name_after_typename : Error< + "expected an identifier or template-id after '::'">; // Language specific pragmas // - Generic warnings diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 02296c0e29..cb55d257a1 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -21,6 +21,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/Bitcode/SerializationFwd.h" +#include "llvm/Support/PointerLikeTypeTraits.h" #include <string> #include <cassert> @@ -512,5 +513,31 @@ struct DenseMapInfo<clang::Selector> { static bool isPod() { return true; } }; +// Provide PointerLikeTypeTraits for IdentifierInfo pointers, which +// are not guaranteed to be 8-byte aligned. +template<> +class PointerLikeTypeTraits<clang::IdentifierInfo*> { +public: + static inline void *getAsVoidPointer(clang::IdentifierInfo* P) { + return P; + } + static inline clang::IdentifierInfo *getFromVoidPointer(void *P) { + return static_cast<clang::IdentifierInfo*>(P); + } + enum { NumLowBitsAvailable = 1 }; +}; + +template<> +class PointerLikeTypeTraits<const clang::IdentifierInfo*> { +public: + static inline const void *getAsVoidPointer(const clang::IdentifierInfo* P) { + return P; + } + static inline const clang::IdentifierInfo *getFromVoidPointer(const void *P) { + return static_cast<const clang::IdentifierInfo*>(P); + } + enum { NumLowBitsAvailable = 1 }; +}; + } // end namespace llvm #endif |