gamesh411 created this revision. gamesh411 added reviewers: steakhal, martong. Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. gamesh411 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
CallDescriptionMap is supposed to be immutable and opaque about the stored CallDescriptions, but moving a CallDescriptionMap does not violate these principles. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D115931 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp Index: clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp =================================================================== --- clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp +++ clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp @@ -19,6 +19,10 @@ namespace ento { namespace { +static_assert(std::is_move_constructible<CallDescriptionMap<bool>>() && + std::is_move_assignable<CallDescriptionMap<bool>>(), + "CallDescriptionMap should support move semantics"); + // A wrapper around CallDescriptionMap<bool> that allows verifying that // all functions have been found. This is needed because CallDescriptionMap // isn't supposed to support iteration. Index: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h =================================================================== --- clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h +++ clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h @@ -141,6 +141,9 @@ CallDescriptionMap(const CallDescriptionMap &) = delete; CallDescriptionMap &operator=(const CallDescription &) = delete; + CallDescriptionMap(CallDescriptionMap &&) = default; + CallDescriptionMap &operator=(CallDescriptionMap &&) = default; + LLVM_NODISCARD const T *lookup(const CallEvent &Call) const { // Slow path: linear lookup. // TODO: Implement some sort of fast path.
Index: clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp =================================================================== --- clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp +++ clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp @@ -19,6 +19,10 @@ namespace ento { namespace { +static_assert(std::is_move_constructible<CallDescriptionMap<bool>>() && + std::is_move_assignable<CallDescriptionMap<bool>>(), + "CallDescriptionMap should support move semantics"); + // A wrapper around CallDescriptionMap<bool> that allows verifying that // all functions have been found. This is needed because CallDescriptionMap // isn't supposed to support iteration. Index: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h =================================================================== --- clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h +++ clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h @@ -141,6 +141,9 @@ CallDescriptionMap(const CallDescriptionMap &) = delete; CallDescriptionMap &operator=(const CallDescription &) = delete; + CallDescriptionMap(CallDescriptionMap &&) = default; + CallDescriptionMap &operator=(CallDescriptionMap &&) = default; + LLVM_NODISCARD const T *lookup(const CallEvent &Call) const { // Slow path: linear lookup. // TODO: Implement some sort of fast path.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits