summaryrefslogtreecommitdiff
path: root/tools/llvmc/doc/LLVMC-Reference.rst
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2009-06-30 00:16:00 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2009-06-30 00:16:00 +0000
commit875ace52ee52c9100cf80a1f0229d26b77963a11 (patch)
tree3c181d261bb571981f4efd0adb0220d73e7e720e /tools/llvmc/doc/LLVMC-Reference.rst
parent583cf319731fc50aac0413bf2f508f4991c81615 (diff)
downloadllvm-875ace52ee52c9100cf80a1f0229d26b77963a11.tar.gz
llvm-875ace52ee52c9100cf80a1f0229d26b77963a11.tar.bz2
llvm-875ace52ee52c9100cf80a1f0229d26b77963a11.tar.xz
Add a way to access argv[0] in hooks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74483 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc/doc/LLVMC-Reference.rst')
-rw-r--r--tools/llvmc/doc/LLVMC-Reference.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/llvmc/doc/LLVMC-Reference.rst b/tools/llvmc/doc/LLVMC-Reference.rst
index 329f9ea5eb..ddc54d2a13 100644
--- a/tools/llvmc/doc/LLVMC-Reference.rst
+++ b/tools/llvmc/doc/LLVMC-Reference.rst
@@ -678,6 +678,28 @@ errors as its status code.
.. _Graphviz: http://www.graphviz.org/
.. _Ghostview: http://pages.cs.wisc.edu/~ghost/
+Conditioning on the executable name
+-----------------------------------
+
+For now, the executable name (the value passed to the driver in ``argv[0]``) is
+accessible only in the C++ code (i.e. hooks). Use the following code::
+
+ namespace llvmc {
+ extern const char* ProgramName;
+ }
+
+ std::string MyHook() {
+ //...
+ if (strcmp(ProgramName, "mydriver") == 0) {
+ //...
+
+ }
+
+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 ``Base`` plugin behaves when it needs to choose the correct linker options
+(think ``g++`` vs. ``gcc``).
+
.. raw:: html
<hr />