Revert my previous, failed attempt to pretty-print anonymous struct/union accesses well. Added a FIXME so we know to revisit this later
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61951 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 7456e8c..14d30d8 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -757,10 +757,11 @@
OS << ")";
}
void StmtPrinter::VisitMemberExpr(MemberExpr *Node) {
- if (!Node->getBase()->isImplicit()) {
- PrintExpr(Node->getBase());
- OS << (Node->isArrow() ? "->" : ".");
- }
+ // FIXME: Suppress printing implicit bases (like "this")
+ PrintExpr(Node->getBase());
+ OS << (Node->isArrow() ? "->" : ".");
+ // FIXME: Suppress printing references to unnamed objects
+ // representing anonymous unions/structs
OS << Node->getMemberDecl()->getNameAsString();
}
void StmtPrinter::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 6db6ea1..bf04042 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -444,7 +444,6 @@
BaseObjectExpr = new DeclRefExpr(BaseObject, BaseObject->getType(),
SourceLocation());
- BaseObjectExpr->setImplicit();
ExtraQuals
= Context.getCanonicalType(BaseObject->getType()).getCVRQualifiers();
} else if (BaseObjectExpr) {
@@ -474,7 +473,6 @@
BaseObjectExpr = new CXXThisExpr(SourceLocation(),
MD->getThisType(Context));
BaseObjectIsPointer = true;
- BaseObjectExpr->setImplicit();
}
} else {
return Diag(Loc, diag::err_invalid_member_use_in_static_method)
@@ -502,7 +500,6 @@
}
Result = new MemberExpr(Result, BaseObjectIsPointer, *FI,
OpLoc, MemberType);
- Result->setImplicit();
BaseObjectIsPointer = false;
ExtraQuals = Context.getCanonicalType(MemberType).getCVRQualifiers();
OpLoc = SourceLocation();
@@ -664,7 +661,6 @@
// Build the implicit member access expression.
Expr *This = new CXXThisExpr(SourceLocation(),
MD->getThisType(Context));
- This->setImplicit();
return new MemberExpr(This, true, cast<NamedDecl>(D),
SourceLocation(), MemberType);
}
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 6a9275f..031fe27 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -90,7 +90,6 @@
&InitExprs[0], InitExprs.size(),
SourceLocation(),
ParentIList->hadDesignators());
- ILE->setImplicit();
ILE->setType(T);
// Modify the parent InitListExpr to point to the implicit InitListExpr.