[LLVMdev] C sequence-point analyzer
Lukas Hellebrandt
kamikazecz at gmail.com
Fri Nov 15 08:46:53 PST 2013
Hi all,
I'm trying to write a tool for detecting undefined behavior in C
regarding sequence points and side effects.
I'm not sure whether it should be a Clang plugin or LLVM run or
something completely different (I'm really new to both Clang and LLVM)
and that's what I need advice with.
For my work, I need to use both AST and alias analysis
Clang plugin:
+relatively easy to use
+access to AST with all the needed info EXCEPT alias analysis (right?)
-no alias analysis, I'd need to write one myself
LLVM run:
+built-in alias analysis (I'd like to use it, writing my own alias
analysis is not really what my work is all about)
-I do NOT have access to AST
-I don't know it at all (but I'm ready to learn it if it shows up to be
the best option)
The big PROBLEM is: a behavior that is undefined in C (and which Clang
has access to) might be (and in my case WILL be) well defined in LLVM
(for example, i=i++; is undefined in C but in LLVM code it will be
already well defined and the result will depend on Clang behavior).
So I thought I could use both, in Clang create a list of rules, for
example "On line L, there is an undefined behavior if X aliases with Y"
and then SOMEHOW dig this info from LLVM run.
Is this a good idea? Is there a way (other than output to file from
Clang and then read it in LLVM) to give this set of rules to LLVM? I'd
also be glad for any other idea, not necessarily including LLVM and
Clang, to solve this problem.
Thanks in advance!
--
*****************************
Lukas Hellebrandt
kamikazecz at gmail.com
*****************************
More information about the llvm-dev
mailing list