Skip to content

Commit fff03d2

Browse files
committed
[rootcling] Remove check for unique_ptr members
Since llvm/llvm-project@f5e687d libc++ implements _LIBCPP_COMPRESSED_PAIR with an anonymous struct (a Clang extension). This results in unique_ptr having a single FieldDecl with an empty name that does not appear as a data member in TClass. Instead, the AST has multiple IndirectFieldDecl's that "refer" into the anonymous struct. In ROOT, we now have two options: We could support anonymous structs, either by allowing data members with empty names or by adding all indirect field declarations as members. However, I would argue that we actually do NOT want to support this extension for IO classes. Instead remove the (questionable) check in rootcling that verifies the number of data members in unique_ptr.
1 parent 71aedf8 commit fff03d2

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

io/rootpcm/src/rootclingIO.cxx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,6 @@ static bool IsUnsupportedUniquePointer(const char *normName, TDataMember *dm)
7878

7979
if (!isUniquePtrOffsetZero) return true;
8080

81-
auto clm = TClass::GetClass(dmTypeName);
82-
if (!clm) {
83-
Error("CloseStreamerInfoROOTFile", "Class %s is not available.", dmTypeName);
84-
return true;
85-
}
86-
87-
// TODO: Is it not clear what situation we are checking for by checking if
88-
// the unique_ptr class has any data members.
89-
clm->BuildRealData(nullptr, /* istransient = */ true);
90-
auto upDms = clm->GetListOfRealData();
91-
if (!upDms) {
92-
Error("CloseStreamerInfoROOTFile", "Cannot determine unique pointer %s data members.", dmTypeName);
93-
return true;
94-
}
95-
96-
if (0 == upDms->GetSize()) {
97-
Error("CloseStreamerInfoROOTFile", "Unique pointer %s has zero data members.", dmTypeName);
98-
return true;
99-
}
100-
10181
// We check if the unique_ptr has a default deleter
10282
std::vector<std::string> out;
10383
int i;

0 commit comments

Comments
 (0)