]> granicus.if.org Git - clang/commitdiff
[Concepts] Remove the IsConcept bit and associated member functions from VarDecl
authorNathan Wilson <nwilson20@gmail.com>
Mon, 8 Feb 2016 22:02:50 +0000 (22:02 +0000)
committerNathan Wilson <nwilson20@gmail.com>
Mon, 8 Feb 2016 22:02:50 +0000 (22:02 +0000)
because the information is now stored in TemplateDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260155 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
lib/Sema/SemaDecl.cpp

index 29b19f2d8e384d62ad7eaf474fa04a808bbb1a8d..a545e2181438cd5e85c13917d6d1c251d78ed5f6 100644 (file)
@@ -816,9 +816,6 @@ protected:
     /// \brief Whether this variable is (C++0x) constexpr.
     unsigned IsConstexpr : 1;
 
-    /// \brief Whether this variable is a (C++ Concepts TS) concept.
-    unsigned IsConcept : 1;
-
     /// \brief Whether this variable is the implicit variable for a lambda
     /// init-capture.
     unsigned IsInitCapture : 1;
@@ -1194,15 +1191,6 @@ public:
     NonParmVarDeclBits.IsConstexpr = IC;
   }
 
-  /// Whether this variable is (C++ Concepts TS) concept.
-  bool isConcept() const {
-    return isa<ParmVarDecl>(this) ? false : NonParmVarDeclBits.IsConcept;
-  }
-  void setConcept(bool IC) {
-    assert(!isa<ParmVarDecl>(this));
-    NonParmVarDeclBits.IsConcept = IC;
-  }
-
   /// Whether this variable is the implicit variable for a lambda init-capture.
   bool isInitCapture() const {
     return isa<ParmVarDecl>(this) ? false : NonParmVarDeclBits.IsInitCapture;
index c908f672a4fcd9bddf0e1da493c0abdcf24a3f0d..754536e629f8b64eff0e40f0cc0b0c8eedf6a4f2 100644 (file)
@@ -5983,7 +5983,8 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
       NewVD->setConstexpr(true);
 
     if (D.getDeclSpec().isConceptSpecified()) {
-      NewVD->setConcept(true);
+      if (VarTemplateDecl *VTD = NewVD->getDescribedVarTemplate())
+        VTD->setConcept();
 
       // C++ Concepts TS [dcl.spec.concept]p2: A concept definition shall not
       // be declared with the thread_local, inline, friend, or constexpr
@@ -9760,10 +9761,12 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl,
     // C++ Concepts TS [dcl.spec.concept]p1: [...]  A variable template
     // definition having the concept specifier is called a variable concept. A
     // concept definition refers to [...] a variable concept and its initializer.
-    if (Var->isConcept()) {
-      Diag(Var->getLocation(), diag::err_var_concept_not_initialized);
-      Var->setInvalidDecl();
-      return;
+    if (VarTemplateDecl *VTD = Var->getDescribedVarTemplate()) {
+      if (VTD->isConcept()) {
+        Diag(Var->getLocation(), diag::err_var_concept_not_initialized);
+        Var->setInvalidDecl();
+        return;
+      }
     }
 
     // OpenCL v1.1 s6.5.3: variables declared in the constant address space must