File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
clang/lib/StaticAnalyzer/Checkers/CHERI Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,9 @@ using namespace cheri;
2929namespace {
3030
3131class AllocationChecker : public Checker <check::PostStmt<CastExpr>> {
32- BugType BT_1{this , " Allocation partitioning" , " CHERI portability" };
32+ BugType BT_Default{this , " Allocation partitioning" , " CHERI portability" };
33+ BugType BT_KnownReg{this , " Heap or static allocation partitioning" ,
34+ " CHERI portability" };
3335
3436 class AllocPartitionBugVisitor : public BugReporterVisitor {
3537 public:
@@ -120,8 +122,10 @@ ExplodedNode *AllocationChecker::emitAllocationPartitionWarning(
120122 llvm::raw_svector_ostream OS (Buf);
121123 OS << " Allocation partition: " ;
122124 describeCast (OS, CE, C.getASTContext ().getLangOpts ());
125+ const MemSpaceRegion *MemSpace = MR->getMemorySpace ();
126+ bool KnownReg = isa<HeapSpaceRegion, GlobalsSpaceRegion>(MemSpace);
123127 auto R = std::make_unique<PathSensitiveBugReport>(
124- BT_1 , OS.str (), ErrNode);
128+ KnownReg ? BT_KnownReg : BT_Default , OS.str (), ErrNode);
125129 R->addVisitor (std::make_unique<AllocPartitionBugVisitor>(MR));
126130 C.emitReport (std::move (R));
127131 return ErrNode;
You can’t perform that action at this time.
0 commit comments