summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-07-30 23:50:53 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-07-30 23:50:53 +0000
commit04559a79415e813283ddfbb8cdfdde5620c95f3b (patch)
treea7996ad4be61cff0c57b1ce6f4518401f1d0a7af /clang/lib/Sema/SemaDeclCXX.cpp
parent293cbf6ffe5423353ea53cb8469477e380504a26 (diff)
downloadbcm5719-llvm-04559a79415e813283ddfbb8cdfdde5620c95f3b.tar.gz
bcm5719-llvm-04559a79415e813283ddfbb8cdfdde5620c95f3b.zip
Updating a comment related to the implementation of -Woverloaded-virtual, and adding a FIXME to a test case. (Drive-by removal of trailing whitespace in the test case as well.)
No functional changes. llvm-svn: 214362
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index c5cd83da59d..8a760a8267c 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -5945,7 +5945,14 @@ static bool FindHiddenVirtualMethod(const CXXBaseSpecifier *Specifier,
if (!MD->isVirtual())
continue;
// If the method we are checking overrides a method from its base
- // don't warn about the other overloaded methods.
+ // don't warn about the other overloaded methods. Clang deviates from GCC
+ // by only diagnosing overloads of inherited virtual functions that do not
+ // override any other virtual functions in the base. GCC's
+ // -Woverloaded-virtual diagnoses any derived function hiding a virtual
+ // function from a base class. These cases may be better served by a
+ // warning (not specific to virtual functions) on call sites when the call
+ // would select a different function from the base class, were it visible.
+ // See FIXME in test/SemaCXX/warn-overload-virtual.cpp for an example.
if (!Data.S->IsOverload(Data.Method, MD, false))
return true;
// Collect the overload only if its hidden.
OpenPOWER on IntegriCloud