aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/LanguageRuntime
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-05-03 10:03:28 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-05-03 10:03:28 +0000
commite76cd4e36e9a9e100c69dc9c434a0d9dcb2fb03a (patch)
treea69f374b4257a0c33ef01109c69126716484c484 /source/Plugins/LanguageRuntime
parentd0e71c991d888d889928d19d1cb6b1b60d6caeca (diff)
downloadlldb-e76cd4e36e9a9e100c69dc9c434a0d9dcb2fb03a.tar.gz
C.128 override, virtual keyword handling
Summary: According to [C128] "Virtual functions should specify exactly one of `virtual`, `override`, or `final`", I've added override where a virtual function is overriden but the explicit `override` keyword was missing. Whenever both `virtual` and `override` were specified, I removed `virtual`. As C.128 puts it: > [...] writing more than one of these three is both redundant and > a potential source of errors. I anticipate a discussion about whether or not to add `override` to destructors but I went for it because of an example in [ISOCPP1000]. Let me repeat the comment for you here: Consider this code: ``` struct Base { virtual ~Base(){} }; struct SubClass : Base { ~SubClass() { std::cout << "It works!\n"; } }; int main() { std::unique_ptr<Base> ptr = std::make_unique<SubClass>(); } ``` If for some odd reason somebody removes the `virtual` keyword from the `Base` struct, the code will no longer print `It works!`. So adding `override` to destructors actively protects us from accidentally breaking our code at runtime. [C128]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c128-virtual-functions-should-specify-exactly-one-of-virtual-override-or-final [ISOCPP1000]: https://github.com/isocpp/CppCoreGuidelines/issues/1000#issuecomment-476951555 Reviewers: teemperor, JDevlieghere, davide, shafik Reviewed By: teemperor Subscribers: kwk, arphaman, kadircet, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61440 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@359868 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'source/Plugins/LanguageRuntime')
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp3
-rw-r--r--source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 9362eb2e7..9f2540fd6 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2659,7 +2659,8 @@ class ObjCExceptionRecognizedStackFrame : public RecognizedStackFrame {
};
class ObjCExceptionThrowFrameRecognizer : public StackFrameRecognizer {
- lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame) {
+ lldb::RecognizedStackFrameSP
+ RecognizeFrame(lldb::StackFrameSP frame) override {
return lldb::RecognizedStackFrameSP(
new ObjCExceptionRecognizedStackFrame(frame));
};
diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h
index 00425b781..3ec4e37b6 100644
--- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h
+++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.h
@@ -34,7 +34,7 @@ public:
RenderScriptRuntimeModulePass(const lldb_private::Process *process)
: ModulePass(ID), m_process_ptr(process) {}
- bool runOnModule(llvm::Module &module);
+ bool runOnModule(llvm::Module &module) override;
private:
const lldb_private::Process *m_process_ptr;