summaryrefslogtreecommitdiffstats
path: root/lib/AST/RawCommentList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/RawCommentList.cpp')
-rw-r--r--lib/AST/RawCommentList.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/lib/AST/RawCommentList.cpp b/lib/AST/RawCommentList.cpp
index c704cab..a5a3287 100644
--- a/lib/AST/RawCommentList.cpp
+++ b/lib/AST/RawCommentList.cpp
@@ -65,7 +65,7 @@ bool mergedCommentIsTrailingComment(StringRef Comment) {
RawComment::RawComment(const SourceManager &SourceMgr, SourceRange SR,
bool Merged) :
Range(SR), RawTextValid(false), BriefTextValid(false),
- IsAlmostTrailingComment(false),
+ IsAttached(false), IsAlmostTrailingComment(false),
BeginLineValid(false), EndLineValid(false) {
// Extract raw comment text, if possible.
if (SR.getBegin() == SR.getEnd() || getRawText(SourceMgr).empty()) {
@@ -87,16 +87,6 @@ RawComment::RawComment(const SourceManager &SourceMgr, SourceRange SR,
}
}
-const Decl *RawComment::getDecl() const {
- if (DeclOrParsedComment.isNull())
- return NULL;
-
- if (const Decl *D = DeclOrParsedComment.dyn_cast<const Decl *>())
- return D;
-
- return DeclOrParsedComment.get<comments::FullComment *>()->getDecl();
-}
-
unsigned RawComment::getBeginLine(const SourceManager &SM) const {
if (BeginLineValid)
return BeginLine;
@@ -169,7 +159,8 @@ const char *RawComment::extractBriefText(const ASTContext &Context) const {
return BriefTextPtr;
}
-comments::FullComment *RawComment::parse(const ASTContext &Context) const {
+comments::FullComment *RawComment::parse(const ASTContext &Context,
+ const Decl *D) const {
// Make sure that RawText is valid.
getRawText(Context.getSourceManager());
@@ -179,13 +170,11 @@ comments::FullComment *RawComment::parse(const ASTContext &Context) const {
RawText.begin(), RawText.end());
comments::Sema S(Context.getAllocator(), Context.getSourceManager(),
Context.getDiagnostics(), Traits);
- S.setDecl(getDecl());
+ S.setDecl(D);
comments::Parser P(L, S, Context.getAllocator(), Context.getSourceManager(),
Context.getDiagnostics(), Traits);
- comments::FullComment *FC = P.parseFullComment();
- DeclOrParsedComment = FC;
- return FC;
+ return P.parseFullComment();
}
namespace {
OpenPOWER on IntegriCloud