Add parsing and AST support for GNU "typeof".
Many small changes to lot's of files.
Still some FIXME's, however the basic support is in place.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40631 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 233c0bb..a14482b 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -1147,7 +1147,7 @@
result = CheckSingleAssignmentConstraints(lhsType, rex);
else
result = CheckCompoundAssignmentConstraints(lhsType, rhsType);
-
+
// decode the result (notice that extensions still return a type).
switch (result) {
case Compatible:
diff --git a/Sema/SemaType.cpp b/Sema/SemaType.cpp
index cf72e38..d700023 100644
--- a/Sema/SemaType.cpp
+++ b/Sema/SemaType.cpp
@@ -95,6 +95,18 @@
// TypeQuals handled by caller.
return Ctx.getTypedefType(cast<TypedefDecl>(D));
}
+ case DeclSpec::TST_typeofType: {
+ QualType T = QualType::getFromOpaquePtr(DS.getTypeRep());
+ assert(!T.isNull() && "Didn't get a type for typeof?");
+ // TypeQuals handled by caller.
+ return Ctx.getTypeOfType(T);
+ }
+ case DeclSpec::TST_typeofExpr: {
+ Expr *E = static_cast<Expr *>(DS.getTypeRep());
+ assert(E && "Didn't get an expression for typeof?");
+ // TypeQuals handled by caller.
+ return Ctx.getTypeOfType(E);
+ }
}
}