[llvm] r210819 - LangRef: clarify that global declarations can have section and alignment info.
Bob Wilson
bob.wilson at apple.com
Thu Jun 12 13:40:33 PDT 2014
Author: bwilson
Date: Thu Jun 12 15:40:33 2014
New Revision: 210819
URL: http://llvm.org/viewvc/llvm-project?rev=210819&view=rev
Log:
LangRef: clarify that global declarations can have section and alignment info.
I'm not sure what it means to set a section for a declaration in another
translation unit, but there are some tests in the tree that do it so it seems
to be legal now regardless.
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=210819&r1=210818&r2=210819&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.rst (original)
+++ llvm/trunk/docs/LangRef.rst Thu Jun 12 15:40:33 2014
@@ -519,12 +519,14 @@ Global Variables
Global variables define regions of memory allocated at compilation time
instead of run-time.
-Global variables definitions must be initialized, may have an explicit section
-to be placed in, and may have an optional explicit alignment specified.
+Global variables definitions must be initialized.
Global variables in other translation units can also be declared, in which
case they don't have an initializer.
+Either global variable definitions or declarations may have an explicit section
+to be placed in and may have an optional explicit alignment specified.
+
A variable may be defined as a global ``constant``, which indicates that
the contents of the variable will **never** be modified (enabling better
optimization, allowing the global data to be placed in the read-only
@@ -589,8 +591,8 @@ Syntax::
[@<GlobalVarName> =] [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
[unnamed_addr] [AddrSpace] [ExternallyInitialized]
- <global | constant> <Type> [<InitializerConstant>
- [, section "name"] [, align <Alignment>]]
+ <global | constant> <Type> [<InitializerConstant>]
+ [, section "name"] [, align <Alignment>]
For example, the following defines a global in a numbered address space
with an initializer, section, and alignment:
More information about the llvm-commits
mailing list