From: Dmitri Gribenko Date: Thu, 21 Jun 2012 21:02:45 +0000 (+0000) Subject: VC9 does not like heterogenous compare function objects. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9530a8bf275f91f95147e1fb205dc85bea1ae45c;p=clang VC9 does not like heterogenous compare function objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158936 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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 { 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::iterator Comment = std::lower_bound(RawComments.begin(), RawComments.end(), - SourceRange(DeclLoc), + RawComment(SourceMgr, SourceRange(DeclLoc)), BeforeThanCompare(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; }