Skip to content

Commit 7216be1

Browse files
committed
[cxx-interop] A little macros fix; breadcrumbs for future fixes.
1 parent 7964918 commit 7216be1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/ClangImporter/ImportMacro.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ static Optional<std::pair<llvm::APSInt, Type>>
328328
}
329329

330330
// Macro identifier.
331+
// TODO: for some reason when in C++ mode, "hasMacroDefinition" is often
332+
// false: rdar://110071334
331333
} else if (token.is(clang::tok::identifier) &&
332334
token.getIdentifierInfo()->hasMacroDefinition()) {
333335

@@ -422,7 +424,7 @@ static ValueDecl *importMacro(ClangImporter::Implementation &impl,
422424
auto diagState = impl.getClangSema().DelayedDiagnostics.push(diagPool);
423425
auto parsedType = impl.getClangSema().getTypeName(identifier,
424426
clang::SourceLocation(),
425-
/*scope*/nullptr);
427+
impl.getClangSema().TUScope);
426428
impl.getClangSema().DelayedDiagnostics.popWithoutEmitting(diagState);
427429

428430
if (parsedType && diagPool.empty()) {

test/ClangImporter/macros.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -typecheck -verify %s
22

3+
// Most of these don't pass: rdar://110071334
4+
// %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-cxx-interop -enable-objc-interop -typecheck -verify %s
5+
36
@_exported import macros
47

58
func circle_area(_ radius: CDouble) -> CDouble {

0 commit comments

Comments
 (0)