aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorAbramo Bagnara <abramo.bagnara@gmail.com>2012-01-07 10:52:36 +0000
committerAbramo Bagnara <abramo.bagnara@gmail.com>2012-01-07 10:52:36 +0000
commit06284c1dc56caed19850bc3766c89f51763724c3 (patch)
tree7d4093a14eb74237d367012fb7c3b1368eec5f3e /lib/CodeGen/CodeGenFunction.cpp
parentf5c9f9fd6f5e2850b9b0f19283430245b696c6e5 (diff)
Fixed TypeofExpr AST and code generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 62d18ea8ee..cde2de9819 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -929,19 +929,33 @@ void CodeGenFunction::EmitVariablyModifiedType(QualType type) {
// We're going to walk down into the type and look for VLA
// expressions.
- type = type.getCanonicalType();
do {
assert(type->isVariablyModifiedType());
const Type *ty = type.getTypePtr();
switch (ty->getTypeClass()) {
+
+ default:
+ // Only sugared types (different from typeof_expr) can reach this point.
+ assert(!type.isCanonical() && "unhandled canonical type!");
+ type = type.getSingleStepDesugaredType(getContext());
+ break;
+
+ case Type::TypeOfExpr: {
+ // This is the only sugared type requiring special treatment.
+ // Emit typeof expression and we are done.
+ Expr *E = cast<TypeOfExprType>(ty)->getUnderlyingExpr();
+ EmitIgnoredExpr(E);
+ return;
+ }
+
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
-#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
+#define NON_CANONICAL_TYPE(Class, Base)
#define DEPENDENT_TYPE(Class, Base) case Type::Class:
-#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
+#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base)
#include "clang/AST/TypeNodes.def"
- llvm_unreachable("unexpected dependent or non-canonical type!");
+ llvm_unreachable("unexpected dependent type!");
// These types are never variably-modified.
case Type::Builtin:
@@ -999,7 +1013,7 @@ void CodeGenFunction::EmitVariablyModifiedType(QualType type) {
break;
}
- case Type::FunctionProto:
+ case Type::FunctionProto:
case Type::FunctionNoProto:
type = cast<FunctionType>(ty)->getResultType();
break;