Author: Nikita Kornev
Date: 2026-07-01T13:26:06+02:00
New Revision: ddf06be97fbf9e8b2b6894f1de87de92f67c452d

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

LOG: [Clang] Fix clang build with GCC 7.5 (#206768)

GCC 7.5 rejects two newer C++ idioms:

- LifetimeSafety/FactsGenerator: replace ArrayRef CTAD with an explicit
ArrayRef<const Expr *> to avoid GCC 7's broken brace-init deduction.
- ScalableStaticAnalysisFramework: add explicit std::move() on
unique_ptr<Derived> returns (pre-P1825, GCC 7 won't implicitly move).

No behavior change; restores compatibility with GCC 7.5.

Co-authored-by: Garbowski, Mateusz <[email protected]>

Added: 
    

Modified: 
    clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
    
clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowAnalysis.cpp
    
clang/lib/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp 
b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
index 8358c69a5165a..b909b8b568aee 100644
--- a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
+++ b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
@@ -626,7 +626,7 @@ void FactsGenerator::VisitCXXOperatorCallExpr(const 
CXXOperatorCallExpr *OCE) {
     }
   }
 
-  ArrayRef Args = {OCE->getArgs(), OCE->getNumArgs()};
+  ArrayRef<const Expr *> Args(OCE->getArgs(), OCE->getNumArgs());
   // For `static operator()`, the first argument is the object argument,
   // remove it from the argument list to avoid off-by-one errors.
   if (OCE->getOperator() == OO_Call && OCE->getDirectCallee()->isStatic())

diff  --git 
a/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowAnalysis.cpp 
b/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowAnalysis.cpp
index bb68bb4353536..0324c2688047c 100644
--- 
a/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowAnalysis.cpp
+++ 
b/clang/lib/ScalableStaticAnalysis/Analyses/PointerFlow/PointerFlowAnalysis.cpp
@@ -91,7 +91,7 @@ Expected<std::unique_ptr<AnalysisResult>> 
deserializePointerFlowAnalysisResult(
   auto Ret = std::make_unique<PointerFlowAnalysisResult>();
 
   Ret->Edges = std::move(Edges);
-  return Ret;
+  return std::move(Ret);
 }
 
 JSONFormat::AnalysisResultRegistry::Add<PointerFlowAnalysisResult>

diff  --git 
a/clang/lib/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageAnalysis.cpp
 
b/clang/lib/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageAnalysis.cpp
index f34645ce8449a..e404eb294ee4b 100644
--- 
a/clang/lib/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageAnalysis.cpp
+++ 
b/clang/lib/ScalableStaticAnalysis/Analyses/UnsafeBufferUsage/UnsafeBufferUsageAnalysis.cpp
@@ -57,7 +57,7 @@ deserializeUnsafeBufferUsageAnalysisResult(
   auto Ret = std::make_unique<UnsafeBufferUsageAnalysisResult>();
 
   Ret->UnsafeBuffers = std::move(*UnsafeBuffers);
-  return Ret;
+  return std::move(Ret);
 }
 
 JSONFormat::AnalysisResultRegistry::Add<UnsafeBufferUsageAnalysisResult>
@@ -116,7 +116,7 @@ deserializeUnsafeBufferReachableAnalysisResult(
   auto Ret = std::make_unique<UnsafeBufferReachableAnalysisResult>();
 
   Ret->Reachables = std::move(*Reachables);
-  return Ret;
+  return std::move(Ret);
 }
 
 JSONFormat::AnalysisResultRegistry::Add<UnsafeBufferReachableAnalysisResult>


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to