adlint 2.6.14 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +1 -3
- data/ChangeLog +511 -0
- data/INSTALL +1 -1
- data/MANIFEST +57 -37
- data/NEWS +36 -7
- data/README +2 -2
- data/Rakefile +6 -6
- data/TODO +1 -1
- data/bin/adlint +25 -16
- data/bin/adlint_chk +22 -12
- data/bin/adlint_cma +17 -12
- data/bin/adlint_sma +22 -12
- data/bin/adlintize +98 -17
- data/etc/conf.d/fallback/cinit.erb +1 -1
- data/etc/conf.d/fallback/traits.erb +37 -37
- data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +1 -1
- data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +41 -41
- data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +1 -1
- data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +40 -40
- data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +1 -1
- data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +40 -40
- data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +1 -1
- data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +40 -40
- data/etc/conf.d/noarch/GNUmakefile.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_sh.erb +1 -1
- data/etc/conf.d/noarch/pinit.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +42 -42
- data/etc/mesg.d/c_builtin/en_US/messages.yml +33 -33
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +5 -5
- data/etc/mesg.d/core/en_US/messages.yml +2 -2
- data/etc/mesg.d/core/ja_JP/messages.yml +2 -2
- data/features/code_check/W0018.feature +197 -0
- data/features/code_check/W0019.feature +79 -0
- data/features/code_check/W0021.feature +81 -0
- data/features/code_check/W0023.feature +203 -0
- data/features/code_check/W0024.feature +226 -0
- data/features/code_check/W0025.feature +5 -0
- data/features/code_check/W0088.feature +2 -2
- data/features/code_check/W0109.feature +2 -2
- data/features/code_check/W0477.feature +0 -3
- data/features/code_check/W0478.feature +0 -1
- data/features/code_check/W0582.feature +3 -3
- data/features/code_check/W0583.feature +4 -7
- data/features/code_check/W0646.feature +0 -1
- data/features/code_check/W0695.feature +0 -1
- data/features/code_check/W0705.feature +8 -0
- data/features/code_check/W0723.feature +0 -1
- data/features/code_check/W0745.feature +1 -0
- data/features/code_check/W0781.feature +1 -0
- data/features/code_check/W1057.feature +141 -0
- data/features/code_check/W1058.feature +93 -0
- data/features/code_check/W1059.feature +86 -0
- data/features/code_check/W1060.feature +77 -0
- data/features/code_check/W1061.feature +143 -0
- data/features/code_check/W1062.feature +162 -0
- data/features/code_check/W1063.feature +123 -0
- data/features/code_check/W1064.feature +83 -0
- data/features/code_check/W1065.feature +82 -0
- data/features/code_check/W9003.feature +2 -0
- data/features/step_definitions/code_check_steps.rb +1 -0
- data/features/support/env.rb +16 -13
- data/lib/adlint.rb +7 -4
- data/lib/adlint/analyzer.rb +131 -157
- data/lib/adlint/annot.rb +149 -0
- data/lib/adlint/cc1.rb +57 -0
- data/lib/adlint/{c → cc1}/branch.rb +74 -62
- data/lib/adlint/{c → cc1}/builtin.rb +21 -21
- data/lib/adlint/{c → cc1}/const.rb +119 -117
- data/lib/adlint/{c → cc1}/conv.rb +76 -78
- data/lib/adlint/{c → cc1}/ctrlexpr.rb +69 -86
- data/lib/adlint/cc1/domain.rb +8103 -0
- data/lib/adlint/{c → cc1}/enum.rb +3 -3
- data/lib/adlint/{c → cc1}/environ.rb +21 -21
- data/lib/adlint/{c → cc1}/expr.rb +232 -218
- data/lib/adlint/{c → cc1}/format.rb +305 -342
- data/lib/adlint/{c → cc1}/interp.rb +269 -220
- data/lib/adlint/cc1/lexer.rb +246 -0
- data/lib/adlint/{c → cc1}/mediator.rb +78 -84
- data/lib/adlint/{c → cc1}/object.rb +261 -264
- data/lib/adlint/{c → cc1}/operator.rb +7 -7
- data/lib/adlint/{c → cc1}/option.rb +4 -3
- data/lib/adlint/{c → cc1}/parser.rb +274 -506
- data/lib/adlint/{c → cc1}/parser.y +69 -301
- data/lib/adlint/cc1/phase.rb +138 -0
- data/lib/adlint/{c → cc1}/resolver.rb +66 -78
- data/lib/adlint/{c → cc1}/scanner.rb +57 -49
- data/lib/adlint/{c → cc1}/scope.rb +3 -3
- data/lib/adlint/{c → cc1}/seqp.rb +13 -5
- data/lib/adlint/{c → cc1}/syntax.rb +819 -1122
- data/lib/adlint/{c → cc1}/type.rb +1498 -1479
- data/lib/adlint/{c → cc1}/util.rb +20 -12
- data/lib/adlint/{c → cc1}/value.rb +699 -642
- data/lib/adlint/code.rb +163 -164
- data/lib/adlint/cpp.rb +2 -2
- data/lib/adlint/cpp/asm.rb +13 -14
- data/lib/adlint/cpp/constexpr.rb +42 -38
- data/lib/adlint/cpp/constexpr.y +44 -40
- data/lib/adlint/cpp/eval.rb +435 -435
- data/lib/adlint/cpp/lexer.rb +343 -340
- data/lib/adlint/cpp/macro.rb +188 -190
- data/lib/adlint/cpp/phase.rb +66 -45
- data/lib/adlint/cpp/scanner.rb +14 -17
- data/lib/adlint/cpp/source.rb +49 -55
- data/lib/adlint/cpp/subst.rb +65 -65
- data/lib/adlint/cpp/syntax.rb +155 -275
- data/lib/adlint/cpp/util.rb +22 -19
- data/lib/adlint/driver.rb +86 -93
- data/lib/adlint/error.rb +33 -52
- data/lib/adlint/exam.rb +158 -24
- data/lib/adlint/exam/c_builtin.rb +7 -7
- data/lib/adlint/exam/c_builtin/cc1_check.rb +20522 -0
- data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +957 -0
- data/lib/adlint/exam/c_builtin/cc1_code.rb +459 -0
- data/lib/adlint/exam/c_builtin/cc1_metric.rb +794 -0
- data/lib/adlint/exam/c_builtin/cpp_check.rb +486 -441
- data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +36 -39
- data/lib/adlint/exam/c_builtin/cpp_code.rb +63 -65
- data/lib/adlint/exam/c_builtin/ld_check.rb +136 -129
- data/lib/adlint/exam/c_builtin/ld_metric.rb +11 -11
- data/lib/adlint/lang.rb +25 -25
- data/lib/adlint/ld.rb +2 -2
- data/lib/adlint/ld/object.rb +220 -188
- data/lib/adlint/ld/phase.rb +94 -63
- data/lib/adlint/ld/typedef.rb +22 -11
- data/lib/adlint/ld/util.rb +43 -35
- data/lib/adlint/lexer.rb +59 -56
- data/lib/adlint/location.rb +140 -0
- data/lib/adlint/memo.rb +157 -0
- data/lib/adlint/message.rb +207 -156
- data/lib/adlint/metric.rb +139 -217
- data/lib/adlint/monitor.rb +45 -43
- data/lib/adlint/phase.rb +56 -29
- data/lib/adlint/prelude.rb +66 -54
- data/lib/adlint/report.rb +253 -332
- data/lib/adlint/source.rb +26 -27
- data/lib/adlint/supp.rb +131 -0
- data/lib/adlint/symbol.rb +14 -16
- data/lib/adlint/token.rb +19 -91
- data/lib/adlint/traits.rb +242 -226
- data/lib/adlint/util.rb +116 -205
- data/lib/adlint/version.rb +8 -8
- data/share/HEADER +2 -2
- data/share/doc/developers_guide_ja.html +148 -19
- data/share/doc/developers_guide_ja.texi +141 -11
- data/share/doc/samples/GNUmakefile +1 -1
- data/share/doc/samples/adlint_traits.yml +45 -36
- data/share/doc/users_guide_en.html +1321 -1252
- data/share/doc/users_guide_en.texi +475 -408
- data/share/doc/users_guide_ja.html +1932 -1878
- data/share/doc/users_guide_ja.texi +324 -273
- data/share/sample/bison-2.5/adlint/GNUmakefile +5 -1
- data/share/sample/bison-2.5/adlint/adlint_traits.yml +38 -38
- data/share/sample/bison-2.5/adlint/lib/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +50 -42
- data/share/sample/bison-2.5/adlint/src/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +50 -42
- data/share/sample/ctags-5.8/adlint/GNUmakefile +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_cinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_pinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_traits.yml +50 -42
- data/share/sample/flex-2.5.35/adlint/GNUmakefile +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +46 -38
- data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +50 -42
- data/share/sample/screen-4.0.3/adlint/GNUmakefile +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/vim/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +49 -41
- data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +46 -38
- data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +50 -42
- data/spec/adlint/{c → cc1}/ctrlexpr_spec.rb +51 -49
- data/spec/adlint/{c → cc1}/domain_spec.rb +210 -179
- data/spec/adlint/{c → cc1}/operator_spec.rb +3 -3
- data/spec/adlint/{c → cc1}/syntax_spec.rb +10 -12
- data/spec/adlint/{c → cc1}/type_spec.rb +61 -68
- data/{lib/adlint/c.rb → spec/adlint/location_spec.rb} +24 -29
- data/spec/conf.d/default_traits.yml +38 -37
- data/spec/conf.d/empty_cinit.h +1 -1
- data/spec/conf.d/empty_pinit.h +1 -1
- data/spec/conf.d/project/foo.c +0 -0
- data/spec/spec_helper.rb +2 -2
- metadata +60 -40
- data/lib/adlint/c/domain.rb +0 -7931
- data/lib/adlint/c/lexer.rb +0 -252
- data/lib/adlint/c/phase.rb +0 -135
- data/lib/adlint/exam/c_builtin/c_check.rb +0 -20745
- data/lib/adlint/exam/c_builtin/c_check_shima.rb +0 -983
- data/lib/adlint/exam/c_builtin/c_code.rb +0 -477
- data/lib/adlint/exam/c_builtin/c_metric.rb +0 -818
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Metric measurements (ld-phase) of adlint-exam-c_builtin package.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
5
5
|
# License:: GPLv3+: GNU General Public License version 3 or later
|
|
6
6
|
#
|
|
7
7
|
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
12
12
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
13
13
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
14
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
|
@@ -40,20 +40,20 @@ module CBuiltin #:nodoc:
|
|
|
40
40
|
class FN_CALL < MetricMeasurement
|
|
41
41
|
def_registrant_phase Ld::PreparePhase
|
|
42
42
|
|
|
43
|
-
def initialize(
|
|
43
|
+
def initialize(phase_ctxt)
|
|
44
44
|
super
|
|
45
|
-
@
|
|
46
|
-
@
|
|
45
|
+
@phase_ctxt = phase_ctxt
|
|
46
|
+
@phase_ctxt[:ld_function_traversal].on_definition += T(:measure)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
private
|
|
50
|
-
def do_prepare(
|
|
51
|
-
def do_execute(
|
|
50
|
+
def do_prepare(*) end
|
|
51
|
+
def do_execute(*) end
|
|
52
52
|
|
|
53
|
-
def measure(
|
|
54
|
-
call_graph = @
|
|
55
|
-
FN_CALL(
|
|
56
|
-
|
|
53
|
+
def measure(fun)
|
|
54
|
+
call_graph = @phase_ctxt[:ld_function_call_graph]
|
|
55
|
+
FN_CALL(FunctionId.new(fun.name, fun.signature),
|
|
56
|
+
fun.location, call_graph.all_callers_of(fun).size)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
data/lib/adlint/lang.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Programming language detection mechanism.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
5
5
|
# License:: GPLv3+: GNU General Public License version 3 or later
|
|
6
6
|
#
|
|
7
7
|
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
12
12
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
13
13
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
14
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
|
|
32
32
|
require "adlint/cpp/scanner"
|
|
33
33
|
require "adlint/cpp/phase"
|
|
34
|
-
require "adlint/
|
|
35
|
-
require "adlint/
|
|
34
|
+
require "adlint/cc1/scanner"
|
|
35
|
+
require "adlint/cc1/phase"
|
|
36
36
|
|
|
37
37
|
module AdLint #:nodoc:
|
|
38
38
|
|
|
@@ -53,7 +53,7 @@ module AdLint #:nodoc:
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
class Cpp
|
|
56
|
-
extend AdLint::Cpp::Scanner
|
|
56
|
+
extend ::AdLint::Cpp::Scanner
|
|
57
57
|
|
|
58
58
|
class << self
|
|
59
59
|
def single_module_phases; [] end
|
|
@@ -62,35 +62,35 @@ module AdLint #:nodoc:
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
class C
|
|
65
|
-
include
|
|
66
|
-
extend
|
|
65
|
+
include Cc1::ScannerConstants
|
|
66
|
+
extend Cc1::Scanner
|
|
67
67
|
|
|
68
68
|
class << self
|
|
69
69
|
def single_module_phases
|
|
70
70
|
[
|
|
71
|
-
AdLint::Cpp::Prepare1Phase,
|
|
72
|
-
AdLint::Cpp::Prepare2Phase,
|
|
73
|
-
AdLint::Cpp::EvalPhase,
|
|
74
|
-
AdLint::Cpp::SubstPhase,
|
|
75
|
-
AdLint::
|
|
76
|
-
AdLint::
|
|
77
|
-
AdLint::
|
|
78
|
-
AdLint::
|
|
79
|
-
AdLint::
|
|
80
|
-
AdLint::Cpp::ReviewPhase,
|
|
81
|
-
AdLint::
|
|
82
|
-
AdLint::Cpp::ExaminationPhase,
|
|
83
|
-
AdLint::
|
|
71
|
+
::AdLint::Cpp::Prepare1Phase,
|
|
72
|
+
::AdLint::Cpp::Prepare2Phase,
|
|
73
|
+
::AdLint::Cpp::EvalPhase,
|
|
74
|
+
::AdLint::Cpp::SubstPhase,
|
|
75
|
+
::AdLint::Cc1::Prepare1Phase,
|
|
76
|
+
::AdLint::Cc1::ParsePhase,
|
|
77
|
+
::AdLint::Cc1::ResolvePhase,
|
|
78
|
+
::AdLint::Cc1::Prepare2Phase,
|
|
79
|
+
::AdLint::Cc1::InterpPhase,
|
|
80
|
+
::AdLint::Cpp::ReviewPhase,
|
|
81
|
+
::AdLint::Cc1::ReviewPhase,
|
|
82
|
+
::AdLint::Cpp::ExaminationPhase,
|
|
83
|
+
::AdLint::Cc1::ExaminationPhase
|
|
84
84
|
].freeze
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def check_phases
|
|
88
88
|
[
|
|
89
|
-
AdLint::Cpp::Prepare1Phase,
|
|
90
|
-
AdLint::Cpp::EvalPhase,
|
|
91
|
-
AdLint::Cpp::SubstPhase,
|
|
92
|
-
AdLint::
|
|
93
|
-
AdLint::
|
|
89
|
+
::AdLint::Cpp::Prepare1Phase,
|
|
90
|
+
::AdLint::Cpp::EvalPhase,
|
|
91
|
+
::AdLint::Cpp::SubstPhase,
|
|
92
|
+
::AdLint::Cc1::Prepare1Phase,
|
|
93
|
+
::AdLint::Cc1::ParsePhase
|
|
94
94
|
].freeze
|
|
95
95
|
end
|
|
96
96
|
end
|
data/lib/adlint/ld.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# AdLint::Ld package loader.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
5
5
|
# License:: GPLv3+: GNU General Public License version 3 or later
|
|
6
6
|
#
|
|
7
7
|
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
12
12
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
13
13
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
14
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
data/lib/adlint/ld/object.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# C runtime object models for cross module analysis.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
5
5
|
# License:: GPLv3+: GNU General Public License version 3 or later
|
|
6
6
|
#
|
|
7
7
|
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
12
12
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
13
13
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
14
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
#
|
|
30
30
|
#++
|
|
31
31
|
|
|
32
|
+
require "adlint/location"
|
|
32
33
|
require "adlint/metric"
|
|
33
34
|
require "adlint/util"
|
|
34
35
|
|
|
@@ -36,24 +37,26 @@ module AdLint #:nodoc:
|
|
|
36
37
|
module Ld #:nodoc:
|
|
37
38
|
|
|
38
39
|
class Variable
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
include LocationHolder
|
|
41
|
+
|
|
42
|
+
def initialize(var_def_rec)
|
|
43
|
+
@met_record = var_def_rec
|
|
41
44
|
end
|
|
42
45
|
|
|
43
46
|
def location
|
|
44
|
-
@
|
|
47
|
+
@met_record.location
|
|
45
48
|
end
|
|
46
49
|
|
|
47
50
|
def name
|
|
48
|
-
@
|
|
51
|
+
@met_record.variable_name
|
|
49
52
|
end
|
|
50
53
|
|
|
51
54
|
def type
|
|
52
|
-
@
|
|
55
|
+
@met_record.type_rep
|
|
53
56
|
end
|
|
54
57
|
|
|
55
58
|
def extern?
|
|
56
|
-
@
|
|
59
|
+
@met_record.variable_linkage_type == "X"
|
|
57
60
|
end
|
|
58
61
|
|
|
59
62
|
def eql?(rhs)
|
|
@@ -68,20 +71,22 @@ module Ld #:nodoc:
|
|
|
68
71
|
end
|
|
69
72
|
|
|
70
73
|
class VariableDeclaration
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
include LocationHolder
|
|
75
|
+
|
|
76
|
+
def initialize(gvar_dcl_rec)
|
|
77
|
+
@met_record = gvar_dcl_rec
|
|
73
78
|
end
|
|
74
79
|
|
|
75
80
|
def location
|
|
76
|
-
@
|
|
81
|
+
@met_record.location
|
|
77
82
|
end
|
|
78
83
|
|
|
79
84
|
def name
|
|
80
|
-
@
|
|
85
|
+
@met_record.variable_name
|
|
81
86
|
end
|
|
82
87
|
|
|
83
88
|
def type
|
|
84
|
-
@
|
|
89
|
+
@met_record.type_rep
|
|
85
90
|
end
|
|
86
91
|
|
|
87
92
|
def extern?
|
|
@@ -101,36 +106,37 @@ module Ld #:nodoc:
|
|
|
101
106
|
|
|
102
107
|
class VariableMapping
|
|
103
108
|
def initialize
|
|
104
|
-
@
|
|
105
|
-
@
|
|
109
|
+
@def_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
110
|
+
@dcl_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
111
|
+
@composing_fpaths = Set.new
|
|
106
112
|
end
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
attr_reader :composing_fpaths
|
|
115
|
+
|
|
116
|
+
def add_variable(var)
|
|
117
|
+
@def_index[var.name].add(var)
|
|
118
|
+
@composing_fpaths.add(var.location.fpath)
|
|
110
119
|
end
|
|
111
120
|
|
|
112
|
-
def add_variable_declaration(
|
|
113
|
-
@
|
|
121
|
+
def add_variable_declaration(var_dcl)
|
|
122
|
+
@dcl_index[var_dcl.name].add(var_dcl)
|
|
123
|
+
@composing_fpaths.add(var_dcl.location.fpath)
|
|
114
124
|
end
|
|
115
125
|
|
|
116
126
|
def all_variables
|
|
117
|
-
@
|
|
118
|
-
all + variables
|
|
119
|
-
}.to_a
|
|
127
|
+
@def_index.values.reduce(Set.new) { |all, vars| all + vars }.to_a
|
|
120
128
|
end
|
|
121
129
|
|
|
122
130
|
def all_variable_declarations
|
|
123
|
-
@
|
|
124
|
-
all + declarations
|
|
125
|
-
}.to_a
|
|
131
|
+
@dcl_index.values.reduce(Set.new) { |all, dcls| all + dcls }.to_a
|
|
126
132
|
end
|
|
127
133
|
|
|
128
|
-
def lookup_variables(
|
|
129
|
-
@
|
|
134
|
+
def lookup_variables(var_name)
|
|
135
|
+
@def_index[var_name].to_a
|
|
130
136
|
end
|
|
131
137
|
|
|
132
|
-
def lookup_variable_declarations(
|
|
133
|
-
@
|
|
138
|
+
def lookup_variable_declarations(var_name)
|
|
139
|
+
@dcl_index[var_name].to_a
|
|
134
140
|
end
|
|
135
141
|
end
|
|
136
142
|
|
|
@@ -141,26 +147,31 @@ module Ld #:nodoc:
|
|
|
141
147
|
|
|
142
148
|
attr_reader :result
|
|
143
149
|
|
|
144
|
-
def execute(
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
def execute(met_fpath)
|
|
151
|
+
sma_wd = Pathname.pwd
|
|
152
|
+
CSV.foreach(met_fpath) do |csv_row|
|
|
153
|
+
rec = MetricRecord.of(csv_row, sma_wd)
|
|
147
154
|
case
|
|
148
|
-
when
|
|
149
|
-
|
|
150
|
-
|
|
155
|
+
when rec.version?
|
|
156
|
+
sma_wd = Pathname.new(rec.exec_working_directory)
|
|
157
|
+
when rec.variable_definition?
|
|
158
|
+
if rec.variable_linkage_type == "X"
|
|
159
|
+
@result.add_variable(Variable.new(rec))
|
|
151
160
|
end
|
|
152
|
-
when
|
|
153
|
-
@result.add_variable_declaration(VariableDeclaration.new(
|
|
161
|
+
when rec.global_variable_declaration?
|
|
162
|
+
@result.add_variable_declaration(VariableDeclaration.new(rec))
|
|
154
163
|
end
|
|
155
164
|
end
|
|
156
165
|
end
|
|
157
166
|
end
|
|
158
167
|
|
|
159
168
|
class VariableReference
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
@
|
|
169
|
+
include LocationHolder
|
|
170
|
+
|
|
171
|
+
def initialize(fun, var, loc)
|
|
172
|
+
@function = fun
|
|
173
|
+
@variable = var
|
|
174
|
+
@location = loc
|
|
164
175
|
end
|
|
165
176
|
|
|
166
177
|
attr_reader :function
|
|
@@ -168,70 +179,71 @@ module Ld #:nodoc:
|
|
|
168
179
|
attr_reader :location
|
|
169
180
|
|
|
170
181
|
def eql?(rhs)
|
|
171
|
-
|
|
172
|
-
@location == rhs.location
|
|
182
|
+
to_a == rhs.to_a
|
|
173
183
|
end
|
|
174
184
|
|
|
175
185
|
alias :== :eql?
|
|
176
186
|
|
|
177
187
|
def hash
|
|
178
|
-
|
|
188
|
+
to_a.hash
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def to_a
|
|
192
|
+
[@function, @variable, @location]
|
|
179
193
|
end
|
|
180
194
|
end
|
|
181
195
|
|
|
182
196
|
class VariableReferenceGraph
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
@
|
|
187
|
-
@referrer_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
188
|
-
@variable_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
197
|
+
def initialize(funcall_graph)
|
|
198
|
+
@funcall_graph = funcall_graph
|
|
199
|
+
@ref_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
200
|
+
@var_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
189
201
|
end
|
|
190
202
|
|
|
191
|
-
def add(
|
|
192
|
-
@
|
|
193
|
-
@
|
|
203
|
+
def add(var_ref)
|
|
204
|
+
@ref_index[var_ref.function].add(var_ref)
|
|
205
|
+
@var_index[var_ref.variable].add(var_ref)
|
|
194
206
|
end
|
|
195
207
|
|
|
196
|
-
def all_referrers_of(
|
|
197
|
-
direct_referrers_of(
|
|
208
|
+
def all_referrers_of(var)
|
|
209
|
+
direct_referrers_of(var) + indirect_referrers_of(var)
|
|
198
210
|
end
|
|
199
211
|
|
|
200
|
-
def direct_referrers_of(
|
|
201
|
-
@
|
|
212
|
+
def direct_referrers_of(var)
|
|
213
|
+
@var_index[var].map { |var_ref| var_ref.function }.to_set
|
|
202
214
|
end
|
|
203
215
|
|
|
204
|
-
def indirect_referrers_of(
|
|
205
|
-
direct_referrers = direct_referrers_of(
|
|
206
|
-
direct_referrers.reduce(Set.new) do |result,
|
|
207
|
-
result + @
|
|
216
|
+
def indirect_referrers_of(var)
|
|
217
|
+
direct_referrers = direct_referrers_of(var)
|
|
218
|
+
direct_referrers.reduce(Set.new) do |result, fun|
|
|
219
|
+
result + @funcall_graph.all_callers_of(fun)
|
|
208
220
|
end
|
|
209
221
|
end
|
|
210
222
|
end
|
|
211
223
|
|
|
212
224
|
class VariableReferenceGraphBuilder
|
|
213
|
-
def initialize(
|
|
214
|
-
@variable_mapping =
|
|
215
|
-
@function_mapping =
|
|
216
|
-
@result = VariableReferenceGraph.new(
|
|
225
|
+
def initialize(var_mapping, fun_mapping, funcall_graph)
|
|
226
|
+
@variable_mapping = var_mapping
|
|
227
|
+
@function_mapping = fun_mapping
|
|
228
|
+
@result = VariableReferenceGraph.new(funcall_graph)
|
|
217
229
|
end
|
|
218
230
|
|
|
219
231
|
attr_reader :result
|
|
220
232
|
|
|
221
|
-
def execute(
|
|
222
|
-
|
|
223
|
-
|
|
233
|
+
def execute(met_fpath)
|
|
234
|
+
sma_wd = Pathname.pwd
|
|
235
|
+
CSV.foreach(met_fpath) do |csv_row|
|
|
236
|
+
rec = MetricRecord.of(csv_row, sma_wd)
|
|
224
237
|
case
|
|
225
|
-
when
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if
|
|
233
|
-
@result.add(VariableReference.new(
|
|
234
|
-
function, variable, record.location))
|
|
238
|
+
when rec.version?
|
|
239
|
+
sma_wd = Pathname.new(rec.exec_working_directory)
|
|
240
|
+
when rec.variable_xref?
|
|
241
|
+
fun = @function_mapping.lookup_functions(
|
|
242
|
+
rec.accessor_function.name).first
|
|
243
|
+
var = @variable_mapping.lookup_variables(rec.accessee_variable).first
|
|
244
|
+
|
|
245
|
+
if fun && var
|
|
246
|
+
@result.add(VariableReference.new(fun, var, rec.location))
|
|
235
247
|
end
|
|
236
248
|
end
|
|
237
249
|
end
|
|
@@ -239,8 +251,8 @@ module Ld #:nodoc:
|
|
|
239
251
|
end
|
|
240
252
|
|
|
241
253
|
class VariableTraversal
|
|
242
|
-
def initialize(
|
|
243
|
-
@variable_mapping =
|
|
254
|
+
def initialize(var_mapping)
|
|
255
|
+
@variable_mapping = var_mapping
|
|
244
256
|
end
|
|
245
257
|
|
|
246
258
|
extend Pluggable
|
|
@@ -249,35 +261,37 @@ module Ld #:nodoc:
|
|
|
249
261
|
def_plugin :on_definition
|
|
250
262
|
|
|
251
263
|
def execute
|
|
252
|
-
@variable_mapping.all_variable_declarations.each do |
|
|
253
|
-
on_declaration.invoke(
|
|
264
|
+
@variable_mapping.all_variable_declarations.each do |var_dcl|
|
|
265
|
+
on_declaration.invoke(var_dcl)
|
|
254
266
|
end
|
|
255
267
|
|
|
256
|
-
@variable_mapping.all_variables.each do |
|
|
257
|
-
on_definition.invoke(
|
|
268
|
+
@variable_mapping.all_variables.each do |var_def|
|
|
269
|
+
on_definition.invoke(var_def)
|
|
258
270
|
end
|
|
259
271
|
end
|
|
260
272
|
end
|
|
261
273
|
|
|
262
274
|
class Function
|
|
263
|
-
|
|
264
|
-
|
|
275
|
+
include LocationHolder
|
|
276
|
+
|
|
277
|
+
def initialize(fun_def_rec)
|
|
278
|
+
@met_record = fun_def_rec
|
|
265
279
|
end
|
|
266
280
|
|
|
267
281
|
def location
|
|
268
|
-
@
|
|
282
|
+
@met_record.location
|
|
269
283
|
end
|
|
270
284
|
|
|
271
285
|
def signature
|
|
272
|
-
@
|
|
286
|
+
@met_record.function_id.signature
|
|
273
287
|
end
|
|
274
288
|
|
|
275
289
|
def name
|
|
276
|
-
@
|
|
290
|
+
@met_record.function_id.name
|
|
277
291
|
end
|
|
278
292
|
|
|
279
293
|
def extern?
|
|
280
|
-
@
|
|
294
|
+
@met_record.function_linkage_type == "X"
|
|
281
295
|
end
|
|
282
296
|
|
|
283
297
|
def eql?(rhs)
|
|
@@ -292,24 +306,34 @@ module Ld #:nodoc:
|
|
|
292
306
|
end
|
|
293
307
|
|
|
294
308
|
class FunctionDeclaration
|
|
295
|
-
|
|
296
|
-
|
|
309
|
+
include LocationHolder
|
|
310
|
+
|
|
311
|
+
def initialize(fun_dcl_rec)
|
|
312
|
+
@met_record = fun_dcl_rec
|
|
297
313
|
end
|
|
298
314
|
|
|
299
315
|
def location
|
|
300
|
-
@
|
|
316
|
+
@met_record.location
|
|
301
317
|
end
|
|
302
318
|
|
|
303
319
|
def signature
|
|
304
|
-
@
|
|
320
|
+
@met_record.function_id.signature
|
|
305
321
|
end
|
|
306
322
|
|
|
307
323
|
def name
|
|
308
|
-
@
|
|
324
|
+
@met_record.function_id.name
|
|
309
325
|
end
|
|
310
326
|
|
|
311
327
|
def extern?
|
|
312
|
-
@
|
|
328
|
+
@met_record.function_linkage_type == "X"
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def explicit?
|
|
332
|
+
@met_record.function_declaration_type == "E"
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def implicit?
|
|
336
|
+
@met_record.function_declaration_type == "I"
|
|
313
337
|
end
|
|
314
338
|
|
|
315
339
|
def eql?(rhs)
|
|
@@ -325,36 +349,37 @@ module Ld #:nodoc:
|
|
|
325
349
|
|
|
326
350
|
class FunctionMapping
|
|
327
351
|
def initialize
|
|
328
|
-
@
|
|
329
|
-
@
|
|
352
|
+
@def_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
353
|
+
@dcl_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
354
|
+
@composing_fpaths = Set.new
|
|
330
355
|
end
|
|
331
356
|
|
|
332
|
-
|
|
333
|
-
|
|
357
|
+
attr_reader :composing_fpaths
|
|
358
|
+
|
|
359
|
+
def add_function(fun)
|
|
360
|
+
@def_index[fun.name].add(fun)
|
|
361
|
+
@composing_fpaths.add(fun.location.fpath)
|
|
334
362
|
end
|
|
335
363
|
|
|
336
|
-
def add_function_declaration(
|
|
337
|
-
@
|
|
364
|
+
def add_function_declaration(fun_dcl)
|
|
365
|
+
@dcl_index[fun_dcl.name].add(fun_dcl)
|
|
366
|
+
@composing_fpaths.add(fun_dcl.location.fpath)
|
|
338
367
|
end
|
|
339
368
|
|
|
340
369
|
def all_functions
|
|
341
|
-
@
|
|
342
|
-
all + functions
|
|
343
|
-
}.to_a
|
|
370
|
+
@def_index.values.reduce(Set.new) { |all, funs| all + funs }.to_a
|
|
344
371
|
end
|
|
345
372
|
|
|
346
373
|
def all_function_declarations
|
|
347
|
-
@
|
|
348
|
-
all + declarations
|
|
349
|
-
}.to_a
|
|
374
|
+
@dcl_index.values.reduce(Set.new) { |all, dcls| all + dcls }.to_a
|
|
350
375
|
end
|
|
351
376
|
|
|
352
|
-
def lookup_functions(
|
|
353
|
-
@
|
|
377
|
+
def lookup_functions(fun_name)
|
|
378
|
+
@def_index[fun_name].to_a
|
|
354
379
|
end
|
|
355
380
|
|
|
356
|
-
def lookup_function_declarations(
|
|
357
|
-
@
|
|
381
|
+
def lookup_function_declarations(fun_name)
|
|
382
|
+
@dcl_index[fun_name].to_a
|
|
358
383
|
end
|
|
359
384
|
end
|
|
360
385
|
|
|
@@ -365,83 +390,87 @@ module Ld #:nodoc:
|
|
|
365
390
|
|
|
366
391
|
attr_reader :result
|
|
367
392
|
|
|
368
|
-
def execute(
|
|
369
|
-
|
|
370
|
-
|
|
393
|
+
def execute(met_fpath)
|
|
394
|
+
sma_wd = Pathname.pwd
|
|
395
|
+
CSV.foreach(met_fpath) do |csv_row|
|
|
396
|
+
rec = MetricRecord.of(csv_row, sma_wd)
|
|
371
397
|
case
|
|
372
|
-
when
|
|
373
|
-
|
|
374
|
-
when
|
|
375
|
-
@result.
|
|
398
|
+
when rec.version?
|
|
399
|
+
sma_wd = Pathname.new(rec.exec_working_directory)
|
|
400
|
+
when rec.function_definition?
|
|
401
|
+
@result.add_function(Function.new(rec))
|
|
402
|
+
when rec.function_declaration?
|
|
403
|
+
@result.add_function_declaration(FunctionDeclaration.new(rec))
|
|
376
404
|
end
|
|
377
405
|
end
|
|
378
406
|
end
|
|
379
407
|
end
|
|
380
408
|
|
|
381
409
|
class FunctionCall
|
|
382
|
-
def initialize(
|
|
383
|
-
@caller_function =
|
|
384
|
-
@callee_function =
|
|
410
|
+
def initialize(caller_fun, callee_fun)
|
|
411
|
+
@caller_function = caller_fun
|
|
412
|
+
@callee_function = callee_fun
|
|
385
413
|
end
|
|
386
414
|
|
|
387
415
|
attr_reader :caller_function
|
|
388
416
|
attr_reader :callee_function
|
|
389
417
|
|
|
390
418
|
def eql?(rhs)
|
|
391
|
-
|
|
392
|
-
@callee_function == rhs.callee_function
|
|
419
|
+
to_a == rhs.to_a
|
|
393
420
|
end
|
|
394
421
|
|
|
395
422
|
alias :== :eql?
|
|
396
423
|
|
|
397
424
|
def hash
|
|
398
|
-
|
|
425
|
+
to_a.hash
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
def to_a
|
|
429
|
+
[@caller_function, @callee_function]
|
|
399
430
|
end
|
|
400
431
|
end
|
|
401
432
|
|
|
402
433
|
class FunctionCallGraph
|
|
403
|
-
extend Memoizable
|
|
404
|
-
|
|
405
434
|
def initialize
|
|
406
435
|
@caller_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
407
436
|
@callee_index = Hash.new { |hash, key| hash[key] = Set.new }
|
|
408
437
|
end
|
|
409
438
|
|
|
410
|
-
def add(
|
|
411
|
-
@caller_index[
|
|
412
|
-
@callee_index[
|
|
439
|
+
def add(funcall)
|
|
440
|
+
@caller_index[funcall.caller_function].add(funcall)
|
|
441
|
+
@callee_index[funcall.callee_function].add(funcall)
|
|
413
442
|
end
|
|
414
443
|
|
|
415
|
-
def all_callers_of(
|
|
416
|
-
direct_callers_of(
|
|
444
|
+
def all_callers_of(callee_fun)
|
|
445
|
+
direct_callers_of(callee_fun) + indirect_callers_of(callee_fun)
|
|
417
446
|
end
|
|
418
447
|
memoize :all_callers_of
|
|
419
448
|
|
|
420
|
-
def direct_callers_of(
|
|
421
|
-
@callee_index[
|
|
449
|
+
def direct_callers_of(callee_fun)
|
|
450
|
+
@callee_index[callee_fun].map { |funcall|
|
|
422
451
|
funcall.caller_function
|
|
423
452
|
}.to_set
|
|
424
453
|
end
|
|
425
454
|
memoize :direct_callers_of
|
|
426
455
|
|
|
427
|
-
def indirect_callers_of(
|
|
428
|
-
direct_callers = direct_callers_of(
|
|
429
|
-
direct_callers.reduce(Set.new) do |all_callers,
|
|
430
|
-
all_callers + collect_callers_of(
|
|
456
|
+
def indirect_callers_of(callee_fun)
|
|
457
|
+
direct_callers = direct_callers_of(callee_fun)
|
|
458
|
+
direct_callers.reduce(Set.new) do |all_callers, fun|
|
|
459
|
+
all_callers + collect_callers_of(fun, all_callers)
|
|
431
460
|
end
|
|
432
461
|
end
|
|
433
462
|
memoize :indirect_callers_of
|
|
434
463
|
|
|
435
464
|
private
|
|
436
|
-
def collect_callers_of(
|
|
437
|
-
direct_callers = direct_callers_of(
|
|
465
|
+
def collect_callers_of(callee_fun, exclusion_list)
|
|
466
|
+
direct_callers = direct_callers_of(callee_fun)
|
|
438
467
|
|
|
439
|
-
direct_callers.reduce(Set.new) do |all_callers,
|
|
440
|
-
if exclusion_list.include?(
|
|
441
|
-
all_callers.add(
|
|
468
|
+
direct_callers.reduce(Set.new) do |all_callers, fun|
|
|
469
|
+
if exclusion_list.include?(fun)
|
|
470
|
+
all_callers.add(fun)
|
|
442
471
|
else
|
|
443
|
-
all_callers.add(
|
|
444
|
-
collect_callers_of(
|
|
472
|
+
all_callers.add(fun) +
|
|
473
|
+
collect_callers_of(fun, exclusion_list + all_callers)
|
|
445
474
|
end
|
|
446
475
|
end
|
|
447
476
|
end
|
|
@@ -449,77 +478,80 @@ module Ld #:nodoc:
|
|
|
449
478
|
end
|
|
450
479
|
|
|
451
480
|
class FunctionCallGraphBuilder
|
|
452
|
-
def initialize(
|
|
453
|
-
@function_mapping =
|
|
481
|
+
def initialize(fun_mapping)
|
|
482
|
+
@function_mapping = fun_mapping
|
|
454
483
|
@result = FunctionCallGraph.new
|
|
455
484
|
end
|
|
456
485
|
|
|
457
486
|
attr_reader :result
|
|
458
487
|
|
|
459
|
-
def execute(
|
|
460
|
-
|
|
461
|
-
|
|
488
|
+
def execute(met_fpath)
|
|
489
|
+
sma_wd = Pathname.pwd
|
|
490
|
+
CSV.foreach(met_fpath) do |csv_row|
|
|
491
|
+
rec = MetricRecord.of(csv_row, sma_wd)
|
|
462
492
|
case
|
|
463
|
-
when
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
493
|
+
when rec.version?
|
|
494
|
+
sma_wd = Pathname.new(rec.exec_working_directory)
|
|
495
|
+
when rec.function_call?
|
|
496
|
+
caller_fun, callee_fun = lookup_functions_by_call(rec)
|
|
497
|
+
if caller_fun && callee_fun
|
|
498
|
+
@result.add(FunctionCall.new(caller_fun, callee_fun))
|
|
467
499
|
end
|
|
468
|
-
when
|
|
469
|
-
|
|
470
|
-
if
|
|
471
|
-
@result.add(FunctionCall.new(
|
|
500
|
+
when rec.function_xref?
|
|
501
|
+
caller_fun, callee_fun = lookup_functions_by_xref(rec)
|
|
502
|
+
if caller_fun && callee_fun
|
|
503
|
+
@result.add(FunctionCall.new(caller_fun, callee_fun))
|
|
472
504
|
end
|
|
473
505
|
end
|
|
474
506
|
end
|
|
475
507
|
end
|
|
476
508
|
|
|
477
|
-
def lookup_functions_by_call(
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
509
|
+
def lookup_functions_by_call(funcall_rec)
|
|
510
|
+
caller_fun = @function_mapping.lookup_functions(
|
|
511
|
+
funcall_rec.caller_function.name).find { |fun|
|
|
512
|
+
fun.location.fpath == funcall_rec.location.fpath
|
|
481
513
|
}
|
|
482
|
-
return nil, nil unless
|
|
514
|
+
return nil, nil unless caller_fun
|
|
483
515
|
|
|
484
|
-
|
|
485
|
-
|
|
516
|
+
callee_funs = @function_mapping.lookup_functions(
|
|
517
|
+
funcall_rec.callee_function.name)
|
|
486
518
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
if
|
|
490
|
-
|
|
519
|
+
callee_fun = callee_funs.first
|
|
520
|
+
callee_funs.each do |fun|
|
|
521
|
+
if fun.location.fpath == caller_fun.location.fpath
|
|
522
|
+
callee_fun = fun
|
|
491
523
|
break
|
|
492
524
|
end
|
|
493
525
|
end
|
|
494
526
|
|
|
495
|
-
return
|
|
527
|
+
return caller_fun, callee_fun
|
|
496
528
|
end
|
|
497
529
|
|
|
498
|
-
def lookup_functions_by_xref(
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
530
|
+
def lookup_functions_by_xref(fun_xref_rec)
|
|
531
|
+
caller_fun = @function_mapping.lookup_functions(
|
|
532
|
+
fun_xref_rec.accessor_function.name).find { |fun|
|
|
533
|
+
fun.location.fpath == fun_xref_rec.location.fpath
|
|
502
534
|
}
|
|
503
|
-
return nil, nil unless
|
|
535
|
+
return nil, nil unless caller_fun
|
|
504
536
|
|
|
505
|
-
|
|
506
|
-
|
|
537
|
+
callee_funs = @function_mapping.lookup_functions(
|
|
538
|
+
fun_xref_rec.accessee_function.name)
|
|
507
539
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
if
|
|
511
|
-
|
|
540
|
+
callee_fun = callee_funs.first
|
|
541
|
+
callee_funs.each do |fun|
|
|
542
|
+
if fun.location.fpath == caller_fun.location.fpath
|
|
543
|
+
callee_fun = fun
|
|
512
544
|
break
|
|
513
545
|
end
|
|
514
546
|
end
|
|
515
547
|
|
|
516
|
-
return
|
|
548
|
+
return caller_fun, callee_fun
|
|
517
549
|
end
|
|
518
550
|
end
|
|
519
551
|
|
|
520
552
|
class FunctionTraversal
|
|
521
|
-
def initialize(
|
|
522
|
-
@function_mapping =
|
|
553
|
+
def initialize(fun_mapping)
|
|
554
|
+
@function_mapping = fun_mapping
|
|
523
555
|
end
|
|
524
556
|
|
|
525
557
|
extend Pluggable
|
|
@@ -528,12 +560,12 @@ module Ld #:nodoc:
|
|
|
528
560
|
def_plugin :on_definition
|
|
529
561
|
|
|
530
562
|
def execute
|
|
531
|
-
@function_mapping.all_function_declarations.each do |
|
|
532
|
-
on_declaration.invoke(
|
|
563
|
+
@function_mapping.all_function_declarations.each do |fun_dcl|
|
|
564
|
+
on_declaration.invoke(fun_dcl)
|
|
533
565
|
end
|
|
534
566
|
|
|
535
|
-
@function_mapping.all_functions.each do |
|
|
536
|
-
on_definition.invoke(
|
|
567
|
+
@function_mapping.all_functions.each do |fun_def|
|
|
568
|
+
on_definition.invoke(fun_def)
|
|
537
569
|
end
|
|
538
570
|
end
|
|
539
571
|
end
|