Skip to content

[SSAF] Fix Expected return type in TypeConstrainedPointers deserialization (gcc 7.5.0) - #211331

Merged
sarnex merged 1 commit into
llvm:mainfrom
KornevNikita:fix-gcc-750
Jul 23, 2026
Merged

[SSAF] Fix Expected return type in TypeConstrainedPointers deserialization (gcc 7.5.0)#211331
sarnex merged 1 commit into
llvm:mainfrom
KornevNikita:fix-gcc-750

Conversation

@KornevNikita

Copy link
Copy Markdown
Contributor

GCC 7.5.0 fails to compile this code. Use explicit upcasts from std::unique_ptr to std::unique_ptr in deserializeSummary and deserializeAnalysisResult. This resolves a compilation error where llvm::Expected<std::unique_ptr> could not be constructed from unique_ptr of derived summary/result types.

…ation

Use explicit upcasts from std::unique_ptr<Derived> to std::unique_ptr<Base> in deserializeSummary and deserializeAnalysisResult.
This resolves a compilation error where llvm::Expected<std::unique_ptr<Base>> could not be constructed from unique_ptr of derived summary/result types.
@llvmorg-github-actions llvmorg-github-actions Bot added clang Clang issues not falling into any other category clang:ssaf Scalable Static Analysis Framework labels Jul 22, 2026
@llvmorg-github-actions

llvmorg-github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-ssaf

Author: Nikita Kornev (KornevNikita)

Changes

GCC 7.5.0 fails to compile this code. Use explicit upcasts from std::unique_ptr<Derived> to std::unique_ptr<Base> in deserializeSummary and deserializeAnalysisResult. This resolves a compilation error where llvm::Expected<std::unique_ptr<Base>> could not be constructed from unique_ptr of derived summary/result types.


Full diff: https://github.com/llvm/llvm-project/pull/211331.diff

1 Files Affected:

  • (modified) clang/lib/ScalableStaticAnalysis/Analyses/TypeConstrainedPointers/TypeConstrainedPointers.cpp (+2-2)
diff --git a/clang/lib/ScalableStaticAnalysis/Analyses/TypeConstrainedPointers/TypeConstrainedPointers.cpp b/clang/lib/ScalableStaticAnalysis/Analyses/TypeConstrainedPointers/TypeConstrainedPointers.cpp
index 8e6d1c4507e26..26f010824e85f 100644
--- a/clang/lib/ScalableStaticAnalysis/Analyses/TypeConstrainedPointers/TypeConstrainedPointers.cpp
+++ b/clang/lib/ScalableStaticAnalysis/Analyses/TypeConstrainedPointers/TypeConstrainedPointers.cpp
@@ -212,7 +212,7 @@ deserializeSummary(const llvm::json::Object &Data, EntityIdTable &,
       std::make_unique<TypeConstrainedPointersEntitySummary>();
 
   Sum->Entities = std::move(*EntityIDSet);
-  return Sum;
+  return std::unique_ptr<EntitySummary>(std::move(Sum));
 }
 
 struct TypeConstrainedPointersJSONFormatInfo final : JSONFormat::FormatInfo {
@@ -246,7 +246,7 @@ deserializeAnalysisResult(const llvm::json::Object &Data,
       std::make_unique<TypeConstrainedPointersAnalysisResult>();
 
   AR->Entities = std::move(*EntityIDSet);
-  return AR;
+  return std::unique_ptr<AnalysisResult>(std::move(AR));
 }
 
 JSONFormat::AnalysisResultRegistry::Add<TypeConstrainedPointersAnalysisResult>

KornevNikita added a commit to intel/llvm that referenced this pull request Jul 23, 2026
…ation (gcc 7.5.0) (#22727)

GCC 7.5.0 fails to compile this code. Use explicit upcasts from
std::unique_ptr to std::unique_ptr in deserializeSummary and
deserializeAnalysisResult. This resolves a compilation error where
llvm::Expected<std::unique_ptr> could not be constructed from unique_ptr
of derived summary/result types.

---
See: llvm/llvm-project#211331
This file has been renamed in the upstream. The PR above should fix the
issue in the upstream.
This one is to fix the toolchain build with gcc 7.5.0 before pulldown.
@sarnex
sarnex merged commit 8b0eab1 into llvm:main Jul 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:ssaf Scalable Static Analysis Framework clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants