[cfe-commits] r44438 - /cfe/trunk/Driver/SerializationTest.cpp
Ted Kremenek
kremenek at apple.com
Thu Nov 29 11:04:55 PST 2007
Author: kremenek
Date: Thu Nov 29 13:04:54 2007
New Revision: 44438
URL: http://llvm.org/viewvc/llvm-project?rev=44438&view=rev
Log:
Only serialize top-level decls that appear at the head of a decl chain.
Modified:
cfe/trunk/Driver/SerializationTest.cpp
Modified: cfe/trunk/Driver/SerializationTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/SerializationTest.cpp?rev=44438&r1=44437&r2=44438&view=diff
==============================================================================
--- cfe/trunk/Driver/SerializationTest.cpp (original)
+++ cfe/trunk/Driver/SerializationTest.cpp Thu Nov 29 13:04:54 2007
@@ -128,18 +128,23 @@
for (std::list<Decl*>::iterator I=Decls.begin(), E=Decls.end(); I!=E; ++I) {
llvm::cerr << "Serializing: Decl.\n";
- Printer->HandleTopLevelDecl(*I);
- FilePrinter->HandleTopLevelDecl(*I);
-
- if (FunctionDecl* FD = dyn_cast<FunctionDecl>(*I))
- if (FD->getBody()) {
- // Construct and print a CFG.
- Janitor<CFG> cfg(CFG::buildCFG(FD->getBody()));
- cfg->print(DeclPP);
- }
-
- // Serialize the decl.
- Sezr.EmitOwnedPtr(*I);
+ // Only serialize the head of a decl chain. The ASTConsumer interfaces
+ // provides us with each top-level decl, including those nested in
+ // a decl chain, so we may be passed decls that are already serialized.
+ if (!Sezr.isRegistered(*I)) {
+ Printer->HandleTopLevelDecl(*I);
+ FilePrinter->HandleTopLevelDecl(*I);
+
+ if (FunctionDecl* FD = dyn_cast<FunctionDecl>(*I))
+ if (FD->getBody()) {
+ // Construct and print a CFG.
+ Janitor<CFG> cfg(CFG::buildCFG(FD->getBody()));
+ cfg->print(DeclPP);
+ }
+
+ // Serialize the decl.
+ Sezr.EmitOwnedPtr(*I);
+ }
}
}
More information about the cfe-commits
mailing list