| 1 |
.. title:: clang-tidy - llvmlibc-implementation-in-namespace |
| 2 |
|
| 3 |
llvmlibc-implementation-in-namespace |
| 4 |
==================================== |
| 5 |
|
| 6 |
Checks that all declarations in the llvm-libc implementation are within the |
| 7 |
correct namespace. |
| 8 |
|
| 9 |
.. code-block:: c++ |
| 10 |
|
| 11 |
// Correct: implementation inside the correct namespace. |
| 12 |
namespace __llvm_libc { |
| 13 |
void LLVM_LIBC_ENTRYPOINT(strcpy)(char *dest, const char *src) {} |
| 14 |
// Namespaces within __llvm_libc namespace are allowed. |
| 15 |
namespace inner{ |
| 16 |
int localVar = 0; |
| 17 |
} |
| 18 |
// Functions with C linkage are allowed. |
| 19 |
extern "C" void str_fuzz(){} |
| 20 |
} |
| 21 |
|
| 22 |
// Incorrect: implementation not in a namespace. |
| 23 |
void LLVM_LIBC_ENTRYPOINT(strcpy)(char *dest, const char *src) {} |
| 24 |
|
| 25 |
// Incorrect: outer most namespace is not correct. |
| 26 |
namespace something_else { |
| 27 |
void LLVM_LIBC_ENTRYPOINT(strcpy)(char *dest, const char *src) {} |
| 28 |
} |