This is less verbose than checking for class, struct, and union individually,
and I believe it's also more efficient (not that that should be the overriding
concern).
Reviewed By: sammccall, xazax.hun
Differential Revision: https://reviews.llvm.org/D147603
}
StorageLocation &DataflowAnalysisContext::createStorageLocation(QualType Type) {
- if (!Type.isNull() &&
- (Type->isStructureOrClassType() || Type->isUnionType())) {
+ if (!Type.isNull() && Type->isRecordType()) {
llvm::DenseMap<const ValueDecl *, StorageLocation *> FieldLocs;
// During context-sensitive analysis, a struct may be allocated in one
// function, but its field accessed in a function lower in the stack than
auto &AggregateLoc = *cast<AggregateStorageLocation>(&Loc);
const QualType Type = AggregateLoc.getType();
- assert(Type->isStructureOrClassType() || Type->isUnionType());
+ assert(Type->isRecordType());
for (const FieldDecl *Field : DACtx->getReferencedFields(Type)) {
assert(Field != nullptr);
return &create<PointerValue>(PointeeLoc);
}
- if (Type->isStructureOrClassType() || Type->isUnionType()) {
+ if (Type->isRecordType()) {
CreatedValuesCount++;
llvm::DenseMap<const ValueDecl *, Value *> FieldValues;
for (const FieldDecl *Field : DACtx->getReferencedFields(Type)) {