clang 10.0.0git

Namespaces | Functions
DataCollection.h File Reference

This file declares helper methods for collecting data from AST nodes. More...

`#include "clang/AST/ASTContext.h"`
Include dependency graph for DataCollection.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Namespaces
| clang
| Dataflow Directional Tag Classes.
| clang::data_collection

## Functions
std::string | clang::data_collection::getMacroStack (SourceLocation Loc, ASTContext &Context)
| Returns a string that represents all macro expansions that expanded into the given SourceLocation. More...
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) More...
template<class T >
void | clang::data_collection::addDataToConsumer (T &DataConsumer, const QualType &QT)
template<class T , class Type >
std::enable_if< std::is_integral< Type >::value||std::is_enum< Type >::value||std::is_convertible< Type, size_t >::value >::type | clang::data_collection::addDataToConsumer (T &DataConsumer, Type Data)

## Detailed Description

This file declares helper methods for collecting data from AST nodes.

To collect data from Stmt nodes, subclass ConstStmtVisitor and include StmtDataCollectors.inc after defining the macros that you need. This provides data collection implementations for most Stmt kinds. Note that the code requires some conditions to be met:

- There must be a method addData(const T &Data) that accepts strings, integral types as well as QualType. All data is forwarded using to this method.
- The ASTContext of the Stmt must be accessible by the name Context.

It is also possible to override individual visit methods. Have a look at the DataCollector in lib/Analysis/CloneDetection.cpp for a usage example.

Definition in file DataCollection.h.