diff options
author | Dimitry Andric <dimitry@andric.com> | 2023-12-20 20:03:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-20 20:03:19 +0100 |
commit | 9055519103eadfba0b48810be926883a71890c55 (patch) | |
tree | f1fbb4e0914b28185d203161761d3637669dae26 /clang/lib/Basic/Version.cpp | |
parent | 8b231d73bdd47a69ccf1350b49fb824999426bba (diff) | |
download | llvm-9055519103eadfba0b48810be926883a71890c55.zip llvm-9055519103eadfba0b48810be926883a71890c55.tar.gz llvm-9055519103eadfba0b48810be926883a71890c55.tar.bz2 |
[clang] Add getClangVendor() and use it in CodeGenModule.cpp (#75935)
In 9a38a72f1d482 `ProductId` was assigned from the stringified value of
`CLANG_VENDOR`, if that macro was defined. However, `CLANG_VENDOR` is
supposed to be a string, as it is defined (optionally) as such in the
top-level clang `CMakeLists.txt`.
Move the addition of `-DCLANG_VENDOR` to the compiler flags from
`clang/lib/Basic/CMakeLists.txt` to the top-level `CMakeLists.txt`, so
it is consistent across the whole clang codebase. Then remove the
stringification from `CodeGenModule.cpp`, to make it work correctly.
Fixes: 9a38a72f1d482
Diffstat (limited to 'clang/lib/Basic/Version.cpp')
-rw-r--r-- | clang/lib/Basic/Version.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp index e205da7..4823f56 100644 --- a/clang/lib/Basic/Version.cpp +++ b/clang/lib/Basic/Version.cpp @@ -57,6 +57,14 @@ std::string getLLVMRevision() { #endif } +std::string getClangVendor() { +#ifdef CLANG_VENDOR + return CLANG_VENDOR; +#else + return ""; +#endif +} + std::string getClangFullRepositoryVersion() { std::string buf; llvm::raw_string_ostream OS(buf); @@ -92,10 +100,7 @@ std::string getClangFullVersion() { std::string getClangToolFullVersion(StringRef ToolName) { std::string buf; llvm::raw_string_ostream OS(buf); -#ifdef CLANG_VENDOR - OS << CLANG_VENDOR; -#endif - OS << ToolName << " version " CLANG_VERSION_STRING; + OS << getClangVendor() << ToolName << " version " CLANG_VERSION_STRING; std::string repo = getClangFullRepositoryVersion(); if (!repo.empty()) { @@ -110,10 +115,7 @@ std::string getClangFullCPPVersion() { // the one we report on the command line. std::string buf; llvm::raw_string_ostream OS(buf); -#ifdef CLANG_VENDOR - OS << CLANG_VENDOR; -#endif - OS << "Clang " CLANG_VERSION_STRING; + OS << getClangVendor() << "Clang " CLANG_VERSION_STRING; std::string repo = getClangFullRepositoryVersion(); if (!repo.empty()) { |