clang: lib/Frontend/ASTMerge.cpp Source File (original) (raw)

1

2

3

4

5

6

7

16

17using namespace clang;

18

19std::unique_ptr

21 return AdaptedAction->CreateASTConsumer(CI, InFile);

22}

23

25

26

27

29 AdaptedAction->setCompilerInstance(&CI);

30 return AdaptedAction->BeginSourceFileAction(CI);

31}

32

41 auto SharedState = std::make_shared(

43 for (unsigned I = 0, N = ASTFiles.size(); I != N; ++I) {

48 true));

52

53 if (!Unit)

54 continue;

55

57 Unit->getASTContext(), Unit->getFileManager(),

58 false, SharedState);

59

61 for (auto *D : TU->decls()) {

62

63 if (const auto *ND = dyn_cast(D))

65 if (II->isStr("__va_list_tag") || II->isStr("__builtin_va_list"))

66 continue;

67

69

70 if (ToDOrError) {

73 } else {

74 llvm::consumeError(ToDOrError.takeError());

75 }

76 }

77 }

78

79 AdaptedAction->ExecuteAction();

81}

82

84 return AdaptedAction->EndSourceFileAction();

85}

86

89: AdaptedAction(std::move(adaptedAction)), ASTFiles(ASTFiles.begin(), ASTFiles.end()) {

90 assert(AdaptedAction && "ASTMergeAction needs an action to adapt");

91}

92

94}

95

97 return AdaptedAction->usesPreprocessorOnly();

98}

99

101 return AdaptedAction->getTranslationUnitKind();

102}

103

105 return AdaptedAction->hasPCHSupport();

106}

107

109 return AdaptedAction->hasASTFileSupport();

110}

111

113 return AdaptedAction->hasCodeCompletionSupport();

114}

Defines the clang::ASTContext interface.

Defines the Diagnostic-related interfaces.

virtual bool HandleTopLevelDecl(DeclGroupRef D)

HandleTopLevelDecl - Handle the specified top-level declaration.

TranslationUnitDecl * getTranslationUnitDecl() const

const LangOptions & getLangOpts() const

Imports selected nodes from one AST context into another context, merging AST nodes where appropriate...

llvm::Expected< ExprWithCleanups::CleanupObject > Import(ExprWithCleanups::CleanupObject From)

Import cleanup objects owned by ExprWithCleanup.

bool hasCodeCompletionSupport() const override

Does this action support use with code completion?

void EndSourceFileAction() override

Callback at the end of processing a single input.

TranslationUnitKind getTranslationUnitKind() override

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

~ASTMergeAction() override

bool usesPreprocessorOnly() const override

Does this action only use the preprocessor?

bool hasASTFileSupport() const override

Does this action support use with AST files?

void ExecuteAction() override

Callback to run the program action, using the initialized compiler instance.

bool BeginSourceFileAction(CompilerInstance &CI) override

Callback at the start of processing a single input.

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

Create the AST consumer object for this action, if supported.

bool hasPCHSupport() const override

Does this action support use with PCH?

@ LoadEverything

Load everything, including Sema.

static std::unique_ptr< ASTUnit > LoadFromASTFile(StringRef Filename, const PCHContainerReader &PCHContainerRdr, WhatToLoad ToLoad, IntrusiveRefCntPtr< DiagnosticsEngine > Diags, const FileSystemOptions &FileSystemOpts, std::shared_ptr< HeaderSearchOptions > HSOpts, std::shared_ptr< LangOptions > LangOpts=nullptr, bool OnlyLocalDecls=false, CaptureDiagsKind CaptureDiagnostics=CaptureDiagsKind::None, bool AllowASTWithCompilerErrors=false, bool UserFilesAreVolatile=false, IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS=llvm::vfs::getRealFileSystem())

Create a ASTUnit from an AST file.

CompilerInstance - Helper class for managing a single instance of the Clang compiler.

const PCHContainerReader & getPCHContainerReader() const

Return the appropriate PCHContainerReader depending on the current CodeGenOptions.

DiagnosticsEngine & getDiagnostics() const

Get the current diagnostics engine.

FileSystemOptions & getFileSystemOpts()

FileManager & getFileManager() const

Return the current file manager to the caller.

std::shared_ptr< HeaderSearchOptions > getHeaderSearchOptsPtr() const

ASTContext & getASTContext() const

ASTConsumer & getASTConsumer() const

DiagnosticOptions & getDiagnosticOpts()

decl_range decls() const

decls_begin/decls_end - Iterate over the declarations stored in this context.

virtual void EndSourceFile()

Callback to inform the diagnostic client that processing of a source file has ended.

virtual void BeginSourceFile(const LangOptions &LangOpts, const Preprocessor *PP=nullptr)

Callback to inform the diagnostic client that processing of a source file is beginning.

Concrete class used by the front-end to report problems and issues.

void SetArgToStringFn(ArgToStringFnTy Fn, void *Cookie)

DiagnosticConsumer * getClient()

const IntrusiveRefCntPtr< DiagnosticIDs > & getDiagnosticIDs() const

Diagnostic consumer that forwards diagnostics along to an existing, already-initialized diagnostic co...

const FrontendInputFile & getCurrentInput() const

friend class ASTMergeAction

CompilerInstance & getCompilerInstance() const

std::unique_ptr< ASTUnit > takeCurrentASTUnit()

One of these records is kept for each identifier that is lexed.

The top declaration context.

ASTContext & getASTContext() const

The JSON file list parser is used to communicate input to InstallAPI.

TranslationUnitKind

Describes the kind of translation unit being processed.

void FormatASTNodeDiagnosticArgument(DiagnosticsEngine::ArgumentKind Kind, intptr_t Val, StringRef Modifier, StringRef Argument, ArrayRef< DiagnosticsEngine::ArgumentValue > PrevArgs, SmallVectorImpl< char > &Output, void *Cookie, ArrayRef< intptr_t > QualTypeVals)

DiagnosticsEngine argument formatting function for diagnostics that involve AST nodes.