diff options
Diffstat (limited to 'clang-tools-extra/clangd/Headers.h')
| -rw-r--r-- | clang-tools-extra/clangd/Headers.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/Headers.h b/clang-tools-extra/clangd/Headers.h index 5a20ea268fd..33b6ff2eacb 100644 --- a/clang-tools-extra/clangd/Headers.h +++ b/clang-tools-extra/clangd/Headers.h @@ -62,8 +62,15 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &, const Inclusion &); // dependencies. Doesn't own the strings it references (IncludeGraph is // self-contained). struct IncludeGraphNode { - // True if current file is a main file rather than a header. - bool IsTU = false; + enum class SourceFlag : uint8_t { + None = 0, + // Whether current file is a main file rather than a header. + IsTU = 1 << 0, + // Whether current file had any uncompilable errors during indexing. + HadErrors = 1 << 1, + }; + + SourceFlag Flags = SourceFlag::None; llvm::StringRef URI; FileDigest Digest{{0}}; std::vector<llvm::StringRef> DirectIncludes; @@ -74,6 +81,22 @@ struct IncludeGraphNode { // edges and multi edges. using IncludeGraph = llvm::StringMap<IncludeGraphNode>; +inline IncludeGraphNode::SourceFlag operator|(IncludeGraphNode::SourceFlag A, + IncludeGraphNode::SourceFlag B) { + return static_cast<IncludeGraphNode::SourceFlag>(static_cast<uint8_t>(A) | + static_cast<uint8_t>(B)); +} + +inline bool operator&(IncludeGraphNode::SourceFlag A, + IncludeGraphNode::SourceFlag B) { + return static_cast<uint8_t>(A) & static_cast<uint8_t>(B); +} + +inline IncludeGraphNode::SourceFlag & +operator|=(IncludeGraphNode::SourceFlag &A, IncludeGraphNode::SourceFlag B) { + return A = A | B; +} + // Information captured about the inclusion graph in a translation unit. // This includes detailed information about the direct #includes, and summary // information about all transitive includes. |

