diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-10-10 17:55:40 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-10-10 17:55:40 +0000 |
commit | d8665b3d1ae65ed6f603e4cf7ff7137c6ac3242c (patch) | |
tree | 14f20e2fd2a16f83513e9c52911c87e94cac6356 /clang/test/Analysis | |
parent | 85c8c81924710ffae33127082b15c80702f97acc (diff) | |
download | bcm5719-llvm-d8665b3d1ae65ed6f603e4cf7ff7137c6ac3242c.tar.gz bcm5719-llvm-d8665b3d1ae65ed6f603e4cf7ff7137c6ac3242c.zip |
[analyzer] Don't run non-path-sensitive checks on system headers...
...but do run them on user headers.
Previously, we were inconsistent here: non-path-sensitive checks on code
/bodies/ were only run in the main source file, but checks on
/declarations/ were run in /all/ headers. Neither of those is the
behavior we want.
Thanks to Sujit for pointing this out!
<rdar://problem/12454226>
llvm-svn: 165635
Diffstat (limited to 'clang/test/Analysis')
-rw-r--r-- | clang/test/Analysis/virtualcall.cpp | 6 | ||||
-rw-r--r-- | clang/test/Analysis/virtualcall.h | 28 |
2 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/Analysis/virtualcall.cpp b/clang/test/Analysis/virtualcall.cpp index 6dfa2b40ef8..c3319b0ac54 100644 --- a/clang/test/Analysis/virtualcall.cpp +++ b/clang/test/Analysis/virtualcall.cpp @@ -51,3 +51,9 @@ int main() { B *b; C *c; } + +#include "virtualcall.h" + +#define AS_SYSTEM +#include "virtualcall.h" +#undef AS_SYSTEM diff --git a/clang/test/Analysis/virtualcall.h b/clang/test/Analysis/virtualcall.h new file mode 100644 index 00000000000..9f7094dc63e --- /dev/null +++ b/clang/test/Analysis/virtualcall.h @@ -0,0 +1,28 @@ +#ifdef AS_SYSTEM +#pragma clang system_header + +namespace system { + class A { + public: + A() { + foo(); // no-warning + } + + virtual int foo(); + }; +} + +#else + +namespace header { + class A { + public: + A() { + foo(); // expected-warning{{Call virtual functions during construction or destruction will never go to a more derived class}} + } + + virtual int foo(); + }; +} + +#endif |