From: Sebastian Redl Date: Mon, 19 Jul 2010 22:38:35 +0000 (+0000) Subject: Remove PCHReader::getStream(), it was unused. Inline PCHReader::getDelsCursor() into... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f82c5855eb93bc8467cefdb87a39167f4f53575;p=clang Remove PCHReader::getStream(), it was unused. Inline PCHReader::getDelsCursor() into its sole caller and remove it. This reduces the attack surface of multiple PCH files towards code outside the PCH implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108763 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Frontend/PCHReader.h b/include/clang/Frontend/PCHReader.h index 9002c169b5..79682edbf2 100644 --- a/include/clang/Frontend/PCHReader.h +++ b/include/clang/Frontend/PCHReader.h @@ -64,6 +64,7 @@ class Preprocessor; class Sema; class SwitchCase; class PCHReader; +class PCHDeclReader; struct HeaderFileInfo; struct PCHPredefinesBlock { @@ -169,6 +170,7 @@ class PCHReader public: enum PCHReadResult { Success, Failure, IgnorePCH }; friend class PCHValidator; + friend class PCHDeclReader; private: /// \brief The receiver of some callbacks invoked by PCHReader. llvm::OwningPtr Listener; @@ -866,10 +868,6 @@ public: /// imported. Sema *getSema() { return SemaObj; } - /// \brief Retrieve the stream that this PCH reader is reading from. - llvm::BitstreamCursor &getStream() { return Chain[0]->Stream; } - llvm::BitstreamCursor &getDeclsCursor() { return Chain[0]->DeclsCursor; } - /// \brief Retrieve the identifier table associated with the /// preprocessor. IdentifierTable &getIdentifierTable(); diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp index e494f7c934..0231fa66a9 100644 --- a/lib/Frontend/PCHReaderDecl.cpp +++ b/lib/Frontend/PCHReaderDecl.cpp @@ -117,7 +117,7 @@ void PCHDeclReader::Visit(Decl *D) { } else if (FunctionDecl *FD = dyn_cast(D)) { // FunctionDecl's body was written last after all other Stmts/Exprs. if (Record[Idx++]) - FD->setLazyBody(Reader.getDeclsCursor().GetCurrentBitNo()); + FD->setLazyBody(Reader.Chain[0]->DeclsCursor.GetCurrentBitNo()); } }