[LLVMdev] [PATCH] Before/After IR Dumps

Chris Lattner clattner at apple.com
Fri Mar 26 16:03:55 PDT 2010


On Mar 15, 2010, at 11:45 AM, David Greene wrote:
>> +namespace {
>> +/// This is a utility to check whether a pass shoulkd have IR dumped
>> +/// before it.
>> +bool PrintBeforePass(Pass *P) {
>> 
>> Please just mark stand-alone functions "static" don't put them in anonymous
>> namespaces.  
> 
> Ok.  Out of curiosity, why the preference for static?

It reduces nesting and makes it easier to understand whether a function is local or not.

static void foo() ...

is obviously static, but:

void foo() ...

looks non-static, but it turns out it is if there is a namespace{ 200 lines above it.

-Chris



More information about the llvm-dev mailing list