[PATCH] D135247: [clang][analyzer] Add stream functions to StdLibraryFunctionsChecker.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 19 00:26:59 PDT 2022


balazske added a comment.

If `StdCLibraryFunctionsChecker` is added as dependency to `StreamChecker` and no other thing is changed these tests fail, and I could not find out the reason:
Errors in test **stream.c**:

  error: 'warning' diagnostics expected but not seen: 
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream.c Line 7: Stream pointer might be NULL
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream.c Line 13: Stream pointer might be NULL
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream.c Line 76: Stream pointer might be NULL

Errors in test **stream-error.c**:

  error: 'warning' diagnostics expected but not seen: 
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 97: might be 'indeterminate'
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 100: Stream might be already closed
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 113: Read function called when stream is in EOF state
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 114: Read function called when stream is in EOF state
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 123: FALSE
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 124: FALSE
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 128: FALSE
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 129: TRUE
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 133: TRUE
    File /local/clang/llvm2/llvm-project/clang/test/Analysis/stream-error.c Line 134: FALSE

Probably the `StdLibraryFunctionsChecker` runs before the `StreamChecker`, and runs always after it if no dependency is there? But this does not explain all test errors and should cause no errors at all. Adding the dependency itself is not enough, `ModelPOSIX` option should be true too. If the option is set to true in the test file even more test errors appear, and it does not work even when the (StdLibraryFunctionsChecker) checker is added (to the RUN command). Without the dependency the tests do not fail if the order of checkers in the enabled checkers list is changed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135247/new/

https://reviews.llvm.org/D135247



More information about the cfe-commits mailing list