This is an archive of the discontinued LLVM Phabricator instance.

Add Windows error code and tidy formatting for system errors
ClosedPublic

Authored by probinson on Nov 20 2015, 3:51 PM.

Details

Summary

In MakeErrMsg, the Windows error text was being pasted directly at the
end of the provided prefix, and only some callers provided appropriate
punctuation. Add the punctuation in MakeErrMsg and remove it from callers.
Also append the actual Windows error code, which can be really useful.

Diff Detail

Repository
rL LLVM

Event Timeline

probinson updated this revision to Diff 40838.Nov 20 2015, 3:51 PM
probinson retitled this revision from to Add Windows error code and tidy formatting for system errors.
probinson updated this object.
probinson added reviewers: aaron.ballman, rnk.
probinson added a subscriber: llvm-commits.

Using Greg Bedwell's test suggestion:

> set SYSTEMROOT=
> clang -c t.cpp

I was able to test the update to error reporting re. a crypto context. I got this message:

fatal error: error in backend: Could not acquire a cryptographic contextInvalid Signature.

(1) There ought to be nicer punctuation, e.g. "context: Invalid Signature."
(2) Providing the actual Windows error number could be more helpful than the text.

With this patch I get:

fatal error: error in backend: Could not acquire a cryptographic context: Invalid Signature. (0x80090006)

rnk accepted this revision.Nov 20 2015, 6:29 PM
rnk edited edge metadata.

lgtm

lib/Support/Windows/WindowsSupport.h
51 ↗(On Diff #40838)

According to MSDN, this call can update the last error code. You might want to cache it locally at the beginning of this function.

This revision is now accepted and ready to land.Nov 20 2015, 6:29 PM
probinson marked an inline comment as done.Nov 23 2015, 9:36 AM
probinson added inline comments.
lib/Support/Windows/WindowsSupport.h
51 ↗(On Diff #40838)

Ah, thanks for catching that.

This revision was automatically updated to reflect the committed changes.
probinson marked an inline comment as done.