[cfe-commits] r156049 - in /cfe/trunk: lib/StaticAnalyzer/Core/SValBuilder.cpp test/Analysis/malloc.c

Anna Zaks ganna at apple.com
Wed May 2 19:13:46 PDT 2012


Author: zaks
Date: Wed May  2 21:13:46 2012
New Revision: 156049

URL: http://llvm.org/viewvc/llvm-project?rev=156049&view=rev
Log:
[analyzer] Revert the functional part of r155944. 

The change resulted in multiple issues on the buildbot, so it's not
ready for prime time. Only enable history tracking for tainted
data(which is experimental) for now.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
    cfe/trunk/test/Analysis/malloc.c

Modified: cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp?rev=156049&r1=156048&r2=156049&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp Wed May  2 21:13:46 2012
@@ -199,6 +199,9 @@
                                    BinaryOperator::Opcode Op,
                                    NonLoc LHS, NonLoc RHS,
                                    QualType ResultTy) {
+  if (!State->isTainted(RHS) && !State->isTainted(LHS))
+    return UnknownVal();
+    
   const SymExpr *symLHS = LHS.getAsSymExpr();
   const SymExpr *symRHS = RHS.getAsSymExpr();
 

Modified: cfe/trunk/test/Analysis/malloc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc.c?rev=156049&r1=156048&r2=156049&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/malloc.c (original)
+++ cfe/trunk/test/Analysis/malloc.c Wed May  2 21:13:46 2012
@@ -776,13 +776,6 @@
   return p->n.m; // expected-warning {{leak}}
 }
 
-// Pointer arithmetic, returning an ElementRegion.
-void *radar11329382(unsigned bl) {
-  void *ptr = malloc (16);
-  ptr = ptr + (2 - bl);
-  return ptr; // no warning
-}
-
 void __assert_rtn(const char *, const char *, int, const char *) __attribute__((__noreturn__));
 int strcmp(const char *, const char *);
 char *a (void);





More information about the cfe-commits mailing list