Balazs Benics
7e5821bae8
Reapply "[analyzer] Handle [[assume(cond)]] as __builtin_assume(cond)" ( #129234 )
...
This is the second attempt to bring initial support for [[assume()]] in
the Clang Static Analyzer.
The first attempt (#116462 ) was reverted in
2b9abf0db2d106c7208b4372e662ef5df869e6f1 due to some weird failure in a
libcxx test involving `#pragma clang loop vectorize(enable)
interleave(enable)`.
The failure could be reduced into:
```c++
template <class ExecutionPolicy>
void transform(ExecutionPolicy) {
#pragma clang loop vectorize(enable) interleave(enable)
for (int i = 0; 0;) { // The DeclStmt of "i" would be added twice in the ThreadSafety analysis.
// empty
}
}
void entrypoint() {
transform(1);
}
```
As it turns out, the problem with the initial patch was this:
```c++
for (const auto *Attr : AS->getAttrs()) {
if (const auto *AssumeAttr = dyn_cast<CXXAssumeAttr>(Attr)) {
Expr *AssumeExpr = AssumeAttr->getAssumption();
if (!AssumeExpr->HasSideEffects(Ctx)) {
childrenBuf.push_back(AssumeExpr);
}
}
// Visit the actual children AST nodes.
// For CXXAssumeAttrs, this is always a NullStmt.
llvm::append_range(childrenBuf, AS->children()); // <--- This was not meant to be part of the "for" loop.
children = childrenBuf;
}
return;
```
The solution was simple. Just hoist it from the loop.
I also had a closer look at `CFGBuilder::VisitAttributedStmt`, where I also spotted another bug.
We would have added the CFG blocks twice if the AttributedStmt would have both the `[[fallthrough]]` and the `[[assume()]]` attributes. With my fix, it will only once add the blocks. Added a regression test for this.
Co-authored-by: Vinay Deshmukh <vinay_deshmukh AT outlook DOT com>
2025-03-06 08:09:09 +01:00
..
2024-05-23 12:56:16 +02:00
2025-03-02 20:30:06 -08:00
2024-01-31 13:55:31 -08:00
2025-02-26 13:57:33 +01:00
2023-05-23 08:29:52 +02:00
2024-05-06 10:36:19 -07:00
2024-05-06 10:36:19 -07:00
2025-02-26 13:57:33 +01:00
2024-05-08 07:35:47 -07:00
2025-01-09 15:43:53 +01:00
2025-02-26 13:57:33 +01:00
2024-01-27 22:20:08 -08:00
2024-05-06 10:36:19 -07:00
2025-02-26 13:57:33 +01:00
2023-05-23 08:29:52 +02:00
2024-06-28 10:17:27 +02:00
2025-03-03 10:44:05 +01:00
2024-03-25 15:24:03 +01:00
2024-03-25 15:24:03 +01:00
2025-01-10 11:17:06 +01:00
2024-03-25 15:24:03 +01:00
2025-01-29 21:58:55 -03:00
2025-02-26 13:57:33 +01:00
2025-02-26 13:57:33 +01:00
2023-08-28 12:13:42 -04:00
2024-03-25 10:08:56 +00:00
2024-10-04 16:12:29 +03:00
2024-09-26 14:00:13 +02:00
2024-03-06 16:42:31 +01:00
2023-07-19 09:01:41 +02:00
2023-09-20 06:11:39 -05:00
2024-02-11 19:43:34 +01:00
2023-08-18 10:47:05 +02:00
2023-09-29 20:02:38 +02:00
2023-08-18 10:47:05 +02:00
2024-08-28 11:30:18 +02:00
2024-08-28 11:30:18 +02:00
2024-06-03 14:23:58 +02:00
2024-06-03 14:23:58 +02:00
2024-06-03 14:23:58 +02:00
2023-08-28 12:13:42 -04:00
2023-09-07 13:35:50 -07:00
2024-09-26 14:00:13 +02:00
2024-01-15 12:12:09 -06:00
2024-07-04 13:46:22 +02:00
2024-01-24 11:22:43 +01:00
2024-11-27 09:41:12 +01:00
2023-05-31 14:43:16 +02:00
2025-01-30 16:21:46 -08:00
2023-11-04 11:11:24 +01:00
2025-02-26 13:57:33 +01:00
2024-10-05 17:21:31 +02:00
2024-07-23 08:39:11 +02:00
2023-08-28 12:13:42 -04:00
2025-02-26 13:57:33 +01:00
2025-03-03 10:44:05 +01:00
2024-09-30 09:16:27 +02:00
2023-08-28 12:13:42 -04:00
2024-05-30 07:56:58 -05:00
2024-08-23 15:38:21 -04:00
2024-08-23 15:38:21 -04:00
2022-12-12 11:25:19 -08:00
2023-08-28 12:13:42 -04:00
2023-05-23 08:29:52 +02:00
2022-12-15 12:26:33 -08:00
2024-11-29 08:23:08 +01:00
2025-03-03 10:44:05 +01:00
2025-01-18 19:16:33 +01:00
2022-12-19 12:49:43 +01:00
2023-01-25 02:32:55 +05:30
2023-10-16 14:51:05 +02:00
2025-02-11 12:54:30 +00:00
2024-09-19 10:04:47 +02:00
2025-02-26 13:57:33 +01:00
2022-09-05 17:06:27 +02:00
2024-11-29 09:19:33 +01:00
2025-02-26 13:57:33 +01:00
2024-05-06 10:36:19 -07:00
2024-05-06 10:36:19 -07:00
2024-05-06 10:36:19 -07:00
2024-09-25 10:43:02 -04:00
2024-09-25 10:43:02 -04:00
2025-01-28 09:10:02 +01:00
2024-03-06 17:01:30 +01:00
2023-08-28 12:13:42 -04:00
2025-03-06 08:09:09 +01:00
2024-03-22 12:04:44 +01:00
2022-10-26 17:22:12 +02:00
2024-09-26 14:00:13 +02:00
2024-04-16 10:41:26 +02:00
2024-11-27 14:27:31 +01:00
2024-06-06 11:46:33 +02:00
2024-05-22 12:37:27 +08:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2024-09-26 14:00:13 +02:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-10-10 09:37:02 +01:00
2023-07-07 13:24:33 +02:00
2024-10-01 11:33:06 +02:00
2022-11-09 15:06:46 +01:00
2025-02-07 08:01:39 +01:00
2025-01-06 12:45:31 +01:00
2023-08-28 12:13:42 -04:00
2025-01-03 11:17:16 +01:00
2023-12-12 16:29:37 +01:00
2023-12-12 12:15:33 -05:00
2024-06-17 23:37:34 +08:00
2023-11-21 13:34:03 +01:00
2023-11-21 13:34:03 +01:00
2023-11-21 13:34:03 +01:00
2024-06-17 23:37:34 +08:00
2023-11-21 13:34:03 +01:00
2024-03-19 07:55:49 -07:00
2024-08-02 17:04:57 +02:00
2024-11-29 09:19:33 +01:00
2025-01-06 12:45:31 +01:00
2025-01-06 12:45:31 +01:00
2022-09-13 09:04:27 +02:00
2022-12-11 17:56:51 -06:00
2023-09-01 21:03:16 +08:00
2025-02-26 13:57:33 +01:00
2024-07-24 13:15:08 +02:00
2024-07-24 13:15:08 +02:00
2025-02-06 16:09:14 +01:00
2025-02-06 16:09:14 +01:00
2025-02-24 08:36:05 +01:00
2023-08-28 12:13:42 -04:00
2024-07-24 13:15:08 +02:00
2024-03-25 12:43:51 +01:00
2024-03-22 11:50:34 +01:00
2024-05-13 13:43:35 +02:00
2024-09-26 14:00:13 +02:00
2024-09-26 14:00:13 +02:00
2023-07-11 08:50:59 +02:00
2024-05-06 10:36:19 -07:00
2024-05-06 10:36:19 -07:00
2025-02-26 13:57:33 +01:00
2024-08-28 08:36:59 +02:00
2025-02-06 17:45:42 +01:00
2024-10-18 13:51:20 +02:00
2025-02-26 13:57:33 +01:00
2025-02-26 13:57:33 +01:00
2025-02-28 17:42:26 +01:00
2023-08-28 12:13:42 -04:00
2025-01-18 19:16:33 +01:00
2023-10-02 09:54:22 -05:00
2023-11-24 10:02:56 +01:00
2024-04-17 08:02:49 +02:00
2024-04-12 18:15:33 +02:00
2022-09-04 23:06:58 +02:00
2023-07-03 16:13:47 +08:00
2023-11-03 17:10:31 +08:00
2024-07-23 08:39:11 +02:00
2025-02-17 15:35:40 +01:00
2024-11-29 09:19:33 +01:00
2023-08-28 12:02:48 +02:00
2025-02-26 13:57:33 +01:00
2022-10-20 14:14:52 +02:00
2023-10-20 13:10:03 -04:00
2023-07-24 11:50:20 +02:00
2025-02-22 01:19:01 +08:00
2023-05-23 08:29:52 +02:00
2025-02-17 11:12:55 +01:00
2025-02-12 11:56:02 +01:00
2024-08-28 08:36:59 +02:00
2025-01-02 15:51:03 +01:00
2023-10-26 21:11:51 +08:00
2025-02-26 13:57:33 +01:00
2024-07-24 13:15:08 +02:00
2024-09-16 06:48:07 +02:00
2023-08-28 12:13:42 -04:00
2024-09-16 19:44:13 +03:00
2023-01-12 10:42:57 +01:00
2024-07-24 13:15:08 +02:00
2025-02-26 13:57:33 +01:00
2024-09-26 14:00:13 +02:00
2024-07-24 13:15:08 +02:00
2024-07-24 13:15:08 +02:00
2024-05-15 10:53:54 +02:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2025-02-06 17:45:42 +01:00
2024-03-06 16:32:14 +01:00
2025-02-26 13:57:33 +01:00
2025-03-03 10:44:05 +01:00
2024-07-24 13:15:08 +02:00
2023-05-25 09:50:56 -07:00
2024-09-03 10:31:36 +02:00
2023-08-28 12:13:42 -04:00
2024-05-06 10:36:19 -07:00
2022-10-26 17:22:12 +02:00
2022-10-26 17:22:12 +02:00
2025-02-28 17:42:26 +01:00
2022-10-26 17:22:12 +02:00
2024-09-16 19:44:13 +03:00
2025-02-07 08:01:39 +01:00
2024-09-16 06:48:07 +02:00
2022-10-03 15:42:38 +02:00
2023-08-28 12:13:42 -04:00
2025-01-18 19:16:33 +01:00
2023-07-18 07:03:32 +02:00
2022-10-12 14:46:32 +02:00
2023-07-18 07:03:32 +02:00
2025-01-18 19:16:33 +01:00
2023-06-08 16:48:24 +02:00
2023-08-28 12:13:42 -04:00
2025-01-30 12:48:09 +01:00
2023-08-28 12:13:42 -04:00
2023-07-06 22:36:51 +08:00
2024-09-09 03:47:39 -05:00
2024-08-27 14:41:52 +02:00
2024-08-27 14:41:52 +02:00
2024-09-06 15:55:16 +02:00
2024-02-13 14:57:55 -08:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2024-02-13 14:57:55 -08:00
2025-02-26 13:57:33 +01:00
2023-08-28 12:13:42 -04:00
2024-05-06 10:36:19 -07:00
2025-02-12 16:18:27 +01:00
2025-02-11 14:25:42 +01:00
2025-03-06 08:09:09 +01:00
2025-02-06 17:45:42 +01:00
2025-02-28 15:26:57 +01:00
2024-10-31 17:02:28 +01:00
2022-09-21 17:26:09 -07:00
2022-10-26 17:22:12 +02:00
2024-07-24 13:15:08 +02:00
2023-08-28 12:13:42 -04:00
2025-01-18 19:16:33 +01:00
2025-01-18 19:16:33 +01:00
2024-09-30 09:16:27 +02:00
2024-10-11 11:58:14 +02:00
2023-07-03 16:13:47 +08:00
2023-08-28 12:13:42 -04:00
2023-10-16 14:51:05 +02:00
2023-03-04 02:01:45 +01:00
2024-12-28 11:09:29 +01:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2024-10-03 09:17:51 +02:00
2025-01-06 12:45:31 +01:00
2024-05-06 10:36:19 -07:00
2024-06-04 10:02:38 +02:00
2023-05-16 15:38:55 +02:00
2024-10-09 11:39:56 +02:00
2024-09-26 14:00:13 +02:00
2024-12-04 19:33:25 +01:00
2024-05-06 10:36:19 -07:00
2023-08-28 12:13:42 -04:00
2025-02-28 15:48:31 +01:00
2022-10-26 17:22:12 +02:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2023-09-13 17:43:33 -07:00
2023-08-28 12:13:42 -04:00
2023-01-26 17:26:05 +01:00
2024-05-07 13:06:11 +02:00
2025-02-06 17:45:42 +01:00
2025-01-18 19:16:33 +01:00
2023-11-24 16:23:56 +08:00
2023-09-24 11:58:14 -03:00
2023-08-28 12:13:42 -04:00
2024-05-22 12:11:18 +02:00
2024-05-22 12:11:18 +02:00
2024-07-29 08:12:22 +02:00
2024-11-29 08:23:08 +01:00
2024-05-06 10:36:19 -07:00
2024-05-06 10:36:19 -07:00
2024-10-23 10:46:36 +02:00
2025-02-26 13:57:33 +01:00
2024-08-28 08:36:59 +02:00
2025-02-16 16:58:43 +01:00
2025-02-11 12:54:30 +00:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2025-01-10 11:17:06 +01:00
2024-04-30 09:01:45 +02:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2024-02-21 09:18:01 +01:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2024-02-08 11:09:57 +01:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2024-04-30 09:01:45 +02:00
2024-03-04 15:28:20 +01:00
2023-10-16 14:51:05 +02:00
2023-10-16 14:51:05 +02:00
2023-11-21 14:02:22 +01:00
2024-11-29 09:19:33 +01:00
2024-11-29 09:19:33 +01:00
2024-11-14 16:28:37 +01:00
2024-04-30 09:01:45 +02:00
2024-04-30 09:01:45 +02:00
2024-09-18 12:22:02 +02:00
2024-04-30 09:01:45 +02:00
2024-04-30 09:01:45 +02:00
2024-04-30 09:01:45 +02:00
2024-09-18 12:22:02 +02:00
2024-06-24 16:34:36 +02:00
2024-04-30 09:01:45 +02:00
2024-04-30 09:01:45 +02:00
2024-09-18 12:22:02 +02:00
2024-04-30 09:01:45 +02:00
2024-11-27 09:41:12 +01:00
2024-11-27 09:41:12 +01:00
2024-11-27 09:41:12 +01:00
2025-01-18 19:16:33 +01:00
2025-03-03 10:44:05 +01:00
2024-02-13 14:57:55 -08:00
2024-02-13 14:57:55 -08:00
2024-02-13 14:57:55 -08:00
2022-11-23 15:52:11 +01:00
2022-12-04 15:57:24 -08:00
2023-09-29 20:02:38 +02:00
2022-10-03 15:42:38 +02:00
2025-01-06 12:45:31 +01:00
2025-01-06 12:45:31 +01:00
2025-01-06 12:45:31 +01:00
2023-09-15 15:07:39 +02:00
2023-02-17 11:37:02 +01:00
2024-09-26 14:00:13 +02:00
2024-09-26 14:00:13 +02:00
2025-02-06 17:45:42 +01:00
2024-09-26 14:00:13 +02:00
2025-02-06 17:45:42 +01:00
2025-02-06 17:45:42 +01:00
2024-10-03 12:27:25 +02:00
2024-09-26 14:00:13 +02:00
2024-09-26 14:00:13 +02:00
2023-08-17 17:55:48 +09:00
2024-11-29 09:19:33 +01:00
2024-01-30 13:03:55 +01:00
2024-05-06 10:36:19 -07:00
2022-10-19 16:06:32 +02:00
2024-05-06 10:36:19 -07:00
2024-05-06 10:36:19 -07:00
2025-01-06 12:45:31 +01:00
2025-02-26 13:57:33 +01:00
2024-05-06 10:36:19 -07:00
2022-09-04 23:06:58 +02:00
2023-08-28 12:13:42 -04:00
2025-02-26 13:57:33 +01:00
2025-02-26 13:57:33 +01:00
2023-08-28 12:13:42 -04:00
2023-08-28 12:13:42 -04:00
2025-02-26 13:57:33 +01:00
2025-02-26 13:57:33 +01:00
2025-02-26 13:57:33 +01:00
2023-08-28 12:13:42 -04:00
2025-02-26 13:57:33 +01:00
2024-02-20 10:25:01 +01:00
2024-02-20 10:25:01 +01:00
2024-05-14 11:57:10 +02:00
2024-02-13 14:57:55 -08:00
2024-07-23 08:39:11 +02:00
2023-08-28 12:13:42 -04:00
2024-11-27 14:27:31 +01:00
2023-10-16 14:51:05 +02:00
2024-07-24 13:15:08 +02:00
2025-01-06 18:08:12 +01:00
2023-01-26 12:55:42 -06:00
2024-09-19 09:57:25 -05:00
2025-02-26 13:57:33 +01:00