diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-09-09 16:14:44 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-09-09 16:14:44 +0000 |
| commit | 54e5b13a2717293ddd7743ae3183e29d6ec3c9d4 (patch) | |
| tree | e9e29bdd4a2888a158ba520f8bea02470e45335f /clang/lib/Sema/SemaExprCXX.cpp | |
| parent | db0ddaa50bb3e7eba4b247c50b1e705f75e4c7c3 (diff) | |
| download | bcm5719-llvm-54e5b13a2717293ddd7743ae3183e29d6ec3c9d4.tar.gz bcm5719-llvm-54e5b13a2717293ddd7743ae3183e29d6ec3c9d4.zip | |
Add proper type-source information to UnaryTypeTraitExpr, including
libclang visitation.
llvm-svn: 113492
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 79b800bc0fe..b660c311d8f 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1982,12 +1982,23 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, } ExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT, - SourceLocation KWLoc, - SourceLocation LParen, - ParsedType Ty, - SourceLocation RParen) { - QualType T = GetTypeFromParser(Ty); + SourceLocation KWLoc, + ParsedType Ty, + SourceLocation RParen) { + TypeSourceInfo *TSInfo; + QualType T = GetTypeFromParser(Ty, &TSInfo); + + if (!TSInfo) + TSInfo = Context.getTrivialTypeSourceInfo(T); + return BuildUnaryTypeTrait(OTT, KWLoc, TSInfo, RParen); +} +ExprResult Sema::BuildUnaryTypeTrait(UnaryTypeTrait OTT, + SourceLocation KWLoc, + TypeSourceInfo *TSInfo, + SourceLocation RParen) { + QualType T = TSInfo->getType(); + // According to http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html // all traits except __is_class, __is_enum and __is_union require a the type // to be complete, an array of unknown bound, or void. @@ -2004,7 +2015,7 @@ ExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT, // There is no point in eagerly computing the value. The traits are designed // to be used from type trait templates, so Ty will be a template parameter // 99% of the time. - return Owned(new (Context) UnaryTypeTraitExpr(KWLoc, OTT, T, + return Owned(new (Context) UnaryTypeTraitExpr(KWLoc, OTT, TSInfo, RParen, Context.BoolTy)); } |

