Skip to content
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

[SR-6055] When given the -output-file-map= option, the driver should check the map file exists (and other improvements) #48612

Open
modocache mannequin opened this issue Oct 4, 2017 · 1 comment
Labels
compiler The Swift compiler itself good first issue Good for newcomers improvement legacy driver Area → compiler: the integrated C++ legacy driver. Succeeded by the swift-driver project

Comments

@modocache
Copy link
Mannequin

modocache mannequin commented Oct 4, 2017

Previous ID SR-6055
Radar None
Original Reporter @modocache
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, Driver, StarterBug
Assignee None
Priority Medium

md5: f1f04b7b7601fefc78802b4bc77a7cb3

Issue Description:

This task tracks two TODOs left in swift/lib/Driver/Driver.cpp three years ago: "perform some preflight checks to ensure the [output map] file exists", and "emit [a] diagnostic with error string [explaining why the file could not be opened]".

Other parts of this Driver.cpp file use the llvm::sys::fs::exists() function in order to check a file exists before the driver proceeds with execution. The same should be done here, so that the user can be notified of a missing file before the driver attempts to open and read on the next line.

Further, assuming the file exists, but the driver is unable to open it on the next line for some reason, an error diagnostic with the reason why should be surfaced. swift/lib/Driver/OutputFileMap.cpp appears to use LLVM functions to open and read the file, and these functions return error objects/codes. Those errors should have a message associated with them, although I don't know the API to read that message off the top of my head.

@belkadan
Copy link
Contributor

belkadan commented Oct 4, 2017

I'm not sure it's necessary to check exists before just trying to read the file, as long as we get a reasonable diagnostic out the other side.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler itself good first issue Good for newcomers improvement legacy driver Area → compiler: the integrated C++ legacy driver. Succeeded by the swift-driver project
Projects
None yet
Development

No branches or pull requests

1 participant