diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-12-20 19:47:16 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-12-20 19:47:16 +0000 |
commit | ee533641635fc3e10dd14072972b378be110b21d (patch) | |
tree | a4ace37577309505ad433183756cb399e4b39ab5 | |
parent | c395bda57a0b2f6d8433a462caa780a7dcb7307b (diff) |
Converted uses of scoped_ptr to OwningPtr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45265 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | AST/TranslationUnit.cpp | 4 | ||||
-rw-r--r-- | Driver/ASTConsumers.cpp | 16 | ||||
-rw-r--r-- | Driver/SerializationTest.cpp | 10 | ||||
-rw-r--r-- | Driver/clang.cpp | 6 | ||||
-rw-r--r-- | Lex/HeaderMap.cpp | 4 |
5 files changed, 21 insertions, 19 deletions
diff --git a/AST/TranslationUnit.cpp b/AST/TranslationUnit.cpp index 8c68e35dcd..777e6e98c9 100644 --- a/AST/TranslationUnit.cpp +++ b/AST/TranslationUnit.cpp @@ -20,7 +20,7 @@ #include "llvm/Bitcode/Deserialize.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/System/Path.h" -#include "llvm/ADT/scoped_ptr.h" +#include "llvm/ADT/OwningPtr.h" #include <stdio.h> @@ -125,7 +125,7 @@ TranslationUnit* clang::ReadASTBitcodeFile(const llvm::sys::Path& Filename, FileManager& FMgr) { // Create the memory buffer that contains the contents of the file. - llvm::scoped_ptr<llvm::MemoryBuffer> + llvm::OwningPtr<llvm::MemoryBuffer> MBuffer(llvm::MemoryBuffer::getFile(Filename.c_str(), strlen(Filename.c_str()))); diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp index edababa080..7a843210e5 100644 --- a/Driver/ASTConsumers.cpp +++ b/Driver/ASTConsumers.cpp @@ -663,23 +663,25 @@ public: // FIXME: This is not portable to Windows. // FIXME: This logic should probably be moved elsewhere later. - llvm::sys::Path ASTFile(EmitDir); + llvm::sys::Path FName(EmitDir); std::vector<char> buf; buf.reserve(strlen(FE->getName())+100); sprintf(&buf[0], "dev_%llx", (uint64_t) FE->getDevice()); - ASTFile.appendComponent(&buf[0]); - ASTFile.createDirectoryOnDisk(true); - if (!ASTFile.canWrite() || !ASTFile.isDirectory()) { + FName.appendComponent(&buf[0]); + FName.createDirectoryOnDisk(true); + if (!FName.canWrite() || !FName.isDirectory()) { assert (false && "Could not create 'device' serialization directory."); return; } - + sprintf(&buf[0], "%s-%llX.ast", FE->getName(), (uint64_t) FE->getInode()); - ASTFile.appendComponent(&buf[0]); + FName.appendComponent(&buf[0]); + EmitASTBitcodeFile(TU,FName); + + // Now emit the sources. - EmitASTBitcodeFile(TU,ASTFile); } }; diff --git a/Driver/SerializationTest.cpp b/Driver/SerializationTest.cpp index a668c7466b..06b6b1a824 100644 --- a/Driver/SerializationTest.cpp +++ b/Driver/SerializationTest.cpp @@ -20,7 +20,7 @@ #include "ASTConsumers.h" #include "clang/AST/TranslationUnit.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/ADT/scoped_ptr.h" +#include "llvm/ADT/OwningPtr.h" #include "llvm/Support/Streams.h" #include <fstream> @@ -71,7 +71,7 @@ bool SerializationTest::Serialize(llvm::sys::Path& Filename, // Pretty-print the decls to a temp file. std::ofstream DeclPP(FNameDeclPrint.c_str()); assert (DeclPP && "Could not open file for printing out decls."); - llvm::scoped_ptr<ASTConsumer> FilePrinter(CreateASTPrinter(&DeclPP)); + llvm::OwningPtr<ASTConsumer> FilePrinter(CreateASTPrinter(&DeclPP)); for (TranslationUnit::iterator I=TU.begin(), E=TU.end(); I!=E; ++I) FilePrinter->HandleTopLevelDecl(*I); @@ -94,7 +94,7 @@ bool SerializationTest::Deserialize(llvm::sys::Path& Filename, // Pretty-print the deserialized decls to a temp file. std::ofstream DeclPP(FNameDeclPrint.c_str()); assert (DeclPP && "Could not open file for printing out decls."); - llvm::scoped_ptr<ASTConsumer> FilePrinter(CreateASTPrinter(&DeclPP)); + llvm::OwningPtr<ASTConsumer> FilePrinter(CreateASTPrinter(&DeclPP)); for (TranslationUnit::iterator I=NewTU->begin(), E=NewTU->end(); I!=E; ++I) FilePrinter->HandleTopLevelDecl(*I); @@ -162,7 +162,7 @@ SerializationTest::~SerializationTest() { using llvm::MemoryBuffer; - llvm::scoped_ptr<MemoryBuffer> + llvm::OwningPtr<MemoryBuffer> MBufferSer(MemoryBuffer::getFile(FNameDeclBefore.c_str(), strlen(FNameDeclBefore.c_str()))); @@ -171,7 +171,7 @@ SerializationTest::~SerializationTest() { return; } - llvm::scoped_ptr<MemoryBuffer> + llvm::OwningPtr<MemoryBuffer> MBufferDSer(MemoryBuffer::getFile(FNameDeclAfter.c_str(), strlen(FNameDeclAfter.c_str()))); diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 4ac14adb9c..91bd117200 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -39,7 +39,7 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/System/Signals.h" #include "llvm/Config/config.h" -#include "llvm/ADT/scoped_ptr.h" +#include "llvm/ADT/OwningPtr.h" #include <memory> using namespace clang; @@ -1040,7 +1040,7 @@ static void ProcessSerializedFile(const std::string& InFile, Diagnostic& Diag, exit (1); } - llvm::scoped_ptr<TranslationUnit> TU(ReadASTBitcodeFile(Filename,FileMgr)); + llvm::OwningPtr<TranslationUnit> TU(ReadASTBitcodeFile(Filename,FileMgr)); if (!TU) { fprintf(stderr, "error: file '%s' could not be deserialized\n", @@ -1050,7 +1050,7 @@ static void ProcessSerializedFile(const std::string& InFile, Diagnostic& Diag, // Observe that we use the source file name stored in the deserialized // translation unit, rather than InFile. - llvm::scoped_ptr<ASTConsumer> + llvm::OwningPtr<ASTConsumer> Consumer(CreateASTConsumer(InFile, Diag, FileMgr, TU->getLangOpts())); if (!Consumer) { diff --git a/Lex/HeaderMap.cpp b/Lex/HeaderMap.cpp index 64a2c8e71b..4079c61544 100644 --- a/Lex/HeaderMap.cpp +++ b/Lex/HeaderMap.cpp @@ -13,7 +13,7 @@ #include "clang/Lex/HeaderMap.h" #include "clang/Basic/FileManager.h" -#include "llvm/ADT/scoped_ptr.h" +#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/MathExtras.h" @@ -78,7 +78,7 @@ const HeaderMap *HeaderMap::Create(const FileEntry *FE) { unsigned FileSize = FE->getSize(); if (FileSize <= sizeof(HMapHeader)) return 0; - llvm::scoped_ptr<const llvm::MemoryBuffer> FileBuffer( + llvm::OwningPtr<const llvm::MemoryBuffer> FileBuffer( llvm::MemoryBuffer::getFile(FE->getName(), strlen(FE->getName()), 0, FE->getSize())); if (FileBuffer == 0) return 0; // Unreadable file? |