diff options
author | Kaelyn Uhrain <rikka@google.com> | 2012-06-15 23:45:51 +0000 |
---|---|---|
committer | Kaelyn Uhrain <rikka@google.com> | 2012-06-15 23:45:51 +0000 |
commit | 7bf33401acf506b0039222834d7259acb80f6311 (patch) | |
tree | d9c1c70595cf34471f773c25c60ba1b77081cf80 /lib/Sema/SemaDecl.cpp | |
parent | 0cdd1fe3ec29b5cbff9a728966ace5c5b5d614f7 (diff) |
Move isCXXSimpleTypeSpecifier from Parser to Sema and tweak it for wider use.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 924b0f73d6..5221322a14 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -80,6 +80,42 @@ class TypeNameValidatorCCC : public CorrectionCandidateCallback { } +/// \brief Determine whether the token kind starts a simple-type-specifier. +bool Sema::isSimpleTypeSpecifier(tok::TokenKind Kind) const { + switch (Kind) { + // FIXME: Take into account the current language when deciding whether a + // token kind is a valid type specifier + case tok::kw_short: + case tok::kw_long: + case tok::kw___int64: + case tok::kw___int128: + case tok::kw_signed: + case tok::kw_unsigned: + case tok::kw_void: + case tok::kw_char: + case tok::kw_int: + case tok::kw_half: + case tok::kw_float: + case tok::kw_double: + case tok::kw_wchar_t: + case tok::kw_bool: + case tok::kw___underlying_type: + return true; + + case tok::annot_typename: + case tok::kw_char16_t: + case tok::kw_char32_t: + case tok::kw_typeof: + case tok::kw_decltype: + return getLangOpts().CPlusPlus; + + default: + break; + } + + return false; +} + /// \brief If the identifier refers to a type name within this scope, /// return the declaration of that type. /// |