clang-tools 19.0.0git
ASTSignals.h
Go to the documentation of this file.
1//===--- ASTSignals.h --------------------------------------------*- C++-*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_ASTSIGNALS_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_ASTSIGNALS_H
11
12#include "ParsedAST.h"
13#include "index/Symbol.h"
14#include "index/SymbolID.h"
15#include "llvm/ADT/DenseMap.h"
16#include "llvm/ADT/StringMap.h"
17
18namespace clang {
19namespace clangd {
20
21/// Signals derived from a valid AST of a file.
22/// Provides information that can only be extracted from the AST to actions that
23/// can't access an AST. The signals are computed and updated asynchronously by
24/// the ASTWorker and thus they are always stale and also can be absent.
25/// Example usage: Information about the declarations used in a file affects
26/// code-completion ranking in that file.
27struct ASTSignals {
28 /// Number of occurrences of each symbol present in the file.
29 llvm::DenseMap<SymbolID, unsigned> ReferencedSymbols;
30 /// Namespaces whose symbols are used in the file, and the number of such
31 /// distinct symbols.
32 llvm::StringMap<unsigned> RelatedNamespaces;
33 /// Preferred preprocessor directive to use for inclusions by the file.
36
37 static ASTSignals derive(const ParsedAST &AST);
38};
39
40} // namespace clangd
41} // namespace clang
42
43#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_ASTSIGNALS_H
Stores and provides access to parsed AST.
Definition: ParsedAST.h:46
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Signals derived from a valid AST of a file.
Definition: ASTSignals.h:27
static ASTSignals derive(const ParsedAST &AST)
Definition: ASTSignals.cpp:18
llvm::DenseMap< SymbolID, unsigned > ReferencedSymbols
Number of occurrences of each symbol present in the file.
Definition: ASTSignals.h:29
llvm::StringMap< unsigned > RelatedNamespaces
Namespaces whose symbols are used in the file, and the number of such distinct symbols.
Definition: ASTSignals.h:32
Symbol::IncludeDirective InsertionDirective
Preferred preprocessor directive to use for inclusions by the file.
Definition: ASTSignals.h:34
@ Include
#include "header.h"
Definition: Symbol.h:93