================ @@ -16191,12 +16191,24 @@ static void AnalyzeImplicitConversions( BO->getRHS()->isKnownToHaveBooleanValue() && BO->getLHS()->HasSideEffects(S.Context) && BO->getRHS()->HasSideEffects(S.Context)) { - S.Diag(BO->getBeginLoc(), diag::warn_bitwise_instead_of_logical) - << (BO->getOpcode() == BO_And ? "&" : "|") << OrigE->getSourceRange() - << FixItHint::CreateReplacement( - BO->getOperatorLoc(), - (BO->getOpcode() == BO_And ? "&&" : "||")); - S.Diag(BO->getBeginLoc(), diag::note_cast_operand_to_int); + clang::SourceManager &SM = S.getSourceManager(); + clang::LangOptions LO = S.getLangOpts(); + clang::SourceLocation BLoc = BO->getOperatorLoc(); + clang::SourceLocation ELoc = + clang::Lexer::getLocForEndOfToken(BLoc, 0, SM, LO); + llvm::StringRef SR = clang::Lexer::getSourceText( + clang::CharSourceRange::getTokenRange(BLoc, ELoc), SM, LO); ---------------- AaronBallman wrote:
```suggestion SourceManager &SM = S.getSourceManager(); const LangOptions &LO = S.getLangOpts(); SourceLocation BLoc = BO->getOperatorLoc(); SourceLocation ELoc = Lexer::getLocForEndOfToken(BLoc, 0, SM, LO); StringRef SR = Lexer::getSourceText( CharSourceRange::getTokenRange(BLoc, ELoc), SM, LO); ``` You shouldn't need to fully qualify any of these from here. Also, no need to copy the `LangOptions` object. https://github.com/llvm/llvm-project/pull/81976 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits