================ @@ -119,14 +122,55 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { return; } - PrintingPolicy PrintPolicy(getLangOpts()); - PrintPolicy.SuppressScope = true; - PrintPolicy.ConstantArraySizeAsWritten = true; - PrintPolicy.UseVoidForZeroParams = false; - PrintPolicy.PrintInjectedClassNameWithArguments = false; + const TypeLoc TL = MatchedDecl->getTypeSourceInfo()->getTypeLoc(); + + auto [Type, QualifierStr] = [MatchedDecl, &Result, this, + &TL]() -> std::pair<std::string, std::string> { + SourceRange TypeRange = TL.getSourceRange(); + + // Function pointer case, get the left and right side of the identifier + // without the identifier. + if (TypeRange.fullyContains(MatchedDecl->getLocation())) { + return {(Lexer::getSourceText( + CharSourceRange::getCharRange(TL.getBeginLoc(), + MatchedDecl->getLocation()), + *Result.SourceManager, getLangOpts()) + + Lexer::getSourceText( + CharSourceRange::getCharRange( + Lexer::getLocForEndOfToken(MatchedDecl->getLocation(), 0, + *Result.SourceManager, + getLangOpts()), + Lexer::getLocForEndOfToken(TL.getEndLoc(), 0, + *Result.SourceManager, + getLangOpts())), + *Result.SourceManager, getLangOpts())) + .str(), + ""}; + } ---------------- 5chmidti wrote:
Is something like this what you had in mind? https://github.com/llvm/llvm-project/pull/113837 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits