diff options
-rw-r--r-- | include/clang/AST/RawCommentList.h | 4 | ||||
-rw-r--r-- | lib/AST/ASTContext.cpp | 2 | ||||
-rw-r--r-- | lib/AST/RawCommentList.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/include/clang/AST/RawCommentList.h b/include/clang/AST/RawCommentList.h index 666a3e6859..0f9b18b32b 100644 --- a/include/clang/AST/RawCommentList.h +++ b/include/clang/AST/RawCommentList.h @@ -129,9 +129,9 @@ class BeforeThanCompare<RawComment> { public: explicit BeforeThanCompare(const SourceManager &SM) : SM(SM) { } - bool operator()(const RawComment &LHS, const SourceRange &RHS) { + bool operator()(const RawComment &LHS, const RawComment &RHS) { return SM.isBeforeInTranslationUnit(LHS.getSourceRange().getBegin(), - RHS.getBegin()); + RHS.getSourceRange().getBegin()); } }; diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 9f8578bafe..23751a56f2 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -81,7 +81,7 @@ const RawComment *ASTContext::getRawCommentForDeclNoCache(const Decl *D) const { ArrayRef<RawComment>::iterator Comment = std::lower_bound(RawComments.begin(), RawComments.end(), - SourceRange(DeclLoc), + RawComment(SourceMgr, SourceRange(DeclLoc)), BeforeThanCompare<RawComment>(SourceMgr)); // Decompose the location for the declaration and find the beginning of the diff --git a/lib/AST/RawCommentList.cpp b/lib/AST/RawCommentList.cpp index 1baa9b87eb..f32e628caa 100644 --- a/lib/AST/RawCommentList.cpp +++ b/lib/AST/RawCommentList.cpp @@ -60,7 +60,7 @@ RawComment::RawComment(const SourceManager &SourceMgr, SourceRange SR, Range(SR), RawTextValid(false), IsAlmostTrailingComment(false), BeginLineValid(false), EndLineValid(false) { // Extract raw comment text, if possible. - if (getRawText(SourceMgr).empty()) { + if (SR.getBegin() == SR.getEnd() || getRawText(SourceMgr).empty()) { Kind = CK_Invalid; return; } |