|
roll clang 131935:132017
clang recently added a warning that warns when invoking 'delete' on a polymorphic non-final class without a virtual destructor. This finds real bugs – see the bug referenced below for a few examples.
However, one common pattern where it fires is this case:
class SomeInterface {
public:
virtual void interfaceMethod() {} // or = 0;
protected:
~SomeInterface() {}
}
class WorkerClass : public SomeInterface {
public:
// many non-virtual functions, but also:
virtual void interfaceMethod() override { /* do actual work */ }
};
void f() {
scoped_ptr<WorkerClass> c(new WorkerClass); // simplified example
}
(See the 2nd half of http://www.gotw.ca/publications/mill18.htm for an explanation of this pattern.)
It is arguably correct to fire the warning here, since someone might make a subclass of WorkerClass and replace |new WorkerClass| with |new WorkerClassSubclass|. This would be broken since WorkerClass doesn't have a virtual destructor.
The solution that the clang folks recommend is to mark WorkerClass as |final| (a c++0x keyword that clang supports as an extension in normal c++ mode – like override). But chrome's base/OWNERS deemed that as too complicated and we decided to make virtual the destructors of leaf classes that implement these interfaces and that are deleted dynamically. All of the changes in this CL are to shut up the warning, not because of real problems (I fixed these in separate CLs).
(For the gtk files, this is necessary because the CHROMEGTK_CALLBACK_ macros add virtual functions.)
BUG= 84424
TEST=none
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=88270
Total comments: 2
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+56 lines, -21 lines) |
Patch |
|
M |
base/message_loop_unittest.cc
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
build/common.gypi
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
1 chunk |
+11 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/download/base_file.h
|
View
|
1
2
3
4
5
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/browser/download/save_file.h
|
View
|
1
2
3
4
5
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/browser/ui/gtk/crypto_module_password_dialog.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+2 lines, -0 lines |
2 comments
|
Download
|
|
M |
chrome/browser/ui/gtk/external_protocol_dialog_gtk.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/ui/gtk/importer/import_lock_dialog_gtk.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/browser/ui/gtk/instant_confirm_dialog_gtk.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/browser/ui/gtk/menu_gtk.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/browser/ui/gtk/update_recommended_dialog.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/renderer/chrome_content_renderer_client.h
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
content/browser/device_orientation/provider_unittest.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
content/browser/renderer_host/render_message_filter.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
content/ppapi_plugin/ppapi_webkitclient_impl.cc
|
View
|
1
2
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
content/renderer/content_renderer_client.h
|
View
|
1
2
3
4
5
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
content/renderer/external_popup_menu.h
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
content/renderer/render_widget_fullscreen_pepper.cc
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
content/renderer/renderer_webkitclient_impl.cc
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
ppapi/proxy/plugin_resource_tracker.h
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
ppapi/proxy/ppb_flash_file_proxy.cc
|
View
|
1
2
3
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
remoting/jingle_glue/jingle_client.h
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
remoting/protocol/protocol_test_client.cc
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
tools/clang/scripts/update.sh
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
ui/base/x/active_window_watcher_x.h
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
webkit/fileapi/file_system_file_util.h
|
View
|
1
2
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
webkit/fileapi/quota_file_util.h
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
webkit/glue/resource_fetcher.h
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
webkit/glue/resource_fetcher_unittest.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+6 lines, -2 lines |
0 comments
|
Download
|
|
M |
webkit/plugins/ppapi/mock_plugin_delegate.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
webkit/plugins/ppapi/ppapi_webplugin_impl.h
|
View
|
1
2
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
webkit/tools/test_shell/test_webview_delegate.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
Total messages: 6 (0 generated)
|