[cfe-commits] r108763 - in /cfe/trunk: include/clang/Frontend/PCHReader.h lib/Frontend/PCHReaderDecl.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Mon Jul 19 15:38:35 PDT 2010


Author: cornedbee
Date: Mon Jul 19 17:38:35 2010
New Revision: 108763

URL: http://llvm.org/viewvc/llvm-project?rev=108763&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/Frontend/PCHReader.h
    cfe/trunk/lib/Frontend/PCHReaderDecl.cpp

Modified: cfe/trunk/include/clang/Frontend/PCHReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PCHReader.h?rev=108763&r1=108762&r2=108763&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/PCHReader.h (original)
+++ cfe/trunk/include/clang/Frontend/PCHReader.h Mon Jul 19 17:38:35 2010
@@ -64,6 +64,7 @@
 class Sema;
 class SwitchCase;
 class PCHReader;
+class PCHDeclReader;
 struct HeaderFileInfo;
 
 struct PCHPredefinesBlock {
@@ -169,6 +170,7 @@
 public:
   enum PCHReadResult { Success, Failure, IgnorePCH };
   friend class PCHValidator;
+  friend class PCHDeclReader;
 private:
   /// \brief The receiver of some callbacks invoked by PCHReader.
   llvm::OwningPtr<PCHReaderListener> Listener;
@@ -866,10 +868,6 @@
   /// 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();

Modified: cfe/trunk/lib/Frontend/PCHReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReaderDecl.cpp?rev=108763&r1=108762&r2=108763&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReaderDecl.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReaderDecl.cpp Mon Jul 19 17:38:35 2010
@@ -117,7 +117,7 @@
   } else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(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());
   }
 }
 





More information about the cfe-commits mailing list