Regenerate.
authorMikhail Glushenkov <foldr@codedgers.com>
Tue, 30 Jun 2009 00:16:43 +0000 (00:16 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Tue, 30 Jun 2009 00:16:43 +0000 (00:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74485 91177308-0d34-0410-b5e6-96231b3b80d8

docs/CompilerDriver.html

index d0bb72396c48bb2600ef5add5615d95038179e02..d84aacf14bb79572d229e4ac898786f96cd7193d 100644 (file)
@@ -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, &quot;mydriver&quot;) == 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">