NoQ added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:163-165
+      ProgramStateManager &StateMgr = N->getState()->getStateManager();
+      MemRegionManager &MRMgr = StateMgr.getRegionManager();
+      return MRMgr.getVarRegion(VD, N->getLocationContext());
----------------
This isn't your code but it came to my attention that there's a convenient (but 
equally confusing) shortcut for this:
```lang=c++
return N->getState()->getLValue(VD, N->getLocationContext());
```


================
Comment at: clang/test/Analysis/uninit-const.cpp:78
   int t;       //expected-note {{'t' declared without an initial value}}
-  int &p = t;  //expected-note {{'p' initialized here}}
-  int &s = p;  //expected-note {{'s' initialized here}}
-  int &q = s;  //expected-note {{'q' initialized here}}
+  int &p = t;  //expected-note {{'p' initialized to the value of 't'}}
+  int &s = p;  //expected-note {{'s' initialized to the value of 'p'}}
----------------
I suspect that this wording can be improved a lot. The note "`'p' initialized 
to the value of 't'`" sounds like an accurate description for `int p = t` but 
not so much for `int &p = t`. Can we detect this case and say something like 
"`'p' refers to 't'`" instead?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101041/new/

https://reviews.llvm.org/D101041

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to