aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/MultiplexExternalSemaSource.cpp
diff options
context:
space:
mode:
authorDmitry Polukhin <34227995+dmpolukhin@users.noreply.github.com>2025-04-03 08:27:13 +0100
committerGitHub <noreply@github.com>2025-04-03 08:27:13 +0100
commite1aaee7ea218f1d89646fa1f43bb4c94c27808b5 (patch)
treeb6a3db35527991d0e0b5f583097e2532cbd214f0 /clang/lib/Sema/MultiplexExternalSemaSource.cpp
parent73e1710a4d5629cce5aaebc01cab1f76e3de5c84 (diff)
downloadllvm-e1aaee7ea218f1d89646fa1f43bb4c94c27808b5.zip
llvm-e1aaee7ea218f1d89646fa1f43bb4c94c27808b5.tar.gz
llvm-e1aaee7ea218f1d89646fa1f43bb4c94c27808b5.tar.bz2
[modules] Handle friend function that was a definition but became only a declaration during AST deserialization (#132214)
Fix for regression #130917, changes in #111992 were too broad. This change reduces scope of previous fix. Added `ExternalASTSource::wasThisDeclarationADefinition` to detect cases when FunctionDecl lost body due to declaration merges.
Diffstat (limited to 'clang/lib/Sema/MultiplexExternalSemaSource.cpp')
-rw-r--r--clang/lib/Sema/MultiplexExternalSemaSource.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/MultiplexExternalSemaSource.cpp b/clang/lib/Sema/MultiplexExternalSemaSource.cpp
index 6d94530..fbfb242 100644
--- a/clang/lib/Sema/MultiplexExternalSemaSource.cpp
+++ b/clang/lib/Sema/MultiplexExternalSemaSource.cpp
@@ -107,6 +107,14 @@ MultiplexExternalSemaSource::hasExternalDefinitions(const Decl *D) {
return EK_ReplyHazy;
}
+bool MultiplexExternalSemaSource::wasThisDeclarationADefinition(
+ const FunctionDecl *FD) {
+ for (const auto &S : Sources)
+ if (S->wasThisDeclarationADefinition(FD))
+ return true;
+ return false;
+}
+
bool MultiplexExternalSemaSource::FindExternalVisibleDeclsByName(
const DeclContext *DC, DeclarationName Name,
const DeclContext *OriginalDC) {