1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus.VirtualCall \
2 // RUN:     -analyzer-config optin.cplusplus.VirtualCall:ShowFixIts=true \
3 // RUN:     %s 2>&1 | FileCheck -check-prefix=TEXT %s
4 
5 // RUN: %check_analyzer_fixit %s %t \
6 // RUN:     -analyzer-checker=core,optin.cplusplus.VirtualCall \
7 // RUN:     -analyzer-config optin.cplusplus.VirtualCall:ShowFixIts=true \
8 // RUN:     -analyzer-output=plist -o %t.plist
9 // RUN: cat %t.plist | FileCheck -check-prefix=PLIST %s
10 
11 struct S {
12   virtual void foo();
SS13   S() {
14     foo();
15     // expected-warning@-1{{Call to virtual method 'S::foo' during construction bypasses virtual dispatch}}
16     // CHECK-FIXES:      S() {
17     // CHECK-FIXES-NEXT:   S::foo();
18     // CHECK-FIXES-NEXT: }
19   }
20   ~S();
21 };
22 
23 // TEXT: warning: Call to virtual method 'S::foo' during construction
24 // TEXT-SAME: bypasses virtual dispatch
25 // TEXT-NEXT: foo();
26 // TEXT-NEXT: ^~~~~
27 // TEXT-NEXT: S::
28 // TEXT-NEXT: 1 warning generated.
29 
30 // PLIST:  <key>fixits</key>
31 // PLIST-NEXT:  <array>
32 // PLIST-NEXT:   <dict>
33 // PLIST-NEXT:    <key>remove_range</key>
34 // PLIST-NEXT:    <array>
35 // PLIST-NEXT:     <dict>
36 // PLIST-NEXT:      <key>line</key><integer>14</integer>
37 // PLIST-NEXT:      <key>col</key><integer>5</integer>
38 // PLIST-NEXT:      <key>file</key><integer>0</integer>
39 // PLIST-NEXT:     </dict>
40 // PLIST-NEXT:     <dict>
41 // PLIST-NEXT:      <key>line</key><integer>14</integer>
42 // PLIST-NEXT:      <key>col</key><integer>4</integer>
43 // PLIST-NEXT:      <key>file</key><integer>0</integer>
44 // PLIST-NEXT:     </dict>
45 // PLIST-NEXT:    </array>
46 // PLIST-NEXT:    <key>insert_string</key><string>S::</string>
47 // PLIST-NEXT:   </dict>
48 // PLIST-NEXT:  </array>
49