Volodymyr Sapsai
93764ff6e2
[modules] Fix miscompilation when using two RecordDecl definitions with the same name.
...
When deserializing a RecordDecl we don't enforce that redeclaration
chain contains only a single definition. So if the canonical decl is not
a definition itself, `RecordType::getDecl` can return different objects
before and after an include. It means we can build CGRecordLayout for
one RecordDecl with its set of FieldDecl but try to use it with
FieldDecl belonging to a different RecordDecl. With assertions enabled
it results in
> Assertion failed: (FieldInfo.count(FD) && "Invalid field for record!"),
> function getLLVMFieldNo, file llvm-project/clang/lib/CodeGen/CGRecordLayout.h, line 199.
and with assertions disabled a bunch of fields are treated as their
memory is located at offset 0.
Fix by keeping the first encountered RecordDecl definition and marking
the subsequent ones as non-definitions. Also need to merge FieldDecl
properly, so that `getPrimaryMergedDecl` works correctly and during name
lookup we don't treat fields from same-name RecordDecl as ambiguous.
rdar://80184238
Differential Revision: https://reviews.llvm.org/D106994
2021-08-30 17:51:38 -07:00
..
2021-08-30 17:51:38 -07:00
2017-10-11 01:49:57 +00:00
2017-10-10 22:33:17 +00:00
2015-06-16 00:08:24 +00:00
2017-01-26 23:07:59 +00:00
2020-09-24 15:21:28 -07:00
2020-06-19 09:41:15 +01:00
2015-08-17 16:39:30 +00:00
2020-04-28 18:41:14 -07:00
2018-07-18 23:21:19 +00:00
2015-08-17 16:39:30 +00:00
2018-03-20 22:36:39 +00:00
2015-06-16 00:08:24 +00:00
2019-07-10 00:30:02 +00:00
2021-06-03 13:00:09 -05:00
2018-04-27 18:01:23 +00:00
2020-02-03 10:09:39 -08:00
2020-01-14 23:39:50 +01:00
2017-04-12 20:58:33 +00:00
2017-04-12 21:09:34 +00:00
2020-12-31 00:27:11 -08:00
2021-02-01 19:46:23 -08:00
2016-12-06 00:40:17 +00:00
2015-06-16 00:08:24 +00:00
2017-06-22 22:18:46 +00:00
2020-07-07 17:13:23 -06:00
2015-06-16 00:08:24 +00:00
2016-10-26 01:08:55 +00:00
2018-05-03 03:58:32 +00:00
2017-11-02 01:06:00 +00:00
2020-06-12 10:29:01 -07:00
2021-08-04 13:46:40 +02:00
2020-06-12 10:29:01 -07:00
2015-06-16 00:08:24 +00:00
2018-07-04 02:25:38 +00:00
2015-06-16 00:08:24 +00:00
2018-02-23 19:30:48 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2020-04-28 18:41:14 -07:00
2015-06-16 00:08:24 +00:00
2015-08-13 17:13:33 +00:00
2017-07-19 00:09:58 +00:00
2020-03-27 14:23:30 -07:00
2017-05-11 22:59:19 +00:00
2017-05-11 16:40:48 +00:00
2015-10-08 04:24:12 +00:00
2020-06-01 09:10:05 +02:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2014-03-18 12:25:27 +00:00
2020-04-28 18:41:14 -07:00
2020-04-28 18:41:14 -07:00
2015-06-16 00:08:24 +00:00
2019-09-10 20:15:45 +00:00
2015-08-13 18:30:25 +00:00
2018-02-09 01:15:13 +00:00
2017-01-26 01:01:01 +00:00
2020-11-05 20:08:23 -08:00
2020-08-25 16:31:27 -07:00
2015-06-29 17:29:50 +00:00
2015-06-16 00:08:24 +00:00
2016-02-06 02:06:43 +00:00
2016-07-21 21:07:47 +00:00
2020-06-15 12:27:25 +01:00
2019-05-22 21:58:17 +00:00
2015-06-16 00:08:24 +00:00
2020-01-27 22:08:37 -05:00
2015-06-16 00:08:24 +00:00
2021-08-06 14:48:28 +02:00
2016-10-20 23:11:45 +00:00
2016-06-23 15:07:32 +00:00
2021-05-17 10:40:51 +02:00
2016-04-12 20:20:33 +00:00
2015-08-18 23:42:50 +00:00
2015-06-23 09:26:37 +00:00
2015-06-16 00:08:24 +00:00
2016-08-29 20:46:59 +00:00
2015-06-16 00:08:24 +00:00
2017-09-14 23:38:44 +00:00
2020-05-28 12:30:38 +02:00
2020-03-20 14:18:15 -07:00
2015-11-03 18:33:07 +00:00
2015-06-16 00:08:24 +00:00
2015-10-13 00:39:40 +00:00
2017-05-18 19:34:55 +00:00
2015-08-09 08:48:41 +00:00
2015-06-16 00:08:24 +00:00
2019-04-11 21:18:23 +00:00
2019-12-03 15:44:01 -08:00
2018-12-06 09:35:04 +00:00
2020-03-03 14:14:24 -08:00
2016-05-03 23:06:40 +00:00
2016-09-01 20:15:25 +00:00
2017-03-06 17:47:57 +00:00
2017-06-02 01:55:39 +00:00
2015-06-16 00:08:24 +00:00
2015-02-13 23:50:20 +00:00
2015-12-18 22:19:11 +00:00
2017-01-26 23:07:59 +00:00
2017-04-12 03:58:58 +00:00
2020-03-10 10:59:26 -07:00
2019-09-10 20:15:45 +00:00
2017-12-22 05:04:43 +00:00
2021-08-16 16:23:04 -07:00
2018-06-15 20:13:28 +00:00
2020-02-28 15:40:24 -08:00
2013-11-07 22:55:02 +00:00
2020-08-20 17:41:28 -07:00
2017-04-29 00:34:47 +00:00
2015-06-16 00:08:24 +00:00
2016-03-14 17:52:37 +00:00
2015-06-16 00:08:24 +00:00
2018-06-01 01:26:18 +00:00
2016-10-21 23:27:37 +00:00
2020-09-18 14:56:47 -07:00
2015-06-16 00:08:24 +00:00
2020-08-21 14:40:09 -04:00
2015-02-24 03:30:14 +00:00
2020-12-31 00:27:11 -08:00
2020-04-28 18:41:14 -07:00
2017-06-26 04:41:22 +00:00
2015-11-03 03:13:11 +00:00
2015-06-16 00:08:24 +00:00
2020-12-30 20:52:01 -08:00
2016-08-25 00:34:00 +00:00
2016-10-21 01:41:56 +00:00
2015-11-04 19:26:32 +00:00
2015-07-21 23:54:07 +00:00
2015-06-16 00:08:24 +00:00
2021-04-16 17:57:03 -07:00
2018-06-07 03:20:30 +00:00
2017-04-24 21:58:13 +00:00
2017-06-29 19:42:35 +00:00
2016-09-09 23:48:27 +00:00
2015-06-16 00:08:24 +00:00
2019-11-16 14:47:20 +01:00
2021-03-23 16:54:28 -07:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2017-05-19 23:32:38 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-09-16 00:55:50 +00:00
2015-09-19 05:32:57 +00:00
2015-06-25 21:42:33 +00:00
2016-04-08 19:57:40 +00:00
2015-06-16 00:08:24 +00:00
2018-08-03 01:00:01 +00:00
2015-06-16 00:08:24 +00:00
2015-11-12 22:19:45 +00:00
2015-06-16 00:08:24 +00:00
2017-01-26 23:07:59 +00:00
2015-06-16 00:08:24 +00:00
2019-02-05 12:05:53 +00:00
2020-01-27 22:08:37 -05:00
2015-06-16 00:08:24 +00:00
2021-08-30 17:51:38 -07:00
2021-08-30 17:51:38 -07:00
2021-08-30 17:51:38 -07:00
2018-07-04 02:25:38 +00:00
2018-05-24 20:03:51 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2018-09-12 02:13:46 +00:00
2018-09-12 23:37:00 +00:00
2016-10-17 13:00:44 +00:00
2016-10-06 20:30:51 +00:00
2021-07-01 18:43:49 -07:00
2016-10-19 11:19:30 +00:00
2015-06-16 00:08:24 +00:00
2016-04-29 19:04:05 +00:00
2015-06-16 00:08:24 +00:00
2016-02-05 19:03:40 +00:00
2018-11-09 02:44:07 +00:00
2015-09-19 05:32:57 +00:00
2015-09-19 05:32:57 +00:00
2015-09-19 05:32:57 +00:00
2015-09-19 05:32:57 +00:00
2017-07-06 21:05:56 +00:00
2020-04-17 22:49:58 -07:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2018-01-09 09:32:53 +00:00
2016-01-08 22:36:45 +00:00
2020-08-26 14:52:03 -07:00
2017-03-09 00:58:22 +00:00
2018-12-06 18:44:50 +00:00
2015-06-23 18:20:18 +00:00
2016-10-21 23:35:03 +00:00
2017-06-12 20:10:48 +00:00
2015-09-02 20:16:09 +00:00
2021-06-14 11:04:56 +02:00
2020-07-28 10:30:35 +01:00
2021-04-12 11:05:55 +00:00
2020-06-01 09:10:05 +02:00
2020-08-24 14:52:53 +02:00
2017-12-22 02:53:30 +00:00
2017-08-15 19:47:06 +00:00
2015-06-23 08:37:21 +00:00
2015-10-30 16:30:27 +00:00
2020-04-28 18:41:14 -07:00
2015-07-10 22:27:17 +00:00
2020-08-13 10:06:40 -04:00
2019-04-19 23:04:05 +00:00
2018-06-28 01:57:04 +00:00
2016-03-21 19:06:06 +00:00
2015-06-16 00:08:24 +00:00
2015-11-17 03:02:41 +00:00
2020-04-28 18:41:14 -07:00
2020-06-04 08:33:39 +02:00
2018-04-30 22:57:02 +00:00
2020-04-28 18:41:14 -07:00
2015-06-16 00:08:24 +00:00
2017-02-22 23:18:49 +00:00
2016-09-09 23:48:27 +00:00
2016-10-11 21:18:20 +00:00
2016-10-14 18:55:44 +00:00
2020-01-27 22:08:37 -05:00
2020-02-12 18:44:19 -05:00
2018-09-04 22:53:19 +00:00
2018-09-05 22:14:46 +00:00
2018-09-05 22:14:46 +00:00
2018-01-06 03:20:59 +00:00
2018-09-04 22:53:19 +00:00
2020-01-14 21:12:15 -08:00
2017-12-21 21:47:22 +00:00
2017-02-24 02:49:47 +00:00
2016-03-06 04:20:05 +00:00
2017-07-25 10:22:06 +00:00
2020-02-12 08:17:01 -08:00
2016-05-31 18:19:32 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2014-12-06 22:11:06 +00:00
2016-03-30 22:22:50 +00:00
2015-06-16 00:08:24 +00:00
2016-03-16 11:17:04 +00:00
2016-04-08 20:53:26 +00:00
2016-03-30 22:18:29 +00:00
2016-01-22 19:03:27 +00:00
2016-03-30 20:16:03 +00:00
2016-04-06 20:58:12 +00:00
2018-07-04 02:25:38 +00:00
2016-04-26 23:40:43 +00:00
2016-07-22 20:49:31 +00:00
2016-05-24 12:10:36 +00:00
2016-05-17 22:44:15 +00:00
2016-06-20 15:10:40 +00:00
2016-07-22 21:08:24 +00:00
2016-08-18 06:15:19 +00:00
2016-10-14 21:41:24 +00:00
2016-10-26 10:24:29 +00:00
2017-01-12 09:16:26 +00:00
2017-04-15 00:07:57 +00:00
2020-11-10 10:14:13 -08:00
2016-08-19 05:25:26 +00:00
2017-07-06 21:05:56 +00:00
2017-06-29 02:19:42 +00:00
2017-06-02 01:55:39 +00:00
2019-09-18 19:09:41 +00:00
2021-02-01 19:46:23 -08:00
2019-05-08 02:03:32 +00:00
2017-05-30 20:13:34 +00:00
2017-04-29 00:34:47 +00:00
2017-04-29 00:34:47 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-11-05 15:24:47 +00:00
2018-06-30 00:49:27 +00:00
2018-12-05 11:17:50 +00:00
2015-05-06 22:31:13 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2017-07-01 00:06:47 +00:00
2018-09-13 14:27:32 +00:00
2015-06-16 00:08:24 +00:00
2017-06-05 18:57:56 +00:00
2019-03-06 02:50:46 +00:00
2019-03-06 05:42:56 +00:00
2015-07-08 01:00:30 +00:00
2016-01-08 22:36:45 +00:00
2020-11-18 11:55:29 -08:00
2018-01-05 02:33:18 +00:00
2018-01-05 02:33:18 +00:00
2020-04-28 18:41:14 -07:00
2015-06-16 00:08:24 +00:00
2015-08-09 01:05:31 +00:00
2018-11-05 12:46:02 +00:00
2015-06-16 00:08:24 +00:00
2017-06-19 23:09:36 +00:00
2018-11-14 01:08:03 +00:00
2017-12-22 02:53:30 +00:00
2020-04-28 18:41:14 -07:00
2020-04-28 18:41:14 -07:00
2020-04-28 18:41:14 -07:00
2020-04-28 18:41:14 -07:00
2015-06-16 00:08:24 +00:00
2020-04-28 18:41:14 -07:00
2015-06-16 00:08:24 +00:00
2020-04-28 18:41:14 -07:00
2015-10-08 06:31:22 +00:00
2020-04-28 18:41:14 -07:00
2020-04-28 18:41:14 -07:00
2018-04-05 12:54:00 +00:00
2018-09-18 17:11:13 +00:00
2020-04-28 18:41:14 -07:00
2015-06-16 00:08:24 +00:00
2020-12-31 00:27:11 -08:00
2015-06-16 00:08:24 +00:00
2015-08-12 02:17:52 +00:00
2020-04-28 18:41:14 -07:00
2016-07-20 19:10:16 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2018-01-06 01:07:05 +00:00
2018-01-06 00:09:23 +00:00
2020-01-27 22:08:37 -05:00
2016-01-12 20:34:32 +00:00
2015-11-12 21:55:58 +00:00
2017-10-30 22:38:20 +00:00
2017-10-11 01:19:11 +00:00
2015-10-13 00:23:25 +00:00
2015-06-16 00:08:24 +00:00
2020-02-03 10:09:39 -08:00
2020-04-28 18:41:14 -07:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00
2015-06-16 00:08:24 +00:00