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