Skip to content

Conversation

tonycoz
Copy link

@tonycoz tonycoz commented Sep 10, 2023

No description provided.

Several distributions build clang with CLANG_VENDOR defined:

https://github.com/llvm/llvm-project/blob/444abb39/clang/lib/Basic/Version.cpp#L96

For example:

  tony@enceladus:~$ grep PRETTY_NAME /etc/os-release
  PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
  tony@enceladus:~$ clang --version | head -n1
  Debian clang version 14.0.6

  tony@enceladus:~$ grep PRETTY_NAME /etc/os-release
  PRETTY_NAME="Ubuntu 22.04.3 LTS"
  tony@enceladus:~$ clang --version | head -n1
  Ubuntu clang version 14.0.0-1ubuntu1.1

  openbsd69$ uname -a
  OpenBSD openbsd69.tony.develop-help.com 6.9 GENERIC#464 amd64
  openbsd69$ cc --version | head -n1
  OpenBSD clang version 10.0.1

  enceladus:~$ clang-15 --version | head -n1
  Alpine clang version 15.0.7
  enceladus:~$ clang --version | head -n1
  Alpine clang version 15.0.7
  enceladus:~$ grep PRETTY_NAME /etc/os-release
  PRETTY_NAME="Alpine Linux v3.17"

From https://trac.macports.org/wiki/XcodeVersionInfo :

  Apple clang version 14.0.0 (clang-1400.0.29.202)

so adjust the regexp to allow a leading vendor.  It's possible
for the vendor to contain spaces, but I haven't found any examples
of that in the wild.

Keep the match tight by checking for the following " version".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants