[llvm-commits] [llvm] r74485 - /llvm/trunk/docs/CompilerDriver.html

Mikhail Glushenkov foldr at codedgers.com
Mon Jun 29 17:16:43 PDT 2009


Author: foldr
Date: Mon Jun 29 19:16:43 2009
New Revision: 74485

URL: http://llvm.org/viewvc/llvm-project?rev=74485&view=rev
Log:
Regenerate.

Modified:
    llvm/trunk/docs/CompilerDriver.html

Modified: llvm/trunk/docs/CompilerDriver.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CompilerDriver.html?rev=74485&r1=74484&r2=74485&view=diff

==============================================================================
--- llvm/trunk/docs/CompilerDriver.html (original)
+++ llvm/trunk/docs/CompilerDriver.html Mon Jun 29 19:16:43 2009
@@ -37,6 +37,7 @@
 <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 @@
 $ ./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 @@
 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">





More information about the llvm-commits mailing list