[analyzer] Ignore annotations if func is inlined.
authorYu Shan <shanyu@google.com>
Mon, 7 Dec 2020 18:58:44 +0000 (10:58 -0800)
committerHaowei Wu <haowei@google.com>
Mon, 7 Dec 2020 19:28:11 +0000 (11:28 -0800)
commit3ce78f54edcfc881377a9e567715caf2f0be2abc
tree04880a97c8aa26c5e78d600ab17e76de7f7b47ce
parent875b4fd5ee95bedd6ec2bcf8423c159ccecd8443
[analyzer] Ignore annotations if func is inlined.

When we annotating a function header so that it could be used by other
TU, we also need to make sure the function is parsed correctly within
the same TU. So if we can find the function's implementation,
ignore the annotations, otherwise, false positive would occur.
Move the escape by value case to post call and do not escape the handle
if the function is inlined and we have analyzed the handle.

Differential Revision: https://reviews.llvm.org/D91902
clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
clang/test/Analysis/fuchsia_handle.cpp