v.g.vassilev removed rL LLVM as the repository for this revision.
v.g.vassilev updated this revision to Diff 68833.
v.g.vassilev added a comment.

Adapt to the new APIs. Now it builds.


https://reviews.llvm.org/D23400

Files:
  lib/Sema/SemaExceptionSpec.cpp
  test/Modules/Inputs/PR28423/Allocator.h
  test/Modules/Inputs/PR28423/Memory.h
  test/Modules/Inputs/PR28423/SmallVector.h
  test/Modules/Inputs/PR28423/StringMap.h
  test/Modules/Inputs/PR28423/StringRef.h
  test/Modules/Inputs/PR28423/iterator_range.h
  test/Modules/Inputs/PR28423/module.modulemap
  test/Modules/Inputs/PR28423/queue
  test/Modules/Inputs/PR28423/string
  test/Modules/pr28423.cpp

Index: test/Modules/pr28423.cpp
===================================================================
--- /dev/null
+++ test/Modules/pr28423.cpp
@@ -0,0 +1,11 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR28423 -verify %s
+// RUN: %clang_cc1 -std=c++11 -fmodules -fmodule-map-file=%S/Inputs/PR28423/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR28423/ -verify %s
+
+#include "StringMap.h"
+#include <queue>
+
+std::priority_queue<unsigned, std::vector<unsigned>, std::greater<unsigned>> a,b;
+void fn1() { a.swap(b); }
+
+// expected-no-diagnostics
\ No newline at end of file
Index: test/Modules/Inputs/PR28423/string
===================================================================
--- /dev/null
+++ test/Modules/Inputs/PR28423/string
@@ -0,0 +1,9 @@
+#ifndef _GLIBCXX_STRING
+#define _GLIBCXX_STRING
+namespace std {
+template <typename _Tp> void swap(_Tp, _Tp);
+template <typename> class allocator;
+template <typename> struct greater {};
+template <typename> struct less;
+}
+#endif
Index: test/Modules/Inputs/PR28423/queue
===================================================================
--- /dev/null
+++ test/Modules/Inputs/PR28423/queue
@@ -0,0 +1,11 @@
+#pragma GCC system_header
+namespace std {
+template <typename, typename _Sequence,
+          typename _Compare = less<typename _Sequence::value_type>>
+class priority_queue {
+  _Compare comp;
+
+public:
+  void swap(priority_queue __pq) noexcept(noexcept(swap(comp, comp)));
+};
+}
Index: test/Modules/Inputs/PR28423/module.modulemap
===================================================================
--- /dev/null
+++ test/Modules/Inputs/PR28423/module.modulemap
@@ -0,0 +1,6 @@
+module "StringRef.h" {header "StringRef.h" export *}
+module "iterator_range.h" {header "iterator_range.h" export *}
+module "SmallVector.h" {header "SmallVector.h" export *}
+module "StringMap.h" {header "StringMap.h" export *}
+module "Memory.h" {header "Memory.h" export *}
+module "Allocator.h" {header "Allocator.h" export *}
Index: test/Modules/Inputs/PR28423/iterator_range.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/PR28423/iterator_range.h
@@ -0,0 +1 @@
+namespace llvm {}
Index: test/Modules/Inputs/PR28423/StringRef.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/PR28423/StringRef.h
@@ -0,0 +1 @@
+namespace llvm{}
Index: test/Modules/Inputs/PR28423/StringMap.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/PR28423/StringMap.h
@@ -0,0 +1,4 @@
+#include "StringRef.h"
+#include "Allocator.h"
+#include "iterator_range.h"
+namespace std {}
Index: test/Modules/Inputs/PR28423/SmallVector.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/PR28423/SmallVector.h
@@ -0,0 +1,7 @@
+
+#include "iterator_range.h"
+#include <string>
+namespace std {
+template <typename _Tp, typename = allocator<_Tp>> class vector;
+}
+
Index: test/Modules/Inputs/PR28423/Memory.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/PR28423/Memory.h
@@ -0,0 +1 @@
+#include <string>
Index: test/Modules/Inputs/PR28423/Allocator.h
===================================================================
--- /dev/null
+++ test/Modules/Inputs/PR28423/Allocator.h
@@ -0,0 +1,3 @@
+
+#include "SmallVector.h"
+#include "Memory.h"
Index: lib/Sema/SemaExceptionSpec.cpp
===================================================================
--- lib/Sema/SemaExceptionSpec.cpp
+++ lib/Sema/SemaExceptionSpec.cpp
@@ -44,7 +44,8 @@
 
   // All the problem cases are member functions named "swap" within class
   // templates declared directly within namespace std.
-  if (!RD || RD->getEnclosingNamespaceContext() != getStdNamespace() ||
+  if (!RD || !getStdNamespace() ||
+      !RD->getEnclosingNamespaceContext()->Equals(getStdNamespace()) ||
       !RD->getIdentifier() || !RD->getDescribedClassTemplate() ||
       !D.getIdentifier() || !D.getIdentifier()->isStr("swap"))
     return false;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to