Skip to content

Commit

Permalink
DebugInfo: Classify noreturn function types as non-reconstructible
Browse files Browse the repository at this point in the history
This information isn't preserved in the DWARF description of function
types (though probably should be - it's preserved on the function
declarations/definitions themselves through the DW_AT_noreturn attribute
- but we should move or also include that in the subroutine type itself
too - but for now, with it not being there, the DWARF is lossy and
can't be reconstructed)
  • Loading branch information
dwblaikie committed Mar 24, 2022
1 parent 0bfa1ab commit 7b498be
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions clang/lib/CodeGen/CGDebugInfo.cpp
Expand Up @@ -5078,6 +5078,7 @@ struct ReconstitutableType : public RecursiveASTVisitor<ReconstitutableType> {
bool VisitFunctionProtoType(FunctionProtoType *FT) {
// noexcept is not encoded in DWARF, so the reversi
Reconstitutable &= !isNoexceptExceptionSpec(FT->getExceptionSpecType());
Reconstitutable &= !FT->getNoReturnAttr();
return Reconstitutable;
}
bool VisitRecordType(RecordType *RT) {
Expand Down
6 changes: 6 additions & 0 deletions clang/test/CodeGenCXX/debug-info-simple-template-names.cpp
Expand Up @@ -116,4 +116,10 @@ void f() {

f1<const unsigned _BitInt(5)>();
// CHECK: !DISubprogram(name: "f1<const unsigned _BitInt(5)>",

// Add a parameter just so this differs from other attributed function types
// that don't mangle differently.
int fnrt() __attribute__((noreturn));
f1<decltype(fnrt)>();
// CHECK: !DISubprogram(name: "f1<int () __attribute__((noreturn))>",
}
Expand Up @@ -325,6 +325,8 @@ int main() {
f1<int t1<>::*>();
void fcc() __attribute__((swiftcall));
f1<decltype(fcc)>();
int fnrt() __attribute__((noreturn));
f1<decltype(fnrt)>();
}
void t8::mem() {
struct t7 { };
Expand Down

0 comments on commit 7b498be

Please sign in to comment.