[clang] 3d280b0 - [clang] Propely handle tests for open DRs in make_cxx_dr_status

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 06:47:54 PST 2022


Author: Vlad Serebrennikov
Date: 2022-11-29T06:47:50-08:00
New Revision: 3d280b03753073960de9225f87780f5d6a4a2cb7

URL: https://github.com/llvm/llvm-project/commit/3d280b03753073960de9225f87780f5d6a4a2cb7
DIFF: https://github.com/llvm/llvm-project/commit/3d280b03753073960de9225f87780f5d6a4a2cb7.diff

LOG: [clang] Propely handle tests for open DRs in make_cxx_dr_status

A follow-up to D136133. It was mentioned in #58382 that there is a need
to test for DRs that have not been officially resolved yet. This patch
aims to replace original "hackery" with proper handling for such cases.
Highlights:

- Availability can be suffixed (further) with "open", "drafting", or
  "review", e.g. // dr2565: 16 open, // drXXXX: 16 c++17 drafting
- Checks are implemented to ensure that this suffix corresponds to
  actual issue status
- Non-resolved DRs are counted (stdout of make_cxx_dr_status)
- No changes made to cxx_dr_status.html
- 'c++20' availability suffix added
- Remove 'concurrency' status since it's no longer
  on the list of statuses in CWG Active Issues

Differential Revision: https://reviews.llvm.org/D138901

Added: 
    

Modified: 
    clang/test/CXX/drs/dr25xx.cpp
    clang/test/CXX/drs/dr26xx.cpp
    clang/www/make_cxx_dr_status

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/dr25xx.cpp b/clang/test/CXX/drs/dr25xx.cpp
index a0b947b8d58ed..ee68b4ad45d11 100644
--- a/clang/test/CXX/drs/dr25xx.cpp
+++ b/clang/test/CXX/drs/dr25xx.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify
 
-namespace dr2565 { // dr2565: 16
+namespace dr2565 { // dr2565: 16 open
   template<typename T>
     concept C = requires (typename T::type x) {
       x + 1;

diff  --git a/clang/test/CXX/drs/dr26xx.cpp b/clang/test/CXX/drs/dr26xx.cpp
index 3ec1aa279dfc9..46d81e544b5c2 100644
--- a/clang/test/CXX/drs/dr26xx.cpp
+++ b/clang/test/CXX/drs/dr26xx.cpp
@@ -14,7 +14,7 @@ using enum E; // expected-error {{unknown type name E}}
 }
 }
 
-namespace dr2628 { // dr2628: yes
+namespace dr2628 { // dr2628: yes open
 
 template <bool A = false, bool B = false>
 struct foo {

diff  --git a/clang/www/make_cxx_dr_status b/clang/www/make_cxx_dr_status
index bdd08832844c8..922a3810ec9a2 100755
--- a/clang/www/make_cxx_dr_status
+++ b/clang/www/make_cxx_dr_status
@@ -95,6 +95,18 @@ latest_release = 15
 
 def availability(issue):
   status = status_map.get(issue, 'unknown')
+  
+  unresolved_status = ''
+  if status.endswith(' open'):
+    status = status[:-5]
+    unresolved_status = 'open'
+  elif status.endswith(' drafting'):
+    status = status[:-9]
+    unresolved_status = 'drafting'
+  elif status.endswith(' review'):
+    status = status[:-7]
+    unresolved_status = 'review'
+
   avail_suffix = ''
   if status.endswith(' c++11'):
     status = status[:-6]
@@ -105,6 +117,9 @@ def availability(issue):
   elif status.endswith(' c++17'):
     status = status[:-6]
     avail_suffix = ' (C++17 onwards)'
+  elif status.endswith(' c++20'):
+    status = status[:-6]
+    avail_suffix = ' (C++20 onwards)'
   if status == 'unknown':
     avail = 'Unknown'
     avail_style = ' class="none"'
@@ -140,17 +155,17 @@ def availability(issue):
     else:
       avail = 'Superseded by <a href="#%s">%s</a>' % (dup, dup)
       try:
-        _, avail_style = availability(int(dup))
+        _, avail_style, _ = availability(int(dup))
       except:
         print("issue %s marked as sup %s" % (issue, dup), file=sys.stderr)
         avail_style = ' class="none"'
   elif status.startswith('dup '):
     dup = int(status.split(' ', 1)[1])
     avail = 'Duplicate of <a href="#%s">%s</a>' % (dup, dup)
-    _, avail_style = availability(dup)
+    _, avail_style, _ = availability(dup)
   else:
     assert False, 'unknown status %s for issue %s' % (status, dr.issue)
-  return (avail + avail_suffix, avail_style)
+  return (avail + avail_suffix, avail_style, unresolved_status)
 
 count = {}
 for dr in drs:
@@ -158,21 +173,28 @@ for dr in drs:
     # This refers to the old ("C++0x") concepts feature, which was not part
     # of any C++ International Standard or Technical Specification.
     continue
-  if dr.issue in (2565, 2628):
+  elif dr.status == 'extension':
     row_style = ' class="open"'
-    avail, avail_style = availability(dr.issue)
-  elif dr.status in ('open', 'concurrency', 'drafting', 'review', 'extension'):
-    # We may have to deal with these some day, but not yet.
+    avail = 'Extension'
+    avail_style = ''
+  elif dr.status in ('open', 'drafting', 'review'):
     row_style = ' class="open"'
-    if dr.status == 'extension':
-      avail = 'Extension'
-    else:
+    avail, avail_style, unresolved_status = availability(dr.issue)
+    if avail == 'Unknown':
       avail = 'Not resolved'
-    avail_style = ''
-    assert dr.issue not in status_map, "have status for not-ready dr %s" % dr.issue
+      avail_style = ''
+    else:
+      assert unresolved_status == dr.status, \
+             "Issue %s is marked '%s', which 
diff ers from CWG index status '%s'" \
+             % (dr.issue, unresolved_status, dr.status)
+    if not avail.startswith('Sup') and not avail.startswith('Dup'):
+      count[avail] = count.get(avail, 0) + 1
   else:
     row_style = ''
-    avail, avail_style = availability(dr.issue)
+    avail, avail_style, unresolved_status = availability(dr.issue)
+    assert not unresolved_status, \
+           "Issue %s is marked '%s', even though it is resolved in CWG index" \
+           % (dr.issue, unresolved_status)
     if not avail.startswith('Sup') and not avail.startswith('Dup'):
       count[avail] = count.get(avail, 0) + 1
 


        


More information about the cfe-commits mailing list