Commit 5599e6f
committed
[PAC][clang] Do not attempt to get definition of non-instantiated template
This patch fixes a crash which we hit after llvm#154490. The reproducer is
provided in a test case.
The root cause of the crash is as follows.
`primaryBaseHasAddressDiscriminatedVTableAuthentication` requires a non-null
CXX record decl definition which might not be available if we are dealing with
a non-instantiated template. It might be the case if the template was not
instantiated due to a prior fatal error. See the corresponding check in the
`Sema::InstantiatingTemplate` constructor.
Previously, we tried to call `isPolymorphic()` on a `CXXRecordDecl` with
null `DefinitionData`, which led to a crash. With this patch, we abort
execution of `ASTContext::findPointerAuthContent` before call to
`primaryBaseHasAddressDiscriminatedVTableAuthentication` if we have a
prior fatal error which might have led to non-instantiated templates.1 parent 7b190b7 commit 5599e6f
File tree
2 files changed
+37
-2
lines changed- clang
- lib/AST
- test/SemaCXX
2 files changed
+37
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1618 | 1618 | | |
1619 | 1619 | | |
1620 | 1620 | | |
1621 | | - | |
| 1621 | + | |
1622 | 1622 | | |
1623 | 1623 | | |
1624 | 1624 | | |
| |||
1672 | 1672 | | |
1673 | 1673 | | |
1674 | 1674 | | |
1675 | | - | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
1676 | 1683 | | |
1677 | 1684 | | |
1678 | 1685 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments