[AA] Take account of C++23's stricter rules for forward declarations (NFC) (#109416)
authorJonathan Tanner <10051116+aDifferentJT@users.noreply.github.com>
Fri, 20 Sep 2024 20:56:40 +0000 (21:56 +0100)
committerTobias Hieta <tobias@hieta.se>
Tue, 24 Sep 2024 06:32:34 +0000 (08:32 +0200)
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
llvm/lib/Analysis/AliasAnalysis.cpp

index 4140387a1f3410917ed86998111fd0afe25e526d..1b5a6ee24b86109e6b2d005fdef2213925ad734b 100644 (file)
@@ -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();
 
index 6eaaad5f332eb911ad10cd0613da3bbea44a6e7c..9cdb315b6088f37573beb37c0ae462e1f4edaffb 100644 (file)
@@ -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)) {}