[clang] 47cadd6 - [analyzer] pr47030: MoveChecker: Unforget a comma in the suppression list.
Artem Dergachev via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 7 10:40:02 PDT 2020
Author: Artem Dergachev
Date: 2020-08-07T10:39:28-07:00
New Revision: 47cadd6106c0a9218f653760dd045cbd16df0fd6
URL: https://github.com/llvm/llvm-project/commit/47cadd6106c0a9218f653760dd045cbd16df0fd6
DIFF: https://github.com/llvm/llvm-project/commit/47cadd6106c0a9218f653760dd045cbd16df0fd6.diff
LOG: [analyzer] pr47030: MoveChecker: Unforget a comma in the suppression list.
Added:
Modified:
clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
clang/test/Analysis/Inputs/system-header-simulator-cxx.h
clang/test/Analysis/use-after-move.cpp
Removed:
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
index da3ce01d032b..a38298a7abed 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
@@ -104,7 +104,7 @@ class MoveChecker
"basic_ios",
"future",
"optional",
- "packaged_task"
+ "packaged_task",
"promise",
"shared_future",
"shared_lock",
diff --git a/clang/test/Analysis/Inputs/system-header-simulator-cxx.h b/clang/test/Analysis/Inputs/system-header-simulator-cxx.h
index 9010ce2bb9b6..a0759479bfeb 100644
--- a/clang/test/Analysis/Inputs/system-header-simulator-cxx.h
+++ b/clang/test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -1133,4 +1133,9 @@ class default_searcher {
operator()( ForwardIt2 first, ForwardIt2 last ) const;
};
-}
+template <typename> class packaged_task;
+template <typename Ret, typename... Args> class packaged_task<Ret(Args...)> {
+ // TODO: Add some actual implementation.
+};
+
+} // namespace std
diff --git a/clang/test/Analysis/use-after-move.cpp b/clang/test/Analysis/use-after-move.cpp
index d7b6c74fabd6..d1278cad4c4f 100644
--- a/clang/test/Analysis/use-after-move.cpp
+++ b/clang/test/Analysis/use-after-move.cpp
@@ -974,3 +974,19 @@ void getAfterMove(std::unique_ptr<A> P) {
// TODO: Warn on a null dereference here.
a->foo();
}
+
+struct OtherMoveSafeClasses {
+ std::packaged_task<int(void)> Task;
+
+ void test() {
+ // Test the suppression caused by use-after-move semantics of
+ // std::package_task being
diff erent from other standard classes.
+ // Only warn in aggressive mode. Don't say that the object
+ // is left in unspecified state after move.
+ std::packaged_task<int(void)> Task2 = std::move(Task);
+ // aggressive-note at -1 {{Object 'Task' is moved}}
+ std::packaged_task<int(void)> Task3 = std::move(Task);
+ // aggressive-warning at -1{{Moved-from object 'Task' is moved}}
+ // aggressive-note at -2 {{Moved-from object 'Task' is moved}}
+ }
+};
More information about the cfe-commits
mailing list