clang 17.0.0git
Public Member Functions | List of all members
clang::TestAST Class Reference

The result of parsing a file specified by TestInputs. More...

#include "clang/Testing/TestAST.h"

Public Member Functions

 TestAST (const TestInputs &)
 Constructing a TestAST parses the virtual file.
 TestAST (StringRef Code)
 TestAST (TestAST &&M)
TestASToperator= (TestAST &&)
 ~TestAST ()
ASTContextcontext ()
 Provides access to the AST context and other parts of Clang.
Semasema ()
SourceManagersourceManager ()
FileManagerfileManager ()
Preprocessorpreprocessor ()
FrontendActionaction ()
llvm::ArrayRef< StoredDiagnosticdiagnostics ()
 Returns diagnostics emitted during parsing.

Detailed Description

The result of parsing a file specified by TestInputs.

The ASTContext, Sema etc are valid as long as this object is alive.

Definition at line 68 of file TestAST.h.

Constructor & Destructor Documentation

◆ TestAST() [1/3]

clang::TestAST::TestAST ( const TestInputs In)

Constructing a TestAST parses the virtual file.

To keep tests terse, critical errors (e.g. invalid flags) are reported as unit test failures with ADD_FAILURE() and produce an empty ASTContext, Sema etc. This frees the test code from handling these explicitly.

Definition at line 76 of file TestAST.cpp.

References clang::TestInputs::Code, clang::CompilerInvocation::CreateFromArgs(), clang::TestInputs::ErrorOK, clang::TestInputs::ExtraArgs, clang::TestInputs::ExtraFiles, clang::TestInputs::FileName, Filename, clang::getCC1ArgsForTesting(), clang::getFilenameForTesting(), clang::TestInputs::Language, and clang::TestInputs::MakeAction.

◆ TestAST() [2/3]

clang::TestAST::TestAST ( StringRef  Code)

Definition at line 76 of file TestAST.h.

◆ TestAST() [3/3]

clang::TestAST::TestAST ( TestAST &&  M)

Definition at line 162 of file TestAST.cpp.

◆ ~TestAST()

clang::TestAST::~TestAST ( )

Definition at line 164 of file TestAST.cpp.

Member Function Documentation

◆ action()

FrontendAction & clang::TestAST::action ( )

Definition at line 88 of file TestAST.h.

◆ context()

ASTContext & clang::TestAST::context ( )

Provides access to the AST context and other parts of Clang.

Definition at line 83 of file TestAST.h.

◆ diagnostics()

llvm::ArrayRef< StoredDiagnostic > clang::TestAST::diagnostics ( )

Returns diagnostics emitted during parsing.

(By default, errors cause test failures, see TestInputs::ErrorOK).

Definition at line 92 of file TestAST.h.

◆ fileManager()

FileManager & clang::TestAST::fileManager ( )

Definition at line 86 of file TestAST.h.

◆ operator=()

TestAST & clang::TestAST::operator= ( TestAST &&  M)

Definition at line 154 of file TestAST.cpp.

◆ preprocessor()

Preprocessor & clang::TestAST::preprocessor ( )

Definition at line 87 of file TestAST.h.

◆ sema()

Sema & clang::TestAST::sema ( )

Definition at line 84 of file TestAST.h.

◆ sourceManager()

SourceManager & clang::TestAST::sourceManager ( )

Definition at line 85 of file TestAST.h.

The documentation for this class was generated from the following files: