[llvm-commits] [llvm] r47342 - in /llvm/trunk: include/llvm/ include/llvm/Support/ lib/AsmParser/ lib/Bitcode/Writer/ lib/Transforms/IPO/ lib/Transforms/Scalar/ lib/VMCore/ tools/llvm2cpp/

Chris Lattner clattner at apple.com
Wed Feb 20 12:49:07 PST 2008


On Feb 20, 2008, at 11:38 AM, Dale Johannesen wrote:

>
> On Feb 20, 2008, at 11:30 AM, Chris Lattner wrote:
>
>>>> None of these are absolute hard requirements or rules, they are  
>>>> more
>>>> of guiding principles.  In this case, pulling in FoldingSet.h into
>>>> Instruction.h means that just about everything that manipulates the
>>>> IR
>>>> will get it.  This means that .cpp files should have their #include
>>>> removed (by #2) and it thus makes it less obvious what is  
>>>> happening.
>>>
>>> Wow, that's complicated.   I've always favored a simple rule:
>>>
>>> Anything that refers to a type is responsible for including the
>>> header
>>> that declares it.
>>
>> We follow the same simple rule.  It's just not the whole story :).
>
> Not really, your principle #2 example above contradicts mine.
> I would have the include in both places in that circumstance.

My intention was to say that code should not include headers it  
doesn't need.  This sort or thing often happens when people cut/paste  
#include blocks from one file to another when they start a new file.

-Chris



More information about the llvm-commits mailing list