[cfe-commits] r67903 - in /cfe/trunk: include/clang/AST/TranslationUnit.h lib/AST/TranslationUnit.cpp tools/clang-cc/SerializationTest.cpp tools/clang-cc/clang.cpp
Chris Lattner
sabre at nondot.org
Fri Mar 27 20:49:26 PDT 2009
Author: lattner
Date: Fri Mar 27 22:49:26 2009
New Revision: 67903
URL: http://llvm.org/viewvc/llvm-project?rev=67903&view=rev
Log:
eliminate ReadASTBitcodeFile
Modified:
cfe/trunk/include/clang/AST/TranslationUnit.h
cfe/trunk/lib/AST/TranslationUnit.cpp
cfe/trunk/tools/clang-cc/SerializationTest.cpp
cfe/trunk/tools/clang-cc/clang.cpp
Modified: cfe/trunk/include/clang/AST/TranslationUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TranslationUnit.h?rev=67903&r1=67902&r2=67903&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TranslationUnit.h (original)
+++ cfe/trunk/include/clang/AST/TranslationUnit.h Fri Mar 27 22:49:26 2009
@@ -82,10 +82,6 @@
bool EmitASTBitcodeBuffer(const TranslationUnit* TU,
std::vector<unsigned char>& Buffer);
-/// ReadASTBitcodeFile - Reconsitute a translation unit from a bitcode file.
-TranslationUnit* ReadASTBitcodeFile(const llvm::sys::Path& Filename,
- FileManager& FMgr);
-
/// ReadASTBitcodeBuffer - Reconsitute a translation unit from a buffer.
TranslationUnit* ReadASTBitcodeBuffer(llvm::MemoryBuffer& MBuffer,
FileManager& FMgr);
Modified: cfe/trunk/lib/AST/TranslationUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TranslationUnit.cpp?rev=67903&r1=67902&r2=67903&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TranslationUnit.cpp (original)
+++ cfe/trunk/lib/AST/TranslationUnit.cpp Fri Mar 27 22:49:26 2009
@@ -144,28 +144,13 @@
return TranslationUnit::Create(Dezr,FMgr);
}
-TranslationUnit*
-clang::ReadASTBitcodeFile(const llvm::sys::Path& Filename, FileManager& FMgr) {
-
- // Create the memory buffer that contains the contents of the file.
- llvm::OwningPtr<llvm::MemoryBuffer>
- MBuffer(llvm::MemoryBuffer::getFile(Filename.c_str()));
-
- if (!MBuffer) {
- // FIXME: Provide diagnostic.
- return NULL;
- }
-
- return ReadASTBitcodeBuffer(*MBuffer, FMgr);
-}
-
TranslationUnit* TranslationUnit::Create(llvm::Deserializer& Dezr,
FileManager& FMgr) {
// Create the translation unit object.
TranslationUnit* TU = new TranslationUnit();
- TU->Context = ASTContext.CreateAll(Dezr, FmMgr);
+ TU->Context = ASTContext::CreateAll(Dezr, FMgr);
return TU;
}
Modified: cfe/trunk/tools/clang-cc/SerializationTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/SerializationTest.cpp?rev=67903&r1=67902&r2=67903&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/SerializationTest.cpp (original)
+++ cfe/trunk/tools/clang-cc/SerializationTest.cpp Fri Mar 27 22:49:26 2009
@@ -81,7 +81,18 @@
llvm::sys::Path& FNameDeclPrint) {
// Deserialize the translation unit.
- TranslationUnit* NewTU = ReadASTBitcodeFile(Filename, FMgr);
+ TranslationUnit* NewTU;
+
+ {
+ // Create the memory buffer that contains the contents of the file.
+ llvm::OwningPtr<llvm::MemoryBuffer>
+ MBuffer(llvm::MemoryBuffer::getFile(Filename.c_str()));
+
+ if (!MBuffer)
+ return false;
+
+ NewTU = ReadASTBitcodeBuffer(*MBuffer, FMgr);
+ }
if (!NewTU)
return false;
Modified: cfe/trunk/tools/clang-cc/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang.cpp?rev=67903&r1=67902&r2=67903&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang.cpp Fri Mar 27 22:49:26 2009
@@ -1535,7 +1535,14 @@
exit (1);
}
- llvm::OwningPtr<TranslationUnit> TU(ReadASTBitcodeFile(Filename, FileMgr));
+ llvm::OwningPtr<TranslationUnit> TU;
+
+ // Create the memory buffer that contains the contents of the file.
+ llvm::OwningPtr<llvm::MemoryBuffer>
+ MBuffer(llvm::MemoryBuffer::getFile(Filename.c_str()));
+
+ if (MBuffer)
+ TU.reset(ReadASTBitcodeBuffer(*MBuffer, FileMgr));
if (!TU) {
fprintf(stderr, "error: file '%s' could not be deserialized\n",
More information about the cfe-commits
mailing list