|
clang
5.0.0
|
Encapsulates the data about a macro definition (e.g. More...
#include "clang/Lex/MacroInfo.h"
Public Types | |
| typedef IdentifierInfo *const * | param_iterator |
| Parameters - The list of parameters for a function-like macro. More... | |
| typedef SmallVectorImpl< Token > ::const_iterator | tokens_iterator |
Public Member Functions | |
| SourceLocation | getDefinitionLoc () const |
| Return the location that the macro was defined at. More... | |
| void | setDefinitionEndLoc (SourceLocation EndLoc) |
| Set the location of the last token in the macro. More... | |
| SourceLocation | getDefinitionEndLoc () const |
| Return the location of the last token in the macro. More... | |
| unsigned | getDefinitionLength (const SourceManager &SM) const |
| Get length in characters of the macro definition. More... | |
| bool | isIdenticalTo (const MacroInfo &Other, Preprocessor &PP, bool Syntactically) const |
| Return true if the specified macro definition is equal to this macro in spelling, arguments, and whitespace. More... | |
| void | setIsBuiltinMacro (bool Val=true) |
| Set or clear the isBuiltinMacro flag. More... | |
| void | setIsUsed (bool Val) |
| Set the value of the IsUsed flag. More... | |
| void | setIsAllowRedefinitionsWithoutWarning (bool Val) |
| Set the value of the IsAllowRedefinitionsWithoutWarning flag. More... | |
| void | setIsWarnIfUnused (bool val) |
| Set the value of the IsWarnIfUnused flag. More... | |
| void | setParameterList (ArrayRef< IdentifierInfo * > List, llvm::BumpPtrAllocator &PPAllocator) |
| Set the specified list of identifiers as the parameter list for this macro. More... | |
| bool | param_empty () const |
| param_iterator | param_begin () const |
| param_iterator | param_end () const |
| unsigned | getNumParams () const |
| ArrayRef< const IdentifierInfo * > | params () const |
| int | getParameterNum (const IdentifierInfo *Arg) const |
| Return the parameter number of the specified identifier, or -1 if the identifier is not a formal parameter identifier. More... | |
| void | setIsFunctionLike () |
| Function/Object-likeness. More... | |
| bool | isFunctionLike () const |
| bool | isObjectLike () const |
| void | setIsC99Varargs () |
| Varargs querying methods. This can only be set for function-like macros. More... | |
| void | setIsGNUVarargs () |
| bool | isC99Varargs () const |
| bool | isGNUVarargs () const |
| bool | isVariadic () const |
| bool | isBuiltinMacro () const |
| Return true if this macro requires processing before expansion. More... | |
| bool | hasCommaPasting () const |
| void | setHasCommaPasting () |
| bool | isUsed () const |
| Return false if this macro is defined in the main file and has not yet been used. More... | |
| bool | isAllowRedefinitionsWithoutWarning () const |
| Return true if this macro can be redefined without warning. More... | |
| bool | isWarnIfUnused () const |
| Return true if we should emit a warning if the macro is unused. More... | |
| unsigned | getNumTokens () const |
| Return the number of tokens that this macro expands to. More... | |
| const Token & | getReplacementToken (unsigned Tok) const |
| tokens_iterator | tokens_begin () const |
| tokens_iterator | tokens_end () const |
| bool | tokens_empty () const |
| ArrayRef< Token > | tokens () const |
| void | AddTokenToBody (const Token &Tok) |
| Add the specified token to the replacement text for the macro. More... | |
| bool | isEnabled () const |
| Return true if this macro is enabled. More... | |
| void | EnableMacro () |
| void | DisableMacro () |
| bool | isUsedForHeaderGuard () const |
| Determine whether this macro was used for a header guard. More... | |
| void | setUsedForHeaderGuard (bool Val) |
| void | dump () const |
Friends | |
| class | Preprocessor |
Encapsulates the data about a macro definition (e.g.
its tokens).
There's an instance of this class for every #define.
Definition at line 34 of file MacroInfo.h.
| typedef IdentifierInfo* const* clang::MacroInfo::param_iterator |
Parameters - The list of parameters for a function-like macro.
This can be empty, for, e.g. "#define X()".
Definition at line 172 of file MacroInfo.h.
| typedef SmallVectorImpl<Token>::const_iterator clang::MacroInfo::tokens_iterator |
Definition at line 235 of file MacroInfo.h.
|
inline |
Add the specified token to the replacement text for the macro.
Definition at line 242 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
|
inline |
Definition at line 259 of file MacroInfo.h.
Referenced by clang::TokenLexer::Init().
| LLVM_DUMP_METHOD void MacroInfo::dump | ( | ) | const |
Definition at line 129 of file MacroInfo.cpp.
References clang::IdentifierInfo::getName(), clang::tok::getPunctuatorSpelling(), and I.
|
inline |
Definition at line 254 of file MacroInfo.h.
Referenced by clang::TokenLexer::Lex().
|
inline |
Return the location of the last token in the macro.
Definition at line 123 of file MacroInfo.h.
|
inline |
Get length in characters of the macro definition.
Definition at line 126 of file MacroInfo.h.
Referenced by clang::TokenLexer::Init().
|
inline |
Return the location that the macro was defined at.
Definition at line 117 of file MacroInfo.h.
Referenced by clang::Preprocessor::appendDefMacroDirective(), and clang::Preprocessor::markMacroAsUsed().
|
inline |
Definition at line 176 of file MacroInfo.h.
Referenced by clang::MacroArgs::create(), clang::MacroArgs::getPreExpArgument(), clang::TokenLexer::Init(), and isIdenticalTo().
|
inline |
Return the number of tokens that this macro expands to.
Definition at line 228 of file MacroInfo.h.
Referenced by clang::Preprocessor::DumpMacro(), isConfigurationPattern(), and MacroDefinitionEquals().
|
inline |
Return the parameter number of the specified identifier, or -1 if the identifier is not a formal parameter identifier.
Definition at line 183 of file MacroInfo.h.
References E, I, param_begin(), and param_end().
Referenced by isIdenticalTo().
Definition at line 230 of file MacroInfo.h.
Referenced by clang::Preprocessor::DumpMacro(), isConfigurationPattern(), and isTrivialSingleTokenExpansion().
|
inline |
Definition at line 211 of file MacroInfo.h.
|
inline |
Return true if this macro can be redefined without warning.
Definition at line 219 of file MacroInfo.h.
|
inline |
Return true if this macro requires processing before expansion.
This is true only for builtin macro, such as __LINE__, whose values are not given by fixed textual expansions. Regular predefined macros from the "<built-in>" buffer are not reported as builtins by this function.
Definition at line 209 of file MacroInfo.h.
Referenced by clang::Preprocessor::CheckMacroName(), DoPrintMacros(), clang::ASTWriter::getMacroID(), and clang::ASTWriter::getMacroRef().
|
inline |
Definition at line 199 of file MacroInfo.h.
Referenced by clang::CodeCompletionResult::CreateCodeCompletionString(), and isIdenticalTo().
|
inline |
Return true if this macro is enabled.
In other words, that we are not currently in an expansion of this macro.
Definition at line 252 of file MacroInfo.h.
|
inline |
Definition at line 193 of file MacroInfo.h.
Referenced by clang::MacroArgs::create(), clang::CodeCompletionResult::CreateCodeCompletionString(), clang::TokenLexer::Init(), isIdenticalTo(), and PrintMacroDefinition().
|
inline |
Definition at line 200 of file MacroInfo.h.
Referenced by isIdenticalTo(), and PrintMacroDefinition().
| bool MacroInfo::isIdenticalTo | ( | const MacroInfo & | Other, |
| Preprocessor & | PP, | ||
| bool | Syntactically | ||
| ) | const |
Return true if the specified macro definition is equal to this macro in spelling, arguments, and whitespace.
| Syntactically | if true, the macro definitions can be identical even if they use different identifiers for the function macro parameters. Otherwise the comparison is lexical and this implements the rules in C99 6.10.3. |
Definition at line 71 of file MacroInfo.cpp.
References E, clang::Token::getIdentifierInfo(), clang::Token::getKind(), getNumParams(), getParameterNum(), clang::Preprocessor::getSpelling(), clang::Token::hasLeadingSpace(), I, clang::Token::isAtStartOfLine(), isC99Varargs(), isFunctionLike(), isGNUVarargs(), param_begin(), and param_end().
|
inline |
Definition at line 194 of file MacroInfo.h.
Referenced by clang::Preprocessor::getLastMacroWithSpelling(), and isTrivialSingleTokenExpansion().
|
inline |
Return false if this macro is defined in the main file and has not yet been used.
Definition at line 216 of file MacroInfo.h.
Referenced by clang::Preprocessor::markMacroAsUsed().
|
inline |
Determine whether this macro was used for a header guard.
Definition at line 265 of file MacroInfo.h.
|
inline |
Definition at line 201 of file MacroInfo.h.
Referenced by clang::CodeCompletionResult::CreateCodeCompletionString().
|
inline |
Return true if we should emit a warning if the macro is unused.
Definition at line 224 of file MacroInfo.h.
Referenced by clang::Preprocessor::markMacroAsUsed().
|
inline |
Definition at line 174 of file MacroInfo.h.
Referenced by clang::CodeCompletionResult::CreateCodeCompletionString(), getParameterNum(), isIdenticalTo(), isTrivialSingleTokenExpansion(), and PrintMacroDefinition().
|
inline |
Definition at line 173 of file MacroInfo.h.
Referenced by PrintMacroDefinition().
|
inline |
Definition at line 175 of file MacroInfo.h.
Referenced by clang::CodeCompletionResult::CreateCodeCompletionString(), getParameterNum(), isIdenticalTo(), isTrivialSingleTokenExpansion(), and PrintMacroDefinition().
|
inline |
Definition at line 177 of file MacroInfo.h.
|
inline |
Set the location of the last token in the macro.
Definition at line 120 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
|
inline |
Definition at line 212 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
|
inline |
Set the value of the IsAllowRedefinitionsWithoutWarning flag.
Definition at line 149 of file MacroInfo.h.
Referenced by clang::Preprocessor::HandlePragmaPushMacro().
Set or clear the isBuiltinMacro flag.
Definition at line 143 of file MacroInfo.h.
Referenced by RegisterBuiltinMacro().
|
inline |
Varargs querying methods. This can only be set for function-like macros.
Definition at line 197 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
|
inline |
Function/Object-likeness.
Keep track of whether this macro has formal parameters.
Definition at line 192 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
|
inline |
Definition at line 198 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
|
inline |
Set the value of the IsUsed flag.
Definition at line 146 of file MacroInfo.h.
Referenced by clang::Preprocessor::markMacroAsUsed(), and clang::ASTReader::ReadMacroRecord().
|
inline |
Set the value of the IsWarnIfUnused flag.
Definition at line 154 of file MacroInfo.h.
|
inline |
Set the specified list of identifiers as the parameter list for this macro.
Definition at line 158 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
|
inline |
Definition at line 267 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
Definition at line 239 of file MacroInfo.h.
Referenced by PrintMacroDefinition().
|
inline |
Definition at line 236 of file MacroInfo.h.
Referenced by clang::TokenLexer::Init(), MacroDefinitionEquals(), and PrintMacroDefinition().
|
inline |
Definition at line 238 of file MacroInfo.h.
Referenced by PrintMacroDefinition().
|
inline |
Definition at line 237 of file MacroInfo.h.
Referenced by clang::TokenLexer::Init().
|
friend |
Definition at line 274 of file MacroInfo.h.
1.8.6