Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/DependencyScan/DependencyScanningTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ llvm::ErrorOr<swiftscan_string_ref_t> getTargetInfo(ArrayRef<const char *> Comma
llvm::StringSaver Saver(Alloc);
// Ensure that we use the Windows command line parsing on Windows as we need
// to ensure that we properly handle paths.
if (llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows())
if (llvm::Triple(llvm::sys::getProcessTriple()).isOSWindows())
llvm::cl::TokenizeWindowsCommandLine(CommandString, Saver, Args);
else
llvm::cl::TokenizeGNUCommandLine(CommandString, Saver, Args);
Expand Down Expand Up @@ -117,6 +117,12 @@ void DepScanInMemoryDiagnosticCollector::addDiagnostic(
Stream.flush();
}

if (SMKind == llvm::SourceMgr::DK_Note &&
FormattedMessage.find("#import \"EmbeddedShims.h\"") !=
std::string::npos) {
assert(0 && "Why are we here?");
}

if (Info.Loc && Info.Loc.isValid()) {
auto bufferIdentifier = SM.getDisplayNameForLoc(Info.Loc);
auto lineAndColumnNumbers = SM.getLineAndColumnInBuffer(Info.Loc);
Expand Down
14 changes: 13 additions & 1 deletion unittests/DependencyScan/ModuleDeps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public func funcA() { }\n"));
}

// Disabled due to rdar://165014838
TEST_F(ScanTest, DISABLED_TestModuleCycle) {
TEST_F(ScanTest, TestModuleCycle) {
SmallString<256> tempDir;
ASSERT_FALSE(llvm::sys::fs::createUniqueDirectory("ScanTest.TestModuleCycle", tempDir));
SWIFT_DEFER { llvm::sys::fs::remove_directories(tempDir); };
Expand Down Expand Up @@ -429,6 +429,18 @@ public func funcB() { }\n"));
ASSERT_FALSE(DependenciesOrErr.getError());
auto Dependencies = DependenciesOrErr.get();
auto Diagnostics = Dependencies->diagnostics;
llvm::errs() << "[ScanTest.TestModuleCycle]==> Num diagnostcis "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this code won't run because of the new assert, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's indeed correct! We are crashing at the new assert, instead of getting here.

<< Diagnostics->count << "\n";
for (size_t i = 0; i < Diagnostics->count; i++) {
llvm::errs() << "[ScanTest.TestModuleCycle]====> [" << i << "]: ";
auto Diagnostic = Diagnostics->diagnostics[i];
auto Severity = Diagnostic->severity;
auto Message = std::string((const char *)Diagnostic->message.data,
Diagnostic->message.length);
llvm::errs() << "severity: " << Severity << " ";
llvm::errs() << "msg: " << Message << "\n";
}

ASSERT_TRUE(Diagnostics->count == 1);
auto Diagnostic = Diagnostics->diagnostics[0];
ASSERT_TRUE(Diagnostic->severity == SWIFTSCAN_DIAGNOSTIC_SEVERITY_ERROR);
Expand Down