diff options
| author | Mehdi Amini <mehdi.amini@apple.com> | 2016-10-09 23:00:34 +0000 |
|---|---|---|
| committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-10-09 23:00:34 +0000 |
| commit | f42454b94b035cd4ad65c8470bb56e761f79b86e (patch) | |
| tree | dc8386dc823263161a0fadf2cf1de1227927a2e7 /llvm/docs | |
| parent | 69125397170c6ee553725b8bfb562fe38d3ffefe (diff) | |
| download | bcm5719-llvm-f42454b94b035cd4ad65c8470bb56e761f79b86e.tar.gz bcm5719-llvm-f42454b94b035cd4ad65c8470bb56e761f79b86e.zip | |
Move the global variables representing each Target behind accessor function
This avoids "static initialization order fiasco"
Differential Revision: https://reviews.llvm.org/D25412
llvm-svn: 283702
Diffstat (limited to 'llvm/docs')
| -rw-r--r-- | llvm/docs/WritingAnLLVMBackend.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/docs/WritingAnLLVMBackend.rst b/llvm/docs/WritingAnLLVMBackend.rst index f0f3ab5504d..f06a95da215 100644 --- a/llvm/docs/WritingAnLLVMBackend.rst +++ b/llvm/docs/WritingAnLLVMBackend.rst @@ -288,11 +288,11 @@ looks like this: .. code-block:: c++ - Target llvm::TheSparcTarget; + Target llvm::getTheSparcTarget(); extern "C" void LLVMInitializeSparcTargetInfo() { RegisterTarget<Triple::sparc, /*HasJIT=*/false> - X(TheSparcTarget, "sparc", "Sparc"); + X(getTheSparcTarget(), "sparc", "Sparc"); } This allows the ``TargetRegistry`` to look up the target by name or by target @@ -305,7 +305,7 @@ example. Here is an example of registering the Sparc assembly printer: .. code-block:: c++ extern "C" void LLVMInitializeSparcAsmPrinter() { - RegisterAsmPrinter<SparcAsmPrinter> X(TheSparcTarget); + RegisterAsmPrinter<SparcAsmPrinter> X(getTheSparcTarget()); } For more information, see "`llvm/Target/TargetRegistry.h |

