Skip to content
Snippets Groups Projects
  1. Jul 12, 2017
  2. Jun 03, 2017
  3. Jan 10, 2017
  4. Dec 15, 2016
  5. Dec 14, 2016
  6. Aug 17, 2016
    • Artem Dergachev's avatar
      [analyzer] Add LocationContext information to SymbolMetadata. · 64f71c6f
      Artem Dergachev authored
      Like SymbolConjured, SymbolMetadata also needs to be uniquely
      identified by the moment of its birth.
      
      Such moments are coded by the (Statement, LocationContext, Block count) triples.
      Each such triple represents the moment of analyzing a statement with a certain
      call backtrace, with corresponding CFG block having been entered a given amount
      of times during analysis of the current code body.
      
      The LocationContext information was accidentally omitted for SymbolMetadata,
      which leads to reincarnation of SymbolMetadata upon re-entering a code body
      with a different backtrace; the new symbol is incorrectly unified with
      the old symbol, which leads to unsound assumptions.
      
      Patch by Alexey Sidorin!
      
      Differential Revision: https://reviews.llvm.org/D21978
      
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278937 91177308-0d34-0410-b5e6-96231b3b80d8
      64f71c6f
  7. Feb 08, 2016
  8. Jan 18, 2016
  9. Jan 13, 2016
    • Artem Dergachev's avatar
      [analyzer] Fix SVal/SymExpr/MemRegion class and enum names for consistency. · 3e7cbba8
      Artem Dergachev authored
      The purpose of these changes is to simplify introduction of definition files
      for the three hierarchies.
      
      1. For every sub-class C of these classes, its kind in the relevant enumeration
      is changed to "CKind" (or C##Kind in preprocessor-ish terms), eg:
      
        MemRegionKind   -> MemRegionValKind
        RegionValueKind -> SymbolRegionValueKind
        CastSymbolKind  -> SymbolCastKind
        SymIntKind      -> SymIntExprKind
      
      2. MemSpaceRegion used to be inconsistently used as both an abstract base and
      a particular region. This region class is now an abstract base and no longer
      occupies GenericMemSpaceRegionKind. Instead, a new class, CodeSpaceRegion,
      is introduced for handling the unique use case for MemSpaceRegion as
      "the generic memory space" (when it represents a memory space that holds all
      executable code).
      
      3. BEG_ prefixes in memory region kind ranges are renamed to BEGIN_ for
      consisitency with symbol kind ranges.
      
      4. FunctionTextRegion and BlockTextRegion are renamed to FunctionCodeRegion and
      BlockCodeRegion, respectively. The term 'code' is less jargony than 'text' and
      we already refer to BlockTextRegion as a 'code region' in BlockDataRegion.
      
      Differential Revision: http://reviews.llvm.org/D16062
      
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257598 91177308-0d34-0410-b5e6-96231b3b80d8
      3e7cbba8
  10. Jan 12, 2016
    • Pierre Gousseau's avatar
      [analyzer] Evaluate integral casts as cast symbols if truncations are detected. · 8c0250d7
      Pierre Gousseau authored
      The current workaround for truncations not being modelled is that the evaluation of integer to integer casts are simply bypassed and so the original symbol is used as the new casted symbol (cf SimpleSValBuilder::evalCastFromNonLoc).
      This lead to the issue described in PR25078, as the RangeConstraintManager associates ranges with symbols.
      
      The new evalIntegralCast method added by this patch wont bypass the cast if it finds the range of the symbol to be greater than the maximum value of the target type.
      
      The fix to RangeSet::pin mentioned in the initial review will be committed separately.
      
      Differential Revision: http://reviews.llvm.org/D12901
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257464 91177308-0d34-0410-b5e6-96231b3b80d8
      8c0250d7
  11. Dec 04, 2015
  12. Nov 19, 2015
  13. Sep 22, 2015
  14. Sep 08, 2015
  15. Dec 19, 2013
  16. Dec 05, 2013
  17. Nov 20, 2013
  18. Sep 18, 2013
  19. Aug 28, 2013
    • Jordan Rose's avatar
      [analyzer] Add support for testing the presence of weak functions. · 3aa6f431
      Jordan Rose authored
      When casting the address of a FunctionTextRegion to bool, or when adding
      constraints to such an address, use a stand-in symbol to represent the
      presence or absence of the function if the function is weakly linked.
      This is groundwork for possible simple availability testing checks, and
      can already catch mistakes involving inverted null checks for
      weakly-linked functions.
      
      Currently, the implementation reuses the "extent" symbols, originally created
      for tracking the size of a malloc region. Since FunctionTextRegions cannot
      be dereferenced, the extent symbol will never be used for anything else.
      Still, this probably deserves a refactoring in the future.
      
      This patch does not attempt to support testing the presence of weak
      /variables/ (global variables), which would likely require much more of
      a change and a generalization of "region structure metadata", like the
      current "extents", vs. "region contents metadata", like CStringChecker's
      "string length".
      
      Patch by Richard <tarka.t.otter@googlemail.com>!
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189492 91177308-0d34-0410-b5e6-96231b3b80d8
      3aa6f431
  20. Jul 25, 2013
  21. Jul 17, 2013
  22. May 29, 2013
  23. May 02, 2013
    • Jordan Rose's avatar
      [analyzer] Don't try to evaluate MaterializeTemporaryExpr as a constant. · 4b75085f
      Jordan Rose authored
      ...and don't consider '0' to be a null pointer constant if it's the
      initializer for a float!
      
      Apparently null pointer constant evaluation looks through both
      MaterializeTemporaryExpr and ImplicitCastExpr, so we have to be more
      careful about types in the callers. For RegionStore this just means giving
      up a little more; for ExprEngine this means handling the
      MaterializeTemporaryExpr case explicitly.
      
      Follow-up to r180894.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180944 91177308-0d34-0410-b5e6-96231b3b80d8
      4b75085f
    • Jordan Rose's avatar
      [analyzer] Consolidate constant evaluation logic in SValBuilder. · e2b1246a
      Jordan Rose authored
      Previously, this was scattered across Environment (literal expressions),
      ExprEngine (default arguments), and RegionStore (global constants). The
      former special-cased several kinds of simple constant expressions, while
      the latter two deferred to the AST's constant evaluator.
      
      Now, these are all unified as SValBuilder::getConstantVal(). To keep
      Environment fast, the special cases for simple constant expressions have
      been left in, but the main benefits are that (a) unusual constants like
      ObjCStringLiterals now work as default arguments and global constant
      initializers, and (b) we're not duplicating code between ExprEngine and
      RegionStore.
      
      This actually caught a bug in our test suite, which is awesome: we stop
      tracking allocated memory if it's passed as an argument along with some
      kind of callback, but not if the callback is 0. We were testing this in
      a case where the callback parameter had a default value, but that value
      was 0. After this change, the analyzer now (correctly) flags that as a
      leak!
      
      <rdar://problem/13773117>
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180894 91177308-0d34-0410-b5e6-96231b3b80d8
      e2b1246a
  24. May 01, 2013
  25. Apr 29, 2013
  26. Apr 26, 2013
    • Jordan Rose's avatar
      [analyzer] Model casts to bool differently from other numbers. · 5e6c06bc
      Jordan Rose authored
      Casts to bool (and _Bool) are equivalent to checks against zero,
      not truncations to 1 bit or 8 bits.
      
      This improved reasoning does cause a change in the behavior of the alpha
      BoolAssignment checker. Previously, this checker complained about statements
      like "bool x = y" if 'y' was known not to be 0 or 1. Now it does not, since
      that conversion is well-defined. It's hard to say what the "best" behavior
      here is: this conversion is safe, but might be better written as an explicit
      comparison against zero.
      
      More usefully, besides improving our model of booleans, this fixes spurious
      warnings when returning the address of a local variable cast to bool.
      
      <rdar://problem/13296133>
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180638 91177308-0d34-0410-b5e6-96231b3b80d8
      5e6c06bc
  27. Apr 16, 2013
    • Anna Zaks's avatar
      [analyzer] Do not crash when processing binary "?:" in C++ · d8eeac5b
      Anna Zaks authored
      When computing the value of ?: expression, we rely on the last expression in
      the previous basic block to be the resulting value of the expression. This is
      not the case for binary "?:" operator (GNU extension) in C++. As the last
      basic block has the expression for the condition subexpression, which is an
      R-value, whereas the true subexpression is the L-value.
      
      Note the operator evaluation just happens to work in C since the true
      subexpression is an R-value (like the condition subexpression). CFG is the
      same in C and C++ case, but the AST nodes are different, which the LValue to
      Rvalue conversion happening after the BinaryConditionalOperator evaluation.
      
      Changed the logic to only use the last expression from the predecessor only
      if it matches either true or false subexpression. Note, the logic needed
      fortification anyway: L and R were passed but not even used by the function.
      
      Also, change the conjureSymbolVal to correctly compute the type, when the
      expression is an LG-value.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179574 91177308-0d34-0410-b5e6-96231b3b80d8
      d8eeac5b
  28. Apr 09, 2013
    • Jordan Rose's avatar
      [analyzer] Replace isIntegerType() with isIntegerOrEnumerationType(). · a5796f87
      Jordan Rose authored
      Previously, the analyzer used isIntegerType() everywhere, which uses the C
      definition of "integer". The C++ predicate with the same behavior is
      isIntegerOrUnscopedEnumerationType().
      
      However, the analyzer is /really/ using this to ask if it's some sort of
      "integrally representable" type, i.e. it should include C++11 scoped
      enumerations as well. hasIntegerRepresentation() sounds like the right
      predicate, but that includes vectors, which the analyzer represents by its
      elements.
      
      This commit audits all uses of isIntegerType() and replaces them with the
      general isIntegerOrEnumerationType(), except in some specific cases where
      it makes sense to exclude scoped enumerations, or any enumerations. These
      cases now use isIntegerOrUnscopedEnumerationType() and getAs<BuiltinType>()
      plus BuiltinType::isInteger().
      
      isIntegerType() is hereby banned in the analyzer - lib/StaticAnalysis and
      include/clang/StaticAnalysis. :-)
      
      Fixes real assertion failures. PR15703 / <rdar://problem/12350701>
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179081 91177308-0d34-0410-b5e6-96231b3b80d8
      a5796f87
  29. Feb 20, 2013
  30. Feb 05, 2013
  31. Dec 04, 2012
  32. Aug 22, 2012
  33. Jun 23, 2012
  34. Jun 07, 2012
  35. May 24, 2012
  36. May 03, 2012
Loading