|
clang
5.0.0
|
Records preprocessor conditional directive regions and allows querying in which region source locations belong to. More...
#include "clang/Lex/PPConditionalDirectiveRecord.h"
Public Member Functions | |
| PPConditionalDirectiveRecord (SourceManager &SM) | |
| Construct a new preprocessing record. More... | |
| size_t | getTotalMemory () const |
| SourceManager & | getSourceManager () const |
| bool | rangeIntersectsConditionalDirective (SourceRange Range) const |
| Returns true if the given range intersects with a conditional directive. More... | |
| bool | areInDifferentConditionalDirectiveRegion (SourceLocation LHS, SourceLocation RHS) const |
| Returns true if the given locations are in different regions, separated by conditional directive blocks. More... | |
| SourceLocation | findConditionalDirectiveRegionLoc (SourceLocation Loc) const |
Public Member Functions inherited from clang::PPCallbacks | |
| virtual | ~PPCallbacks () |
| virtual void | FileChanged (SourceLocation Loc, FileChangeReason Reason, SrcMgr::CharacteristicKind FileType, FileID PrevFID=FileID()) |
| Callback invoked whenever a source file is entered or exited. More... | |
| virtual void | FileSkipped (const FileEntry &SkippedFile, const Token &FilenameTok, SrcMgr::CharacteristicKind FileType) |
| Callback invoked whenever a source file is skipped as the result of header guard optimization. More... | |
| virtual bool | FileNotFound (StringRef FileName, SmallVectorImpl< char > &RecoveryPath) |
| Callback invoked whenever an inclusion directive results in a file-not-found error. More... | |
| virtual void | InclusionDirective (SourceLocation HashLoc, const Token &IncludeTok, StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File, StringRef SearchPath, StringRef RelativePath, const Module *Imported) |
Callback invoked whenever an inclusion directive of any kind (#include, #import, etc.) has been processed, regardless of whether the inclusion will actually result in an inclusion. More... | |
| virtual void | moduleImport (SourceLocation ImportLoc, ModuleIdPath Path, const Module *Imported) |
| Callback invoked whenever there was an explicit module-import syntax. More... | |
| virtual void | EndOfMainFile () |
| Callback invoked when the end of the main file is reached. More... | |
| virtual void | Ident (SourceLocation Loc, StringRef str) |
| Callback invoked when a #ident or #sccs directive is read. More... | |
| virtual void | PragmaDirective (SourceLocation Loc, PragmaIntroducerKind Introducer) |
| Callback invoked when start reading any pragma directive. More... | |
| virtual void | PragmaComment (SourceLocation Loc, const IdentifierInfo *Kind, StringRef Str) |
| Callback invoked when a #pragma comment directive is read. More... | |
| virtual void | PragmaDetectMismatch (SourceLocation Loc, StringRef Name, StringRef Value) |
| Callback invoked when a #pragma detect_mismatch directive is read. More... | |
| virtual void | PragmaDebug (SourceLocation Loc, StringRef DebugType) |
| Callback invoked when a #pragma clang __debug directive is read. More... | |
| virtual void | PragmaMessage (SourceLocation Loc, StringRef Namespace, PragmaMessageKind Kind, StringRef Str) |
| Callback invoked when a #pragma message directive is read. More... | |
| virtual void | PragmaDiagnosticPush (SourceLocation Loc, StringRef Namespace) |
| Callback invoked when a #pragma gcc diagnostic push directive is read. More... | |
| virtual void | PragmaDiagnosticPop (SourceLocation Loc, StringRef Namespace) |
| Callback invoked when a #pragma gcc diagnostic pop directive is read. More... | |
| virtual void | PragmaDiagnostic (SourceLocation Loc, StringRef Namespace, diag::Severity mapping, StringRef Str) |
| Callback invoked when a #pragma gcc diagnostic directive is read. More... | |
| virtual void | PragmaOpenCLExtension (SourceLocation NameLoc, const IdentifierInfo *Name, SourceLocation StateLoc, unsigned State) |
| Called when an OpenCL extension is either disabled or enabled with a pragma. More... | |
| virtual void | PragmaWarning (SourceLocation Loc, StringRef WarningSpec, ArrayRef< int > Ids) |
| Callback invoked when a #pragma warning directive is read. More... | |
| virtual void | PragmaWarningPush (SourceLocation Loc, int Level) |
| Callback invoked when a #pragma warning(push) directive is read. More... | |
| virtual void | PragmaWarningPop (SourceLocation Loc) |
| Callback invoked when a #pragma warning(pop) directive is read. More... | |
| virtual void | MacroExpands (const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range, const MacroArgs *Args) |
| Called by Preprocessor::HandleMacroExpandedIdentifier when a macro invocation is found. More... | |
| virtual void | MacroDefined (const Token &MacroNameTok, const MacroDirective *MD) |
| Hook called whenever a macro definition is seen. More... | |
| virtual void | MacroUndefined (const Token &MacroNameTok, const MacroDefinition &MD, const MacroDirective *Undef) |
| Hook called whenever a macro #undef is seen. More... | |
| virtual void | Defined (const Token &MacroNameTok, const MacroDefinition &MD, SourceRange Range) |
| Hook called whenever the 'defined' operator is seen. More... | |
| virtual void | SourceRangeSkipped (SourceRange Range) |
| Hook called when a source range is skipped. More... | |
Additional Inherited Members | |
Public Types inherited from clang::PPCallbacks | |
| enum | FileChangeReason { EnterFile, ExitFile, SystemHeaderPragma, RenameFile } |
| enum | PragmaMessageKind { PMK_Message, PMK_Warning, PMK_Error } |
| Determines the kind of #pragma invoking a call to PragmaMessage. More... | |
| enum | ConditionValueKind { CVK_NotEvaluated, CVK_False, CVK_True } |
Records preprocessor conditional directive regions and allows querying in which region source locations belong to.
Definition at line 26 of file PPConditionalDirectiveRecord.h.
|
explicit |
Construct a new preprocessing record.
Definition at line 19 of file PPConditionalDirectiveRecord.cpp.
|
inline |
Returns true if the given locations are in different regions, separated by conditional directive blocks.
Definition at line 80 of file PPConditionalDirectiveRecord.h.
References findConditionalDirectiveRegionLoc().
Referenced by clang::edit::Commit::insertFromRange().
| SourceLocation PPConditionalDirectiveRecord::findConditionalDirectiveRegionLoc | ( | SourceLocation | Loc | ) | const |
Definition at line 48 of file PPConditionalDirectiveRecord.cpp.
References clang::SourceManager::isBeforeInTranslationUnit(), and clang::SourceLocation::isInvalid().
Referenced by areInDifferentConditionalDirectiveRegion().
|
inline |
Definition at line 71 of file PPConditionalDirectiveRecord.h.
| size_t PPConditionalDirectiveRecord::getTotalMemory | ( | ) | const |
Definition at line 120 of file PPConditionalDirectiveRecord.cpp.
| bool PPConditionalDirectiveRecord::rangeIntersectsConditionalDirective | ( | SourceRange | Range | ) | const |
Returns true if the given range intersects with a conditional directive.
if a #if/#endif block is fully contained within the range, this function will return false.
Definition at line 24 of file PPConditionalDirectiveRecord.cpp.
References clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::SourceManager::isBeforeInTranslationUnit(), and clang::SourceRange::isInvalid().
1.8.6