aboutsummaryrefslogtreecommitdiff
path: root/docs/RAVFrontendAction.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/RAVFrontendAction.rst')
-rw-r--r--docs/RAVFrontendAction.rst15
1 files changed, 9 insertions, 6 deletions
diff --git a/docs/RAVFrontendAction.rst b/docs/RAVFrontendAction.rst
index 2f60ce9e82..ec5d5d54ff 100644
--- a/docs/RAVFrontendAction.rst
+++ b/docs/RAVFrontendAction.rst
@@ -25,9 +25,10 @@ unit.
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;
+ 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 a small example program:
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()));
}
};