Skip to content
  1. Sep 17, 2012
  2. Sep 13, 2012
  3. Sep 10, 2012
  4. Sep 08, 2012
    • Jordan Rose's avatar
      [analyzer] ObjCSelfInitChecker should always clean up in postCall checks. · 5481cfef
      Jordan Rose authored
      ObjCSelfInitChecker stashes information in the GDM to persist it across
      function calls; it is stored in pre-call checks and retrieved post-call.
      The post-call check is supposed to clear out the stored state, but was
      failing to do so in cases where the call did not have a symbolic return
      value.
      
      This was actually causing the inappropriate cache-out from r163361.
      Per discussion with Anna, we should never actually cache out when
      assuming the receiver of an Objective-C message is non-nil, because
      we guarded that node generation by checking that the state has changed.
      Therefore, the only states that could reach this exact ExplodedNode are
      ones that should have merged /before/ making this assumption.
      
      r163361 has been reverted and the test case removed, since it won't
      actually test anything interesting now.
      
      llvm-svn: 163449
      5481cfef
    • Jordan Rose's avatar
      [analyzer] Add debug output for ObjCSelfInitChecker's state. · bd94e5d8
      Jordan Rose authored
      No functionality change.
      
      llvm-svn: 163448
      bd94e5d8
    • Anna Zaks's avatar
      [analyzer] Address John's code review for r163407. · 044f3e26
      Anna Zaks authored
      Teach malloc sizeof checker to find type inconsistencies in multi-
      dimensional arrays.
      
      llvm-svn: 163438
      044f3e26
    • Ted Kremenek's avatar
      Remove ProgramState::getSymVal(). It was being misused by Checkers, · 244e1d7d
      Ted Kremenek authored
      with at least one subtle bug in MacOSXKeyChainAPIChecker where the
      calling the method was a substitute for assuming a symbolic value
      was null (which is not the case).
      
      We still keep ConstraintManager::getSymVal(), but we use that as
      an optimization in SValBuilder and ProgramState::getSVal() to
      constant-fold SVals.  This is only if the ConstraintManager can
      provide us with that information, which is no longer a requirement.
      As part of this, introduce a default implementation of
      ConstraintManager::getSymVal() which returns null.
      
      For Checkers, introduce ConstraintManager::isNull(), which queries
      the state to see if the symbolic value is constrained to be a null
      value.  It does this without assuming it has been implicitly constant
      folded.
      
      llvm-svn: 163428
      244e1d7d
  5. Sep 07, 2012
  6. Sep 06, 2012
    • Jordan Rose's avatar
      [analyzer] Don't attempt to devirtualize calls to base class destructors. · 2bc9674b
      Jordan Rose authored
      CXXDestructorCall now has a flag for when it is a base destructor call.
      Other kinds of destructor calls (locals, fields, temporaries, and 'delete')
      all behave as "whole-object" destructors and do not behave differently
      from one another (specifically, in these cases we /should/ try to
      devirtualize a call to a virtual destructor).
      
      This was causing crashes in both our internal buildbot, the crash still
      being tracked in PR13765, and some of the crashes being tracked in PR13763,
      due to a assertion failure. (The behavior under -Asserts happened to be
      correct anyway.)
      
      Adding this knowledge also allows our DynamicTypePropagation checker to do
      a bit less work; the special rules about virtual method calls during a
      destructor only require extra handling during base destructors.
      
      llvm-svn: 163348
      2bc9674b
    • Anna Zaks's avatar
      [analyzer] Enhance the member expr tracking to account for references. · 3245e584
      Anna Zaks authored
      As per Jordan's suggestion. (Came out of code review for r163261.)
      
      llvm-svn: 163269
      3245e584
    • Anna Zaks's avatar
      [analyzer] Remove unneeded code. · 1e2a0dc4
      Anna Zaks authored
      This region is set as interesting as part of trackNullOrUndefValue call,
      no need to mark it as interesting twice.
      
      llvm-svn: 163260
      1e2a0dc4
  7. Sep 05, 2012
  8. Sep 01, 2012
    • Jordan Rose's avatar
      [analyzer] Future-proofing r163012 (nameless functions and RetainCountChecker) · ccf192e4
      Jordan Rose authored
      Any future exceptions need to go INSIDE the test that checks if the
      IdentifierInfo is non-null!
      
      No functionality change. Thanks for the review, Ted.
      
      llvm-svn: 163067
      ccf192e4
    • Jordan Rose's avatar
      [analyzer] Always derive a CallEvent's return type from its origin expr. · 2da56438
      Jordan Rose authored
      Previously, we preferred to get a result type by looking at the callee's
      declared result type. This allowed us to handlereferences, which are
      represented in the AST as lvalues of their pointee type. (That is, a call
      to a function returning 'int &' has type 'int' and value kind 'lvalue'.)
      
      However, this results in us preferring the original type of a function
      over a casted type. This is a problem when a function  pointer is casted
      to another type, because the conjured result value will have the wrong
      type. AdjustedReturnValueChecker is supposed to handle this, but still
      doesn't handle the case where there is no "original function" at all,
      i.e. where the callee is unknown.
      
      Now, we instead look at the call expression's value kind (lvalue, xvalue,
      or prvalue), and adjust the expr's type accordingly. This will have no
      effect when the function is inlined, and will conjure the value that will
      actually be used when it is not.
      
      This makes AdjustedReturnValueChecker /nearly/ unnecessary; unfortunately,
      the cases where it would still be useful are where we need to cast the
      result of an inlined function or a checker-evaluated function, and in these
      cases we don't know what we're casting /from/ by the time we can do post-
      call checks. In light of that, remove AdjustedReturnValueChecker, which
      was already not checking quite a few calls.
      
      llvm-svn: 163065
      2da56438
  9. Aug 31, 2012
  10. Aug 30, 2012
  11. Aug 29, 2012
    • Anna Zaks's avatar
      [analyzer] Improved diagnostic pruning for calls initializing values. · 5d4ec363
      Anna Zaks authored
      This heuristic addresses the case when a pointer (or ref) is passed
      to a function, which initializes the variable (or sets it to something
      other than '0'). On the branch where the inlined function does not
      set the value, we report use of undefined value (or NULL pointer
      dereference). The access happens in the caller and the path
      through the callee would get pruned away with regular path pruning. To
      solve this issue, we previously disabled diagnostic pruning completely
      on undefined and null pointer dereference checks, which entailed very
      verbose diagnostics in most cases. Furthermore, not all of the
      undef value checks had the diagnostic pruning disabled.
      
      This patch implements the following heuristic: if we pass a pointer (or
      ref) to the region (on which the error is reported) into a function and
      it's value is either undef or 'NULL' (and is a pointer), do not prune
      the function.
      
      llvm-svn: 162863
      5d4ec363
    • Jordan Rose's avatar
      [analyzer] C++ objects returned on the stack may be wrapped in ExprWithCleanups. · 2c625dd6
      Jordan Rose authored
      In C++, objects being returned on the stack are actually copy-constructed into
      the return value. That means that when a temporary is returned, it still has
      to be destroyed, i.e. the returned expression will be wrapped in an
      ExprWithCleanups node. Our "returning stack memory" checker needs to look
      through this node to see if we really are returning an object by value.
      
      PR13722
      
      llvm-svn: 162817
      2c625dd6
  12. Aug 28, 2012
    • Jordan Rose's avatar
      [analyzer] Rename addTrackNullOrUndefValueVisitor to trackNullOrUndefValue. · a0f7d35a
      Jordan Rose authored
      This helper function (in the clang::ento::bugreporter namespace) may add more
      than one visitor, but conceptually it's tracking a single use of a null or
      undefined value and should do so as best it can.
      
      Also, the BugReport parameter has been made a reference to underscore that
      it is non-optional.
      
      llvm-svn: 162720
      a0f7d35a
  13. Aug 27, 2012
  14. Aug 24, 2012
    • Ted Kremenek's avatar
      Rename the "experimental" checker package to "alpha". We will then refine · 7c65b8f2
      Ted Kremenek authored
      this group into "alpha" and "beta" to distinguish between checkers in
      different levels of premature state.
      
      llvm-svn: 162582
      7c65b8f2
    • Anna Zaks's avatar
      [analyzer] Fix realloc related bug in the malloc checker. · fe6eb67b
      Anna Zaks authored
      When reallocation of a non-allocated (not owned) symbol fails do not
      expect it to be freed.
      
      llvm-svn: 162533
      fe6eb67b
    • Anna Zaks's avatar
      [analyzer] Remove unnecessary code. · 6fb4b055
      Anna Zaks authored
      This code has been added a while ago and removing it does not trigger
      any test failures. The false positives it was trying to suppress are
      probably handled by other logic (ex: special handling of delegates).
      
      llvm-svn: 162529
      6fb4b055
    • Anna Zaks's avatar
      [analyzer] Make analyzer less aggressive when dealing with [self init]. · 3d5d3d3e
      Anna Zaks authored
      With inlining, retain count checker starts tracking 'self' through the
      init methods. The analyser results were too noisy if the developer
      did not follow 'self = [super init]' pattern (which is common
      especially in older code bases) - we reported self init anti-pattern AND
      possible use-after-free. This patch teaches the retain count
      checker to assume that [super init] does not fail when it's not consumed
      by another expression. This silences the retain count warning that warns
      about possibility of use-after-free when init fails, while preserving
      all the other checking on 'self'.
      
      llvm-svn: 162508
      3d5d3d3e
  15. Aug 23, 2012
  16. Aug 22, 2012
Loading