[cfe-commits] [PATCH] llvm.annotation support

Joerg Sonnenberger joerg at britannica.bec.de
Sat Jun 18 03:53:09 PDT 2011


On Fri, Jun 17, 2011 at 09:45:51PM -0700, Chris Lattner wrote:
> 
> On Jun 17, 2011, at 4:57 PM, John McCall wrote:
> 
> > As a general note, this looks pretty good;  I just have a few organizational
> > and data-structure comments.
> > 
> > diff --git a/lib/CodeGen/CGAnnotations.cpp b/lib/CodeGen/CGAnnotations.cpp
> > 
> > +static const char *AnnotationSection = "llvm.metadata";
> > 
> > This should be a #define;  every single place you use this in the file ends up having to call strlen completely unnecessarily.
> 
> FYI, the optimizer folds strlen of constant strings.  This would be preferred though:
> 
> static const char * const AnnotationSection = "llvm.metadata";

Even better:
static const char AnnotationSection[] = "llvm.metadata";

...in which case strlen() can be substituted with sizeof-1.

Joerg



More information about the cfe-commits mailing list