Author: teemperor
Date: Tue Aug 29 02:27:41 2017
New Revision: 311991

URL: http://llvm.org/viewvc/llvm-project?rev=311991&view=rev
Log:
[modules] Add test for using declaration in classes.

Summary:
This adds a test that checks if the using declaration in classes still works as 
intended with modules.

The motivation for this is that we tried to add a shortcut to `removeDecl` that 
would skip the removal of declarations from the lookup table if they are 
hidden. This optimization passed the clang test suite but actually broke the 
using declaration in combination with -fmodules-local-submodule-visibility. In 
this mode we hide all decls from other modules such as by chance the parent 
method, in which case don't remove the parent method from the lookup table and 
get ambiguous lookup errors. After this patch we now correctly see if this 
behavior is broken by a patch like this in the test suite.

Reviewers: v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D37180

Added:
    cfe/trunk/test/Modules/using-decl-inheritance.cpp

Added: cfe/trunk/test/Modules/using-decl-inheritance.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/using-decl-inheritance.cpp?rev=311991&view=auto
==============================================================================
--- cfe/trunk/test/Modules/using-decl-inheritance.cpp (added)
+++ cfe/trunk/test/Modules/using-decl-inheritance.cpp Tue Aug 29 02:27:41 2017
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -x c++ -fmodules -fmodules-local-submodule-visibility 
-fmodules-cache-path=%t %s -verify
+// RUN: %clang_cc1 -x c++ -fmodules -fmodules-cache-path=%t %s -verify
+
+// expected-no-diagnostics
+
+#pragma clang module build A
+  module A { }
+#pragma clang module contents
+#pragma clang module begin A
+struct A {
+   virtual void Foo(double x) const;
+};
+#pragma clang module end
+#pragma clang module endbuild
+
+#pragma clang module build B
+  module B { }
+#pragma clang module contents
+#pragma clang module begin B
+#pragma clang module import A
+struct B : A {
+   using A::Foo;
+   virtual void Foo(double x) const;
+};
+#pragma clang module end
+#pragma clang module endbuild
+
+#pragma clang module import B
+
+int main() {
+  B b;
+  b.Foo(1.0);
+}
+


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to