Skip to content

Commit a95c1e9

Browse files
RKSimonAlexisPerry
authored andcommitted
[Interp] Record::getBase - merge isRecordType/getAs<RecordType>() checks. NFC.
Noticed because static analyzer doesn't understand that isRecordType is just a wrapper to isa<> and was warning about a potential null dereference
1 parent 0c5a395 commit a95c1e9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clang/lib/AST/Interp/Record.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ const Record::Base *Record::getBase(const RecordDecl *FD) const {
4949
}
5050

5151
const Record::Base *Record::getBase(QualType T) const {
52-
if (!T->isRecordType())
53-
return nullptr;
54-
55-
const RecordDecl *RD = T->getAs<RecordType>()->getDecl();
56-
return BaseMap.lookup(RD);
52+
if (auto *RT = T->getAs<RecordType>()) {
53+
const RecordDecl *RD = RT->getDecl();
54+
return BaseMap.lookup(RD);
55+
}
56+
return nullptr;
5757
}
5858

5959
const Record::Base *Record::getVirtualBase(const RecordDecl *FD) const {

0 commit comments

Comments
 (0)