Skip to content

Improve perfs for large databases#5

Merged
ebrocas merged 12 commits into
mainfrom
dev
Jun 19, 2026
Merged

Improve perfs for large databases#5
ebrocas merged 12 commits into
mainfrom
dev

Conversation

@ebrocas

@ebrocas ebrocas commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

ebrocas added 12 commits June 19, 2026 13:54
Signed-off-by: Eloïse Brocas <ebrocas@quarkslab.com>
Signed-off-by: Eloïse Brocas <ebrocas@quarkslab.com>
Signed-off-by: Eloïse Brocas <ebrocas@quarkslab.com>
Signed-off-by: Eloïse Brocas <ebrocas@quarkslab.com>
The C/C++ indexer back-end (inherited from Sourcetrail) used several
clang AST APIs that were removed or changed up to and including LLVM 19,
so it no longer compiled once BUILD_CXX_LANGUAGE_PACKAGE was enabled.
Port it to LLVM/Clang 19 (the default toolchain on Debian trixie):

- ClangInvocationInfo: <llvm/Support/Host.h> moved to
  <llvm/TargetParser/Host.h>.
- CxxDeclNameResolver: NamespaceDecl::getOriginalNamespace() removed;
  use the equivalent getCanonicalDecl().
- CxxAstVisitor: TemplateTypeParmDecl::getDefaultArgumentInfo() removed;
  the default argument is now a TemplateArgumentLoc, so use
  getDefaultArgument().getTypeSourceInfo() with a null guard.
- CxxAstVisitor: ClassTemplateSpecializationDecl::getTypeAsWritten()
  removed; iterate getTemplateArgsAsWritten()->arguments() directly.
- utilityClang: the TagTypeKind enumerators became an enum class
  (TTK_Struct -> TagTypeKind::Struct, etc.).
- utilityClang / CanonicalFilePathCache / CxxDiagnosticConsumer /
  PreprocessorCallbacks: FileEntry::getName() was removed and the file
  name now lives on FileEntryRef. Thread FileEntryRef / OptionalFileEntryRef
  through getFileNameOfFileEntry() and its callers, resolving entries via
  SourceManager::getFileEntryRefForID(). The InclusionDirective PPCallbacks
  override is updated to the LLVM 19 signature (OptionalFileEntryRef plus
  the split SuggestedModule / ModuleImported parameters).

The minimum supported LLVM/Clang version is now 19.
CxxAstVisitor::TraverseClassTemplateSpecializationDecl is a custom
replacement for the RecursiveASTVisitor traversal that intentionally
skips the specialization's own type loc. It did not traverse the
specialization's base specifiers, so the base class of an implicitly
instantiated template was only ever recorded from the primary template,
in its generic form (e.g. "VectorBase<T, N>").

The substituted base type ("VectorBase<float, 2>") is sugar that only
exists on the specialization decl. Traverse the specialization's base
specifiers (guarded by hasDefinition()) so the inheritance edge of an
implicit instantiation is recorded with its actual template arguments.
The vendored Catch v1 fatal-condition handler computes its alternate
signal-stack size in a constexpr using MINSIGSTKSZ and declares the
stack buffer with that size. Since glibc 2.34 MINSIGSTKSZ is no longer
an integer constant expression, which breaks compilation of the test
binary on current toolchains (e.g. Debian trixie):

  error: call to non-'constexpr' function 'long int sysconf(int)'
  error: size of array 'altStackMem' is not an integral constant-expression

Make sigStackSize a runtime value and give altStackMem a fixed 32 KiB
size (the value Catch already prefers; MINSIGSTKSZ is far smaller, so the
chosen ss_size never exceeds the buffer).
- Add a case asserting that a type used as a template argument in an
  explicit class template specialization ("class A<S>") is recorded as a
  type use. This exercises the getTemplateArgsAsWritten() traversal added
  during the LLVM 19 port.
- Update the expected inheritance edge of an implicit template
  specialization to "VectorBase<float, 2U>": since LLVM/Clang 19 an
  unsigned non-type template argument is pretty-printed canonically with
  the "U" suffix. This case now passes thanks to the base-specifier
  traversal fix.
Now that the C/C++ indexer builds against LLVM/Clang 19, ship it in the
package:

- rules: configure with -DBUILD_CXX_LANGUAGE_PACKAGE=ON and pin
  Clang_DIR / LLVM_DIR to the LLVM 19 toolchain for a deterministic build.
- control: add llvm-19-dev, libclang-19-dev, libclang-cpp19-dev and
  clang-19 to Build-Depends; update the package description (C/C++
  indexing is now available, Python indexing remains disabled).
- lintian-overrides: the indexer copies Clang's builtin compiler headers
  into <sharedDataDir>/data/cxx/include at the fixed runtime path; note
  the resulting duplication of libclang-common-19-dev as intentional.
Signed-off-by: Eloïse Brocas <ebrocas@quarkslab.com>
Signed-off-by: Eloïse Brocas <ebrocas@quarkslab.com>
Bring the documentation in line with the current state of the project:

* uniformity: rename remaining 'Sourcetrail' references to 'NumbatUI'
  across the docs pages, fix the broken download link in
  getting_started.md (it pointed at the upstream Sourcetrail releases).
* installation: rewrite docs/installation.md around the three supported
  paths (Docker, manual build, native .deb) instead of the obsolete
  Sourcetrail binary installers; fix the data-folder locations.
* info: bump C/C++ support to LLVM/Clang 19 (hard minimum), document
  that C/C++ indexing is built with -DBUILD_CXX_LANGUAGE_PACKAGE=ON and
  off by default, note Python indexing is disabled by design, and
  replace the dead CoatiSoftware tracker links with the NumbatUI ones.
@ebrocas ebrocas merged commit bb80612 into main Jun 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant