[clang][c++20] Fix code coverage mapping crash with generalized NTTPs (#85837)
Introduced in #78041, originally reported as #79957 and fixed partially in #80050. `OpaqueValueExpr` used with `TemplateArgument::StructuralValue` has no corresponding source expression. A test case with subobject-referring NTTP added.
This commit is contained in:
committed by
GitHub
parent
2669ee1174
commit
6be1a1535e
@@ -2271,7 +2271,8 @@ struct CounterCoverageMappingBuilder
|
||||
}
|
||||
|
||||
void VisitOpaqueValueExpr(const OpaqueValueExpr* OVE) {
|
||||
Visit(OVE->getSourceExpr());
|
||||
if (OVE->isUnique())
|
||||
Visit(OVE->getSourceExpr());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name templates.cpp %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -std=c++20 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name templates.cpp %s | FileCheck %s
|
||||
|
||||
template<typename T>
|
||||
void unused(T x) {
|
||||
@@ -30,5 +30,6 @@ namespace structural_value_crash {
|
||||
|
||||
void test() {
|
||||
tpl_fn<arr>();
|
||||
tpl_fn<&arr[1]>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user