Skip to content
  1. Jul 31, 2012
    • Anna Zaks's avatar
      [analyzer] Handle inlining of instance calls to super. · 5808eb80
      Anna Zaks authored
      Use self-init.m for testing. (It used to have a bunch of failing tests
      with dynamic inlining turned on.)
      
      llvm-svn: 161012
      5808eb80
    • Jordan Rose's avatar
      [analyzer] Perform post-call checks for all inlined calls. · c2d249ce
      Jordan Rose authored
      Previously, we were only checking the origin expressions of inlined calls.
      Checkers using the generic postCall and older postObjCMessage callbacks were
      ignored. Now that we have CallEventManager, it is much easier to create
      a CallEvent generically when exiting an inlined function, which we can then
      use for post-call checks.
      
      No test case because we don't (yet) have any checkers that depend on this
      behavior (which is why it hadn't been fixed before now).
      
      llvm-svn: 161005
      c2d249ce
  2. Jul 30, 2012
    • Anna Zaks's avatar
      [analyzer] Very simple ObjC instance method inlining · 63282aef
      Anna Zaks authored
      - Retrieves the type of the object/receiver from the state.
      - Binds self during stack setup.
      - Only explores the path on which the method is inlined (no
      bifurcation to explore the path on which the method is not inlined).
      
      llvm-svn: 160991
      63282aef
    • Anna Zaks's avatar
      [analyzer] Add -analyzer-ipa=dynamic option for inlining dynamically · e4919098
      Anna Zaks authored
      dispatched methods.
      
      Disabled by default for now.
      
      llvm-svn: 160988
      e4919098
    • Jordan Rose's avatar
      [analyzer] Only allow CallEvents to be created by CallEventManager. · fcd016e5
      Jordan Rose authored
      This ensures that it is valid to reference-count any CallEvents, and we
      won't accidentally try to reclaim a CallEvent that lives on the stack.
      It also hides an ugly switch statement for handling CallExprs!
      
      There should be no functionality change here.
      
      llvm-svn: 160986
      fcd016e5
    • Jordan Rose's avatar
      [analyzer] Introduce a CallEventManager to keep a pool of CallEvents. · d457ca92
      Jordan Rose authored
      This allows us to get around the C++ "virtual constructor" problem
      when we'd like to create a CallEvent from an ExplodedNode, an inlined
      StackFrameContext, or another CallEvent. The solution has three parts:
      
      - CallEventManager uses a BumpPtrAllocator to allocate CallEvent-sized
        memory blocks. It also keeps a cache of freed CallEvents for reuse.
      - CallEvents all have protected copy constructors, along with cloneTo()
        methods that use placement new to copy into CallEventManager-managed
        memory, vtables intact.
      - CallEvents owned by CallEventManager are now wrapped in an
        IntrusiveRefCntPtr. Going forwards, it's probably a good idea to create
        ALL CallEvents through the CallEventManager, so that we don't accidentally
        try to reclaim a stack-allocated CallEvent.
      
      All of this machinery is currently unused but will be put into use shortly.
      
      llvm-svn: 160983
      d457ca92
  3. Jul 27, 2012
  4. Jul 26, 2012
    • Jordan Rose's avatar
      [analyzer] CallEvent is no longer a value object. · 72ce8e2d
      Jordan Rose authored
      After discussion, the type-based dispatch was decided to be bad for
      maintenance and made it very easy for subtle bugs to creep in. Instead,
      we'll just be very careful when we do have to allocate these on the heap.
      
      llvm-svn: 160817
      72ce8e2d
    • Jordan Rose's avatar
      4f7df9be
    • Jordan Rose's avatar
      [analyzer] Don't crash on implicit statements inside initializers. · 25bc20f8
      Jordan Rose authored
      Our BugReporter knows how to deal with implicit statements: it looks in
      the ParentMap until it finds a parent with a valid location. However, since
      initializers are not in the body of a constructor, their sub-expressions are
      not in the ParentMap. That was easy enough to fix in AnalysisDeclContext.
      
      ...and then even once THAT was fixed, there's still an extra funny case
      of Objective-C object pointer fields under ARC, which are initialized with
      a top-level ImplicitValueInitExpr. To catch these cases,
      PathDiagnosticLocation will now fall back to the start of the current
      function if it can't find any other valid SourceLocations. This isn't great,
      but it's miles better than a crash.
      
      (All of this is only relevant when constructors and destructors are being
      inlined, i.e. under -cfg-add-initializers and -cfg-add-implicit-dtors.)
      
      llvm-svn: 160810
      25bc20f8
    • Jordan Rose's avatar
      [analyzer] Don't crash on array constructors and destructors. · 20edae87
      Jordan Rose authored
      This workaround is fairly lame: we simulate the first element's constructor
      and destructor and rely on the region invalidation to "initialize" the rest
      of the elements.
      
      llvm-svn: 160809
      20edae87
    • Jordan Rose's avatar
      [analyzer] Handle C++ member initializers and destructors. · 54529a34
      Jordan Rose authored
      This uses CFG to tell if a constructor call is for a member, and uses
      the member's region appropriately.
      
      llvm-svn: 160808
      54529a34
    • Jordan Rose's avatar
      [analyzer] Use the CFG to see if a constructor is for a local variable. · 05375eb4
      Jordan Rose authored
      Previously we were using ParentMap and crawling through the parent DeclStmt.
      This should be at least slightly cheaper (and is also more flexible).
      
      No (intended) functionality change.
      
      llvm-svn: 160807
      05375eb4
    • Jordan Rose's avatar
      [analyzer] Handle base class initializers and destructors. · b970505d
      Jordan Rose authored
      Most of the logic here is fairly simple; the interesting thing is that
      we now distinguish complete constructors from base or delegate constructors.
      We also make sure to cast to the base class before evaluating a constructor
      or destructor, since non-virtual base classes may behave differently.
      
      This includes some refactoring of VisitCXXConstructExpr and VisitCXXDestructor
      in order to keep ExprEngine.cpp as clean as possible (leaving the details for
      ExprEngineCXX.cpp).
      
      llvm-svn: 160806
      b970505d
    • Jordan Rose's avatar
      [analyzer] Show paths for destructor calls. · a4c0d21f
      Jordan Rose authored
      This modifies BugReporter and friends to handle CallEnter and CallExitEnd
      program points that came from implicit call CFG nodes (read: destructors).
      
      This required some extra handling for nested implicit calls. For example,
      the added multiple-inheritance test case has a call graph that looks like this:
      
      testMultipleInheritance3
        ~MultipleInheritance
          ~SmartPointer
          ~Subclass
            ~SmartPointer
              ***bug here***
      
      In this case we correctly notice that we started in an inlined function
      when we reach the CallEnter program point for the second ~SmartPointer.
      However, when we reach the next CallEnter (for ~Subclass), we were
      accidentally re-using the inner ~SmartPointer call in the diagnostics.
      
      Rather than guess if we saw the corresponding CallExitEnd based on the
      contents of the active path, we now just ask the PathDiagnostic if there's
      any known stack before popping off the top path.
      
      (A similar issue could have occured without multiple inheritance, but there
      wasn't a test case for it.)
      
      llvm-svn: 160804
      a4c0d21f
    • Jordan Rose's avatar
      [analyzer] Inline ctors + dtors when the CFG is built for them. · c5d85244
      Jordan Rose authored
      At the very least this means initializer nodes for constructors and
      automatic object destructors are present in the CFG.
      
      llvm-svn: 160803
      c5d85244
    • Jordan Rose's avatar
      [analyzer] PostImplicitCall can also occur between CFGElements. · 443ec10e
      Jordan Rose authored
      This avoids an assertion crash when we invalidate on a destructor call
      instead of inlining it.
      
      llvm-svn: 160802
      443ec10e
    • Anna Zaks's avatar
      [analyzer] Inline ObjC class methods. · 83f1495f
      Anna Zaks authored
      - Some cleanup(the TODOs) will be done after ObjC method inlining is
      complete.
      - Simplified CallEvent::getDefinition not to require ISDynamicDispatch
      parameter.
      - Also addressed Jordan's comments from r160530.
      
      llvm-svn: 160768
      83f1495f
    • Ted Kremenek's avatar
    • Ted Kremenek's avatar
  5. Jul 25, 2012
  6. Jul 23, 2012
  7. Jul 21, 2012
  8. Jul 20, 2012
  9. Jul 19, 2012
  10. Jul 18, 2012
    • Jordan Rose's avatar
      [analyzer] Combine all ObjC message CallEvents into ObjCMethodCall. · 627b046c
      Jordan Rose authored
      As pointed out by Anna, we only differentiate between explicit message sends
      
      This also adds support for ObjCSubscriptExprs, which are basically the same
      as properties in many ways. We were already checking these, but not emitting
      nice messages for them.
      
      This depends on the llvm::PointerIntPair change in r160456.
      
      llvm-svn: 160461
      627b046c
    • Jordan Rose's avatar
      [analyzer] Rename addExtraInvalidatedRegions to get...Regions · 9003d0d0
      Jordan Rose authored
      Per Anna's comment that "add..." sounds like a method that modifies
      the receiver, rather than its argument.
      
      No functionality change.
      
      llvm-svn: 160460
      9003d0d0
    • Jordan Rose's avatar
      [analyzer] Make CallEvent a value object. · 59e6ce92
      Jordan Rose authored
      We will need to be able to easily reconstruct a CallEvent from an ExplodedNode
      for diagnostic purposes, and that's exactly what factory functions are for.
      CallEvent objects are small enough (four pointers and a SourceLocation) that
      returning them through the stack is fairly cheap. Clients who just need to use
      existing CallEvents can continue to do so using const references.
      
      This uses the same sort of "kind-field-dispatch" as SVal, though most of the
      nastiness is contained in the DISPATCH and DISPATCH_ARG macros at the end of
      the file. (We can't use a template for this because member-pointers to base
      class methods don't call derived-class methods even when casting to the
      derived class. We can't use variadic macros because they're a C99 feature.)
      
      llvm-svn: 160459
      59e6ce92
    • Jordan Rose's avatar
      [analyzer] Remove obsolete ObjCPropRef SVal kind. · 074ebb3a
      Jordan Rose authored
      ObjC properties are handled through their semantic form of ObjCMessageExprs
      and their wrapper PseudoObjectExprs, and have been for quite a while. The
      syntactic ObjCPropertyRefExprs do not appear in the CFG and are not visited
      by ExprEngine.
      
      No functionality change.
      
      llvm-svn: 160458
      074ebb3a
    • Jordan Rose's avatar
      [analyzer] Remove unused ExprEngine::VisitCXXTemporaryObjectExpr. · be25b07f
      Jordan Rose authored
      llvm-svn: 160457
      be25b07f
    • Benjamin Kramer's avatar
      Remove trivial destructor from SVal. · e6f70085
      Benjamin Kramer authored
      This enables the faster SmallVector in clang and also allows clang's unused
      variable warnings to be more effective. Fix the two instances that popped up.
      
      The RetainCountChecker change actually changes functionality, it would be nice
      if someone from the StaticAnalyzer folks could look at it.
      
      llvm-svn: 160444
      e6f70085
    • Ted Kremenek's avatar
      Fix crash in RegionStoreManager::evalDerivedToBase() due to not handling references · 46dcfc94
      Ted Kremenek authored
      (in uses of dynamic_cast<>).
      
      Fixes <rdar://problem/11817693>.
      
      llvm-svn: 160427
      46dcfc94
  11. Jul 17, 2012
Loading