Bug 443110

Summary: getTranslationUnitDecl return nullptr on MacOS
Product: [Developer tools] clazy Reporter: hanyoung
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: REPORTED ---    
Severity: normal CC: smartins
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description hanyoung 2021-09-29 08:42:56 UTC
SUMMARY

On MacOS big sur

STEPS TO REPRODUCE
1. use clazy to compile a sample c++ file has code that should trigger checks
2. 
3. 

OBSERVED RESULT
no diagnostic

EXPECTED RESULT
should print diagnostic

SOFTWARE/OS VERSIONS
macOS: big sur 11.5.2

https://invent.kde.org/sdk/clazy/-/blob/master/src/Clazy.cpp#L180 this returns nullptr on MacOS Big Sur 11.5.2
So the checks are not run. I believe it has something to do with Apple Clang. A example clang plugin build with llvm source works as expected (but not with Apple clang).

I tried another example clang plugin with clazy's cmake file, getTranslationUnitDecl also returns nullptr.
Comment 1 hanyoung 2021-09-29 08:50:20 UTC
The llvm used in linking is llvm12 from brew, clazy wraps itself around Apple clang. However manually load ClazyPlugin with llvm12's clang from brew works as expected.