summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/AST.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/AST.h')
-rw-r--r--clang-tools-extra/clangd/AST.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/AST.h b/clang-tools-extra/clangd/AST.h
index 6cae719986a..a40aeaf32a7 100644
--- a/clang-tools-extra/clangd/AST.h
+++ b/clang-tools-extra/clangd/AST.h
@@ -148,6 +148,21 @@ std::string getQualification(ASTContext &Context,
const NamedDecl *ND,
llvm::ArrayRef<std::string> VisibleNamespaces);
+/// Whether we must avoid computing linkage for D during code completion.
+/// Clang aggressively caches linkage computation, which is stable after the AST
+/// is built. Unfortunately the AST is incomplete during code completion, so
+/// linkage may still change.
+///
+/// Example: `auto x = []{^}` at file scope.
+/// During code completion, the initializer for x hasn't been parsed yet.
+/// x has type `undeduced auto`, and external linkage.
+/// If we compute linkage at this point, the external linkage will be cached.
+///
+/// After code completion the initializer is attached, and x has a lambda type.
+/// This means x has "unique external" linkage. If we computed linkage above,
+/// the cached value is incorrect. (clang catches this with an assertion).
+bool hasUnstableLinkage(const Decl *D);
+
} // namespace clangd
} // namespace clang
OpenPOWER on IntegriCloud