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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 23 14:51:21 PDT 2020


MaskRay added a comment.

In D80475#2052294 <https://reviews.llvm.org/D80475#2052294>, @orivej wrote:

> I have reproduced the error with Clang 7 and 10. I am compiling with a slightly customized version of a fresh libcxx.
>
> The interesting question is why you or CI can build llvm without this error. What brings std::transform into scope?


I cannot reproduce with clang 7. My command line:

  /home/ray/ccls/build/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/CodeGen -I/home/ray/llvm/llvm/lib/CodeGen -I/usr/include/libxml2 -Iinclude -I/home/ray/llvm/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -g -fPIC -fno-exceptions -fno-rtti -gsplit-dwarf -std=c++14 -c /home/ray/llvm/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp -fsyntax-only

You can delete `TargetLoweringObjectFileImpl.cpp.o` and run `ninja -v llc` to get the clang command line. By checking `-H`, I find that `<algorithm>` is included via `llvm/ADT/Hashing.h`



================
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();
----------------
Use `llvm::transform` to avoid future ADL gotcha.


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