r183632 - [CodeGen] Make CGCleanup.h include what it now uses

Tobias Grosser tobias at grosser.es
Sun Jun 9 10:30:57 PDT 2013


On 06/09/2013 09:56 AM, Reid Kleckner wrote:
> Author: rnk
> Date: Sun Jun  9 11:56:53 2013
> New Revision: 183632
>
> URL: http://llvm.org/viewvc/llvm-project?rev=183632&view=rev
> Log:
> [CodeGen] Make CGCleanup.h include what it now uses
>
> Also move CGCleanup.h to the top of CGCleanup.cpp to verify that
> CGCleanup.h really includes what it needs.

[...]

> -namespace llvm {
> -  class Value;
> -  class BasicBlock;
> -  class BranchInst;
> -}
> +#include "llvm/IR/BasicBlock.h"
> +#include "llvm/IR/Value.h"
> +#include "llvm/IR/Instructions.h"

Hi Reid,

out of interest, why is this an improvement? It seems to be against the 
'include as little as possible rule' [1].

Also, is the 'include what it now uses' a reference to the 'include what 
you use' tool [2]. This tool states the following:

"Include what you use" means this: for every symbol (type, function 
variable, or macro) that you use in foo.cc, either foo.cc or foo.h 
should #include a .h file that exports the declaration of that symbol."

It does not say anything about the case where a full symbol is not 
needed and hence an include is not necessary.

Could you give me some insights about your reasoning?

Cheers,
Tobi

[1] http://llvm.org/docs/CodingStandards.html#include-as-little-as-possible
[2] http://code.google.com/p/include-what-you-use/



More information about the cfe-commits mailing list