clang API Documentation
#include <MacroInfo.h>
Public Types | |
| typedef IdentifierInfo *const * | arg_iterator |
| typedef SmallVector< Token, 8 > ::const_iterator | tokens_iterator |
Public Member Functions | |
| MacroInfo (SourceLocation DefLoc) | |
| MacroInfo (const MacroInfo &MI, llvm::BumpPtrAllocator &PPAllocator) | |
| void | FreeArgumentList () |
| void | Destroy () |
| Destroy - destroy this MacroInfo object. | |
| SourceLocation | getDefinitionLoc () const |
| void | setDefinitionEndLoc (SourceLocation EndLoc) |
| SourceLocation | getDefinitionEndLoc () const |
| unsigned | getDefinitionLength (SourceManager &SM) const |
| Get length in characters of the macro definition. | |
| bool | isIdenticalTo (const MacroInfo &Other, Preprocessor &PP) const |
| void | setIsBuiltinMacro (bool Val=true) |
| void | setIsUsed (bool Val) |
| void | setIsAllowRedefinitionsWithoutWarning (bool Val) |
| void | setIsWarnIfUnused (bool val) |
| Set the value of the IsWarnIfUnused flag. | |
| void | setArgumentList (IdentifierInfo *const *List, unsigned NumArgs, llvm::BumpPtrAllocator &PPAllocator) |
| bool | arg_empty () const |
| arg_iterator | arg_begin () const |
| arg_iterator | arg_end () const |
| unsigned | getNumArgs () const |
| int | getArgumentNum (IdentifierInfo *Arg) const |
| void | setIsFunctionLike () |
| bool | isFunctionLike () const |
| bool | isObjectLike () const |
| void | setIsC99Varargs () |
| Varargs querying methods. This can only be set for function-like macros. | |
| void | setIsGNUVarargs () |
| bool | isC99Varargs () const |
| bool | isGNUVarargs () const |
| bool | isVariadic () const |
| bool | isBuiltinMacro () const |
| bool | isFromAST () const |
| isFromAST - Return true if this macro was loaded from an AST file. | |
| void | setIsFromAST (bool FromAST=true) |
| setIsFromAST - Set whether this macro was loaded from an AST file. | |
| bool | hasChangedAfterLoad () const |
| Determine whether this macro has changed since it was loaded from an AST file. | |
| void | setChangedAfterLoad (bool CAL=true) |
| Note whether this macro has changed after it was loaded from an AST file. | |
| bool | isUsed () const |
| bool | isAllowRedefinitionsWithoutWarning () const |
| bool | isWarnIfUnused () const |
| Return true if we should emit a warning if the macro is unused. | |
| unsigned | getNumTokens () const |
| const Token & | getReplacementToken (unsigned Tok) const |
| tokens_iterator | tokens_begin () const |
| tokens_iterator | tokens_end () const |
| bool | tokens_empty () const |
| void | AddTokenToBody (const Token &Tok) |
| bool | isEnabled () const |
| void | EnableMacro () |
| void | DisableMacro () |
| void | setVisibility (bool Public, SourceLocation Loc) |
| Set the export location for this macro. | |
| bool | isPublic () const |
| Determine whether this macro is part of the public API of its module. | |
| SourceLocation | getVisibilityLocation () |
| Determine the location where this macro was explicitly made public or private within its module. | |
MacroInfo - Each identifier that is #define'd has an instance of this class associated with it, used to implement macro expansion.
Definition at line 27 of file MacroInfo.h.
| typedef IdentifierInfo* const* clang::MacroInfo::arg_iterator |
Arguments - The list of arguments for a function-like macro. This can be empty, for, e.g. "#define X()".
Definition at line 187 of file MacroInfo.h.
| typedef SmallVector<Token, 8>::const_iterator clang::MacroInfo::tokens_iterator |
Definition at line 258 of file MacroInfo.h.
| MacroInfo::MacroInfo | ( | SourceLocation | DefLoc | ) |
Definition at line 18 of file MacroInfo.cpp.
| MacroInfo::MacroInfo | ( | const MacroInfo & | MI, |
| llvm::BumpPtrAllocator & | PPAllocator | ||
| ) |
Definition at line 36 of file MacroInfo.cpp.
References setArgumentList().
| void clang::MacroInfo::AddTokenToBody | ( | const Token & | Tok | ) | [inline] |
AddTokenToBody - Add the specified token to the replacement text for the macro.
Definition at line 265 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
| arg_iterator clang::MacroInfo::arg_begin | ( | ) | const [inline] |
Definition at line 189 of file MacroInfo.h.
Referenced by clang::CodeCompletionResult::CreateCodeCompletionString(), getArgumentNum(), isIdenticalTo(), isTrivialSingleTokenExpansion(), and PrintMacroDefinition().
| bool clang::MacroInfo::arg_empty | ( | ) | const [inline] |
Definition at line 188 of file MacroInfo.h.
Referenced by PrintMacroDefinition().
| arg_iterator clang::MacroInfo::arg_end | ( | ) | const [inline] |
Definition at line 190 of file MacroInfo.h.
Referenced by clang::CodeCompletionResult::CreateCodeCompletionString(), getArgumentNum(), isIdenticalTo(), isTrivialSingleTokenExpansion(), and PrintMacroDefinition().
| void clang::MacroInfo::Destroy | ( | ) | [inline] |
Destroy - destroy this MacroInfo object.
Definition at line 120 of file MacroInfo.h.
References FreeArgumentList().
| void clang::MacroInfo::DisableMacro | ( | ) | [inline] |
Definition at line 280 of file MacroInfo.h.
Referenced by clang::TokenLexer::Init().
| void clang::MacroInfo::EnableMacro | ( | ) | [inline] |
Definition at line 275 of file MacroInfo.h.
Referenced by clang::TokenLexer::Lex().
| void clang::MacroInfo::FreeArgumentList | ( | ) | [inline] |
FreeArgumentList - Free the argument list of the macro, restoring it to a state where it can be reused for other devious purposes.
Definition at line 114 of file MacroInfo.h.
Referenced by Destroy().
| int clang::MacroInfo::getArgumentNum | ( | IdentifierInfo * | Arg | ) | const [inline] |
getArgumentNum - Return the argument number of the specified identifier, or -1 if the identifier is not a formal argument identifier.
Definition at line 195 of file MacroInfo.h.
References arg_begin(), and arg_end().
| SourceLocation clang::MacroInfo::getDefinitionEndLoc | ( | ) | const [inline] |
getDefinitionEndLoc - Return the location of the last token in the macro.
Definition at line 134 of file MacroInfo.h.
Referenced by clang::PreprocessingRecord::MacroDefined().
| unsigned clang::MacroInfo::getDefinitionLength | ( | SourceManager & | SM | ) | const [inline] |
Get length in characters of the macro definition.
Definition at line 137 of file MacroInfo.h.
Referenced by clang::TokenLexer::Init().
| SourceLocation clang::MacroInfo::getDefinitionLoc | ( | ) | const [inline] |
getDefinitionLoc - Return the location that the macro was defined at.
Definition at line 127 of file MacroInfo.h.
Referenced by clang::Preprocessor::HandlePragmaPopMacro(), clang::PreprocessingRecord::MacroDefined(), and clang::Preprocessor::markMacroAsUsed().
| unsigned clang::MacroInfo::getNumArgs | ( | ) | const [inline] |
Definition at line 191 of file MacroInfo.h.
Referenced by clang::MacroArgs::getPreExpArgument(), clang::TokenLexer::Init(), and isIdenticalTo().
| unsigned clang::MacroInfo::getNumTokens | ( | ) | const [inline] |
getNumTokens - Return the number of tokens that this macro expands to.
Definition at line 249 of file MacroInfo.h.
Referenced by clang::Preprocessor::DumpMacro().
| const Token& clang::MacroInfo::getReplacementToken | ( | unsigned | Tok | ) | const [inline] |
Definition at line 253 of file MacroInfo.h.
Referenced by clang::Preprocessor::DumpMacro(), and isTrivialSingleTokenExpansion().
| SourceLocation clang::MacroInfo::getVisibilityLocation | ( | ) | [inline] |
Determine the location where this macro was explicitly made public or private within its module.
Definition at line 297 of file MacroInfo.h.
| bool clang::MacroInfo::hasChangedAfterLoad | ( | ) | const [inline] |
Determine whether this macro has changed since it was loaded from an AST file.
Definition at line 226 of file MacroInfo.h.
| bool clang::MacroInfo::isAllowRedefinitionsWithoutWarning | ( | ) | const [inline] |
isAllowRedefinitionsWithoutWarning - Return true if this macro can be redefined without warning.
Definition at line 238 of file MacroInfo.h.
| bool clang::MacroInfo::isBuiltinMacro | ( | ) | const [inline] |
isBuiltinMacro - Return true if this macro is a builtin macro, such as __LINE__, which requires processing before expansion.
Definition at line 216 of file MacroInfo.h.
Referenced by DoPrintMacros(), and clang::PreprocessingRecord::MacroExpands().
| bool clang::MacroInfo::isC99Varargs | ( | ) | const [inline] |
Definition at line 210 of file MacroInfo.h.
Referenced by clang::CodeCompletionResult::CreateCodeCompletionString(), and isIdenticalTo().
| bool clang::MacroInfo::isEnabled | ( | ) | const [inline] |
isEnabled - Return true if this macro is enabled: in other words, that we are not currently in an expansion of this macro.
Definition at line 273 of file MacroInfo.h.
Referenced by clang::MacroArgs::ArgNeedsPreexpansion(), and isTrivialSingleTokenExpansion().
| bool clang::MacroInfo::isFromAST | ( | ) | const [inline] |
isFromAST - Return true if this macro was loaded from an AST file.
Definition at line 219 of file MacroInfo.h.
| bool clang::MacroInfo::isFunctionLike | ( | ) | const [inline] |
Definition at line 204 of file MacroInfo.h.
Referenced by clang::MacroArgs::create(), clang::CodeCompletionResult::CreateCodeCompletionString(), clang::TokenLexer::Init(), isIdenticalTo(), and PrintMacroDefinition().
| bool clang::MacroInfo::isGNUVarargs | ( | ) | const [inline] |
Definition at line 211 of file MacroInfo.h.
Referenced by isIdenticalTo(), and PrintMacroDefinition().
| bool MacroInfo::isIdenticalTo | ( | const MacroInfo & | Other, |
| Preprocessor & | PP | ||
| ) | const |
isIdenticalTo - Return true if the specified macro definition is equal to this macro in spelling, arguments, and whitespace. This is used to emit duplicate definition warnings. This implements the rules in C99 6.10.3.
Definition at line 92 of file MacroInfo.cpp.
References arg_begin(), arg_end(), clang::Token::getIdentifierInfo(), clang::Token::getKind(), getNumArgs(), clang::Preprocessor::getSpelling(), clang::Token::hasLeadingSpace(), clang::Token::isAtStartOfLine(), isC99Varargs(), isFunctionLike(), and isGNUVarargs().
| bool clang::MacroInfo::isObjectLike | ( | ) | const [inline] |
Definition at line 205 of file MacroInfo.h.
Referenced by isTrivialSingleTokenExpansion().
| bool clang::MacroInfo::isPublic | ( | ) | const [inline] |
Determine whether this macro is part of the public API of its module.
Definition at line 293 of file MacroInfo.h.
| bool clang::MacroInfo::isUsed | ( | ) | const [inline] |
isUsed - Return false if this macro is defined in the main file and has not yet been used.
Definition at line 234 of file MacroInfo.h.
Referenced by clang::Preprocessor::markMacroAsUsed().
| bool clang::MacroInfo::isVariadic | ( | ) | const [inline] |
Definition at line 212 of file MacroInfo.h.
Referenced by clang::CodeCompletionResult::CreateCodeCompletionString().
| bool clang::MacroInfo::isWarnIfUnused | ( | ) | const [inline] |
Return true if we should emit a warning if the macro is unused.
Definition at line 243 of file MacroInfo.h.
Referenced by clang::Preprocessor::HandlePragmaPopMacro(), and clang::Preprocessor::markMacroAsUsed().
| void clang::MacroInfo::setArgumentList | ( | IdentifierInfo *const * | List, |
| unsigned | NumArgs, | ||
| llvm::BumpPtrAllocator & | PPAllocator | ||
| ) | [inline] |
setArgumentList - Set the specified list of identifiers as the argument list for this macro.
Definition at line 173 of file MacroInfo.h.
References NumArgs.
Referenced by MacroInfo(), and clang::ASTReader::ReadMacroRecord().
| void clang::MacroInfo::setChangedAfterLoad | ( | bool | CAL = true | ) | [inline] |
Note whether this macro has changed after it was loaded from an AST file.
Definition at line 230 of file MacroInfo.h.
| void clang::MacroInfo::setDefinitionEndLoc | ( | SourceLocation | EndLoc | ) | [inline] |
setDefinitionEndLoc - Set the location of the last token in the macro.
Definition at line 131 of file MacroInfo.h.
| void clang::MacroInfo::setIsAllowRedefinitionsWithoutWarning | ( | bool | Val | ) | [inline] |
setIsAllowRedefinitionsWithoutWarning - Set the value of the IsAllowRedefinitionsWithoutWarning flag.
Definition at line 162 of file MacroInfo.h.
Referenced by clang::Preprocessor::HandlePragmaPushMacro().
| void clang::MacroInfo::setIsBuiltinMacro | ( | bool | Val = true | ) | [inline] |
setIsBuiltinMacro - Set or clear the isBuiltinMacro flag.
Definition at line 150 of file MacroInfo.h.
Referenced by RegisterBuiltinMacro().
| void clang::MacroInfo::setIsC99Varargs | ( | ) | [inline] |
Varargs querying methods. This can only be set for function-like macros.
Definition at line 208 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
| void clang::MacroInfo::setIsFromAST | ( | bool | FromAST = true | ) | [inline] |
setIsFromAST - Set whether this macro was loaded from an AST file.
Definition at line 222 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
| void clang::MacroInfo::setIsFunctionLike | ( | ) | [inline] |
Function/Object-likeness. Keep track of whether this macro has formal parameters.
Definition at line 203 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
| void clang::MacroInfo::setIsGNUVarargs | ( | ) | [inline] |
Definition at line 209 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
| void clang::MacroInfo::setIsUsed | ( | bool | Val | ) | [inline] |
setIsUsed - Set the value of the IsUsed flag.
Definition at line 156 of file MacroInfo.h.
Referenced by clang::Preprocessor::markMacroAsUsed(), and clang::ASTReader::ReadMacroRecord().
| void clang::MacroInfo::setIsWarnIfUnused | ( | bool | val | ) | [inline] |
Set the value of the IsWarnIfUnused flag.
Definition at line 167 of file MacroInfo.h.
| void clang::MacroInfo::setVisibility | ( | bool | Public, |
| SourceLocation | Loc | ||
| ) | [inline] |
Set the export location for this macro.
Definition at line 286 of file MacroInfo.h.
Referenced by clang::ASTReader::ReadMacroRecord().
| tokens_iterator clang::MacroInfo::tokens_begin | ( | ) | const [inline] |
Definition at line 259 of file MacroInfo.h.
Referenced by clang::TokenLexer::Init(), and PrintMacroDefinition().
| bool clang::MacroInfo::tokens_empty | ( | ) | const [inline] |
Definition at line 261 of file MacroInfo.h.
Referenced by PrintMacroDefinition().
| tokens_iterator clang::MacroInfo::tokens_end | ( | ) | const [inline] |
Definition at line 260 of file MacroInfo.h.
Referenced by clang::TokenLexer::Init(), and PrintMacroDefinition().