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

Charlie Barto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 20:47:20 PST 2022


barcharcraz created this revision.
barcharcraz added a project: LLVM.
Herald added a subscriber: rovka.
barcharcraz requested review of this revision.
Herald added a subscriber: llvm-commits.

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 <https://reviews.llvm.org/rG4c263ede5471a7fe3b06e8208b3f1aba1b9dcef2>, 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119213

Files:
  llvm/utils/TableGen/GlobalISel/GIMatchDag.cpp


Index: llvm/utils/TableGen/GlobalISel/GIMatchDag.cpp
===================================================================
--- llvm/utils/TableGen/GlobalISel/GIMatchDag.cpp
+++ llvm/utils/TableGen/GlobalISel/GIMatchDag.cpp
@@ -48,7 +48,7 @@
          << Assignment.first << ")";
       Separator = ", ";
     }
-    OS << format("|%p|", &N);
+    OS << ::llvm::format("|%p|", &N);
     writePorts("d", N->getOperandInfo());
     OS << "}\"";
     if (N->isMatchRoot())
@@ -82,7 +82,7 @@
     writePorts("s", N->getOperandInfo());
     OS << "|" << N->getName() << "|";
     N->printDescription(OS);
-    OS << format("|%p|", &N);
+    OS << ::llvm::format("|%p|", &N);
     writePorts("d", N->getOperandInfo());
     OS << "}\",style=dotted]\n";
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119213.406690.patch
Type: text/x-patch
Size: 749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220208/bb549465/attachment.bin>


More information about the llvm-commits mailing list