Skip to content

[DO NOT MERGE] Logging to test -verify-additional-file on Windows #80549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
16 changes: 16 additions & 0 deletions lib/Frontend/DiagnosticVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,11 @@ findDiagnostic(std::vector<CapturedDiagnosticInfo> &CapturedDiagnostics,
const ExpectedDiagnosticInfo &Expected, unsigned BufferID) {
auto fallbackI = CapturedDiagnostics.end();

llvm::errs() << "Looking for expected error in [[" << BufferID << "]]:" << Expected.LineNo << ": " << Expected.MessageStr << "\n";
for (auto I = CapturedDiagnostics.begin(), E = CapturedDiagnostics.end();
I != E; ++I) {

llvm::errs() << " >>> Comparing against [[" << I->SourceBufferID << "]]:" << I->Line << ": " << I->Message << "\n";
// Verify the file and line of the diagnostic.
if (I->Line != Expected.LineNo || I->SourceBufferID != BufferID)
continue;
Expand All @@ -285,10 +288,15 @@ findDiagnostic(std::vector<CapturedDiagnosticInfo> &CapturedDiagnostics,
continue;
}

llvm::errs() << " <<< Found a match!\n~~~~\n";
// Okay, we found a match, hurray!
return { I, true };
}

if (fallbackI == CapturedDiagnostics.end())
llvm::errs() << " <<< Did not find a match.\n~~~~\n";
else
llvm::errs() << " <<< Did not find a match, but found a fallback.\n~~~~\n";
// No perfect match; we'll return the fallback or `end()` instead.
return { fallbackI, false };
}
Expand Down Expand Up @@ -1322,9 +1330,17 @@ bool DiagnosticVerifier::finishProcessing() {
}
if (bufferID) {
additionalBufferIDs.push_back(*bufferID);
llvm::errs() << "Got additional file: [[" << *bufferID << "]]::" << path << "\n";
} else {
llvm::errs() << "Could not open additional file: " << path << "\n";
}
}

for (auto captured : CapturedDiagnostics) {
auto id = *captured.SourceBufferID;
llvm::errs() << "Captured error in [[" << id << "]]::" << SM.getIdentifierForBuffer(id) << ": " << captured.Line << "\n";
}

ArrayRef<unsigned> BufferIDLists[2] = { BufferIDs, additionalBufferIDs };
for (ArrayRef<unsigned> BufferIDList : BufferIDLists)
for (auto &BufferID : BufferIDList) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// RUN: rm -rf %t
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs %s -cxx-interoperability-mode=upcoming-swift -verify-additional-file %S/Inputs/inheritance.h -Xcc -Wno-return-type -Xcc -Wno-inaccessible-base

// TODO: Fix this lit test failure on windows rdar://145218056
// XFAIL: OS=windows-msvc

import Inheritance

let _ = ImmortalRefereceExample.returnImmortalRefType()
Expand Down