-
Steinar H. Gunderson authored
Another cross-cutting clang-tidy change. This time, we run the clang-tidy modernize-use-override fixit over the entire code base. The change, for virtual member functions in child classes, modifies this: virtual void Foo(); to void Foo() override; and also strips any redundant "override final" (changed to only final), "virtual ... override" (changed to only virtual) and the likes. The primary advantage of using C++11 override is that it enables catching subtle inheritance errors. In particular, if you change the prototype of a member function in a base class and missed a derived class, the override specifier will instantly tell you via a compiler error. Similarly, if you get the types or number of parameters wrong in a derived class (and use override), you will get a compiler error. And finally, if you create a member function that happens to have the same signature as a base member class but you didn't know about it (ie., don't use override), you will most likely get an "inconsistent use of override" warning. We already use override a fair amount in our case base (about 9000 instances), so this is mostly about getting into a consistent state without a lot of manual labor. Change-Id: I40802461dc97c7f97c1b688f4c9fc0ba3dba4794
Steinar H. Gunderson authoredAnother cross-cutting clang-tidy change. This time, we run the clang-tidy modernize-use-override fixit over the entire code base. The change, for virtual member functions in child classes, modifies this: virtual void Foo(); to void Foo() override; and also strips any redundant "override final" (changed to only final), "virtual ... override" (changed to only virtual) and the likes. The primary advantage of using C++11 override is that it enables catching subtle inheritance errors. In particular, if you change the prototype of a member function in a base class and missed a derived class, the override specifier will instantly tell you via a compiler error. Similarly, if you get the types or number of parameters wrong in a derived class (and use override), you will get a compiler error. And finally, if you create a member function that happens to have the same signature as a base member class but you didn't know about it (ie., don't use override), you will most likely get an "inconsistent use of override" warning. We already use override a fair amount in our case base (about 9000 instances), so this is mostly about getting into a consistent state without a lot of manual labor. Change-Id: I40802461dc97c7f97c1b688f4c9fc0ba3dba4794
Loading