[llvm] r210808 - Add missing "InitializerConstant" to global variable syntax in LangRef.

Reid Kleckner rnk at google.com
Thu Jun 12 13:14:44 PDT 2014


On Thu, Jun 12, 2014 at 1:03 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

>
> > On 2014-Jun-12, at 11:42, Bob Wilson <bob.wilson at apple.com> wrote:
> >
> > Author: bwilson
> > Date: Thu Jun 12 13:42:55 2014
> > New Revision: 210808
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=210808&view=rev
> > Log:
> > Add missing "InitializerConstant" to global variable syntax in LangRef.
> >
> > The syntax for Global Variables in LangRef is missing the initializer.
> > This syntax section was added in r199218 along with changes to the
> > dllexport/dllimport handling, and I guess it was just an oversight to
> omit the
> > initializer values. I’ve marked the initializer as optional because this
> syntax
> > is used for both declarations and definitions.
> >
> > Modified:
> >    llvm/trunk/docs/LangRef.rst
> >
> > Modified: llvm/trunk/docs/LangRef.rst
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=210808&r1=210807&r2=210808&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/docs/LangRef.rst (original)
> > +++ llvm/trunk/docs/LangRef.rst Thu Jun 12 13:42:55 2014
> > @@ -589,8 +589,8 @@ Syntax::
> >
> >     [@<GlobalVarName> =] [Linkage] [Visibility] [DLLStorageClass]
> [ThreadLocal]
> >                          [unnamed_addr] [AddrSpace]
> [ExternallyInitialized]
> > -                         <global | constant> <Type>
> > -                         [, section "name"] [, align <Alignment>]
> > +                         <global | constant> <Type>
> [<InitializerConstant>
> > +                         [, section "name"] [, align <Alignment>]]
>
> Was it intentional to require an InitializerConstant any time there's a
> section name and/or an Alignment?  In particular, it seems unlikely that
> a declaration (without a value) can't specify the alignment.


I tried to check LLParser.cpp to answer this question when I reviewed the
change, but I misread it.  You're right, we do accept this:
@y = external global i32*, align 4

You can have alignment and section without an initializer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140612/a2bc9ab9/attachment.html>


More information about the llvm-commits mailing list