clang-tools  16.0.0git
SymbolOrigin.h
Go to the documentation of this file.
1 //===--- SymbolOrigin.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_INDEX_SYMBOLORIGIN_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOLORIGIN_H
11 
12 #include "llvm/Support/raw_ostream.h"
13 #include <cstdint>
14 
15 namespace clang {
16 namespace clangd {
17 
18 // Describes the source of information about a symbol.
19 // Mainly useful for debugging, e.g. understanding code completion results.
20 // This is a bitfield as information can be combined from several sources.
21 enum class SymbolOrigin : uint16_t {
22  Unknown = 0,
23  AST = 1 << 0, // Directly from the AST (indexes should not set this).
24  Open = 1 << 1, // From the dynamic index of open files.
25  Static = 1 << 2, // From a static, externally-built index.
26  Merge = 1 << 3, // A non-trivial index merge was performed.
27  Identifier = 1 << 4, // Raw identifiers in file.
28  Remote = 1 << 5, // Remote index.
29  Preamble = 1 << 6, // From the dynamic index of preambles.
30  // 7 reserved
31  Background = 1 << 8, // From the automatic project index.
32  StdLib = 1 << 9, // Standard library index.
33 };
34 
36  return static_cast<SymbolOrigin>(static_cast<uint16_t>(A) |
37  static_cast<uint16_t>(B));
38 }
40  return A = A | B;
41 }
43  return static_cast<SymbolOrigin>(static_cast<uint16_t>(A) &
44  static_cast<uint16_t>(B));
45 }
46 
47 llvm::raw_ostream &operator<<(llvm::raw_ostream &, SymbolOrigin);
48 
49 } // namespace clangd
50 } // namespace clang
51 
52 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOLORIGIN_H
clang::clangd::SymbolOrigin::Background
@ Background
clang::clangd::SymbolOrigin::AST
@ AST
clang::clangd::operator&
DeclRelationSet operator&(DeclRelation L, DeclRelation R)
Definition: FindTarget.h:211
clang::clangd::SymbolOrigin::Open
@ Open
ns1::ns2::A
@ A
Definition: CategoricalFeature.h:3
clang::clangd::SymbolOrigin::Merge
@ Merge
clang::clangd::SymbolOrigin::Remote
@ Remote
clang::clangd::operator|=
IncludeGraphNode::SourceFlag & operator|=(IncludeGraphNode::SourceFlag &A, IncludeGraphNode::SourceFlag B)
Definition: Headers.h:106
clang::clangd::SymbolOrigin::StdLib
@ StdLib
clang::clangd::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
Definition: CodeComplete.cpp:2199
clang::clangd::SymbolOrigin::Static
@ Static
clang::clangd::operator|
DeclRelationSet operator|(DeclRelation L, DeclRelation R)
Definition: FindTarget.h:208
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::clangd::SymbolOrigin
SymbolOrigin
Definition: SymbolOrigin.h:21
ns1::ns2::B
@ B
Definition: CategoricalFeature.h:3
clang::clangd::SymbolOrigin::Preamble
@ Preamble
clang::clangd::SymbolOrigin::Identifier
@ Identifier
clang::clangd::SymbolOrigin::Unknown
@ Unknown