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

Kim Gräsman kim.grasman at gmail.com
Sun Jun 9 10:48:13 PDT 2013


Hi Tobias,

I can't speak for Reid's change, but I thought I'd clarify a little on
include-what-you-use: see the wiki for more detail on its reasoning
around uses, forward declarations and author intent. The paragraph on
the front page is a little misleading, IWYU does much more than that.

- Kim

On Sun, Jun 9, 2013 at 7:30 PM, Tobias Grosser <tobias at grosser.es> wrote:
> 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/
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list