[PATCH] D30157: [analyzer] Improve valist check

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 19 10:54:55 PST 2017


xazax.hun created this revision.

This patch makes the valist check more robust to the different kind of ASTs that are generated on different platforms:

Generated on x86_64-pc-linux-gnu:

  |-TypedefDecl 0x1d07a40 <<invalid sloc>> <invalid sloc> implicit __builtin_ms_va_list 'char *'
  | `-PointerType 0x1d07a00 'char *'
  |   `-BuiltinType 0x1d071b0 'char'
  
  |-TypedefDecl 0x1d07d08 <<invalid sloc>> <invalid sloc> implicit referenced __builtin_va_list 'struct __va_list_tag [1]'
  | `-ConstantArrayType 0x1d07cb0 'struct __va_list_tag [1]' 1 
  |   `-RecordType 0x1d07b20 'struct __va_list_tag'
  |     `-Record 0x1d07a90 '__va_list_tag'

Generated on hexagon-unknown-linux:

  -TypedefDecl 0x6c47e0 <<invalid sloc>> <invalid sloc> implicit referenced __builtin_va_list 'char *'
  | `-PointerType 0x6c47a0 'char *'
  |   `-BuiltinType 0x6c4020 'char'
  
  |-TypedefDecl 0x6c4860 </home/xazax/C++Modelling/llvm/tools/clang/test/Analysis/Inputs/system-header-simulator-for-valist.h:13:1, col:27> col:27 referenced va_list '__builtin_va_list':'char *'
  | `-TypedefType 0x6c4830 '__builtin_va_list' sugar
  |   |-Typedef 0x6c47e0 '__builtin_va_list'
  |   `-PointerType 0x6c47a0 'char *'
  |     `-BuiltinType 0x6c4020 'char'

This patch also manages to fix one of the FIXMEs in the tests.

Note that, some tests are only there for x86_64-pc-linux-gnu. The reason is that, the analyzer manages to notice the uninitializedness of va_list on hexagon-unknown-linux, so it generates a sink node before this check could be triggered.


https://reviews.llvm.org/D30157

Files:
  lib/StaticAnalyzer/Checkers/ValistChecker.cpp
  test/Analysis/valist-uninitialized-no-undef.c
  test/Analysis/valist-uninitialized.c
  test/Analysis/valist-unterminated.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30157.89070.patch
Type: text/x-patch
Size: 12924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170219/0083d0fd/attachment-0001.bin>


More information about the cfe-commits mailing list