This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Fixing segfault when there's no IdentifierInfo
AbandonedPublic

Authored by juliehockett on Jul 10 2018, 3:06 PM.

Details

Summary

Bug 36150 found a segfault on mac when a CXXRecordDecl has no IdentifierInfo, this fixes it.

Diff Detail

Event Timeline

juliehockett created this revision.Jul 10 2018, 3:06 PM
JonasToth added inline comments.
clang-tools-extra/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp
44

Please move then return false onto the next line.

Is there a way to add a test, that would trigger the old segfault and show that it does not happen anymore with this fix?

Is there a way to add a test, that would trigger the old segfault and show that it does not happen anymore with this fix?

+1, we should have a minimal test case for this fix, https://bugs.llvm.org/show_bug.cgi?id=36150 provides a case, but we need to reduce it (getting rid of the STD header).

Is there a way to add a test, that would trigger the old segfault and show that it does not happen anymore with this fix?

+1, we should have a minimal test case for this fix, https://bugs.llvm.org/show_bug.cgi?id=36150 provides a case, but we need to reduce it (getting rid of the STD header).

Does anyone know of a case where the base would not be a CXXRecordDecl that doesn't involve std::functional? (for background, I could only reproduce the error in the test case in https://bugs.llvm.org/show_bug.cgi?id=36150 on a Mac)

Is there a way to add a test, that would trigger the old segfault and show that it does not happen anymore with this fix?

+1, we should have a minimal test case for this fix, https://bugs.llvm.org/show_bug.cgi?id=36150 provides a case, but we need to reduce it (getting rid of the STD header).

Does anyone know of a case where the base would not be a CXXRecordDecl that doesn't involve std::functional? (for background, I could only reproduce the error in the test case in https://bugs.llvm.org/show_bug.cgi?id=36150 on a Mac)

Perhaps something like:

template <typename Ty>
struct S : Ty {
  S(Ty Fn) : Ty(Fn) {}
};

void f() {
  S s{[](){}};
}

Not certain if this is what you're looking for, but it is a trick used in <functional> implementations sometimes.

juliehockett abandoned this revision.Jul 27 2018, 9:18 AM