aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-09 16:14:44 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-09 16:14:44 +0000
commit3d37c0ada0e46b87be0a10e8d52d990a97d3907a (patch)
tree2459ac7c67d04bbceb55065dc9bf40dd479a3bfb /lib/Sema/SemaExprCXX.cpp
parentec9bf475657e4fd7c8e920ff816a4e3cdb2ea213 (diff)
Add proper type-source information to UnaryTypeTraitExpr, including
libclang visitation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113492 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r--lib/Sema/SemaExprCXX.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 79b800bc0f..b660c311d8 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/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));
}