diff --git a/docs/CompilerDriver.html b/docs/CompilerDriver.html index d0bb72396c4..d84aacf14bb 100644 --- a/docs/CompilerDriver.html +++ b/docs/CompilerDriver.html @@ -37,6 +37,7 @@ The ReST source lives in the directory 'tools/llvmc/doc'. -->
  • Hooks and environment variables
  • How plugins are loaded
  • Debugging
  • +
  • Conditioning on the executable name
  • @@ -94,9 +95,8 @@ $ llvmc --linker=c++ hello.o $ ./a.out hello -

    By default, LLVMC uses llvm-gcc to compile the source code. It is -also possible to choose the work-in-progress clang compiler with -the -clang option.

    +

    By default, LLVMC uses llvm-gcc to compile the source code. It is also +possible to choose the clang compiler with the -clang option.

    Predefined options

    @@ -633,6 +633,27 @@ be performed at compile-time because the plugins can load code dynamically. When invoked with --check-graph, llvmc doesn't perform any compilation tasks and returns the number of encountered errors as its status code.

    +
    +
    +

    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).