Skip to content
  1. Jul 08, 2011
  2. Jul 07, 2011
    • Chandler Carruth's avatar
      Based on comments from Chris, switch to using CFG::getNumBlockIDs() · 50020d94
      Chandler Carruth authored
      rather than a computed std::distance(). At some point I had convinced
      myself that these two were different; but as far as I can tell on
      re-exampination they aren't, and the number of block IDs is actually
      just a count of the blocks in the CFG.
      
      While this removes the primary motivation for guarding all of this with
      CollectStats, I have a patch coming up that will almost certainly make
      it important again.
      
      llvm-svn: 134552
      50020d94
  3. Jul 06, 2011
    • Chandler Carruth's avatar
      Build up statistics about the work done for analysis based warnings. · b4836ea7
      Chandler Carruth authored
      Special detail is added for uninitialized variable analysis as this has
      serious performance problems than need to be tracked.
      
      Computing some of this data is expensive, for example walking the CFG to
      determine its size. To avoid doing that unless the stats data is going
      to be used, we thread a bit into the Sema object to track whether
      detailed stats should be collected or not. This bit is used to avoid
      computations whereever the computations are likely to be more expensive
      than checking the state of the flag. Thus, counters are in some cases
      unconditionally updated, but the more expensive (and less frequent)
      aggregation steps are skipped.
      
      With this patch, we're able to see that for 'gcc.c':
      *** Analysis Based Warnings Stats:
      232 functions analyzed (0 w/o CFGs).
        7151 CFG blocks built.
        30 average CFG blocks per function.
        1167 max CFG blocks per function.
      163 functions analyzed for uninitialiazed variables
        640 variables analyzed.
        3 average variables per function.
        94 max variables per function.
        96409 block visits.
        591 average block visits per function.
        61546 max block visits per function.
      
      And for the reduced testcase in PR10183:
      *** Analysis Based Warnings Stats:
      98 functions analyzed (0 w/o CFGs).
        8526 CFG blocks built.
        87 average CFG blocks per function.
        7277 max CFG blocks per function.
      68 functions analyzed for uninitialiazed variables
        1359 variables analyzed.
        19 average variables per function.
        1196 max variables per function.
        2540494 block visits.
        37360 average block visits per function.
        2536495 max block visits per function.
      
      That last number is the somewhat scary one that indicates the problem in
      PR10183.
      
      llvm-svn: 134494
      b4836ea7
  4. Jul 02, 2011
  5. May 11, 2011
  6. Apr 05, 2011
    • Chandler Carruth's avatar
      Simplify the tracking of when to issue a fixit hint, making the helper · dd8f0d05
      Chandler Carruth authored
      function more clear and obvious in behavior.
      
      Add some comments documenting the behavior of the primary diagnostic helper.
      
      llvm-svn: 128901
      dd8f0d05
    • Chandler Carruth's avatar
      Separate the logic for issuing the initialization fixit hint from the · 7a037202
      Chandler Carruth authored
      diagnostic emission. The fixit hint, when suggested, typically has
      nothing to do with the nature or form of the reference.
      
      llvm-svn: 128899
      7a037202
    • Chandler Carruth's avatar
      Begin refactoring the uninitialized warning code that I uglied up. This · 895904da
      Chandler Carruth authored
      extracts a function to handle the emission of the diagnostic separately
      from the walking over the set of uninitialized uses.
      
      Also updates the naming used within this extracted function to be a bit
      more consistent with the rest of Clang's naming patterns.
      
      The next step will be breaking this apart so that we can go through
      different functions rather than tracking so many boolean variables.
      
      llvm-svn: 128898
      895904da
    • Chandler Carruth's avatar
      Fix PR9624 by explicitly disabling uninitialized warnings for direct self-init: · b5d4831f
      Chandler Carruth authored
        int x = x;
      
      GCC disables its warnings on this construct as a way of indicating that
      the programmer intentionally wants the variable to be uninitialized.
      Only the warning on the initializer is turned off in this iteration.
      
      This makes the code a lot more ugly, but starts commenting the
      surprising behavior here. This is a WIP, I want to refactor it
      substantially for clarity, and to determine whether subsequent warnings
      should be suppressed or not.
      
      llvm-svn: 128894
      b5d4831f
    • Chandler Carruth's avatar
      Cleanup the style of some of this code prior to functional changes. · 4e02182a
      Chandler Carruth authored
      I think this moves the code in the desired direction of the new style
      recommendations (and style conventional in Clang), but if anyone prefers
      the previous style, or has other suggestions just chime in and I'll
      follow up.
      
      llvm-svn: 128878
      4e02182a
    • Ted Kremenek's avatar
      Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with... · 37881934
      Ted Kremenek authored
      Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with numerous CFG and UninitializedValues analysis changes:
      
      1) Change the CFG to include the DeclStmt for conditional variables, instead of using the condition itself as a faux DeclStmt.
      2) Update ExprEngine (the static analyzer) to understand (1), so not to regress.
      3) Update UninitializedValues.cpp to initialize all tracked variables to Uninitialized at the start of the function/method.
      4) Only use the SelfReferenceChecker (SemaDecl.cpp) on global variables, leaving the dataflow analysis to handle other cases.
      
      The combination of (1) and (3) allows the dataflow-based -Wuninitialized to find self-init problems when the initializer
      contained control-flow.
      
      llvm-svn: 128858
      37881934
  7. Apr 04, 2011
  8. Mar 19, 2011
  9. Mar 17, 2011
  10. Mar 15, 2011
  11. Mar 10, 2011
    • Ted Kremenek's avatar
      When doing reachability analysis for warnings issued under... · a099c595
      Ted Kremenek authored
      When doing reachability analysis for warnings issued under DiagRuntimeBehavior, don't construct a ParentMap or CFGStmtMap.
      Instead, create a small set of Stmt* -> CFGBlock* mappings during CFG construction for only the statements we care about
      relating to the diagnostics we want to check for reachability.
      
      llvm-svn: 127396
      a099c595
  12. Mar 03, 2011
  13. Mar 02, 2011
  14. Feb 23, 2011
  15. Feb 05, 2011
  16. Feb 03, 2011
  17. Feb 01, 2011
    • Ted Kremenek's avatar
      Add temporary hack to -Wuninitialize to create a separate CFG (for C++ code)... · 5b428844
      Ted Kremenek authored
      Add temporary hack to -Wuninitialize to create a separate CFG (for C++ code) that doesn't include implicit dtors.
      
      Implicit dtors confuse the ad hoc path-sensitivity of UninitializedValuesV2.cpp.  This isn't
      the ideal solution, as it will directly impact compile time, but should significantly reduce
      the noise of -Wuninitialized on some code bases.
      
      This immediately "fixes" the false positive reported in PR 9063, although this
      isn't the right fix in the long run.
      
      llvm-svn: 124667
      5b428844
  18. Jan 27, 2011
  19. Jan 26, 2011
    • Ted Kremenek's avatar
      Teach -Wreturn-type that destructors can appear · 5d068499
      Ted Kremenek authored
      after a 'return' in a CFGBlock.  This accidentally
      was working before, but the false assumption that
      'return' always appeared at the end of the block
      was uncovered by a recent change.
      
      llvm-svn: 124280
      5d068499
  20. Jan 25, 2011
  21. Jan 21, 2011
  22. Jan 18, 2011
  23. Jan 17, 2011
  24. Jan 16, 2011
  25. Jan 15, 2011
  26. Jan 08, 2011
    • Chandler Carruth's avatar
      Remove a kludge from analysis based warnings that used to detect · b35635e9
      Chandler Carruth authored
      temporaries with no-return destructors. The CFG now properly supports
      temporaries and implicit destructors which both makes this kludge no
      longer work, and conveniently removes the need for it.
      
      Turn on CFG handling of implicit destructors and initializers. Several
      ad-hoc benchmarks don't indicate any measurable performance impact from
      growing the CFG, and it fixes real correctness problems with warnings.
      
      As a result of turning on these CFG elements, we started to tickle an
      inf-loop in the unreachable code logic used for warnings. The fix is
      trivial.
      
      llvm-svn: 123056
      b35635e9
Loading