aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-09-05 06:31:47 +0000
committerJohn McCall <rjmccall@apple.com>2009-09-05 06:31:47 +0000
commit2191b20bfb31fc0e22a158f6b4204cd0b7dbd0fd (patch)
treef83185278453f6702e0ebee829f34e2cd58b6a4f /lib/Sema
parenta2f4ec0df645fc249d2945beef9653f03b175417 (diff)
Start emitting ElaboratedTypes in C++ mode. Support the effort in various
ways: remove elab types during desugaring, enhance pretty-printing to allow tags to be suppressed without suppressing scopes, look through elab types when associating a typedef name with an anonymous record type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81065 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/Sema.cpp4
-rw-r--r--lib/Sema/SemaDecl.cpp2
-rw-r--r--lib/Sema/SemaType.cpp7
3 files changed, 12 insertions, 1 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 755cc22d52..b41902c15f 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -52,6 +52,10 @@ static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t Val,
// If the desugared type is a vector type, we don't want to expand it,
// it will turn into an attribute mess. People want their "vec4".
!isa<VectorType>(DesugaredTy) &&
+
+ // Don't aka just because we saw an elaborated type.
+ (!isa<ElaboratedType>(Ty) ||
+ cast<ElaboratedType>(Ty)->getUnderlyingType() != DesugaredTy) &&
// Don't desugar magic Objective-C types.
Ty.getUnqualifiedType() != Context.getObjCIdType() &&
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index e929b5f0d6..9809ea5501 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3893,7 +3893,7 @@ TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T) {
D.getIdentifier(),
T);
- if (TagType *TT = dyn_cast<TagType>(T)) {
+ if (const TagType *TT = T->getAs<TagType>()) {
TagDecl *TD = TT->getDecl();
// If the TagDecl that the TypedefDecl points to is an anonymous decl
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 80cdcd5464..b6db829de6 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -195,6 +195,13 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS,
"Can't handle qualifiers on typedef names yet!");
// TypeQuals handled by caller.
Result = Context.getTypeDeclType(cast<TypeDecl>(D));
+
+ // In C++, make an ElaboratedType.
+ if (getLangOptions().CPlusPlus) {
+ TagDecl::TagKind Tag
+ = TagDecl::getTagKindForTypeSpec(DS.getTypeSpecType());
+ Result = Context.getElaboratedType(Result, Tag);
+ }
if (D->isInvalidDecl())
isInvalid = true;