class ExpansionInfo
Declaration
class ExpansionInfo { /* full declaration omitted */ };
Description
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.
Declared at: clang/include/clang/Basic/SourceManager.h:348
Member Variables
- private clang::SourceLocation SpellingLoc
- Where the spelling for the token can be found.
- private clang::SourceLocation ExpansionLocStart
- In a macro expansion, ExpansionLocStart and ExpansionLocEnd indicate the start and end of the expansion. In object-like macros, they will be the same. In a function-like macro expansion, the start will be the identifier and the end will be the ')'. Finally, in macro-argument instantiations, the end will be 'SourceLocation()', an invalid location.
- private clang::SourceLocation ExpansionLocEnd
- In a macro expansion, ExpansionLocStart and ExpansionLocEnd indicate the start and end of the expansion. In object-like macros, they will be the same. In a function-like macro expansion, the start will be the identifier and the end will be the ')'. Finally, in macro-argument instantiations, the end will be 'SourceLocation()', an invalid location.
- private bool ExpansionIsTokenRange
- Whether the expansion range is a token range.
Method Overview
- public static clang::SrcMgr::ExpansionInfo create(clang::SourceLocation SpellingLoc, clang::SourceLocation Start, clang::SourceLocation End, bool ExpansionIsTokenRange = true)
- public static clang::SrcMgr::ExpansionInfo createForMacroArg(clang::SourceLocation SpellingLoc, clang::SourceLocation ExpansionLoc)
- public static clang::SrcMgr::ExpansionInfo createForTokenSplit(clang::SourceLocation SpellingLoc, clang::SourceLocation Start, clang::SourceLocation End)
- public clang::SourceLocation getExpansionLocEnd() const
- public clang::CharSourceRange getExpansionLocRange() const
- public clang::SourceLocation getExpansionLocStart() const
- public clang::SourceLocation getSpellingLoc() const
- public bool isExpansionTokenRange() const
- public bool isFunctionMacroExpansion() const
- public bool isMacroArgExpansion() const
- public bool isMacroBodyExpansion() const
Methods
¶static clang::SrcMgr::ExpansionInfo create(
clang::SourceLocation SpellingLoc,
clang::SourceLocation Start,
clang::SourceLocation End,
bool ExpansionIsTokenRange = true)
static clang::SrcMgr::ExpansionInfo create(
clang::SourceLocation SpellingLoc,
clang::SourceLocation Start,
clang::SourceLocation End,
bool ExpansionIsTokenRange = true)
Description
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.
Declared at: clang/include/clang/Basic/SourceManager.h:407
Parameters
- clang::SourceLocation SpellingLoc
- clang::SourceLocation Start
- clang::SourceLocation End
- bool ExpansionIsTokenRange = true
¶static clang::SrcMgr::ExpansionInfo
createForMacroArg(
clang::SourceLocation SpellingLoc,
clang::SourceLocation ExpansionLoc)
static clang::SrcMgr::ExpansionInfo
createForMacroArg(
clang::SourceLocation SpellingLoc,
clang::SourceLocation ExpansionLoc)
Description
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: When expanding '\c F(42)', the '\c x' would call this with an would call this with an SpellingLoc pointing at '\c 42' and an ExpansionLoc pointing at its and an ExpansionLoc pointing at its location in the definition of '\c F'.
Declared at: clang/include/clang/Basic/SourceManager.h:437
Parameters
- clang::SourceLocation SpellingLoc
- clang::SourceLocation ExpansionLoc
¶static clang::SrcMgr::ExpansionInfo
createForTokenSplit(
clang::SourceLocation SpellingLoc,
clang::SourceLocation Start,
clang::SourceLocation End)
static clang::SrcMgr::ExpansionInfo
createForTokenSplit(
clang::SourceLocation SpellingLoc,
clang::SourceLocation Start,
clang::SourceLocation End)
Description
Return a special ExpansionInfo representing a token that ends prematurely. This is used to model a '>>' token that has been split into '>' tokens and similar cases. Unlike for the other forms of expansion, the expansion range in this case is a character range, not a token range.
Declared at: clang/include/clang/Basic/SourceManager.h:450
Parameters
- clang::SourceLocation SpellingLoc
- clang::SourceLocation Start
- clang::SourceLocation End
¶clang::SourceLocation getExpansionLocEnd() const
clang::SourceLocation getExpansionLocEnd() const
Declared at: clang/include/clang/Basic/SourceManager.h:374
¶clang::CharSourceRange getExpansionLocRange()
const
clang::CharSourceRange getExpansionLocRange()
const
Declared at: clang/include/clang/Basic/SourceManager.h:381
¶clang::SourceLocation getExpansionLocStart() const
clang::SourceLocation getExpansionLocStart() const
Declared at: clang/include/clang/Basic/SourceManager.h:370
¶clang::SourceLocation getSpellingLoc() const
clang::SourceLocation getSpellingLoc() const
Declared at: clang/include/clang/Basic/SourceManager.h:366
¶bool isExpansionTokenRange() const
bool isExpansionTokenRange() const
Declared at: clang/include/clang/Basic/SourceManager.h:379
¶bool isFunctionMacroExpansion() const
bool isFunctionMacroExpansion() const
Declared at: clang/include/clang/Basic/SourceManager.h:396
¶bool isMacroArgExpansion() const
bool isMacroArgExpansion() const
Declared at: clang/include/clang/Basic/SourceManager.h:387
¶bool isMacroBodyExpansion() const
bool isMacroBodyExpansion() const
Declared at: clang/include/clang/Basic/SourceManager.h:392