Skip to content

Commit f3fef7b

Browse files
committed
[cxx-interop] Do not get private discriminator for private Clang types
When generating debug symbols for private Clang types (which we started importing recently), the compiler crashes due to an assertion failure from ClangModuleUnit::getDiscriminatorForPrivateDecl(), which is called by getFilePrivateScope(). This patch fixes the issue crash by not calling getFilePrivateScope() for Clang types types. A discriminator is usually needed to disambiguate private Swift types declared in different files, but Clang types follow different scoping conventions that make this discriminator unnecessary. rdar://148481025
1 parent f61a3c9 commit f3fef7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2578,7 +2578,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
25782578
// Scope outermost fileprivate decls in an inline private discriminator
25792579
// namespace.
25802580
if (auto *Decl = DbgTy.getDecl())
2581-
if (Decl->isOutermostPrivateOrFilePrivateScope())
2581+
if (!ClangDecl && Decl->isOutermostPrivateOrFilePrivateScope())
25822582
Scope = getFilePrivateScope(Scope, Decl);
25832583

25842584
return Scope;

0 commit comments

Comments
 (0)