[cfe-dev] [Analyzer - iterBindings] Why ‘RegionStoreManager::iterBindings()’ doesn't consider the 'offset' when iterate 'RegionBindings'?

Wong Henry via cfe-dev cfe-dev at lists.llvm.org
Fri Sep 8 00:22:42 PDT 2017


Hi all,
When I implement a checker that handle "strcat()", I need to iterate all the bindings to get the offset for null character. However "iterBindings()" doesn't consider the region's offset.

I don't know if this can be called a question, but I just want to know why "BindingsHandler::HandleBinding" only takes region as a argument and ignores the region's offset, is there no such demand, or is there any other reason?

-----------------------------------------------------------
  void iterBindings(Store store, BindingsHandler& f) override {
    RegionBindingsRef B = getRegionBindings(store);
    for (RegionBindingsRef::iterator I = B.begin(), E = B.end(); I != E; ++I) {
      const ClusterBindings &Cluster = I.getData();
      for (ClusterBindings::iterator CI = Cluster.begin(), CE = Cluster.end();
           CI != CE; ++CI) {
        const BindingKey &K = CI.getKey();
        if (!K.isDirect())
          continue;
        if (const SubRegion *R = dyn_cast<SubRegion>(K.getRegion())) {
          // FIXME: Possibly incorporate the offset?
          if (!f.HandleBinding(*this, store, R, CI.getData()))
            return;
        }
      }
    }
  }
-----------------------------------------------------------

Thanks,
Henry Wong
Qihoo 360 CodeSafe Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170908/f72893dc/attachment.html>


More information about the cfe-dev mailing list