aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/ASTContext.h
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2012-06-20 00:34:58 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2012-06-20 00:34:58 +0000
commitaa0cd85838f2a024e589ea4e8c2094130065af21 (patch)
treeb4e013c1268210fa0769c263d702c637395b59ae /include/clang/AST/ASTContext.h
parented36b2a80878c29603bdc89a7969253fb6446174 (diff)
Structured comment parsing, first step.
* Retain comments in the AST * Serialize/deserialize comments * Find comments attached to a certain Decl * Expose raw comment text and SourceRange via libclang git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158771 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/ASTContext.h')
-rw-r--r--include/clang/AST/ASTContext.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index 6ceed17eb8..172ac88edf 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -27,6 +27,7 @@
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/AST/CanonicalType.h"
+#include "clang/Comments/RawCommentList.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -51,7 +52,6 @@ namespace clang {
class ASTMutationListener;
class IdentifierTable;
class SelectorTable;
- class SourceManager;
class TargetInfo;
class CXXABI;
// Decls
@@ -418,6 +418,30 @@ public:
return FullSourceLoc(Loc,SourceMgr);
}
+ /// \brief All comments in this translation unit.
+ RawCommentList Comments;
+
+ /// \brief True if comments are already loaded from ExternalASTSource.
+ mutable bool CommentsLoaded;
+
+ /// \brief Mapping from declarations to their comments (stored within
+ /// Comments list), once we have already looked up the comment associated
+ /// with a given declaration.
+ mutable llvm::DenseMap<const Decl *, const RawComment *> DeclComments;
+
+ /// \brief Return the Doxygen-style comment attached to a given declaration,
+ /// without looking into cache.
+ const RawComment *getRawCommentForDeclNoCache(const Decl *D) const;
+
+public:
+ void addComment(const RawComment &RC) {
+ Comments.addComment(RC, *this);
+ }
+
+ /// \brief Return the Doxygen-style comment attached to a given declaration.
+ /// Returns NULL if no comment is attached.
+ const RawComment *getRawCommentForDecl(const Decl *D) const;
+
/// \brief Retrieve the attributes for the given declaration.
AttrVec& getDeclAttrs(const Decl *D);