[cfe-commits] r44592 - in /cfe/trunk/Driver: ASTConsumers.h SerializationTest.cpp clang.cpp
Ted Kremenek
kremenek at apple.com
Tue Dec 4 16:26:13 PST 2007
Author: kremenek
Date: Tue Dec 4 18:26:13 2007
New Revision: 44592
URL: http://llvm.org/viewvc/llvm-project?rev=44592&view=rev
Log:
Added serialization support of SourceManager to the clang driver.
Modified:
cfe/trunk/Driver/ASTConsumers.h
cfe/trunk/Driver/SerializationTest.cpp
cfe/trunk/Driver/clang.cpp
Modified: cfe/trunk/Driver/ASTConsumers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.h?rev=44592&r1=44591&r2=44592&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTConsumers.h (original)
+++ cfe/trunk/Driver/ASTConsumers.h Tue Dec 4 18:26:13 2007
@@ -20,6 +20,7 @@
class ASTConsumer;
class Diagnostic;
+class FileManager;
struct LangOptions;
ASTConsumer *CreateASTPrinter(std::ostream* OS = NULL);
@@ -31,7 +32,7 @@
ASTConsumer *CreateUnitValsChecker(Diagnostic &Diags);
ASTConsumer *CreateLLVMEmitter(Diagnostic &Diags, const LangOptions &Features);
ASTConsumer *CreateCodeRewriterTest(Diagnostic &Diags);
-ASTConsumer *CreateSerializationTest(Diagnostic &Diags);
+ASTConsumer *CreateSerializationTest(Diagnostic &Diags, FileManager& FMgr);
} // end clang namespace
Modified: cfe/trunk/Driver/SerializationTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/SerializationTest.cpp?rev=44592&r1=44591&r2=44592&view=diff
==============================================================================
--- cfe/trunk/Driver/SerializationTest.cpp (original)
+++ cfe/trunk/Driver/SerializationTest.cpp Tue Dec 4 18:26:13 2007
@@ -16,6 +16,7 @@
#include "ASTConsumers.h"
#include "clang/Basic/TargetInfo.h"
+#include "clang/Basic/SourceManager.h"
#include "clang/AST/AST.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
@@ -54,6 +55,7 @@
class SerializationTest : public ASTConsumer {
ASTContext* Context;
Diagnostic &Diags;
+ FileManager &FMgr;
std::list<Decl*> Decls;
enum { BasicMetadataBlock = 1,
@@ -61,7 +63,9 @@
DeclsBlock = 3 };
public:
- SerializationTest(Diagnostic &d) : Context(NULL), Diags(d) {};
+ SerializationTest(Diagnostic &d, FileManager& fmgr)
+ : Context(NULL), Diags(d), FMgr(fmgr) {};
+
~SerializationTest();
virtual void Initialize(ASTContext& context, unsigned) {
@@ -79,8 +83,9 @@
} // end anonymous namespace
-ASTConsumer* clang::CreateSerializationTest(Diagnostic &Diags) {
- return new SerializationTest(Diags);
+ASTConsumer*
+clang::CreateSerializationTest(Diagnostic &Diags, FileManager& FMgr) {
+ return new SerializationTest(Diags,FMgr);
}
static void WritePreamble(llvm::BitstreamWriter& Stream) {
@@ -171,8 +176,8 @@
Sezr.EnterBlock();
// "Fake" emit the SourceManager.
- llvm::cerr << "Faux-serializing: SourceManager.\n";
- Sezr.EmitPtr(&Context->SourceMgr);
+ llvm::cerr << "Serializing: SourceManager.\n";
+ Sezr.Emit(Context->SourceMgr);
// Emit the Target.
llvm::cerr << "Serializing: Target.\n";
@@ -256,9 +261,9 @@
FoundBlock = Dezr.SkipToBlock(BasicMetadataBlock);
assert (FoundBlock);
- // "Fake" read the SourceManager.
- llvm::cerr << "Faux-Deserializing: SourceManager.\n";
- Dezr.RegisterPtr(&Context->SourceMgr);
+ // Read the SourceManager.
+ llvm::cerr << "Deserializing: SourceManager.\n";
+ SourceManager::CreateAndRegister(Dezr,FMgr);
{ // Read the TargetInfo.
llvm::cerr << "Deserializing: Target.\n";
Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=44592&r1=44591&r2=44592&view=diff
==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Tue Dec 4 18:26:13 2007
@@ -905,7 +905,8 @@
break;
case TestSerialization:
- Consumer = CreateSerializationTest(PP.getDiagnostics());
+ Consumer = CreateSerializationTest(PP.getDiagnostics(),
+ HeaderInfo.getFileMgr());
break;
case EmitLLVM:
More information about the cfe-commits
mailing list