clang 19.0.0git
Functions
clang::data_collection Namespace Reference

Functions

std::string getMacroStack (SourceLocation Loc, ASTContext &Context)
 Returns a string that represents all macro expansions that expanded into the given SourceLocation.
 
template<class T >
void addDataToConsumer (T &DataConsumer, llvm::StringRef Str)
 Utility functions for implementing addData() for a consumer that has a method update(StringRef)
 
template<class T >
void addDataToConsumer (T &DataConsumer, const QualType &QT)
 
template<class T , class Type >
std::enable_if_t< std::is_integral< Type >::value||std::is_enum< Type >::value||std::is_convertible< Type, size_t >::value > addDataToConsumer (T &DataConsumer, Type Data)
 
static void printMacroName (llvm::raw_string_ostream &MacroStack, ASTContext &Context, SourceLocation Loc)
 Prints the macro name that contains the given SourceLocation into the given raw_string_ostream.
 

Function Documentation

◆ addDataToConsumer() [1/3]

template<class T >
void clang::data_collection::addDataToConsumer ( T &  DataConsumer,
const QualType QT 
)

Definition at line 48 of file DataCollection.h.

References addDataToConsumer(), and clang::QualType::getAsString().

◆ addDataToConsumer() [2/3]

template<class T >
void clang::data_collection::addDataToConsumer ( T &  DataConsumer,
llvm::StringRef  Str 
)

Utility functions for implementing addData() for a consumer that has a method update(StringRef)

Definition at line 44 of file DataCollection.h.

Referenced by addDataToConsumer().

◆ addDataToConsumer() [3/3]

template<class T , class Type >
std::enable_if_t< std::is_integral< Type >::value||std::is_enum< Type >::value|| std::is_convertible< Type, size_t >::value > clang::data_collection::addDataToConsumer ( T &  DataConsumer,
Type  Data 
)

Definition at line 56 of file DataCollection.h.

References clang::Data.

◆ getMacroStack()

std::string clang::data_collection::getMacroStack ( SourceLocation  Loc,
ASTContext Context 
)

Returns a string that represents all macro expansions that expanded into the given SourceLocation.

If 'getMacroStack(A) == getMacroStack(B)' is true, then the SourceLocations A and B are expanded from the same macros in the same order.

Definition at line 33 of file DataCollection.cpp.

References clang::SourceLocation::isMacroID(), printMacroName(), and SM.

Referenced by clang::MinComplexityConstraint::calculateStmtComplexity().

◆ printMacroName()

static void clang::data_collection::printMacroName ( llvm::raw_string_ostream &  MacroStack,
ASTContext Context,
SourceLocation  Loc 
)
static

Prints the macro name that contains the given SourceLocation into the given raw_string_ostream.

Definition at line 18 of file DataCollection.cpp.

References clang::Lexer::getImmediateMacroName().

Referenced by getMacroStack().