clang  16.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"

Collaboration diagram for clang::TestInputs:
Collaboration graph
[legend]

Public Member Functions

 TestInputs ()=default
 
 TestInputs (StringRef Code)
 

Public Attributes

std::string Code
 The source code of the input file to be parsed. More...
 
TestLanguage Language = TestLanguage::Lang_OBJCXX
 The language to parse as. More...
 
std::vector< std::stringExtraArgs = {}
 Extra argv to pass to clang -cc1. More...
 
llvm::StringMap< std::stringExtraFiles = {}
 Extra virtual files that are available to be #included. More...
 
bool ErrorOK = false
 By default, error diagnostics during parsing are reported as gtest errors. More...
 
std::function< std::unique_ptr< FrontendAction >)> MakeAction
 The action used to parse the code. More...
 

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.

Referenced by clang::TestAST::TestAST().

◆ 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 55 of file TestAST.h.

Referenced by clang::TestAST::TestAST().

◆ 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.

◆ 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.

Referenced by clang::TestAST::TestAST().

◆ 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 59 of file TestAST.h.


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