diff options
Diffstat (limited to 'test/Analysis/inline.cpp')
-rw-r--r-- | test/Analysis/inline.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Analysis/inline.cpp b/test/Analysis/inline.cpp index d16eeaf619..4298e1aac8 100644 --- a/test/Analysis/inline.cpp +++ b/test/Analysis/inline.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-ipa=inlining -verify %s void clang_analyzer_eval(bool); +void clang_analyzer_checkInlined(bool); class A { public: @@ -43,3 +44,30 @@ void testPathSensitivity(int x) { clang_analyzer_eval(ptr->getNum() == x); // expected-warning {{TRUE}} } + +namespace PureVirtualParent { + class Parent { + public: + virtual int pureVirtual() const = 0; + int callVirtual() const { + return pureVirtual(); + } + }; + + class Child : public Parent { + public: + virtual int pureVirtual() const { + clang_analyzer_checkInlined(true); // expected-warning{{TRUE}} + return 42; + } + }; + + void testVirtual() { + Child x; + + clang_analyzer_eval(x.pureVirtual() == 42); // expected-warning{{TRUE}} + clang_analyzer_eval(x.callVirtual() == 42); // expected-warning{{TRUE}} + } +} + + |