Commit c269182
authored
[lldb][TypeSystemClang] Initialize ClassTemplateSpecializationDecl's StrictPackMatch field (llvm#126215)
This addresses the MSAN failure reported
in
llvm#125791 (comment):
```
==5633==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 in clang::ASTNodeImporter::CallOverloadedCreateFun<clang::ClassTemplateSpecializationDecl>::operator()
#1 in bool clang::ASTNodeImporter::GetImportedOrCreateSpecialDecl<...>
...
```
The ASTImporter reads `D->hasStrictPackMatch()` and forwards it to the
constructor of the destination `ClassTemplateSpecializationDecl`. But if
`D` is a decl that LLDB created from debug-info, it would've been
created using `ClassTemplateSpecializationDecl::CreateDeserialized`,
which doesn't initialize the `StrictPackMatch` field.
This patch just initializes the field to a fixed value of `false`, to
preserve previous behaviour and avoid the use-of-uninitialized-value.
An alternative would be to always initialize it in the
`ClassTemplateSpecializationDecl` constructor, but there were
reservations about providing a default value for it because it might
lead to hard-to-diagnose problems down the line.1 parent 98e118c commit c269182
File tree
2 files changed
+8
-0
lines changed- clang/include/clang/AST
- lldb/source/Plugins/TypeSystem/Clang
2 files changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1960 | 1960 | | |
1961 | 1961 | | |
1962 | 1962 | | |
| 1963 | + | |
| 1964 | + | |
1963 | 1965 | | |
1964 | 1966 | | |
1965 | 1967 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1666 | 1666 | | |
1667 | 1667 | | |
1668 | 1668 | | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
1669 | 1675 | | |
1670 | 1676 | | |
1671 | 1677 | | |
| |||
0 commit comments