hugoeg added inline comments.
================
Comment at: clang-tidy/abseil/NoInternalDepsCheck.cpp:20
+
+bool IsInAbseilFile(const SourceManager& manager, SourceLocation loc){
+ if (loc.isInvalid()) {
----------------
hokein wrote:
> I think we can make it as an ASTMatcher instead of a function like:
>
> ```
> AST_POLYMORPHIC_MATCHER_P(isInAbseilFile,
> AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt,
> TypeLoc)) {
> // your code here.
> }
> ```
Unfortunately, I do not think we can. That was the way I originally tried to
implement it. It worked on no-namespace-check, but not in this one. This is
because as an AST_POLYMORPHIC_MATCHER_P, we are trying to match an usage of a
Decl, not the Decl itself and since we are matching a TypeLoc in
no-internal-deps-check, not really the usage, it doesn't work.
As a result, I modified my original implementation, which you will see in
no-namespace-check and turned it into IsInAbseilFile(SourceManager&,
SourceLocation), which is just takes a source location and returns whether the
location we matched is in an Abseil file
https://reviews.llvm.org/D50542
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits