woboq / moc-ng

A reimplementation of Qt's moc using libclang. Contains both a drop-in remplacement, and a plugin for the clang compiler.
https://woboq.com/blog/moc-with-clang.html
GNU General Public License v3.0
204 stars 24 forks source link

clang 10 updates needed #15

Closed bjornstromberg closed 4 years ago

bjornstromberg commented 4 years ago

of course the new major clang upgrade mess up stuff again..

from Clang 10.0.0 Release Notes

Internal API Changes
These are major API changes that have happened since the 9.0.0 release of Clang. 
If upgrading an external codebase that uses Clang as a library, 
this section should help get you past the largest hurdles of upgrading.

libTooling APIs that transfer ownership of FrontendAction objects now pass them by unique_ptr,
making the ownership transfer obvious in the type system. 
FrontendActionFactory::create() now returns a unique_ptr<FrontendAction>. 
runToolOnCode, runToolOnCodeWithArgs, 
ToolInvocation::ToolInvocation() now take a unique_ptr<FrontendAction>.

so with clang, llvm and libc++ 10.0.0 on arch linux, moc-ng does not build anymore.

first two errors are isolated to above change note for internal api.

/*buildpath*/moc-ng/src/main.cpp:451:38: error: no matching constructor for initialization of 'clang::tooling::ToolInvocation'
      clang::tooling::ToolInvocation Inv(Argv, new clang::PrintPreprocessedAction, &FM);
/*buildpath*/moc-ng/src/main.cpp:465:34: error: no matching constructor for initialization of 'clang::tooling::ToolInvocation'
  clang::tooling::ToolInvocation Inv(Argv, new MocAction, &FM);

and this one might be a chain reaction.. but adding to the list for completeness.

/*buildpath*/moc-ng/src/mocng.cpp:159:37: error: no viable conversion from 'Optional<clang::FileEntryRef>' to 'const clang::FileEntry *'
            const clang::FileEntry *File = PP.LookupFile(
bjornstromberg commented 4 years ago

had a look and its only smart pointer related, i guess the result will be another batch of preprocessor macros, so it does not mess up builds on older clang.

i'm not going to pursue to get this working on arch linux, i'll target ubuntu 20.04 with clang-10 instead, it fits the requirements..

i'll have a go at this next week if nobody been bored and fixed it during the weekend.

bjornstromberg commented 4 years ago

16 fixes for clang 9 & 10 so both build.