clang
15.0.0git
|
MacroExpansionContext tracks the macro expansions processed by the Preprocessor. More...
#include "clang/Analysis/MacroExpansionContext.h"
Public Member Functions | |
MacroExpansionContext (const LangOptions &LangOpts) | |
Creates a MacroExpansionContext. More... | |
void | registerForPreprocessor (Preprocessor &PP) |
Register the necessary callbacks to the Preprocessor to record the expansion events and the generated tokens. More... | |
Optional< StringRef > | getExpandedText (SourceLocation MacroExpansionLoc) const |
Optional< StringRef > | getOriginalText (SourceLocation MacroExpansionLoc) const |
LLVM_DUMP_METHOD void | dumpExpansionRangesToStream (raw_ostream &OS) const |
LLVM_DUMP_METHOD void | dumpExpandedTextsToStream (raw_ostream &OS) const |
LLVM_DUMP_METHOD void | dumpExpansionRanges () const |
LLVM_DUMP_METHOD void | dumpExpandedTexts () const |
Friends | |
class | detail::MacroExpansionRangeRecorder |
MacroExpansionContext tracks the macro expansions processed by the Preprocessor.
It means that it can track source locations from a single translation unit. For every macro expansion it can tell you what text will be substituted.
It was designed to deal with:
Definition at line 73 of file MacroExpansionContext.h.
|
explicit |
Creates a MacroExpansionContext.
Definition at line 85 of file MacroExpansionContext.cpp.
void MacroExpansionContext::dumpExpandedTexts | ( | ) | const |
Definition at line 137 of file MacroExpansionContext.cpp.
References dumpExpandedTextsToStream().
void MacroExpansionContext::dumpExpandedTextsToStream | ( | raw_ostream & | OS | ) | const |
Definition at line 159 of file MacroExpansionContext.cpp.
Referenced by dumpExpandedTexts().
void MacroExpansionContext::dumpExpansionRanges | ( | ) | const |
Definition at line 134 of file MacroExpansionContext.cpp.
References dumpExpansionRangesToStream().
void MacroExpansionContext::dumpExpansionRangesToStream | ( | raw_ostream & | OS | ) | const |
Definition at line 141 of file MacroExpansionContext.cpp.
Referenced by dumpExpansionRanges().
Optional< StringRef > MacroExpansionContext::getExpandedText | ( | SourceLocation | MacroExpansionLoc | ) | const |
MacroExpansionLoc | Must be the expansion location of a macro. |
Definition at line 100 of file MacroExpansionContext.cpp.
References clang::SourceLocation::isMacroID().
Referenced by getExpandedMacro().
Optional< StringRef > MacroExpansionContext::getOriginalText | ( | SourceLocation | MacroExpansionLoc | ) | const |
MacroExpansionLoc | Must be the expansion location of a macro. |
Definition at line 118 of file MacroExpansionContext.cpp.
References clang::CharSourceRange::getCharRange(), clang::Lexer::getSourceText(), and clang::SourceLocation::isMacroID().
void MacroExpansionContext::registerForPreprocessor | ( | Preprocessor & | PP | ) |
Register the necessary callbacks to the Preprocessor to record the expansion events and the generated tokens.
Must ensure that this object outlives the given Preprocessor.
Definition at line 88 of file MacroExpansionContext.cpp.
References clang::Preprocessor::addPPCallbacks(), clang::Preprocessor::getSourceManager(), and clang::Preprocessor::setTokenWatcher().
|
friend |
Definition at line 103 of file MacroExpansionContext.h.