[cfe-commits] r164781 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/AST/Type.h lib/AST/TypePrinter.cpp

Benjamin Kramer benny.kra at googlemail.com
Thu Sep 27 10:37:30 PDT 2012


Author: d0k
Date: Thu Sep 27 12:37:30 2012
New Revision: 164781

URL: http://llvm.org/viewvc/llvm-project?rev=164781&view=rev
Log:
Pass PrintingPolicy by reference, copying it isn't cheap.

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h
    cfe/trunk/include/clang/AST/Type.h
    cfe/trunk/lib/AST/TypePrinter.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=164781&r1=164780&r2=164781&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Thu Sep 27 12:37:30 2012
@@ -393,9 +393,11 @@
   OwningPtr<ExternalASTSource> ExternalSource;
   ASTMutationListener *Listener;
 
-  clang::PrintingPolicy getPrintingPolicy() const { return PrintingPolicy; }
+  const clang::PrintingPolicy &getPrintingPolicy() const {
+    return PrintingPolicy;
+  }
 
-  void setPrintingPolicy(clang::PrintingPolicy Policy) {
+  void setPrintingPolicy(const clang::PrintingPolicy &Policy) {
     PrintingPolicy = Policy;
   }
   

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=164781&r1=164780&r2=164781&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Thu Sep 27 12:37:30 2012
@@ -3033,9 +3033,9 @@
 
   // FIXME: Remove the string version.
   void printExceptionSpecification(std::string &S, 
-                                   PrintingPolicy Policy) const;
+                                   const PrintingPolicy &Policy) const;
   void printExceptionSpecification(raw_ostream &OS, 
-                                   PrintingPolicy Policy) const;
+                                   const PrintingPolicy &Policy) const;
 
   static bool classof(const Type *T) {
     return T->getTypeClass() == FunctionProto;

Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=164781&r1=164780&r2=164781&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Thu Sep 27 12:37:30 2012
@@ -556,7 +556,8 @@
 
 void 
 FunctionProtoType::printExceptionSpecification(raw_ostream &OS, 
-                                               PrintingPolicy Policy) const {
+                                               const PrintingPolicy &Policy)
+                                                                         const {
   
   if (hasDynamicExceptionSpec()) {
     OS << " throw(";
@@ -1343,7 +1344,8 @@
 
 void 
 FunctionProtoType::printExceptionSpecification(std::string &S, 
-                                               PrintingPolicy Policy) const {
+                                               const PrintingPolicy &Policy)
+                                                                         const {
   
   if (hasDynamicExceptionSpec()) {
     S += " throw(";





More information about the cfe-commits mailing list