[llvm-branch-commits] [llvm] release/19.x: [AA] Take account of C++23's stricter rules for forward declarations (NFC) (#109416) (PR #109476)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Sep 20 14:02:23 PDT 2024


https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/109476

Backport 76bc1eddb2cf8b6cc073649ade21b59bbed438a2

Requested by: @nikic

>From d28a483434e3404d2136558a95ec201c3b327925 Mon Sep 17 00:00:00 2001
From: Jonathan Tanner <10051116+aDifferentJT at users.noreply.github.com>
Date: Fri, 20 Sep 2024 21:56:40 +0100
Subject: [PATCH] [AA] Take account of C++23's stricter rules for forward
 declarations (NFC) (#109416)

C++23 has stricter rules for forward declarations around
std::unique_ptr, this means that the inline declaration of the
constructor was failing under clang in C++23 mode, switching to an
out-of-line definition of the constructor fixes this.

This was fairly major impact as it blocked inclusion of a lot of headers
under clang in C++23 mode.

Fixes #106597.

(cherry picked from commit 76bc1eddb2cf8b6cc073649ade21b59bbed438a2)
---
 llvm/include/llvm/Analysis/AliasAnalysis.h | 2 +-
 llvm/lib/Analysis/AliasAnalysis.cpp        | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h
index 4140387a1f3410..1b5a6ee24b8610 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -320,7 +320,7 @@ class AAResults {
 public:
   // Make these results default constructable and movable. We have to spell
   // these out because MSVC won't synthesize them.
-  AAResults(const TargetLibraryInfo &TLI) : TLI(TLI) {}
+  AAResults(const TargetLibraryInfo &TLI);
   AAResults(AAResults &&Arg);
   ~AAResults();
 
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 6eaaad5f332eb9..9cdb315b6088f3 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -73,6 +73,8 @@ static cl::opt<bool> EnableAATrace("aa-trace", cl::Hidden, cl::init(false));
 static const bool EnableAATrace = false;
 #endif
 
+AAResults::AAResults(const TargetLibraryInfo &TLI) : TLI(TLI) {}
+
 AAResults::AAResults(AAResults &&Arg)
     : TLI(Arg.TLI), AAs(std::move(Arg.AAs)), AADeps(std::move(Arg.AADeps)) {}
 



More information about the llvm-branch-commits mailing list