[llvm] [llvm][SandboxIR] Fix some clang-cl warnings on Windows (PR #101660)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 05:13:58 PDT 2024


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/101660

[4958/6355] Building CXX object lib\SandboxIR\CMakeFiles\LLVMSandboxIR.dir\Tracker.cpp.obj In file included from C:\Work\david.spickett\llvm-project\llvm\lib\SandboxIR\Tracker.cpp:9: In file included from C:\Work\david.spickett\llvm-project\llvm\include\llvm/SandboxIR/Tracker.h:48: C:\Work\david.spickett\llvm-project\llvm\include\llvm/SandboxIR/Use.h(46,16): warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
   46 |   friend class CallBrInst;         // For constructor
      |                ^
      |                ::llvm::
In file included from C:\Work\david.spickett\llvm-project\llvm\lib\SandboxIR\Tracker.cpp:13:
C:\Work\david.spickett\llvm-project\llvm\include\llvm/SandboxIR/SandboxIR.h(1433,16): warning:
unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
 1433 |   friend class PtrToInt; // For constructor.
      |                ^
      |                ::llvm::

First one I think is a missing forward declaration and I couldn't find the right class for the second one but it appears to be unused anyway.

>From 37f85364a14661c911fe98d3bd52ad3f88abf65b Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 2 Aug 2024 12:10:39 +0000
Subject: [PATCH] [llvm][SandboxIR] Fix some clang-cl warnings on Windows

[4958/6355] Building CXX object lib\SandboxIR\CMakeFiles\LLVMSandboxIR.dir\Tracker.cpp.obj
In file included from C:\Work\david.spickett\llvm-project\llvm\lib\SandboxIR\Tracker.cpp:9:
In file included from C:\Work\david.spickett\llvm-project\llvm\include\llvm/SandboxIR/Tracker.h:48:
C:\Work\david.spickett\llvm-project\llvm\include\llvm/SandboxIR/Use.h(46,16): warning:
unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
   46 |   friend class CallBrInst;         // For constructor
      |                ^
      |                ::llvm::
In file included from C:\Work\david.spickett\llvm-project\llvm\lib\SandboxIR\Tracker.cpp:13:
C:\Work\david.spickett\llvm-project\llvm\include\llvm/SandboxIR/SandboxIR.h(1433,16): warning:
unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft-unqualified-friend]
 1433 |   friend class PtrToInt; // For constructor.
      |                ^
      |                ::llvm::

First one I think is a missing forward declaration and I couldn't find
the right class for the second one but it appears to be unused anyway.
---
 llvm/include/llvm/SandboxIR/SandboxIR.h | 1 -
 llvm/include/llvm/SandboxIR/Use.h       | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/SandboxIR/SandboxIR.h b/llvm/include/llvm/SandboxIR/SandboxIR.h
index 313b541ddcaca..05f4e90f5eb1d 100644
--- a/llvm/include/llvm/SandboxIR/SandboxIR.h
+++ b/llvm/include/llvm/SandboxIR/SandboxIR.h
@@ -1430,7 +1430,6 @@ class CastInst : public UnaryInstruction {
       : UnaryInstruction(ClassID::Cast, getCastOpcode(CI->getOpcode()), CI,
                          Ctx) {}
   friend Context;        // for SBCastInstruction()
-  friend class PtrToInt; // For constructor.
   Use getOperandUseInternal(unsigned OpIdx, bool Verify) const final {
     return getOperandUseDefault(OpIdx, Verify);
   }
diff --git a/llvm/include/llvm/SandboxIR/Use.h b/llvm/include/llvm/SandboxIR/Use.h
index 35d01daf39f6e..5b55337b12bc2 100644
--- a/llvm/include/llvm/SandboxIR/Use.h
+++ b/llvm/include/llvm/SandboxIR/Use.h
@@ -22,6 +22,7 @@ class Context;
 class Value;
 class User;
 class CallBase;
+class CallBrInst;
 class PHINode;
 
 /// Represents a Def-use/Use-def edge in SandboxIR.



More information about the llvm-commits mailing list