diff options
author | Alp Toker <alp@nuanti.com> | 2013-12-13 20:49:58 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2013-12-13 20:49:58 +0000 |
commit | cbb9034e2a04f116bfd8cd62f69ef717afa10933 (patch) | |
tree | 64b8bbe479d4621042e921d9db0327e085cc6b7b /clang/lib/Parse/ParseExprCXX.cpp | |
parent | f6d58ff5c46cdaeda4a43039eeacdcfa94bb8f51 (diff) | |
download | bcm5719-llvm-cbb9034e2a04f116bfd8cd62f69ef717afa10933.tar.gz bcm5719-llvm-cbb9034e2a04f116bfd8cd62f69ef717afa10933.zip |
Eliminate BinaryTypeTraitExpr
There's nothing special about type traits accepting two arguments.
This commit eliminates BinaryTypeTraitExpr and switches all related handling
over to TypeTraitExpr.
Also fixes a CodeGen failure with variadic type traits appearing in a
non-constant expression.
The BTT/TT prefix and evaluation code is retained as-is for now but will soon
be further cleaned up.
This is part of the ongoing work to unify type traits.
llvm-svn: 197273
Diffstat (limited to 'clang/lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExprCXX.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index 846995e0ceb..9c2cfcc490e 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -2693,18 +2693,12 @@ static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) { } } -static BinaryTypeTrait BinaryTypeTraitFromTokKind(tok::TokenKind kind) { - switch(kind) { - default: llvm_unreachable("Not a known binary type trait"); -#define TYPE_TRAIT_2(Spelling, Name, Key) \ - case tok::kw_ ## Spelling: return BTT_ ## Name; -#include "clang/Basic/TokenKinds.def" - } -} - static TypeTrait TypeTraitFromTokKind(tok::TokenKind kind) { switch (kind) { default: llvm_unreachable("Not a known type trait"); +#define TYPE_TRAIT_2(Spelling, Name, Key) \ +case tok::kw_ ## Spelling: return BTT_ ## Name; +#include "clang/Basic/TokenKinds.def" #define TYPE_TRAIT_N(Spelling, Name, Key) \ case tok::kw_ ## Spelling: return TT_ ## Name; #include "clang/Basic/TokenKinds.def" @@ -2805,15 +2799,9 @@ ExprResult Parser::ParseTypeTrait() { if (Arity == 1) return Actions.ActOnUnaryTypeTrait(UnaryTypeTraitFromTokKind(Kind), Loc, Args[0], EndLoc); - if (Arity == 2) - return Actions.ActOnBinaryTypeTrait(BinaryTypeTraitFromTokKind(Kind), Loc, - Args[0], Args[1], EndLoc); - if (!Arity) - return Actions.ActOnTypeTrait(TypeTraitFromTokKind(Kind), Loc, Args, - EndLoc); - - llvm_unreachable("unhandled type trait rank"); - return ExprError(); + + return Actions.ActOnTypeTrait(TypeTraitFromTokKind(Kind), Arity, Loc, Args, + EndLoc); } /// ParseArrayTypeTrait - Parse the built-in array type-trait |