mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -333,12 +333,16 @@ getIntegerConstantForMacroToken(ClangImporter::Implementation &impl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Macro identifier.
|
// Macro identifier.
|
||||||
// TODO: for some reason when in C++ mode, "hasMacroDefinition" is often
|
} else if (token.is(clang::tok::identifier)) {
|
||||||
// false: rdar://110071334
|
|
||||||
} else if (token.is(clang::tok::identifier) &&
|
|
||||||
token.getIdentifierInfo()->hasMacroDefinition()) {
|
|
||||||
|
|
||||||
auto rawID = token.getIdentifierInfo();
|
auto rawID = token.getIdentifierInfo();
|
||||||
|
|
||||||
|
// When importing in (Objective-)C++ language mode, sometimes a macro might
|
||||||
|
// have an outdated identifier info, which would cause Clang preprocessor to
|
||||||
|
// assume that it does not have a definition.
|
||||||
|
if (rawID->isOutOfDate())
|
||||||
|
(void)impl.getClangPreprocessor().getLeafModuleMacros(rawID);
|
||||||
|
|
||||||
auto definition = impl.getClangPreprocessor().getMacroDefinition(rawID);
|
auto definition = impl.getClangPreprocessor().getMacroDefinition(rawID);
|
||||||
if (!definition)
|
if (!definition)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -typecheck -verify %s
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -typecheck -verify %s
|
||||||
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -cxx-interoperability-mode=default -enable-objc-interop -typecheck -verify %s
|
||||||
// Most of these don't pass: rdar://110071334
|
|
||||||
// %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-cxx-interop -enable-objc-interop -typecheck -verify %s
|
|
||||||
|
|
||||||
@_exported import macros
|
@_exported import macros
|
||||||
|
|
||||||
|
|||||||
7
test/Interop/Cxx/objc-correctness/darwin-macros.swift
Normal file
7
test/Interop/Cxx/objc-correctness/darwin-macros.swift
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// RUN: %target-swift-frontend -cxx-interoperability-mode=default -typecheck -verify -I %S/Inputs %s
|
||||||
|
|
||||||
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
|
import Darwin
|
||||||
|
|
||||||
|
let _ = COPYFILE_ALL
|
||||||
Reference in New Issue
Block a user