Fixed a crash in cppcoreguidelines-pro-type-member-init when checking record types with indirect fields pre-C++11.
Fixed handling of indirect fields so they are properly checked and suggested fixes are proposed.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp | ||
---|---|---|
31 ↗ | (On Diff #56341) | Is getCanonicalType() important here? Did you try using QualType::getAsCXXRecordDecl()? |
clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp | ||
---|---|---|
31 ↗ | (On Diff #56341) | Probably not but I didn't try it. I just moved the previous function up to the top so I didn't have to forward declare it. One thing I'm simply unsure of is whether it's possible to get a RecordDecl that's not a CXXRecordDecl in C++ code. It seems like the answer is no but that might be another reason to keep it as is if I'm wrong about that... |
clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp | ||
---|---|---|
31 ↗ | (On Diff #56341) |
From the documents, RecordDecl and CXXRecordDecl present struct/union/class, except CXXRecordDecl provides more methods for classes. So I think you can try QualType::getAsCXXRecordDecl() here. |