You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't import a C++ class definition until the class is required to be complete. (#5865)
When importing a class definition, ask Clang to complete it first. This
causes class template specializations to get instantiated as needed when
the type-checking of Carbon requires a C++ class to be complete. It also
allows Clang to implement things like modules-aware definition
visibility checking.
Don't reject importing a class with a virtual base if it's never
required to be complete. Instead, defer diagnosing until the definition
is required.
This also removes the recursion from `MapType`, as mapping a class type
no longer maps its definition.
In order to get diagnostics from instantiation failures, fix a bug that
caused any Clang diagnostics produced after the initial building of the
`ASTUnit` to get discarded. This exposed some duplicate diagnostic
issues in `ImportNameFromCpp` which are fixed here too.
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+11]]:3: note: while completing C++ class type `Cpp.B` [InCppTypeCompletion]
184
+
// CHECK:STDERR: return p;
185
+
// CHECK:STDERR: ^~~~~~~~~
186
+
// CHECK:STDERR:
174
187
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.B*` to `Cpp.A*` [ConversionFailure]
175
188
// CHECK:STDERR: return p;
176
189
// CHECK:STDERR: ^~~~~~~~~
@@ -221,9 +234,9 @@ class V {
221
234
// CHECK:STDOUT:
222
235
// CHECK:STDOUT: constants {
223
236
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
224
-
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
225
237
// CHECK:STDOUT: %ptr.ddb: type = ptr_type %Derived [concrete]
226
238
// CHECK:STDOUT: %pattern_type.5c8: type = pattern_type %ptr.ddb [concrete]
239
+
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
227
240
// CHECK:STDOUT: %ptr.fb2: type = ptr_type %Base [concrete]
228
241
// CHECK:STDOUT: %pattern_type.72a: type = pattern_type %ptr.fb2 [concrete]
229
242
// CHECK:STDOUT: %ConvertPtr.type: type = fn_type @ConvertPtr [concrete]
@@ -345,9 +358,9 @@ class V {
345
358
// CHECK:STDOUT:
346
359
// CHECK:STDOUT: constants {
347
360
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
348
-
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
0 commit comments