[PATCH] D59802: [clang-tidy] Add new checker: llvm-avoid-cast-in-conditional
Don Hinton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 25 19:06:55 PDT 2019
hintonda marked an inline comment as done.
hintonda added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/utils/HeaderFileExtensionsUtils.h:17
+using llvm::SmallSet;
+
----------------
hintonda wrote:
> Eugene.Zelenko wrote:
> > It'll be easier to use llvm::SmallSet in using statement.
> Unfortunately, that won't compile.
>
> The reason is that the llvm checkers live in `namespace clang::clang-tidy::llvm`, so if you include an llvm checker header, which opens the `clang::clang-tidy::llvm` namespace, clang doesn't know whether to look in `llvm` or `clang::clang-tidy::llvm` since you are in `clang::clang-tidy`.
>
> The error does suggest using `::llvm::SmallSet`, but that seems sorta klugey.
>
> Since this looks ugly, how about I add `using llvm::SmallSet;` to ` clang/include/clang/LLVM.h`?
>
Btw, the reason this never caused a problem before was that the first llvm checker header included in `clang-tools-extra/clang-tidy/llvm/LLVMTidyModule.cpp` was `HeaderGuardCheck.h`, which only include `HeaderGuardCheck.h` before opening the new `clang::clang-tidy::llvm` namespace. Once I added this checker, which was included before `HeaderGuardCheck.h`, it made the new `llvm` namespace was ambiguous within `clang-tidy`, hence the error.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59802/new/
https://reviews.llvm.org/D59802
More information about the cfe-commits
mailing list