cryptoad created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
cryptoad requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92413

Files:
  clang/lib/Sema/SemaLookup.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/template-specialization.cpp


Index: clang/test/OpenMP/template-specialization.cpp
===================================================================
--- /dev/null
+++ clang/test/OpenMP/template-specialization.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -verify -fopenmp -fsyntax-only %s
+
+// expected-no-diagnostics
+
+template <typename T>
+struct z {
+  static void aj() {
+    T f;
+#pragma omp target map(f)
+    ;
+  }
+};
+
+template <typename> class ar {};
+template <int> struct as {};
+template class z<ar<as<4>>>;
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -17549,6 +17549,7 @@
     auto &DeclNames = SemaRef.getASTContext().DeclarationNames;
     MapperId.setName(DeclNames.getIdentifier(
         &SemaRef.getASTContext().Idents.get("default")));
+    MapperId.setLoc(StartLoc);
   }
 
   // Iterators to find the current unresolved mapper expression.
Index: clang/lib/Sema/SemaLookup.cpp
===================================================================
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -2576,6 +2576,8 @@
 
     bool addClassTransitive(CXXRecordDecl *RD) {
       Classes.insert(RD);
+      if (InstantiationLoc.isInvalid())
+        InstantiationLoc = RD->getLocation();
       return ClassesTransitive.insert(RD);
     }
 


Index: clang/test/OpenMP/template-specialization.cpp
===================================================================
--- /dev/null
+++ clang/test/OpenMP/template-specialization.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -verify -fopenmp -fsyntax-only %s
+
+// expected-no-diagnostics
+
+template <typename T>
+struct z {
+  static void aj() {
+    T f;
+#pragma omp target map(f)
+    ;
+  }
+};
+
+template <typename> class ar {};
+template <int> struct as {};
+template class z<ar<as<4>>>;
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -17549,6 +17549,7 @@
     auto &DeclNames = SemaRef.getASTContext().DeclarationNames;
     MapperId.setName(DeclNames.getIdentifier(
         &SemaRef.getASTContext().Idents.get("default")));
+    MapperId.setLoc(StartLoc);
   }
 
   // Iterators to find the current unresolved mapper expression.
Index: clang/lib/Sema/SemaLookup.cpp
===================================================================
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -2576,6 +2576,8 @@
 
     bool addClassTransitive(CXXRecordDecl *RD) {
       Classes.insert(RD);
+      if (InstantiationLoc.isInvalid())
+        InstantiationLoc = RD->getLocation();
       return ClassesTransitive.insert(RD);
     }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D92413: Argumen... Kostya Kortchinsky via Phabricator via cfe-commits

Reply via email to