|
@@ -10,6 +10,7 @@
|
|
#ifndef LLVM_CLANG_AST_RAW_COMMENT_LIST_H
|
|
#ifndef LLVM_CLANG_AST_RAW_COMMENT_LIST_H
|
|
#define LLVM_CLANG_AST_RAW_COMMENT_LIST_H
|
|
#define LLVM_CLANG_AST_RAW_COMMENT_LIST_H
|
|
|
|
|
|
|
|
+#include "clang/Basic/CommentOptions.h"
|
|
#include "clang/Basic/SourceManager.h"
|
|
#include "clang/Basic/SourceManager.h"
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
|
|
|
|
@@ -40,7 +41,7 @@ public:
|
|
RawComment() : Kind(RCK_Invalid), IsAlmostTrailingComment(false) { }
|
|
RawComment() : Kind(RCK_Invalid), IsAlmostTrailingComment(false) { }
|
|
|
|
|
|
RawComment(const SourceManager &SourceMgr, SourceRange SR,
|
|
RawComment(const SourceManager &SourceMgr, SourceRange SR,
|
|
- bool Merged = false);
|
|
|
|
|
|
+ bool Merged, bool ParseAllComments);
|
|
|
|
|
|
CommentKind getKind() const LLVM_READONLY {
|
|
CommentKind getKind() const LLVM_READONLY {
|
|
return (CommentKind) Kind;
|
|
return (CommentKind) Kind;
|
|
@@ -82,12 +83,18 @@ public:
|
|
|
|
|
|
/// Returns true if this comment is not a documentation comment.
|
|
/// Returns true if this comment is not a documentation comment.
|
|
bool isOrdinary() const LLVM_READONLY {
|
|
bool isOrdinary() const LLVM_READONLY {
|
|
- return (Kind == RCK_OrdinaryBCPL) || (Kind == RCK_OrdinaryC);
|
|
|
|
|
|
+ return ((Kind == RCK_OrdinaryBCPL) || (Kind == RCK_OrdinaryC)) &&
|
|
|
|
+ !ParseAllComments;
|
|
}
|
|
}
|
|
|
|
|
|
/// Returns true if this comment any kind of a documentation comment.
|
|
/// Returns true if this comment any kind of a documentation comment.
|
|
bool isDocumentation() const LLVM_READONLY {
|
|
bool isDocumentation() const LLVM_READONLY {
|
|
- return !isInvalid() && !isOrdinary();
|
|
|
|
|
|
+ return !isInvalid() && (!isOrdinary() || ParseAllComments);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// Returns whether we are parsing all comments.
|
|
|
|
+ bool isParseAllComments() const LLVM_READONLY {
|
|
|
|
+ return ParseAllComments;
|
|
}
|
|
}
|
|
|
|
|
|
/// Returns raw comment text with comment markers.
|
|
/// Returns raw comment text with comment markers.
|
|
@@ -135,6 +142,10 @@ private:
|
|
bool IsTrailingComment : 1;
|
|
bool IsTrailingComment : 1;
|
|
bool IsAlmostTrailingComment : 1;
|
|
bool IsAlmostTrailingComment : 1;
|
|
|
|
|
|
|
|
+ /// When true, ordinary comments starting with "//" and "/*" will be
|
|
|
|
+ /// considered as documentation comments.
|
|
|
|
+ bool ParseAllComments : 1;
|
|
|
|
+
|
|
mutable bool BeginLineValid : 1; ///< True if BeginLine is valid
|
|
mutable bool BeginLineValid : 1; ///< True if BeginLine is valid
|
|
mutable bool EndLineValid : 1; ///< True if EndLine is valid
|
|
mutable bool EndLineValid : 1; ///< True if EndLine is valid
|
|
mutable unsigned BeginLine; ///< Cached line number
|
|
mutable unsigned BeginLine; ///< Cached line number
|
|
@@ -142,10 +153,12 @@ private:
|
|
|
|
|
|
/// \brief Constructor for AST deserialization.
|
|
/// \brief Constructor for AST deserialization.
|
|
RawComment(SourceRange SR, CommentKind K, bool IsTrailingComment,
|
|
RawComment(SourceRange SR, CommentKind K, bool IsTrailingComment,
|
|
- bool IsAlmostTrailingComment) :
|
|
|
|
|
|
+ bool IsAlmostTrailingComment,
|
|
|
|
+ bool ParseAllComments) :
|
|
Range(SR), RawTextValid(false), BriefTextValid(false), Kind(K),
|
|
Range(SR), RawTextValid(false), BriefTextValid(false), Kind(K),
|
|
IsAttached(false), IsTrailingComment(IsTrailingComment),
|
|
IsAttached(false), IsTrailingComment(IsTrailingComment),
|
|
IsAlmostTrailingComment(IsAlmostTrailingComment),
|
|
IsAlmostTrailingComment(IsAlmostTrailingComment),
|
|
|
|
+ ParseAllComments(ParseAllComments),
|
|
BeginLineValid(false), EndLineValid(false)
|
|
BeginLineValid(false), EndLineValid(false)
|
|
{ }
|
|
{ }
|
|
|
|
|
|
@@ -207,4 +220,3 @@ private:
|
|
} // end namespace clang
|
|
} // end namespace clang
|
|
|
|
|
|
#endif
|
|
#endif
|
|
-
|
|
|