clang-tools 10.0.0

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_SYMBOL_ORIGIN_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOL_ORIGIN_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 reuslts.
20 // This is a bitfield as information can be combined from several sources.
21 enum class SymbolOrigin : uint8_t {
22 Unknown = 0,
23 AST = 1 << 0, // Directly from the AST (indexes should not set this).
24 Dynamic = 1 << 1, // From the dynamic index of opened files.
25 Static = 1 << 2, // From the static, externally-built index.
26 Merge = 1 << 3, // A non-trivial index merge was performed.
27 Identifier = 1 << 4, // Raw identifiers in file.
28 // Remaining bits reserved for index implementations.
29 };
30
31 inline SymbolOrigin operator|(SymbolOrigin A, SymbolOrigin B) {
32 return static_cast<SymbolOrigin>(static_cast<uint8_t>(A) |
33 static_cast<uint8_t>(B));
34 }
35 inline SymbolOrigin &operator|=(SymbolOrigin &A, SymbolOrigin B) {
36 return A = A | B;
37 }
38 inline SymbolOrigin operator&(SymbolOrigin A, SymbolOrigin B) {
39 return static_cast<SymbolOrigin>(static_cast<uint8_t>(A) &
40 static_cast<uint8_t>(B));
41 }
42
43 llvm::raw_ostream &operator<<(llvm::raw_ostream &, SymbolOrigin);
44
45 } // namespace clangd
46 } // namespace clang
47
48 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOL_ORIGIN_H
clang::clangd::SymbolOrigin::Identifier
clang::clangd::DuplicateHandling::Merge
clang::clangd::operator &
DeclRelationSet operator &(DeclRelation L, DeclRelation R)
Definition: FindTarget.h:198
clang::clangd::operator|
DeclRelationSet operator|(DeclRelation L, DeclRelation R)
Definition: FindTarget.h:195
clang::clangd::SymbolOrigin::AST
clang::clangd::SymbolOrigin::Static
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::clangd::SymbolOrigin::Unknown
clang::clangd::SymbolOrigin::Dynamic
clang::clangd::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
Definition: CodeComplete.cpp:1850
clang::clangd::SymbolOrigin
SymbolOrigin
Definition: SymbolOrigin.h:21
clang::clangd::operator|=
IncludeGraphNode::SourceFlag & operator|=(IncludeGraphNode::SourceFlag &A, IncludeGraphNode::SourceFlag B)
Definition: Headers.h:96