r210313 - Devise a package-private means to determine the LLVM version string

Alp Toker alp at nuanti.com
Fri Jun 6 04:39:12 PDT 2014


On 06/06/2014 14:23, Timur Iskhodzhanov wrote:
>
> 2014-06-06 10:58 GMT+04:00 Alp Toker <alp at nuanti.com 
> <mailto:alp at nuanti.com>>:
>
>     Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=210313&r1=210312&r2=210313&view=diff
>     <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=210313&r1=210312&r2=210313&view=diff>
>     ==============================================================================
>     --- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
>     +++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Fri Jun  6
>     01:58:25 2014
>     @@ -16,6 +16,7 @@
>      #include "clang/Basic/SourceManager.h"
>      #include "clang/Basic/TargetInfo.h"
>      #include "clang/Basic/Version.h"
>     +#include "clang/Config/config.h"
>      #include "clang/Frontend/ChainedDiagnosticConsumer.h"
>      #include "clang/Frontend/FrontendAction.h"
>      #include "clang/Frontend/FrontendActions.h"
>     @@ -709,9 +710,7 @@ bool CompilerInstance::ExecuteAction(Fro
>        // Validate/process some options.
>        if (getHeaderSearchOpts().Verbose)
>          OS << "clang -cc1 version " CLANG_VERSION_STRING
>     -#ifdef PACKAGE_STRING
>     -       << " based upon " << PACKAGE_STRING
>     -#endif
>     +       << " based upon " << BACKEND_PACKAGE_STRING
>             << " default target " <<
>     llvm::sys::getDefaultTargetTriple() << "\n";
>
>        if (getFrontendOpts().ShowTimers)
>
>
> Is the removal of #ifdef intentional?

Yes, it matches the original LLVM config.h behaviour this way. The goal 
was to make the config.h switch without functional changes in output.

Now that it's working though we might want to push ahead make it 
consistent with clang --version. That would involve:

  1) Guard with #ifdef CLANG_VENDOR
  2) Change the string from "upon" to "on"

Feel free to take that up, it's not on my immediate TODO list.

Alp.

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list