[libcxx-commits] [libcxx] [libc++] Allow the use of extensions in the implementation (PR #79532)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 14 08:33:33 PDT 2024


philnik777 wrote:

> My approximate understanding is that any query of diagnostic overrides ends up loading all the mappings (which is a bunch of work), and in order to understand the region they apply to it has to page in source-level information (since they are source-location based). Maybe this can be fixed eventually in clang, but we need some solution meanwhile.
> 
> @philnik777 thanks for the context!
> 
> > I'm pretty sure I've checked compile times before and after and didn't see any significant regression
> 
> (I would assume this is using libc++ textually rather than as modules, but just want to check)

Yes. I did not at all expect there to be a significant difference between normal header inclusion and clang modules.

> > We're already depending on this in parts of the code base. IMO we should fix forward instead if this is actually a problem with this approach.
> 
> Can you tell me how to check how much would break? (I know how to test llvm but not libcxx specifically). As a short-term fix, we could enable extensions for just those regions/files until we find a way to do it globally that scales well.

You should be able to run the test suite with `ninja check-libcxx`.

> > I've done it this way to avoid introducing extensions in the test suite, since that shouldn't be using extensions as much as possible as a conformance test suite and it's used by other implementations
> 
> It seems nice to enforce this, but if we can't revert and there isn't another obvious fix-forward, is it possible to live without this enforcement? Or move the pragmas out of libc++ proper and into the testsuite?

I'd really like to avoid not enforcing this, since I expect there to be a significant amount of clean-up to pile up over a few months, maybe even making it almost prohibitive to revert. I also don't see a way to move the pragmas to the test suite.

While it's not pretty, I think we could disable the pragmas when using clang modules with `#if __has_feature(modules)`. We already suppress all diagnostics in the modules configuration anyways. Since the problem seems to be modules-specific this should make everyone happy. WDYT?


https://github.com/llvm/llvm-project/pull/79532


More information about the libcxx-commits mailing list