class GeneratePCHAction

Declaration

class GeneratePCHAction : public ASTFrontendAction { /* full declaration omitted */ };

Description

Abstract base class to use for AST consumer-based frontend actions.

Declared at: clang/include/clang/Frontend/FrontendActions.h:86

Inherits from: ASTFrontendAction

Member Variables

Method Overview

Inherited from ASTFrontendAction:

Inherited from FrontendAction:

Methods

bool BeginSourceFileAction(
    clang::CompilerInstance& CI)

Description

Callback at the start of processing a single input.

Declared at: clang/include/clang/Frontend/FrontendActions.h:113

Parameters

clang::CompilerInstance& CI

Returns

True on success; on failure ExecutionAction() and EndSourceFileAction() will not be called.

static bool ComputeASTConsumerArguments(
    clang::CompilerInstance& CI,
    std::string& Sysroot)

Description

Compute the AST consumer arguments that will be used to create the PCHGenerator instance returned by CreateASTConsumer.

Declared at: clang/include/clang/Frontend/FrontendActions.h:104

Parameters

clang::CompilerInstance& CI
std::string& Sysroot

Returns

false if an error occurred, true otherwise.

std::unique_ptr<ASTConsumer> CreateASTConsumer(
    clang::CompilerInstance& CI,
    llvm::StringRef InFile)

Description

Create the AST consumer object for this action, if supported. This routine is called as part of BeginSourceFile(), which will fail if the AST consumer cannot be created. This will not be called if the action has indicated that it only uses the preprocessor.

Declared at: clang/include/clang/Frontend/FrontendActions.h:88

Parameters

clang::CompilerInstance& CI
- The current compiler instance, provided as a convenience, see getCompilerInstance().
llvm::StringRef InFile
- The current input file, provided as a convenience, see getCurrentFile().

Returns

The new AST consumer, or null on failure.

static std::unique_ptr<llvm::raw_pwrite_stream>
CreateOutputFile(clang::CompilerInstance& CI,
                 llvm::StringRef InFile,
                 std::string& OutputFile)

Description

Creates file to write the PCH into and returns a stream to write it into. On error, returns null.

Declared at: clang/include/clang/Frontend/FrontendActions.h:110

Parameters

clang::CompilerInstance& CI
llvm::StringRef InFile
std::string& OutputFile

clang::TranslationUnitKind
getTranslationUnitKind()

Description

For AST-based actions, the kind of translation unit we're handling.

Declared at: clang/include/clang/Frontend/FrontendActions.h:91

bool hasASTFileSupport() const

Description

Does this action support use with AST files?

Declared at: clang/include/clang/Frontend/FrontendActions.h:95

bool shouldEraseOutputFiles()

Description

Callback at the end of processing a single input, to determine if the output files should be erased or not. By default it returns true if a compiler error occurred. This is guaranteed to only be called following a successful call to BeginSourceFileAction (and BeginSourceFile).

Declared at: clang/include/clang/Frontend/FrontendActions.h:97