aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-02-05 09:16:17 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-04-06 20:14:02 +0000
commitdc36515b628331e03ac8c23a6749f7f3eb1ebec8 (patch)
treeedbdd9b3c90f2bcdd201ae52d34314c430544b04 /contrib/llvm-project/clang/lib
parentddbac700c256bec42c441b75a5cb5f74e9be601f (diff)
Diffstat (limited to 'contrib/llvm-project/clang/lib')
-rw-r--r--contrib/llvm-project/clang/lib/AST/ASTContext.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
index 5eb7aa366456..9a0ede201059 100644
--- a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
@@ -498,7 +498,11 @@ void ASTContext::attachCommentsToJustParsedDecls(ArrayRef<Decl *> Decls,
return;
FileID File;
- for (Decl *D : Decls) {
+ for (const Decl *D : Decls) {
+ if (D->isInvalidDecl())
+ continue;
+
+ D = &adjustDeclToTemplate(*D);
SourceLocation Loc = D->getLocation();
if (Loc.isValid()) {
// See if there are any new comments that are not attached to a decl.