clang 19.0.0git
Public Member Functions | Public Attributes | List of all members
clang::TestInputs Struct Reference

Specifies a virtual source file to be parsed as part of a test. More...

#include "clang/Testing/TestAST.h"

Public Member Functions

 TestInputs ()=default
 
 TestInputs (StringRef Code)
 

Public Attributes

std::string Code
 The source code of the input file to be parsed.
 
TestLanguage Language = TestLanguage::Lang_OBJCXX
 The language to parse as.
 
std::vector< std::string > ExtraArgs = {}
 Extra argv to pass to clang -cc1.
 
llvm::StringMap< std::string > ExtraFiles = {}
 Extra virtual files that are available to be #included.
 
std::string FileName
 Filename to use for translation unit. A default will be used when empty.
 
bool ErrorOK = false
 By default, error diagnostics during parsing are reported as gtest errors.
 
std::function< std::unique_ptr< FrontendAction >()> MakeAction
 The action used to parse the code.
 

Detailed Description

Specifies a virtual source file to be parsed as part of a test.

Definition at line 34 of file TestAST.h.

Constructor & Destructor Documentation

◆ TestInputs() [1/2]

clang::TestInputs::TestInputs ( )
default

◆ TestInputs() [2/2]

clang::TestInputs::TestInputs ( StringRef  Code)
inline

Definition at line 36 of file TestAST.h.

Member Data Documentation

◆ Code

std::string clang::TestInputs::Code

The source code of the input file to be parsed.

Definition at line 39 of file TestAST.h.

◆ ErrorOK

bool clang::TestInputs::ErrorOK = false

By default, error diagnostics during parsing are reported as gtest errors.

To suppress this, set ErrorOK or include "error-ok" in a comment in Code. In either case, all diagnostics appear in TestAST::diagnostics().

Definition at line 58 of file TestAST.h.

◆ ExtraArgs

std::vector<std::string> clang::TestInputs::ExtraArgs = {}

Extra argv to pass to clang -cc1.

Definition at line 46 of file TestAST.h.

◆ ExtraFiles

llvm::StringMap<std::string> clang::TestInputs::ExtraFiles = {}

Extra virtual files that are available to be #included.

Keys are plain filenames ("foo.h"), values are file content.

Definition at line 50 of file TestAST.h.

◆ FileName

std::string clang::TestInputs::FileName

Filename to use for translation unit. A default will be used when empty.

Definition at line 53 of file TestAST.h.

◆ Language

TestLanguage clang::TestInputs::Language = TestLanguage::Lang_OBJCXX

The language to parse as.

This affects the -x and -std flags used, and the filename.

Definition at line 43 of file TestAST.h.

◆ MakeAction

std::function<std::unique_ptr<FrontendAction>()> clang::TestInputs::MakeAction

The action used to parse the code.

By default, a SyntaxOnlyAction is used.

Definition at line 62 of file TestAST.h.


The documentation for this struct was generated from the following file: