[PATCH] D80475: [TargetLoweringObjectFileImpl] Use llvm::transform

Orivej Desh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 23 15:24:34 PDT 2020


orivej marked an inline comment as done.
orivej added a comment.

My C++ library does not allow even this:

  #include <algorithm>
  #include <string>
  
  int main()
  {
      std::string s("hello");
      transform(s.begin(), s.end(), s.begin(), [](char c) -> char { return c; });
  }

  main.cpp:7:5: error: use of undeclared identifier 'transform'; did you mean 'std::transform'?
      transform(s.begin(), s.end(), s.begin(), [](char c) -> char { return c; });



================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:1749
   std::string HexString = AI.toString(16, /*Signed=*/false);
-  transform(HexString.begin(), HexString.end(), HexString.begin(), tolower);
+  transform(HexString, HexString.begin(), tolower);
   unsigned Size = HexString.size();
----------------
MaskRay wrote:
> Use `llvm::transform` to avoid future ADL gotcha.
Are you sure? Changing the signature like this makes the name resolution argument independent, since `llvm::transform` is in scope due to `using namespace llvm;`.  Nothing else in this file qualifies `llvm::`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80475/new/

https://reviews.llvm.org/D80475





More information about the llvm-commits mailing list