brintos

brintos / llvm-project-archived public Read only

0
0
Text · 795 B · ba742b5 Raw
29 lines · plain
1.. title:: clang-tidy - llvmlibc-callee-namespace2 3llvmlibc-callee-namespace4====================================5 6Checks all calls resolve to functions within correct namespace.7 8.. code-block:: c++9 10    // Implementation inside the LIBC_NAMESPACE namespace.11    // Correct if:12    // - LIBC_NAMESPACE is a macro13    // - LIBC_NAMESPACE expansion starts with `__llvm_libc`14    namespace LIBC_NAMESPACE {15 16    // Allow calls with the fully qualified name.17    LIBC_NAMESPACE::strlen("hello");18 19    // Allow calls to compiler provided functions.20    (void)__builtin_abs(-1);21 22    // Bare calls are allowed as long as they resolve to the correct namespace.23    strlen("world");24 25    // Disallow calling into functions in the global namespace.26    ::strlen("!");27 28    } // namespace LIBC_NAMESPACE29