linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools build: Fix clang detection with clang >= 8.0
@ 2019-08-13  5:07 Matthew Dawson
  2019-08-14 20:47 ` Nick Desaulniers
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Dawson @ 2019-08-13  5:07 UTC (permalink / raw)
  To: linux-kernel, clang-built-linux; +Cc: Matthew Dawson

The 8.0 release of clang/llvm moved the VirtualFileSystem.h header
to from clang to llvm.  This change causes a compile error, causing
perf to not detect clang/llvm.

Fix by including the right header for the different versions of llvm,
using the older header for llvm < 8, and the new header for llvm >= 8.

Signed-off-by: Matthew Dawson <matthew@mjdsystems.ca>
---
 tools/build/feature/test-clang.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/build/feature/test-clang.cpp b/tools/build/feature/test-clang.cpp
index a2b3f092d2f0..313ef1568880 100644
--- a/tools/build/feature/test-clang.cpp
+++ b/tools/build/feature/test-clang.cpp
@@ -1,10 +1,14 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "clang/Basic/VirtualFileSystem.h"
 #include "clang/Driver/Driver.h"
 #include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/raw_ostream.h"
+#if LLVM_VERSION_MAJOR >= 8
+#include "llvm/Support/VirtualFileSystem.h"
+#else
+#include "clang/Basic/VirtualFileSystem.h"
+#endif
 
 using namespace clang;
 using namespace clang::driver;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools build: Fix clang detection with clang >= 8.0
  2019-08-13  5:07 [PATCH] tools build: Fix clang detection with clang >= 8.0 Matthew Dawson
@ 2019-08-14 20:47 ` Nick Desaulniers
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Desaulniers @ 2019-08-14 20:47 UTC (permalink / raw)
  To: Matthew Dawson; +Cc: LKML, clang-built-linux

On Mon, Aug 12, 2019 at 10:07 PM Matthew Dawson <matthew@mjdsystems.ca> wrote:
>
> The 8.0 release of clang/llvm moved the VirtualFileSystem.h header
> to from clang to llvm.  This change causes a compile error, causing
> perf to not detect clang/llvm.
>
> Fix by including the right header for the different versions of llvm,
> using the older header for llvm < 8, and the new header for llvm >= 8.
>
> Signed-off-by: Matthew Dawson <matthew@mjdsystems.ca>

Specifically the header was moved in svn revision r344140.
llvmorg-8.0.0 was tagged off of r356365, while llvmorg-7.0.0 is tagged
off of r342383.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  tools/build/feature/test-clang.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/build/feature/test-clang.cpp b/tools/build/feature/test-clang.cpp
> index a2b3f092d2f0..313ef1568880 100644
> --- a/tools/build/feature/test-clang.cpp
> +++ b/tools/build/feature/test-clang.cpp
> @@ -1,10 +1,14 @@
>  // SPDX-License-Identifier: GPL-2.0
> -#include "clang/Basic/VirtualFileSystem.h"
>  #include "clang/Driver/Driver.h"
>  #include "clang/Frontend/TextDiagnosticPrinter.h"
>  #include "llvm/ADT/IntrusiveRefCntPtr.h"
>  #include "llvm/Support/ManagedStatic.h"
>  #include "llvm/Support/raw_ostream.h"
> +#if LLVM_VERSION_MAJOR >= 8
> +#include "llvm/Support/VirtualFileSystem.h"
> +#else
> +#include "clang/Basic/VirtualFileSystem.h"
> +#endif

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-14 20:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-13  5:07 [PATCH] tools build: Fix clang detection with clang >= 8.0 Matthew Dawson
2019-08-14 20:47 ` Nick Desaulniers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).