clang API Documentation
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded, and the SpellingLoc - where the actual character data for the token came from. More...
#include <SourceManager.h>
Public Member Functions | |
SourceLocation | getSpellingLoc () const |
SourceLocation | getExpansionLocStart () const |
SourceLocation | getExpansionLocEnd () const |
std::pair< SourceLocation, SourceLocation > | getExpansionLocRange () const |
bool | isMacroArgExpansion () const |
bool | isMacroBodyExpansion () const |
bool | isFunctionMacroExpansion () const |
Static Public Member Functions | |
static ExpansionInfo | create (SourceLocation SpellingLoc, SourceLocation Start, SourceLocation End) |
Return a ExpansionInfo for an expansion. | |
static ExpansionInfo | createForMacroArg (SourceLocation SpellingLoc, SourceLocation ExpansionLoc) |
Return a special ExpansionInfo for the expansion of a macro argument into a function-like macro's body. |
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded, and the SpellingLoc - where the actual character data for the token came from.
Definition at line 310 of file SourceManager.h.
static ExpansionInfo clang::SrcMgr::ExpansionInfo::create | ( | SourceLocation | SpellingLoc, |
SourceLocation | Start, | ||
SourceLocation | End | ||
) | [inline, static] |
Return a ExpansionInfo for an expansion.
Start and End specify the expansion range (where the macro is expanded), and SpellingLoc specifies the spelling location (where the characters from the token come from). All three can refer to normal File SLocs or expansion locations.
Definition at line 363 of file SourceManager.h.
References clang::SourceLocation::getRawEncoding(), and X.
Referenced by createForMacroArg().
static ExpansionInfo clang::SrcMgr::ExpansionInfo::createForMacroArg | ( | SourceLocation | SpellingLoc, |
SourceLocation | ExpansionLoc | ||
) | [inline, static] |
Return a special ExpansionInfo for the expansion of a macro argument into a function-like macro's body.
ExpansionLoc specifies the expansion location (where the macro is expanded). This doesn't need to be a range because a macro is always expanded at a macro parameter reference, and macro parameters are always exactly one token. SpellingLoc specifies the spelling location (where the characters from the token come from). ExpansionLoc and SpellingLoc can both refer to normal File SLocs or expansion locations.
Given the code:
#define F(x) f(x) F(42);
When expanding 'F(42)'
, the 'x'
would call this with an SpellingLoc pointing at '42'
and an ExpansionLoc pointing at its location in the definition of 'F'
.
Definition at line 391 of file SourceManager.h.
References create().
SourceLocation clang::SrcMgr::ExpansionInfo::getExpansionLocEnd | ( | ) | const [inline] |
Definition at line 331 of file SourceManager.h.
References getExpansionLocStart(), clang::SourceLocation::getFromRawEncoding(), and clang::SourceLocation::isInvalid().
Referenced by getExpansionLocRange(), clang::SourceManager::isAtEndOfImmediateMacroExpansion(), and isFunctionMacroExpansion().
std::pair<SourceLocation,SourceLocation> clang::SrcMgr::ExpansionInfo::getExpansionLocRange | ( | ) | const [inline] |
Definition at line 337 of file SourceManager.h.
References getExpansionLocEnd(), and getExpansionLocStart().
Referenced by clang::SourceManager::getImmediateExpansionRange().
SourceLocation clang::SrcMgr::ExpansionInfo::getExpansionLocStart | ( | ) | const [inline] |
Definition at line 328 of file SourceManager.h.
References clang::SourceLocation::getFromRawEncoding().
Referenced by clang::SourceManager::getDecomposedIncludedLoc(), getExpansionLocEnd(), getExpansionLocRange(), clang::Lexer::getImmediateMacroName(), clang::SourceManager::isAtEndOfImmediateMacroExpansion(), clang::SourceManager::isAtStartOfImmediateMacroExpansion(), isFunctionMacroExpansion(), isMacroArgExpansion(), isMacroBodyExpansion(), and clang::Lexer::makeFileCharRange().
SourceLocation clang::SrcMgr::ExpansionInfo::getSpellingLoc | ( | ) | const [inline] |
Definition at line 325 of file SourceManager.h.
References clang::SourceLocation::getFromRawEncoding().
Referenced by clang::Lexer::getImmediateMacroName(), and clang::SourceManager::getImmediateSpellingLoc().
bool clang::SrcMgr::ExpansionInfo::isFunctionMacroExpansion | ( | ) | const [inline] |
Definition at line 352 of file SourceManager.h.
References getExpansionLocEnd(), getExpansionLocStart(), and clang::SourceLocation::isValid().
bool clang::SrcMgr::ExpansionInfo::isMacroArgExpansion | ( | ) | const [inline] |
Definition at line 341 of file SourceManager.h.
References getExpansionLocStart(), clang::SourceLocation::getFromRawEncoding(), clang::SourceLocation::isInvalid(), and clang::SourceLocation::isValid().
Referenced by clang::Lexer::getImmediateMacroName(), clang::SourceManager::isAtEndOfImmediateMacroExpansion(), clang::SourceManager::isAtStartOfImmediateMacroExpansion(), clang::SourceManager::isMacroArgExpansion(), and clang::Lexer::makeFileCharRange().
bool clang::SrcMgr::ExpansionInfo::isMacroBodyExpansion | ( | ) | const [inline] |
Definition at line 347 of file SourceManager.h.
References getExpansionLocStart(), clang::SourceLocation::getFromRawEncoding(), and clang::SourceLocation::isValid().
Referenced by clang::SourceManager::isMacroBodyExpansion().