Omit arguments of __builtin_object_size from the CFG.
authorJordan Rose <jordan_rose@apple.com>
Mon, 19 Aug 2013 16:27:28 +0000 (16:27 +0000)
committerJordan Rose <jordan_rose@apple.com>
Mon, 19 Aug 2013 16:27:28 +0000 (16:27 +0000)
commit5374c07ab92e2c78ccf43186383fc5e33835ebb8
treef6a8bd1a7cf6167901f4c16101a13d66b0ebaf0b
parentab458a13b0c6ef8cc558e8c1975c399de1220444
Omit arguments of __builtin_object_size from the CFG.

This builtin does not actually evaluate its arguments for side effects,
so we shouldn't include them in the CFG. In the analyzer, rely on the
constant expression evaluator to get the proper semantics, at least for
now. (In the future, we could get ambitious and try to provide path-
sensitive size values.)

In theory, this does pose a problem for liveness analysis: a variable can
be used within the __builtin_object_size argument expression but not show
up as live. However, it is very unlikely that such a value would be used
to compute the object size and not used to access the object in some way.

<rdar://problem/14760817>

llvm-svn: 188679
clang/lib/Analysis/CFG.cpp
clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
clang/test/Analysis/builtin-functions.cpp
clang/test/Analysis/cfg.cpp