[llvm] 17508cb - [NFC] Fix builds on recent GCC with C++20 enabled

Alexander Batashev via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 09:44:57 PDT 2023


Author: Alexander Batashev
Date: 2023-07-18T19:44:06+03:00
New Revision: 17508cbcc628ad45012660362bd1ace81da85f3b

URL: https://github.com/llvm/llvm-project/commit/17508cbcc628ad45012660362bd1ace81da85f3b
DIFF: https://github.com/llvm/llvm-project/commit/17508cbcc628ad45012660362bd1ace81da85f3b.diff

LOG: [NFC] Fix builds on recent GCC with C++20 enabled

The following pattern fails on recent GCC versions with -std=c++20 flag passed
and succeeds with -std=c++17. Such behavior is not observed on Clang 16.0.

```c++
template <typename T>
struct Foo {
    Foo<T>(int a) {}
};
```

This patch removes template parameter from constructor in two occurences to
make the following command complete successfully:
bazel build -c fastbuild --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 @llvm-project//llvm/...

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D154782

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/ByteProvider.h
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/ByteProvider.h b/llvm/include/llvm/CodeGen/ByteProvider.h
index e0ba40b1353363..3187b4e68c56f3 100644
--- a/llvm/include/llvm/CodeGen/ByteProvider.h
+++ b/llvm/include/llvm/CodeGen/ByteProvider.h
@@ -29,8 +29,7 @@ namespace llvm {
 /// are used to extract Bytes.
 template <typename ISelOp> class ByteProvider {
 private:
-  ByteProvider<ISelOp>(std::optional<ISelOp> Src, int64_t DestOffset,
-                       int64_t SrcOffset)
+  ByteProvider(std::optional<ISelOp> Src, int64_t DestOffset, int64_t SrcOffset)
       : Src(Src), DestOffset(DestOffset), SrcOffset(SrcOffset) {}
 
   // TODO -- use constraint in c++20

diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 89f39f8693c26f..0bfcb8ce8bc534 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -3472,8 +3472,7 @@ template <typename BaseTy, typename ToTy>
 struct CachedReachabilityAA : public BaseTy {
   using RQITy = ReachabilityQueryInfo<ToTy>;
 
-  CachedReachabilityAA<BaseTy, ToTy>(const IRPosition &IRP, Attributor &A)
-      : BaseTy(IRP, A) {}
+  CachedReachabilityAA(const IRPosition &IRP, Attributor &A) : BaseTy(IRP, A) {}
 
   /// See AbstractAttribute::isQueryAA.
   bool isQueryAA() const override { return true; }


        


More information about the llvm-commits mailing list