Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang][c++20] Fix code coverage mapping crash with generalized NTTPs #85837

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/lib/CodeGen/CoverageMappingGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,8 @@ struct CounterCoverageMappingBuilder
}

void VisitOpaqueValueExpr(const OpaqueValueExpr* OVE) {
Visit(OVE->getSourceExpr());
if (OVE->isUnique())
Visit(OVE->getSourceExpr());
}
};

Expand Down
3 changes: 2 additions & 1 deletion clang/test/CoverageMapping/templates.cpp
Original file line number Diff line number Diff line change
@@ -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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, separate launch mode should be added instead of changing existing one? OTOH, it was irrelevant to any specific C++ standard.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't have any reason to expect the shared cases might differently in earlier standard versions, this is fine.

template<typename T>
void unused(T x) {
Expand Down Expand Up @@ -30,5 +30,6 @@ namespace structural_value_crash {

void test() {
tpl_fn<arr>();
tpl_fn<&arr[1]>();
}
}
Loading