I'd like to use RedundantStringCStrCheck's formatDereference function
from the up-coming modernize-use-std-print check. Let's move it to
FixItHintUtils so that the implementation can be shared.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM, code compiles locally, restarted CI job (maybe will pass).
Add [NFC] to change title before committing as this changes does not impact functionality.
clang-tools-extra/clang-tidy/utils/FixItHintUtils.cpp | ||
---|---|---|
230 | NOTE: make this internal function static so it would have internal linkage. |
Comment Actions
Looks like there is missing dependency in CMake:
https://lab.llvm.org/buildbot/#/builders/57/builds/27531
FAILED: lib/libclangTidyUtils.so.17git : && /home/buildbots/clang.15.0.4/bin/clang++ --gcc-toolchain=/usr -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics -Wl,--gc-sections -shared -Wl,-soname,libclangTidyUtils.so.17git -o lib/libclangTidyUtils.so.17git tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/Aliasing.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/ASTUtils.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/DeclRefExprUtils.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/ExceptionAnalyzer.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/ExceptionSpecAnalyzer.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/ExprSequence.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/FileExtensionsUtils.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/FixItHintUtils.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/HeaderGuard.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/IncludeInserter.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/IncludeSorter.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/LexerUtils.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/NamespaceAliaser.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/OptionsUtils.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/RenamerClangTidyCheck.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/TransformerClangTidyCheck.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/TypeTraits.cpp.o tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/UsingInserter.cpp.o -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbots/docker-RHEL84-buildbot/SetupBot/worker_env/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib:" lib/libclangTidy.so.17git lib/libclangTransformer.so.17git lib/libclangSema.so.17git lib/libclangASTMatchers.so.17git lib/libclangAST.so.17git lib/libLLVMFrontendOpenMP.so.17git lib/libclangLex.so.17git lib/libclangBasic.so.17git lib/libLLVMSupport.so.17git -Wl,-rpath-link,/home/buildbots/docker-RHEL84-buildbot/SetupBot/worker_env/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib && : ld.lld: error: undefined symbol: clang::tooling::fixit::internal::getText(clang::CharSourceRange, clang::ASTContext const&) >>> referenced by FixItHintUtils.cpp >>> tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/FixItHintUtils.cpp.o:(clang::tidy::utils::fixit::formatDereference[abi:cxx11](clang::Expr const&, clang::ASTContext const&)) >>> referenced by FixItHintUtils.cpp >>> tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/FixItHintUtils.cpp.o:(clang::tidy::utils::fixit::formatDereference[abi:cxx11](clang::Expr const&, clang::ASTContext const&)) clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
Comment Actions
Add clangTooling to LINK_LIBS for tooling::fixit::getText for clangTidyUtils to fix failure to build with BUILD_SHARED_LIBS=ON:
ld.lld: error: undefined symbol: clang::tooling::fixit::internal::getText(clang::CharSourceRange, clang::ASTContext const&) >>> referenced by FixItHintUtils.cpp >>> tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/FixItHintUtils.cpp.o:(clang::tidy::utils::fixit::formatDereference[abi:cxx11](clang::Expr const&, clang::ASTContext const&)) >>> referenced by FixItHintUtils.cpp >>> tools/clang/tools/extra/clang-tidy/utils/CMakeFiles/obj.clangTidyUtils.dir/FixItHintUtils.cpp.o:(clang::tidy::utils::fixit::formatDereference[abi:cxx11](clang::Expr const&, clang::ASTContext const&))
I've no idea whether this is a sensible solution, but it does seem to work in my testing.