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

Reid Kleckner rnk at google.com
Sun Jun 9 11:18:13 PDT 2013


CGCleanup.h needs full definitions for these types.  This was the minimal
set of headers I needed to make CGCleanup.h compile if it is included first
in the TU, as is done in CGCleanup.cpp.

Previously it was compiling because CodeGenFunction.h was pulling this and
other stuff in first.


On Sun, Jun 9, 2013 at 1: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<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<http://llvm.org/docs/CodingStandards.html#include-as-little-as-possible>
> [2] http://code.google.com/p/**include-what-you-use/<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<http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130609/52c41acc/attachment.html>


More information about the cfe-commits mailing list