[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

Endre Fülöp via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 01:12:28 PST 2020


gamesh411 added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:697-699
+      // The behavior is undefined if the value of the argument is not
+      // representable as unsigned char or is not equal to EOF. See e.g. C99
+      // 7.4.1.2 The isalpha function (p: 181-182).
----------------
martong wrote:
> Szelethus wrote:
> > This is true for the rest of the summaries as well, but shouldn't we retrieve the `unsigned char` size from `ASTContext`?
> Yes this is a good idea. I will do this.
> 
> What bothers me really much, however, is that we should handle EOF in a platform dependent way as well ... and I have absolutely no idea how to do that given that is defined by a macro in a platform specific header file. I am desperately in need for help and ideas about how could we get the value of EOF for the analysed platform.
If the EOF is not used in the TU analyzed, then there would be no way to find the specific `#define`.
Another approach would be to check if the value is defined by an expression that is the EOF define (maybe transitively?).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73898





More information about the cfe-commits mailing list