override implies virtual and is a strict superset of virtual, so there's nothing inherently wrong with "mixing" them.  The advantage of override is that it will cause the compiler to error if, for example, you delete a virtual method from a base class (or change the signature), but forget to make a corresponding change in derived implementations.<br><div><br></div><div>For example, if you have</div><div><br></div><div>class A</div><div>{</div><div>public:</div><div>   virtual void Foo();</div><div>};</div><div><br></div><div>class B : public A</div><div>{</div><div>public:</div><div>  virtual void Foo();</div><div>};</div><div><br></div><div>this is all fine.  If someone goes and changes A to the following:</div><div><br></div><div>class A</div><div>{</div><div>public:</div><div>   virtual void Foo(int x);</div><div>};</div><div><br></div><div>This will continue to compile no problem, and not alert the user to the fact that there is now a bug in the code.  On the other hand, if the original implementation of B had been like this:</div><div><br></div><div>class B : public A</div><div>{</div><div>public:</div><div>   virtual void Foo() override;   // keyword "virtual" is optional here</div><div>};</div><div><br></div><div>then when the change was made to A, B would generate a compiler error that there was no appropriate method to override.</div><div><br></div><div>As far as deciding to switch to override, I propose we decide that right now :)   There's no advantage to not doing so, since it is a strict superset of virtual, and surfaces a common source of programmer error as a compiler error.</div><br><div class="gmail_quote">On Mon Nov 17 2014 at 4:43:31 PM <<a href="mailto:jingham@apple.com">jingham@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As I understand it, mixing override & virtual is a recipe for confusion...  We currently use virtual, and not override.  At some point we can talk about switching over to using override everywhere, but I don't think we are at that point.<br>
<br>
So in this case your patch is incorrect, and the "virtual" should go back in.  And then until we decide to switch to using override, can you turn off whatever warning is causing you to (as I understand it) incorrectly remove these "virtual" markers?<br>
<br>
Jim<br>
<br>
<br>
> On Nov 17, 2014, at 3:14 PM, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>> wrote:<br>
><br>
> It's fine as virtual, but you're overriding a method and not marking it as override. You don't need to write both down (you could, but it's a nop) as override only works on virtual functions.<br>
><br>
> -eric<br>
><br>
> On Mon Nov 17 2014 at 3:07:27 PM <<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>> wrote:<br>
> I'm sure I'm missing something obvious, but I don't understand what this warning you are fixing is supposed to be telling you about.  The inheritance hierarchy is:<br>
><br>
> PlatformDarwin<--<u></u>PlatformPOSIX<--Platform<br>
><br>
> Platform.h defines:<br>
><br>
>         virtual Error<br>
>         ResolveExecutable (const FileSpec &exe_file,<br>
>                            const ArchSpec &arch,<br>
>                            lldb::ModuleSP &module_sp,<br>
>                            const FileSpecList *module_search_paths_ptr);<br>
><br>
><br>
> Then PlatformPosix.h doesn't override ResolveExecutable, and finally, PlatformDarwin has:<br>
><br>
>     virtual lldb_private::Error<br>
>     ResolveExecutable (const lldb_private::FileSpec &exe_file,<br>
>                        const lldb_private::ArchSpec &arch,<br>
>                        lldb::ModuleSP &module_sp,<br>
>                        const lldb_private::FileSpecList *module_search_paths_ptr);<br>
><br>
><br>
> Why is it wrong for PlatformDarwin to define this method as virtual?<br>
><br>
> Jim<br>
><br>
><br>
><br>
> > On Nov 17, 2014, at 2:55 PM, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>> wrote:<br>
> ><br>
> > Author: echristo<br>
> > Date: Mon Nov 17 16:55:13 2014<br>
> > New Revision: 222186<br>
> ><br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=222186&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=222186&view=rev</a><br>
> > Log:<br>
> > Fix override/virtual warnings.<br>
> ><br>
> > Modified:<br>
> >    lldb/trunk/source/Plugins/<u></u>Platform/MacOSX/<u></u>PlatformDarwin.h<br>
> ><br>
> > Modified: lldb/trunk/source/Plugins/<u></u>Platform/MacOSX/<u></u>PlatformDarwin.h<br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h?rev=222186&r1=222185&r2=222186&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lldb/trunk/source/<u></u>Plugins/Platform/MacOSX/<u></u>PlatformDarwin.h?rev=222186&<u></u>r1=222185&r2=222186&view=diff</a><br>
> > ==============================<u></u>==============================<u></u>==================<br>
> > --- lldb/trunk/source/Plugins/<u></u>Platform/MacOSX/<u></u>PlatformDarwin.h (original)<br>
> > +++ lldb/trunk/source/Plugins/<u></u>Platform/MacOSX/<u></u>PlatformDarwin.h Mon Nov 17 16:55:13 2014<br>
> > @@ -27,57 +27,58 @@ public:<br>
> >     //----------------------------<u></u>------------------------------<u></u>--<br>
> >     // lldb_private::Platform functions<br>
> >     //----------------------------<u></u>------------------------------<u></u>--<br>
> > -    virtual lldb_private::Error<br>
> > +    lldb_private::Error<br>
> >     ResolveExecutable (const lldb_private::ModuleSpec &module_spec,<br>
> >                        lldb::ModuleSP &module_sp,<br>
> >                        const lldb_private::FileSpecList *module_search_paths_ptr) override;<br>
> ><br>
> > -    virtual lldb_private::Error<br>
> > +    lldb_private::Error<br>
> >     ResolveSymbolFile (lldb_private::Target &target,<br>
> >                        const lldb_private::ModuleSpec &sym_spec,<br>
> > -                       lldb_private::FileSpec &sym_file);<br>
> > +                       lldb_private::FileSpec &sym_file) override;<br>
> ><br>
> >     lldb_private::FileSpecList<br>
> >     LocateExecutableScriptingResou<u></u>rces (lldb_private::Target *target,<br>
> >                                         lldb_private::Module &module,<br>
> > -                                        lldb_private::Stream* feedback_stream);<br>
> > +                                        lldb_private::Stream* feedback_stream) override;<br>
> ><br>
> > -    virtual lldb_private::Error<br>
> > +    lldb_private::Error<br>
> >     GetSharedModule (const lldb_private::ModuleSpec &module_spec,<br>
> >                      lldb::ModuleSP &module_sp,<br>
> >                      const lldb_private::FileSpecList *module_search_paths_ptr,<br>
> >                      lldb::ModuleSP *old_module_sp_ptr,<br>
> > -                     bool *did_create_ptr);<br>
> > +                     bool *did_create_ptr) override;<br>
> ><br>
> > -    virtual size_t<br>
> > +    size_t<br>
> >     GetSoftwareBreakpointTrapOpcod<u></u>e (lldb_private::Target &target,<br>
> > -                                     lldb_private::BreakpointSite *bp_site);<br>
> > +                                     lldb_private::BreakpointSite *bp_site) override;<br>
> ><br>
> > -    virtual bool<br>
> > +    bool<br>
> >     GetProcessInfo (lldb::pid_t pid,<br>
> > -                    lldb_private::<u></u>ProcessInstanceInfo &proc_info);<br>
> > +                    lldb_private::<u></u>ProcessInstanceInfo &proc_info) override;<br>
> ><br>
> > -    virtual lldb::BreakpointSP<br>
> > -    SetThreadCreationBreakpoint (lldb_private::Target &target);<br>
> > +    lldb::BreakpointSP<br>
> > +    SetThreadCreationBreakpoint (lldb_private::Target &target) override;<br>
> ><br>
> > -    virtual uint32_t<br>
> > +    uint32_t<br>
> >     FindProcesses (const lldb_private::<u></u>ProcessInstanceInfoMatch &match_info,<br>
> > -                   lldb_private::<u></u>ProcessInstanceInfoList &process_infos);<br>
> > -<br>
> > -    virtual bool<br>
> > -    ModuleIsExcludedForNonModuleSp<u></u>ecificSearches (lldb_private::Target &target, const lldb::ModuleSP &module_sp);<br>
> > -<br>
> > +                   lldb_private::<u></u>ProcessInstanceInfoList &process_infos) override;<br>
> > +<br>
> > +    bool<br>
> > +    ModuleIsExcludedForNonModuleSp<u></u>ecificSearches(lldb_private::<u></u>Target &target,<br>
> > +                                              const lldb::ModuleSP &module_sp) override;<br>
> > +<br>
> >     bool<br>
> >     ARMGetSupportedArchitectureAtI<u></u>ndex (uint32_t idx, lldb_private::ArchSpec &arch);<br>
> ><br>
> >     bool<br>
> >     x86GetSupportedArchitectureAtI<u></u>ndex (uint32_t idx, lldb_private::ArchSpec &arch);<br>
> ><br>
> > -    virtual int32_t<br>
> > -    GetResumeCountForLaunchInfo (lldb_private::<u></u>ProcessLaunchInfo &launch_info);<br>
> > +    int32_t<br>
> > +    GetResumeCountForLaunchInfo (lldb_private::<u></u>ProcessLaunchInfo &launch_info) override;<br>
> ><br>
> > -    virtual void<br>
> > -    CalculateTrapHandlerSymbolName<u></u>s ();<br>
> > +    void<br>
> > +    CalculateTrapHandlerSymbolName<u></u>s () override;<br>
> ><br>
> > protected:<br>
> ><br>
> ><br>
> ><br>
> > ______________________________<u></u>_________________<br>
> > lldb-commits mailing list<br>
> > <a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/lldb-commits</a><br>
><br>
<br>
<br>
______________________________<u></u>_________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/lldb-commits</a><br>
</blockquote></div>