[SSAF] Fix Expected return type in TypeConstrainedPointers deserialization (gcc 7.5.0) - #211331
Merged
Conversation
…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.
|
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-ssaf Author: Nikita Kornev (KornevNikita) ChangesGCC 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:
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>
|
steakhal
approved these changes
Jul 23, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.