diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:09 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:09 +0000 |
commit | 519fc96c475680de2cc49e7811dbbfadb912cbcc (patch) | |
tree | 310ca684459b7e9ae13c9a3b9abf308b3a634afe /include/clang/AST/RawCommentList.h | |
parent | 2298981669bf3bd63335a4be179bc0f96823a8f4 (diff) |
Notes
Diffstat (limited to 'include/clang/AST/RawCommentList.h')
-rw-r--r-- | include/clang/AST/RawCommentList.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/include/clang/AST/RawCommentList.h b/include/clang/AST/RawCommentList.h index 5dc8694e77e94..1eea56dee6223 100644 --- a/include/clang/AST/RawCommentList.h +++ b/include/clang/AST/RawCommentList.h @@ -10,8 +10,11 @@ #define LLVM_CLANG_AST_RAWCOMMENTLIST_H #include "clang/Basic/CommentOptions.h" +#include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseMap.h" +#include <map> namespace clang { @@ -196,17 +199,25 @@ public: void addComment(const RawComment &RC, const CommentOptions &CommentOpts, llvm::BumpPtrAllocator &Allocator); - ArrayRef<RawComment *> getComments() const { - return Comments; - } + /// \returns A mapping from an offset of the start of the comment to the + /// comment itself, or nullptr in case there are no comments in \p File. + const std::map<unsigned, RawComment *> *getCommentsInFile(FileID File) const; + + bool empty() const; + + unsigned getCommentBeginLine(RawComment *C, FileID File, + unsigned Offset) const; + unsigned getCommentEndOffset(RawComment *C) const; private: SourceManager &SourceMgr; - std::vector<RawComment *> Comments; - - void addDeserializedComments(ArrayRef<RawComment *> DeserializedComments); + // mapping: FileId -> comment begin offset -> comment + llvm::DenseMap<FileID, std::map<unsigned, RawComment *>> OrderedComments; + mutable llvm::DenseMap<RawComment *, unsigned> CommentBeginLine; + mutable llvm::DenseMap<RawComment *, unsigned> CommentEndOffset; friend class ASTReader; + friend class ASTWriter; }; } // end namespace clang |