[PATCH] D15710: [clang-tidy] Add non-inline function definition and variable definition check in header files.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 4 06:49:08 PST 2016


alexfh added inline comments.

================
Comment at: clang-tidy/misc/DefinitionsInHeadersCheck.cpp:24
@@ +23,3 @@
+               .bind("name-decl"),
+      this);
+}
----------------
We're looking at the problem from different angles. My view is that a reasonable file naming convention (which at least makes interface header files, textual headers and main files distinguishable) is a widespread enough practice, and the benefits it brings outweigh the costs of enforcing it. However, the opposite point of view also has its right to exist, so we need a solution that fits both ;)

> Perhaps another solution to this is use isInMainFile() || usesHeaderFileExtension().

You probably meant `!isInMainFile() || usesHeaderFileExtension()`. I guess, that will work for us. We could also make the list of header file extensions (or a regular expression pattern for header files) configurable, so that the `usesHeaderFileExtension()` part could be disabled, if needed.


http://reviews.llvm.org/D15710





More information about the cfe-commits mailing list