tidy - llvmlibc-callee-namespace — Extra Clang Tools 22.0.0git documentation (original) (raw)

Checks all calls resolve to functions within correct namespace.

// Implementation inside the LIBC_NAMESPACE namespace. // Correct if: // - LIBC_NAMESPACE is a macro // - LIBC_NAMESPACE expansion starts with __llvm_libc namespace LIBC_NAMESPACE {

// Allow calls with the fully qualified name. LIBC_NAMESPACE::strlen("hello");

// Allow calls to compiler provided functions. (void)__builtin_abs(-1);

// Bare calls are allowed as long as they resolve to the correct namespace. strlen("world");

// Disallow calling into functions in the global namespace. ::strlen("!");

} // namespace LIBC_NAMESPACE