[PATCH] D44346: [clang-tidy] Add Zircon module to clang-tidy

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 13 17:00:06 PDT 2018


aaron.ballman added a comment.

I dreamed up some test cases that may or may not make sense. I think they boil down to a few things:

- Does inheriting from a prohibited type still diagnose when the derived type is used to construct a temporary?
- Should it still be prohibited if the temporary type is being returned?



================
Comment at: clang-tidy/zircon/ZirconTidyModule.cpp:29
+};
+// Register the ZirconTidyModule using this statically initialized variable.
+static ClangTidyModuleRegistry::Add<ZirconModule>
----------------
Can you add a bit of vertical whitespace before this comment?


================
Comment at: test/clang-tidy/zircon-temporary-objects.cpp:82
+
+} // namespace NS
----------------
Some additional test cases:
```
template <typename Ty>
Ty make_ty() { return Ty{}; }

// Call make_ty<> with two types: one allowed and one disallowed; I assume only the disallowed triggers the diagnostic.

struct Bingo : NS::Bar {}; // Not explicitly disallowed

void f() {
  Bingo{}; // Should this diagnose because it inherits from Bar?
}

// Assuming derived classes diagnose if the base is prohibited:
template <typename Ty>
struct Quux : Ty {};

void f() {
  Quux<NS::Bar>{}; // Diagnose
  Quux<Bar>{}; // Fine?
}
```


https://reviews.llvm.org/D44346





More information about the cfe-commits mailing list