diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2014-06-12 20:40:33 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2014-06-12 20:40:33 +0000 |
| commit | 85b24f2b36d4d133a18cb12260458a65ebb26c9e (patch) | |
| tree | 89dd4ec7e7913f683b0807e9e09aa8d54938f06e | |
| parent | 8895c52a6303a00559272cefb098e9a553cd8bf0 (diff) | |
| download | bcm5719-llvm-85b24f2b36d4d133a18cb12260458a65ebb26c9e.tar.gz bcm5719-llvm-85b24f2b36d4d133a18cb12260458a65ebb26c9e.zip | |
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.
llvm-svn: 210819
| -rw-r--r-- | llvm/docs/LangRef.rst | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index 434bcbe6655..ee95cb9f850 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -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: |

