[all-commits] [llvm/llvm-project] 89da34: [analyzer] Handle [[assume(cond)]] as __builtin_as...

Vinay Deshmukh via All-commits all-commits at lists.llvm.org
Thu Dec 19 04:49:38 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 89da344e5879e5347b5057520d5230e40ae24831
      https://github.com/llvm/llvm-project/commit/89da344e5879e5347b5057520d5230e40ae24831
  Author: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
  Date:   2024-12-19 (Thu, 19 Dec 2024)

  Changed paths:
    M clang/include/clang/AST/AttrIterator.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
    M clang/lib/Analysis/CFG.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
    A clang/test/Analysis/cxx23-assume-attribute.cpp
    M clang/test/Analysis/out-of-bounds-new.cpp

  Log Message:
  -----------
  [analyzer] Handle [[assume(cond)]] as __builtin_assume(cond) (#116462)

Resolves #100762 

Gist of the change:
1. All the symbol analysis, constraint manager and expression parsing
logic was already present, but the previous code didn't "visit" the
expressions within `assume()` by parsing those expressions, all of the
code "just works" by evaluating the SVals, and hence leaning on the same
logic that makes the code with `__builtin_assume` work
2. "Ignore" an expression from adding in CFG if it has side-effects (
similar to CGStmt.cpp (todo add link))
3. Add additional test case for ternary operator handling and modify
CFG.cpp's VisitGuardedExpr code for `continue`-ing if the `ProgramPoint`
is a `StmtPoint`

---------

Co-authored-by: Balazs Benics <benicsbalazs at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list