diff options
Diffstat (limited to 'include/clang/Lex/MacroInfo.h')
-rw-r--r-- | include/clang/Lex/MacroInfo.h | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h index 5887041..90f95b7 100644 --- a/include/clang/Lex/MacroInfo.h +++ b/include/clang/Lex/MacroInfo.h @@ -62,6 +62,9 @@ class MacroInfo { /// it has not yet been redefined or undefined. bool IsBuiltinMacro : 1; + /// IsFromAST - True if this macro was loaded from an AST file. + bool IsFromAST : 1; + private: //===--------------------------------------------------------------------===// // State that changes as the macro is used. @@ -76,24 +79,28 @@ private: /// emit -Wunused-macros diagnostics. bool IsUsed : 1; - ~MacroInfo() { + /// AllowRedefinitionsWithoutWarning - True if this macro can be redefined + /// without emitting a warning. + bool IsAllowRedefinitionsWithoutWarning : 1; + + ~MacroInfo() { assert(ArgumentList == 0 && "Didn't call destroy before dtor!"); } public: MacroInfo(SourceLocation DefLoc); - + MacroInfo(const MacroInfo &MI, llvm::BumpPtrAllocator &PPAllocator); + /// FreeArgumentList - Free the argument list of the macro, restoring it to a /// state where it can be reused for other devious purposes. - void FreeArgumentList(llvm::BumpPtrAllocator &PPAllocator) { - PPAllocator.Deallocate(ArgumentList); + void FreeArgumentList() { ArgumentList = 0; NumArguments = 0; } /// Destroy - destroy this MacroInfo object. - void Destroy(llvm::BumpPtrAllocator &PPAllocator) { - FreeArgumentList(PPAllocator); + void Destroy() { + FreeArgumentList(); this->~MacroInfo(); } @@ -125,6 +132,12 @@ public: IsUsed = Val; } + /// setIsAllowRedefinitionsWithoutWarning - Set the value of the + /// IsAllowRedefinitionsWithoutWarning flag. + void setIsAllowRedefinitionsWithoutWarning(bool Val) { + IsAllowRedefinitionsWithoutWarning = Val; + } + /// setArgumentList - Set the specified list of identifiers as the argument /// list for this macro. void setArgumentList(IdentifierInfo* const *List, unsigned NumArgs, @@ -172,10 +185,22 @@ public: /// __LINE__, which requires processing before expansion. bool isBuiltinMacro() const { return IsBuiltinMacro; } + /// isFromAST - Return true if this macro was loaded from an AST file. + bool isFromAST() const { return IsFromAST; } + + /// setIsFromAST - Set whether this macro was loaded from an AST file. + void setIsFromAST(bool FromAST = true) { IsFromAST = FromAST; } + /// isUsed - Return false if this macro is defined in the main file and has /// not yet been used. bool isUsed() const { return IsUsed; } + /// isAllowRedefinitionsWithoutWarning - Return true if this macro can be + /// redefined without warning. + bool isAllowRedefinitionsWithoutWarning() const { + return IsAllowRedefinitionsWithoutWarning; + } + /// getNumTokens - Return the number of tokens that this macro expands to. /// unsigned getNumTokens() const { |