obfuscator-llvm / obfuscator

3.81k stars 1.16k forks source link

macos 10.15.5 build llvm-4.0 failed (CGOpenMPRuntime.cpp error : a lambda parameter...) #152

Closed zpd2009 closed 3 years ago

zpd2009 commented 4 years ago

env:

clang version Apple clang version 11.0.0 (clang-1100.0.33.17) Target: x86_64-apple-darwin19.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

error logs:

workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6275:24: error: a lambda parameter cannot shadow an explicitly captured entity CodeGenFunction &CGF, PrePostActionTy &) { ^ workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6274:31: note: variable 'CGF' is explicitly captured here auto &&BeginThenGen = [&D, &CGF, Device, &Info, &CodeGen, &NoPrivAction]( ^ workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6274:31: warning: lambda capture 'CGF' is not used [-Wunused-lambda-capture] auto &&BeginThenGen = [&D, &CGF, Device, &Info, &CodeGen, &NoPrivAction](


workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6274:62: warning: lambda capture
      'NoPrivAction' is not used [-Wunused-lambda-capture]
  auto &&BeginThenGen = [&D, &CGF, Device, &Info, &CodeGen, &NoPrivAction](
                                                          ~~~^~~~~~~~~~~~
workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6321:62: error: a lambda parameter
      cannot shadow an explicitly captured entity
  auto &&EndThenGen = [&CGF, Device, &Info](CodeGenFunction &CGF,
                                                             ^
workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6321:25: note: variable 'CGF' is
      explicitly captured here
  auto &&EndThenGen = [&CGF, Device, &Info](CodeGenFunction &CGF,
                        ^
workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6321:25: warning: lambda capture
      'CGF' is not used [-Wunused-lambda-capture]
  auto &&EndThenGen = [&CGF, Device, &Info](CodeGenFunction &CGF,
                       ~^~~~
workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6400:56: error: a lambda parameter
      cannot shadow an explicitly captured entity
  auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
                                                       ^
workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6400:26: note: variable 'CGF' is
      explicitly captured here
  auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
                         ^
workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:6400:26: warning: lambda capture
      'CGF' is not used [-Wunused-lambda-capture]
  auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) {
                      ~~~^~~
In file included from workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:14:
In file included from workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CGCXXABI.h:18:
In file included from workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CodeGenFunction.h:21:
In file included from workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CodeGenModule.h:19:
In file included from workspace/ollvm/obfuscator/tools/clang/lib/CodeGen/CodeGenTypes.h:20:
workspace/ollvm/obfuscator/tools/clang/include/clang/Sema/Sema.h:1588:27: warning: private field 'Keyword'
      is not used [-Wunused-private-field]
    const IdentifierInfo *Keyword;
                          ^
22 warnings and 3 errors generated.
make[2]: *** [tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGOpenMPRuntime.cpp.o] Error 1
make[1]: *** [tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/all] Error 2
make: *** [all] Error 2

-------------------------

I had tried to fix it like this:  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236193

but it doesnot work.  it has the same error.
jokerknight commented 3 years ago

save issue , looks like clang version not compatible lambda code my clang version is Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin19.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

zpd2009 commented 3 years ago

save issue , looks like clang version not compatible lambda code my clang version is Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin19.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

it‘s a bug in llvm4.0. I had sloved it from llvm source code. https://reviews.llvm.org/rL291939, this patch fixed the bug.