diff options
author | ed <ed@FreeBSD.org> | 2009-07-04 13:58:26 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-07-04 13:58:26 +0000 |
commit | 72621d11de5b873f1695f391eb95f0b336c3d2d4 (patch) | |
tree | 84360c8989c912127a383af37c4b1aa5767bd16e /docs/CompilerDriver.html | |
parent | cf5cd875b51255602afaed29deb636b66b295671 (diff) | |
download | FreeBSD-src-72621d11de5b873f1695f391eb95f0b336c3d2d4.zip FreeBSD-src-72621d11de5b873f1695f391eb95f0b336c3d2d4.tar.gz |
Import LLVM 74788.
Diffstat (limited to 'docs/CompilerDriver.html')
-rw-r--r-- | docs/CompilerDriver.html | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/docs/CompilerDriver.html b/docs/CompilerDriver.html index e79ec5c..6b531c4 100644 --- a/docs/CompilerDriver.html +++ b/docs/CompilerDriver.html @@ -37,6 +37,7 @@ The ReST source lives in the directory 'tools/llvmc/doc'. --> <li><a class="reference internal" href="#hooks-and-environment-variables" id="id17">Hooks and environment variables</a></li> <li><a class="reference internal" href="#how-plugins-are-loaded" id="id18">How plugins are loaded</a></li> <li><a class="reference internal" href="#debugging" id="id19">Debugging</a></li> +<li><a class="reference internal" href="#conditioning-on-the-executable-name" id="id20">Conditioning on the executable name</a></li> </ul> </li> </ul> @@ -94,9 +95,8 @@ $ llvmc --linker=c++ hello.o $ ./a.out hello </pre> -<p>By default, LLVMC uses <tt class="docutils literal"><span class="pre">llvm-gcc</span></tt> to compile the source code. It is -also possible to choose the work-in-progress <tt class="docutils literal"><span class="pre">clang</span></tt> compiler with -the <tt class="docutils literal"><span class="pre">-clang</span></tt> option.</p> +<p>By default, LLVMC uses <tt class="docutils literal"><span class="pre">llvm-gcc</span></tt> to compile the source code. It is also +possible to choose the <tt class="docutils literal"><span class="pre">clang</span></tt> compiler with the <tt class="docutils literal"><span class="pre">-clang</span></tt> option.</p> </div> <div class="section" id="predefined-options"> <h1><a class="toc-backref" href="#id6">Predefined options</a></h1> @@ -633,6 +633,27 @@ be performed at compile-time because the plugins can load code dynamically. When invoked with <tt class="docutils literal"><span class="pre">--check-graph</span></tt>, <tt class="docutils literal"><span class="pre">llvmc</span></tt> doesn't perform any compilation tasks and returns the number of encountered errors as its status code.</p> +</div> +<div class="section" id="conditioning-on-the-executable-name"> +<h2><a class="toc-backref" href="#id20">Conditioning on the executable name</a></h2> +<p>For now, the executable name (the value passed to the driver in <tt class="docutils literal"><span class="pre">argv[0]</span></tt>) is +accessible only in the C++ code (i.e. hooks). Use the following code:</p> +<pre class="literal-block"> +namespace llvmc { +extern const char* ProgramName; +} + +std::string MyHook() { +//... +if (strcmp(ProgramName, "mydriver") == 0) { + //... + +} +</pre> +<p>In general, you're encouraged not to make the behaviour dependent on the +executable file name, and use command-line switches instead. See for example how +the <tt class="docutils literal"><span class="pre">Base</span></tt> plugin behaves when it needs to choose the correct linker options +(think <tt class="docutils literal"><span class="pre">g++</span></tt> vs. <tt class="docutils literal"><span class="pre">gcc</span></tt>).</p> <hr /> <address> <a href="http://jigsaw.w3.org/css-validator/check/referer"> @@ -645,7 +666,7 @@ errors as its status code.</p> <a href="mailto:foldr@codedgers.com">Mikhail Glushenkov</a><br /> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br /> -Last modified: $Date: 2009-06-25 20:21:10 +0200 (Thu, 25 Jun 2009) $ +Last modified: $Date: 2009-06-30 02:16:43 +0200 (Tue, 30 Jun 2009) $ </address></div> </div> </div> |