This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][TableGen] Fully qualify calls to llvm::format that have ::std:: types as paramters

Authored by barcharcraz on Feb 7 2022, 8:47 PM.



Hello, I work on the Microsoft standard standard library and we encountered a build failure upon enabling std::format in /std:c++latest mode.

This showed up in commit 4c263ed, it's "fixed" in main, but the underlying issue festers and will cause a new failure if headers are rearranged such that GIMatchDiag.cpp sees the content of <format>.

On C++ standard versions that have std::format these calls become ambiguous with std::format due to ADL triggered by the unique_ptr* parameters.

On another note it's a little odd to format &N as a pointer when N is a unique_ptr, that's for someone else to consider though, I don't know enough about the code in question.

This is my first patch for llvm, so do let me know if I've screwed up the submission process.

Diff Detail

Event Timeline

barcharcraz created this revision.Feb 7 2022, 8:47 PM
barcharcraz requested review of this revision.Feb 7 2022, 8:47 PM

Did you run all the TableGen tests?

Did you run all the TableGen tests?

Are they not included in the CI test suite? I'm not sure what's going on with the debian failures.

Sorry, I don't know what the CI test suite is. I don't know much about the testing facilities.

It appears to run ninja check-llvm which seems to have passed on windows at least.

Out of curiosity (not knowing all the intricacies of ADL), is the leading :: really needed or would llvm::format without that prefix suffice? Personally, I find the prefix a bit grating visually.

barcharcraz added a comment.EditedFeb 8 2022, 4:47 PM

llvm::format should also suffice, although it's slightly less specific (possibly matching llvm::llvm::format or similar). It won't trigger adl though.

I've removed the global qualification on ::llvm::format

@Paul-C-Anagnostopoulos Since you are the code-owner for TableGen... Is there anything else I need to do in order for this to be merged? It looks like header reorganization has made things no-longer break, but this fix will still make things more robust.

Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2022, 12:59 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jun 22 2022, 9:37 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.