[clang] 803403a - Fix a bug in the property-based serialization of

John McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 16 13:08:15 PST 2019


Author: John McCall
Date: 2019-12-16T16:08:09-05:00
New Revision: 803403afc83f659be1c620eb1896dcf704b18b0a

URL: https://github.com/llvm/llvm-project/commit/803403afc83f659be1c620eb1896dcf704b18b0a
DIFF: https://github.com/llvm/llvm-project/commit/803403afc83f659be1c620eb1896dcf704b18b0a.diff

LOG: Fix a bug in the property-based serialization of
dependent template names.

Apparently we didn't test this in the test suite because we have
a lot of redundant ways of representing this situation that kick
in in the more common situations.  For example, DependentTST stores
a qualifier + identifier pair rather than a TemplateName.

Added: 
    

Modified: 
    clang/include/clang/AST/PropertiesBase.td
    clang/test/PCH/cxx-templates.cpp
    clang/test/PCH/cxx-templates.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/PropertiesBase.td b/clang/include/clang/AST/PropertiesBase.td
index 1cd1c79d2358..9aacdb9fee36 100644
--- a/clang/include/clang/AST/PropertiesBase.td
+++ b/clang/include/clang/AST/PropertiesBase.td
@@ -362,7 +362,7 @@ let Class = PropertyTypeCase<TemplateName, "DependentTemplate"> in {
                       : nullptr) }];
   }
   def : Property<"operatorKind", OverloadedOperatorKind> {
-    let Conditional = [{ identifier }];
+    let Conditional = [{ !identifier }];
     let Read = [{ dtn->getOperator() }];
   }
   def : Creator<[{

diff  --git a/clang/test/PCH/cxx-templates.cpp b/clang/test/PCH/cxx-templates.cpp
index 966bd00b858c..cd2787d90359 100644
--- a/clang/test/PCH/cxx-templates.cpp
+++ b/clang/test/PCH/cxx-templates.cpp
@@ -165,3 +165,13 @@ namespace DependentMemberExpr {
   static_assert(A<int>().f() == 1); // expected-error {{static_assert failed}}
 #endif
 }
+
+namespace DependentTemplateName {
+  struct HasMember {
+    template <class T> struct Member;
+  };
+
+  void test() {
+    getWithIdentifier<HasMember>();
+  }
+}

diff  --git a/clang/test/PCH/cxx-templates.h b/clang/test/PCH/cxx-templates.h
index 5aa68546a429..b4ea2c23b3cc 100644
--- a/clang/test/PCH/cxx-templates.h
+++ b/clang/test/PCH/cxx-templates.h
@@ -448,3 +448,11 @@ namespace DependentMemberExpr {
     constexpr int f() { return Base::setstate(); }
   };
 }
+
+namespace DependentTemplateName {
+  template <template <class> class Template>
+  struct TakesClassTemplate {};
+
+  template <class T>
+  TakesClassTemplate<T::template Member> getWithIdentifier();
+}


        


More information about the cfe-commits mailing list