[cfe-commits] r44209 - in /cfe/trunk: AST/StmtDumper.cpp Sema/SemaDecl.cpp
Steve Naroff
snaroff at apple.com
Sat Nov 17 13:37:36 PST 2007
Author: snaroff
Date: Sat Nov 17 15:37:36 2007
New Revision: 44209
URL: http://llvm.org/viewvc/llvm-project?rev=44209&view=rev
Log:
Now that we are passing back "free standing decls", make sure -ast-dump works like -ast-print.
Also added a cast to be safe...
Modified:
cfe/trunk/AST/StmtDumper.cpp
cfe/trunk/Sema/SemaDecl.cpp
Modified: cfe/trunk/AST/StmtDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtDumper.cpp?rev=44209&r1=44208&r2=44209&view=diff
==============================================================================
--- cfe/trunk/AST/StmtDumper.cpp (original)
+++ cfe/trunk/AST/StmtDumper.cpp Sat Nov 17 15:37:36 2007
@@ -219,8 +219,16 @@
}
}
fprintf(F, "\"");
+ } else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
+ // print a free standing tag decl (e.g. "struct x;").
+ const char *tagname;
+ if (const IdentifierInfo *II = TD->getIdentifier())
+ tagname = II->getName();
+ else
+ tagname = "<anonymous>";
+ fprintf(F, "\"%s %s;\"", TD->getKindName(), tagname);
+ // FIXME: print tag bodies.
} else {
- // FIXME: "struct x;"
assert(0 && "Unexpected decl");
}
}
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=44209&r1=44208&r2=44209&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Sat Nov 17 15:37:36 2007
@@ -347,7 +347,7 @@
// TODO: emit error on 'typedef int;'
// if (!DS.isMissingDeclaratorOk()) Diag(...);
- return DS.getTypeRep();
+ return dyn_cast_or_null<TagDecl>(static_cast<Decl *>(DS.getTypeRep()));
}
bool Sema::CheckSingleInitializer(Expr *&Init, bool isStatic,
More information about the cfe-commits
mailing list