r260155 - [Concepts] Remove the IsConcept bit and associated member functions from VarDecl

Nathan Wilson via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 8 14:02:50 PST 2016


Author: nwilson
Date: Mon Feb  8 16:02:50 2016
New Revision: 260155

URL: http://llvm.org/viewvc/llvm-project?rev=260155&view=rev
Log:
[Concepts] Remove the IsConcept bit and associated member functions from VarDecl
because the information is now stored in TemplateDecl.

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=260155&r1=260154&r2=260155&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Mon Feb  8 16:02:50 2016
@@ -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;

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=260155&r1=260154&r2=260155&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Feb  8 16:02:50 2016
@@ -5983,7 +5983,8 @@ Sema::ActOnVariableDeclarator(Scope *S,
       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 *
     // 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




More information about the cfe-commits mailing list