NoQ added a comment.

I have just one comment and i think it'd be good to land.



================
Comment at: lib/StaticAnalyzer/Core/CheckerHelpers.cpp:104
+  ProgramStateManager &Mgr = State->getStateManager();
+  if (!LHSVal.getAs<NonLoc>() && LHSVal.getAs<Loc>()) {
+    LHSVal = Mgr.getStoreManager().getBinding(State->getStore(),
----------------
Every `SVal` is either `Unknown` or `Undefined` or `NonLoc` or `Loc`, so the 
check after `&&` is unnecessary.

Also, i believe that it'd be more correct to look at the AST's 
`Expr::isLValue()` (in the caller function, where the expression is still 
available) instead of looking at the `SVal` type here. These approaches are 
significantly different: you need to discriminate between pointer-type rvalues 
and integer-type lvalues, both of which are represented as `Loc` values; in the 
former case, we shouldn't blindly get the binding. I've seen these incorrectly 
discriminated-between in multiple places in the analyzer, and i believe we 
should fix this eventually.


Repository:
  rL LLVM

https://reviews.llvm.org/D30295



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

Reply via email to