[PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes

Etienne Bergeron via cfe-commits cfe-commits at lists.llvm.org
Tue May 31 19:38:10 PDT 2016


etienneb added a comment.

In http://reviews.llvm.org/D20714#444802, @Eugene.Zelenko wrote:

> Point of Include What You Use suggestions to rely on explicit dependencies, not implicit ones.


It's true most of the time.
In some case,  splitting the header file is for maintainability and including the root is still the right coding-style to use.

I can't tell about what clang/llvm community will prefer. Both approaches make sense and it's matter of choice.

As an example, look to "ast.h"... there is no needs at all for the existence of that file if you only rely on your current rules.

  14 #ifndef LLVM_CLANG_AST_AST_H
  15 #define LLVM_CLANG_AST_AST_H
  16 
  17 // This header exports all AST interfaces.
  18 #include "clang/AST/ASTContext.h"
  19 #include "clang/AST/Decl.h"
  20 #include "clang/AST/DeclCXX.h"
  21 #include "clang/AST/DeclObjC.h"
  22 #include "clang/AST/DeclTemplate.h"
  23 #include "clang/AST/Expr.h"
  24 #include "clang/AST/ExprObjC.h"
  25 #include "clang/AST/StmtVisitor.h"
  26 #include "clang/AST/Type.h"
  27 
  28 #endif

On my side, having the include statement for every AST file is over-kill.


Repository:
  rL LLVM

http://reviews.llvm.org/D20714





More information about the cfe-commits mailing list