r220450 - Update the documentation for API change to CreateASTConsumer the rest of the way.

Nick Lewycky nicholas at mxc.ca
Wed Oct 22 16:57:14 PDT 2014


Author: nicholas
Date: Wed Oct 22 18:57:14 2014
New Revision: 220450

URL: http://llvm.org/viewvc/llvm-project?rev=220450&view=rev
Log:
Update the documentation for API change to CreateASTConsumer the rest of the way.

Modified:
    cfe/trunk/docs/RAVFrontendAction.rst

Modified: cfe/trunk/docs/RAVFrontendAction.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/RAVFrontendAction.rst?rev=220450&r1=220449&r2=220450&view=diff
==============================================================================
--- cfe/trunk/docs/RAVFrontendAction.rst (original)
+++ cfe/trunk/docs/RAVFrontendAction.rst Wed Oct 22 18:57:14 2014
@@ -27,7 +27,8 @@ unit.
       public:
         virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
           clang::CompilerInstance &Compiler, llvm::StringRef InFile) {
-          return new FindNamedClassConsumer;
+          return std::unique_ptr<clang::ASTConsumer>(
+              new FindNamedClassConsumer);
         }
       };
 
@@ -111,9 +112,10 @@ freshly created FindNamedClassConsumer:
 
 ::
 
-      virtual clang::ASTConsumer *CreateASTConsumer(
+      virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
         clang::CompilerInstance &Compiler, llvm::StringRef InFile) {
-        return new FindNamedClassConsumer(&Compiler.getASTContext());
+        return std::unique_ptr<clang::ASTConsumer>(
+            new FindNamedClassConsumer(&Compiler.getASTContext()));
       }
 
 Now that the ASTContext is available in the RecursiveASTVisitor, we can
@@ -185,9 +187,10 @@ Now we can combine all of the above into
 
       class FindNamedClassAction : public clang::ASTFrontendAction {
       public:
-        virtual clang::ASTConsumer *CreateASTConsumer(
+        virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
           clang::CompilerInstance &Compiler, llvm::StringRef InFile) {
-          return new FindNamedClassConsumer(&Compiler.getASTContext());
+          return std::unique_ptr<clang::ASTConsumer>(
+              new FindNamedClassConsumer(&Compiler.getASTContext()));
         }
       };
 





More information about the cfe-commits mailing list