csmith-project / creduce

C-Reduce, a C and C++ program reducer
Other
1.47k stars 128 forks source link

LLVM/Clang 10: C-Reduce make fails for " no member named 'C' in 'clang::InputKind'" #199

Open laixiaodong opened 4 years ago

laixiaodong commented 4 years ago

Hi, I want build creduce locally, my system is Rehl8, and clang version is 10.0, with creduce-2.10.0. but after configure, there are many errors in "make".

`TransformationManager.cpp:104:38: error: no member named 'C' in 'clang::InputKind' if (IK.getLanguage() == InputKind::C) {


TransformationManager.cpp:105:73: error: no member named 'C' in 'clang::InputKind'
    Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::C, T, PPOpts);
                                                             ~~~~~~~~~~~^
TransformationManager.cpp:107:43: error: no member named 'CXX' in 'clang::InputKind'
  else if (IK.getLanguage() == InputKind::CXX) {
                               ~~~~~~~~~~~^
TransformationManager.cpp:111:73: error: no member named 'CXX' in 'clang::InputKind'
    Invocation.setLangDefaults(ClangInstance->getLangOpts(), InputKind::CXX, T, PPOpts);
                                                             ~~~~~~~~~~~^
TransformationManager.cpp:113:42: error: no member named 'OpenCL' in 'clang::InputKind'
  else if(IK.getLanguage() == InputKind::OpenCL) {
                              ~~~~~~~~~~~^
TransformationManager.cpp:125:69: warning: comparison between NULL and non-pointer ('llvm::ErrorOr<const DirectoryEntry *>' and NULL) [-Wnull-arit
       ClangInstance->getFileManager().getDirectory(CLCPath, false) != NULL) {
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
TransformationManager.cpp:125:69: error: invalid operands to binary expression ('llvm::ErrorOr<const DirectoryEntry *>' and 'long')
       ClangInstance->getFileManager().getDirectory(CLCPath, false) != NULL) {
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
` 

anyone know how to fix it? or which clang version I should use? 
thanks~
eeide commented 4 years ago

Hi! C-Reduce 2.10.0 is intended to work with LLVM/Clang 8.

The next (upcoming) release of C-Reduce will be intended to work with LLVM/Clang 9. I hope to get this release done soon. If you don't want to wait, you can get the current dvelopment version of C-Reduce from GitHub—it should work with LLVM/Clang 9 (or 8, in fact).

eeide commented 4 years ago

I will investigate the build error you reported after I get the next release of C-Reduce out the door (for LLVM/Clang 9).

Meanwhile, I'm going to change the name of this issue to reflect the fact that it related to LLVM/Clang 10.

laixiaodong commented 4 years ago

@eeide thank you so much ~

eeide commented 4 years ago

Thanks, @berolinux, for the patch! (I have not looked at it yet.)

As I noted in the earlier comments for this issue, I want to finish a release that supports LLVM 9 before I investigate support for LLVM 10.

berolinux commented 4 years ago

Thanks, @berolinux, for the patch! (I have not looked at it yet.)

As I noted in the earlier comments for this issue, I want to finish a release that supports LLVM 9 before I investigate support for LLVM 10.

Sure. Might make sense to push my patch to the llvm-svn-compatible branch until then, chances are that's where other LLVM 10 users will look first...

marxin commented 4 years ago

I would like to point out that LLVM 10 has been released. So a creduce release would be handy.

eeide commented 4 years ago

Thank you for the heads-up!

Cogitri commented 4 years ago

FWIW Alpine Linux Edge will probably jump onto #204 for now to support LLVM10: https://gitlab.alpinelinux.org/alpine/aports/merge_requests/5975/diffs?commit_id=f1ddd678f31172e60843b790de608855cd0f1352 .

marxin commented 4 years ago

And one also needs switch from c++11 to c++14:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 832c35b..fb12817 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,9 +114,9 @@ check_cxx_compiler_flag(

 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
     OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
-  # XXX figure out how to get "-std=c++11 -fno-rtti" from LLVM.  That's how we
+  # XXX figure out how to get "-std=c++14 -fno-rtti" from LLVM.  That's how we
   # get those options in the Automake path...
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-strict-aliasing -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Wno-missing-field-initializers")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fno-rtti -fno-strict-aliasing -Wall -Wextra -Wno-long-long -Wno-unused-parameter -Wno-missing-field-initializers")
   if(SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
   endif()
marxin commented 4 years ago

Note that LLVM 10 is slower: #210

Cogitri commented 4 years ago

Note that LLVM 10 is slower: #210

Yup, but even so most if not all distros will jump onto LLVM10, it doesn't really scale to keep old LLVM versions around.

marxin commented 4 years ago

Yup, but even so most if not all distros will jump onto LLVM10, it doesn't really scale to keep old LLVM versions around.

Sure, I also want to update to LLVM 10 in openSUSE, but 3 times slower clang_delta is a real problem to me! We should investigate what's wrong or different.

Cogitri commented 4 years ago

but 3 times slower clang_delta is a real problem to me! We should investigate what's wrong or different.

Ah yes, I didn't want to doubt that, sorry if it sounded like that. Yes, that regression should certainly be fixed! :)

chenyang78 commented 4 years ago

Based on the pull request from @berolinux , I pushed a new branch llvm10.0. Thanks, @berolinux !

regehr commented 4 years ago

thanks Yang!