Skip to content

Clang-Tidy fails when I include PQXX library #139286

Open
@cla-db

Description

@cla-db

My project uses clang-tidy with no issues. Recently I added to PQXX library (https://pqxx.org/libpqxx/) to connect to a Postgres database and since then clang-tidy fails.

I can confirm that simply including the library causes the failure, no matter what the code does with that library (even nothing).

Steps to reproduce:

  1. Instal the PQXX library on the system
  2. Add #include <pqxx/pqxx> to a .cpp file
  3. Run clang-tidy on that file

Stack trace:

0. Program arguments: clang-tidy --extra-arg-before=--driver-mode=g++ /home/claudio/dev/HOS/data_reader/src/process_variables.cpp -- /usr/bin/c++ -I/usr/include/postgresql -I/home/claudio/dev/HOS/data_reader/src -std=c++20 -std=gnu++20 -Wall -Wextra -Wpedantic -Werror -MD -MT CMakeFiles/data_reader.dir/src/process_variables.cpp.o -MF CMakeFiles/data_reader.dir/src/process_variables.cpp.o.d -o CMakeFiles/data_reader.dir/src/process_variables.cpp.o -c /home/claudio/dev/HOS/data_reader/src/process_variables.cpp
1.      <eof> parser at end of file
2.      ASTMatcher: Processing 'altera-id-dependent-backward-branch' against:
        WhileStmt : </usr/include/pqxx/internal/encodings.hxx:219:3, line:220:51>
--- Bound Nodes Begin ---
    backward_branch - { WhileStmt : </usr/include/pqxx/internal/encodings.hxx:219:3, line:220:51> }
    cond_expr - { CXXFoldExpr : </usr/include/pqxx/internal/encodings.hxx:219:10, col:41> }
--- Bound Nodes End ---
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM.so.18.1      0x00007fe015f623bf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 63
1  libLLVM.so.18.1      0x00007fe015f604f9 llvm::sys::RunSignalHandlers() + 89
2  libLLVM.so.18.1      0x00007fe015f62b00
3  libc.so.6            0x00007fe014c80330
4  clang-tidy           0x00005577373c7d80 clang::tidy::altera::IdDependentBackwardBranchCheck::hasIdDepVar(clang::Expr const*) + 224
5  clang-tidy           0x00005577373c90eb clang::tidy::altera::IdDependentBackwardBranchCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) + 715
6  clang-tidy           0x00005577379a9f15
7  clang-tidy           0x00005577379dd00c clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) + 156
8  clang-tidy           0x00005577379a965f
9  clang-tidy           0x00005577379d3d91
10 clang-tidy           0x00005577379bb623
11 clang-tidy           0x00005577379dbfa2
12 clang-tidy           0x00005577379af586
13 clang-tidy           0x00005577379ac66f
14 clang-tidy           0x00005577379b2ec1
15 clang-tidy           0x00005577379aca17
16 clang-tidy           0x00005577379ae96b
17 clang-tidy           0x00005577379ac747
18 clang-tidy           0x00005577379ae96b
19 clang-tidy           0x00005577379ac747
20 clang-tidy           0x00005577379d96eb
21 clang-tidy           0x00005577379acb89
22 clang-tidy           0x00005577379ac213
23 clang-tidy           0x000055773797e825 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) + 709
24 libclang-cpp.so.18.1 0x00007fe01f209fbc clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 44
25 libclang-cpp.so.18.1 0x00007fe01d35e3d6 clang::ParseAST(clang::Sema&, bool, bool) + 598
26 libclang-cpp.so.18.1 0x00007fe01f1cd62c clang::FrontendAction::Execute() + 92
27 libclang-cpp.so.18.1 0x00007fe01f14a0b4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 708
28 libclang-cpp.so.18.1 0x00007fe01f3c16b9 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) + 425
29 clang-tidy           0x0000557737ffdab3
30 libclang-cpp.so.18.1 0x00007fe01f3c1414 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) + 292
31 libclang-cpp.so.18.1 0x00007fe01f3c017f clang::tooling::ToolInvocation::run() + 1231
32 libclang-cpp.so.18.1 0x00007fe01f3c31c1 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) + 5041
33 clang-tidy           0x0000557737ff9d9b clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, clang::tooling::CompilationDatabase const&, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, bool, llvm::StringRef) + 1083
34 clang-tidy           0x0000557737379c65 clang::tidy::clangTidyMain(int, char const**) + 10005
35 libc.so.6            0x00007fe014c651ca
36 libc.so.6            0x00007fe014c6528b __libc_start_main + 139
37 clang-tidy           0x0000557737374fe5 _start + 37
Segmentation fault

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-tidycrashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions