nasa / trick

Trick Simulation Environment. Trick provides a common set of simulation capabilities and utilities to build simulations automatically.
Other
34 stars 19 forks source link

Missing Member For LLVM 10 #1519

Closed shaferandrew closed 1 year ago

shaferandrew commented 1 year ago

Hello,

Compiling the latest trick on Ubuntu 20.04 with LLVM 10 produces the following error message:

/usr/bin/g++ -g -I/usr/lib/llvm-10/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti  -std=c++14 -DLIBCLANG_MAJOR=10 -DLIBCLANG_MINOR=0 -DLIBCLANG_PATCHLEVEL=0 -DTRICK_GCC_VERSION=\"9.4.0\"  -DTRICK_VERSION=\"19.6.0-beta\" -c main.cpp -o object_Linux_9.4_x86_64/main.o
main.cpp: In function ‘void set_lang_opts(clang::CompilerInstance&)’:
main.cpp:126:30: error: ‘class clang::LangOptions’ has no member named ‘CPlusPlus20’; did you mean ‘CPlusPlus2a’?
  126 |             ci.getLangOpts().CPlusPlus20 = true ;
      |                              ^~~~~~~~~~~
      |                              CPlusPlus2a

In this block, it checks to see if LIBCLANG_MAJOR >= 10 and then attempts to use a member called "CPlusPlus20", defined in the LLVM Clang header (https://github.com/llvm/llvm-project/blame/main/clang/include/clang/Basic/LangOptions.def#L99). But in the LangOptions.def file for LLVM 10.0.0, that option is still labeled with the legacy "CPlusPlus2a" (https://github.com/llvm/llvm-project/blame/1e1f5eb7c978da3b062daaf3c32c459704e65a55/clang/include/clang/Basic/LangOptions.def#L94)

Most of that LLVM conversion work was done in this commit: https://github.com/llvm/llvm-project/commit/6a30894391ca671bab16c505eff30c7819bd8e8e, and included in LLVM 11.0.0 RC1.

I think that an additional macro is needed to use "CPlusPlus2a" for LIBCLANG_MAJOR = 10 and to use "CPlusPlus20" for versions >= 11.

jdeans289 commented 1 year ago

Whoops, thanks for pointing that out! I'll get a fix out asap

jdeans289 commented 1 year ago

Can you pull the newest version of master and let me know if it fixes the issue?

shaferandrew commented 1 year ago

@jdeans289 The latest commit on master (479171f5), fixes this issue on my development machine and our CI/CD system.

Thanks!