PetScan::extract(Decl *): check that declaration is a variable declaration
commit1e7018d0b1b541641c477ea8c2c44e769b6b33a2
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 13 Jan 2016 21:18:51 +0000 (13 22:18 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 15 Jan 2016 07:27:05 +0000 (15 08:27 +0100)
treee32570d82f973c5eff5249cb3aa78035fec2b67a
parent01ac46581c44c00c1b75ebc0d94fe89f934afd9f
PetScan::extract(Decl *): check that declaration is a variable declaration

The method assumes that its argument is a variable declaration, without
checking that this is really the case.
In fact, the method may get called on other kinds of declarations.
In particular, if the type of a variable is declared together with
that variable, then this type declaration appears as a separate
declaration in the corresponding DeclStmt.

Check that the argument is indeed a variable declaration and fail if it is not.
This means that the kind of variable declaration described above is
currently not allowed.

Reported-by: Michael Kruse <MichaelKruse@meinersbur.de>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
scan.cc
scan.h
tests/autodetect/decl3.c [new file with mode: 0644]
tests/autodetect/decl3.scop [new file with mode: 0644]