[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>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165635 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/virtualcall.h b/test/Analysis/virtualcall.h
new file mode 100644
index 0000000..9f7094d
--- /dev/null
+++ b/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