[PATCH] D136953: [C++20] Diagnose invalid and reserved module names

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 28 08:25:42 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/lib/Sema/SemaModule.cpp:257
+    else if (PartName.startswith("std") &&
+             (PartName.size() == 3 || isDigit(PartName.drop_front(3)[0])))
+      Reason = /*reserved*/ 1;
----------------
cor3ntin wrote:
> erichkeane wrote:
> > aaron.ballman wrote:
> > > cor3ntin wrote:
> > > > 
> > > lol but my way is so much more complicated, so it must be more right... ;-)
> > Is this logic right?  By my reading of the standard, 
> > 
> > `export module stdFoo.bar` << fine
> > `export module std00Foo.bar` << fine
> > 
> > as neither  'consist of std followed by zero or more digits'.
> > 
> > This patch looks like it'll only allow the 1st, but not the 2nd.  
> I've been wondering the same, I think the standard is a bit confusing in that regard.
> `std00Foo` is "std followed by 0 or more digit".
> 
But it isn't 'consisting' of that, it is consisting of std, 0 or more digits, then 'Foo'.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136953/new/

https://reviews.llvm.org/D136953



More information about the cfe-commits mailing list