================
@@ -1011,6 +979,30 @@ void SExprBuilder::exitCFG(const CFGBlock *Last) {
IncompleteArgs.clear();
}
+static CapabilityExpr makeCapabilityExpr(const til::SExpr *E, QualType VDT,
+ bool Neg) {
+ // We need to look at the declaration of the type of the value to determine
+ // which it is. The type should either be a record or a typedef, or a pointer
+ // or reference thereof.
+ if (const auto *RT = VDT->getAs<RecordType>()) {
+ if (const auto *RD = RT->getDecl())
+ if (const auto *CA = RD->getAttr<CapabilityAttr>())
+ return CapabilityExpr(E, CA->getName(), Neg,
+ RD->hasAttr<ReentrantCapabilityAttr>());
+ } else if (const auto *TT = VDT->getAs<TypedefType>()) {
+ if (const auto *TD = TT->getDecl())
+ if (const auto *CA = TD->getAttr<CapabilityAttr>())
+ return CapabilityExpr(E, CA->getName(), Neg,
+ TD->hasAttr<ReentrantCapabilityAttr>());
+ } else if (VDT->isPointerOrReferenceType())
+ return makeCapabilityExpr(E, VDT->getPointeeType(), Neg);
+
+ return CapabilityExpr(E, StringRef("mutex"), Neg, false);
+}
----------------
melver wrote:
I'll rework this, trying to improve readability here as well.
https://github.com/llvm/llvm-project/pull/137133
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits