https://github.com/aaronpuchert commented: This probably fits better in `Sema/SemaDeclAttr.cpp`. Maybe `checkLockFunAttrCommon` is a good place. Add a test to `clang/test/Sema/attr-capabilities.c{,pp}`. https://github.com/llvm/llvm-project/pull/67520