[libc-commits] [PATCH] D113946: [libc][clang-tidy] fix namespace check for externals
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Nov 16 11:38:15 PST 2021
sivachandra accepted this revision.
sivachandra added a comment.
For libc requirements, LGTM. Please wait for @aaron.ballman for stamping the clang-tidy parts.
================
Comment at: clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp:39
+// intercepted.
+static const char *FUNCTIONS_TO_IGNORE_NAMESPACE[] = {
+ "__errno_location", "malloc", "calloc", "realloc", "free"};
----------------
michaelrj wrote:
> sivachandra wrote:
> > Eugene.Zelenko wrote:
> > > Why not `std::array` of appropriate LLVM container?
> > May be `static const std::uordered_set<llvm::StringRef>`? It would likely make the lookup below much neater.
> an unordered set is a good idea, but the documentation for `StringRef` says it's best not to use them for storage, so I went with `std::string` instead. The code is still a lot nicer.
Literal strings will not count as "storage". They are global data. On the other hand, `std::string` will make copies of the literals and require "storage".
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113946/new/
https://reviews.llvm.org/D113946
More information about the libc-commits
mailing list