clang-tools 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
Modularize::PreprocessorTracker Class Referenceabstract

Preprocessor tracker for modularize. More...

#include <PreprocessorTracker.h>

Public Member Functions

virtual ~PreprocessorTracker ()
 
virtual void handlePreprocessorEntry (clang::Preprocessor &PP, llvm::StringRef RootHeaderFile)=0
 
virtual void handlePreprocessorExit ()=0
 
virtual void handleIncludeDirective (llvm::StringRef DirectivePath, int DirectiveLine, int DirectiveColumn, llvm::StringRef TargetPath)=0
 
virtual bool checkForIncludesInBlock (clang::Preprocessor &PP, clang::SourceRange BlockSourceRange, const char *BlockIdentifierMessage, llvm::raw_ostream &OS)=0
 
virtual bool reportInconsistentMacros (llvm::raw_ostream &OS)=0
 
virtual bool reportInconsistentConditionals (llvm::raw_ostream &OS)=0
 

Static Public Member Functions

static PreprocessorTrackercreate (llvm::SmallVector< std::string, 32 > &Headers, bool DoBlockCheckHeaderListOnly)
 

Detailed Description

Preprocessor tracker for modularize.

The PreprocessorTracker class defines an API for checking macro expansions and preprocessor conditional expressions in a header file for consistency among one or more compilations of the header in a #include scenario. This is for helping a user find which macro expansions or conditionals might be problematic with respect to using the headers in the modules scenario, because they evaluate to different values depending on how or where a header is included.

The handlePreprocessorEntry function implementation will register a PPCallbacks object in the given Preprocessor object. The calls to the callbacks will collect information about the macro expansions and preprocessor conditionals encountered, for later analysis and reporting of inconsistencies between runs performed by calls to the reportInconsistentMacros and reportInconsistentConditionals functions respectively. The handlePreprocessorExit informs the implementation that a preprocessing session is complete, allowing it to do any needed compilation completion activities in the checker.

Definition at line 41 of file PreprocessorTracker.h.

Constructor & Destructor Documentation

◆ ~PreprocessorTracker()

Modularize::PreprocessorTracker::~PreprocessorTracker ( )
virtual

Definition at line 1260 of file PreprocessorTracker.cpp.

Member Function Documentation

◆ checkForIncludesInBlock()

virtual bool Modularize::PreprocessorTracker::checkForIncludesInBlock ( clang::Preprocessor &  PP,
clang::SourceRange  BlockSourceRange,
const char *  BlockIdentifierMessage,
llvm::raw_ostream &  OS 
)
pure virtual

◆ create()

PreprocessorTracker * Modularize::PreprocessorTracker::create ( llvm::SmallVector< std::string, 32 > &  Headers,
bool  DoBlockCheckHeaderListOnly 
)
static

Definition at line 1263 of file PreprocessorTracker.cpp.

Referenced by main().

◆ handleIncludeDirective()

virtual void Modularize::PreprocessorTracker::handleIncludeDirective ( llvm::StringRef  DirectivePath,
int  DirectiveLine,
int  DirectiveColumn,
llvm::StringRef  TargetPath 
)
pure virtual

◆ handlePreprocessorEntry()

virtual void Modularize::PreprocessorTracker::handlePreprocessorEntry ( clang::Preprocessor &  PP,
llvm::StringRef  RootHeaderFile 
)
pure virtual

◆ handlePreprocessorExit()

virtual void Modularize::PreprocessorTracker::handlePreprocessorExit ( )
pure virtual

◆ reportInconsistentConditionals()

virtual bool Modularize::PreprocessorTracker::reportInconsistentConditionals ( llvm::raw_ostream &  OS)
pure virtual

◆ reportInconsistentMacros()

virtual bool Modularize::PreprocessorTracker::reportInconsistentMacros ( llvm::raw_ostream &  OS)
pure virtual

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