diff options
Diffstat (limited to 'include/clang/Lex/PreprocessingRecord.h')
-rw-r--r-- | include/clang/Lex/PreprocessingRecord.h | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/include/clang/Lex/PreprocessingRecord.h b/include/clang/Lex/PreprocessingRecord.h index 2584340f6ec7..4609fe3c68f8 100644 --- a/include/clang/Lex/PreprocessingRecord.h +++ b/include/clang/Lex/PreprocessingRecord.h @@ -304,6 +304,9 @@ namespace clang { /// and are referenced by the iterator using negative indices. std::vector<PreprocessedEntity *> LoadedPreprocessedEntities; + /// \brief The set of ranges that were skipped by the preprocessor, + std::vector<SourceRange> SkippedRanges; + /// \brief Global (loaded or local) ID for a preprocessed entity. /// Negative values are used to indicate preprocessed entities /// loaded from the external source while non-negative values are used to @@ -400,7 +403,7 @@ namespace clang { typedef std::random_access_iterator_tag iterator_category; typedef int difference_type; - iterator() : Self(0), Position(0) { } + iterator() : Self(nullptr), Position(0) { } iterator(PreprocessingRecord *Self, int Position) : Self(Self), Position(Position) { } @@ -556,28 +559,32 @@ namespace clang { /// \brief Retrieve the macro definition that corresponds to the given /// \c MacroInfo. MacroDefinition *findMacroDefinition(const MacroInfo *MI); + + /// \brief Retrieve all ranges that got skipped while preprocessing. + const std::vector<SourceRange> &getSkippedRanges() const { + return SkippedRanges; + } private: - virtual void MacroExpands(const Token &Id, const MacroDirective *MD, - SourceRange Range, const MacroArgs *Args); - virtual void MacroDefined(const Token &Id, const MacroDirective *MD); - virtual void MacroUndefined(const Token &Id, const MacroDirective *MD); - virtual void InclusionDirective(SourceLocation HashLoc, - const Token &IncludeTok, - StringRef FileName, - bool IsAngled, - CharSourceRange FilenameRange, - const FileEntry *File, - StringRef SearchPath, - StringRef RelativePath, - const Module *Imported); - virtual void Ifdef(SourceLocation Loc, const Token &MacroNameTok, - const MacroDirective *MD); - virtual void Ifndef(SourceLocation Loc, const Token &MacroNameTok, - const MacroDirective *MD); + void MacroExpands(const Token &Id, const MacroDirective *MD, + SourceRange Range, const MacroArgs *Args) override; + void MacroDefined(const Token &Id, const MacroDirective *MD) override; + void MacroUndefined(const Token &Id, const MacroDirective *MD) override; + void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, + StringRef FileName, bool IsAngled, + CharSourceRange FilenameRange, + const FileEntry *File, StringRef SearchPath, + StringRef RelativePath, + const Module *Imported) override; + void Ifdef(SourceLocation Loc, const Token &MacroNameTok, + const MacroDirective *MD) override; + void Ifndef(SourceLocation Loc, const Token &MacroNameTok, + const MacroDirective *MD) override; /// \brief Hook called whenever the 'defined' operator is seen. - virtual void Defined(const Token &MacroNameTok, const MacroDirective *MD, - SourceRange Range); + void Defined(const Token &MacroNameTok, const MacroDirective *MD, + SourceRange Range) override; + + void SourceRangeSkipped(SourceRange Range) override; void addMacroExpansion(const Token &Id, const MacroInfo *MI, SourceRange Range); |