cxx-modules-sandbox
cxx-modules-sandbox copied to clipboard
More use cases
Some other use cases to add to this repository that I've mentioned elsewhere (Slack or Reddit):
- [x] generated sources
- [x] code that can confuse naïve scanners:
const char* foo = "
#include <vector>
import M;
";
- [x] module names expanded from macros (import and export)
- [x] module names expanded from macros on the command line (import and export)
- [ ] overlapping file basenames (
foo.mppandfoo.cpp)
I think to be conforming, that example would need to use a `R"(raw string)" since it spans multiple lines. I'd also make it use names that don't exist so it can't accidentally work.
Also missing is a test of importing a module from inside a non-translated #included header.
Should have a test with attributes like import foo [[ns::a]] [[ns::b]];. Could be really evil and do import foo [[ns::evil("]]")]]; to break regexes that try to match attributes like import\s+((\w+)(\s*\.\s*\w+)*) *(\[\[[^\]]*\]\] *)*; .
#define NO_SUCH_MODULE <some_header.h>
import NO_SUCH_MODULE;
Should be handled as a header unit import of <some_header.h> rather than importing a module named NO_SUCH_MODULE.
We also have the line continuation splits after @boris-kolpackov's paper. A few existing examples may now be ill-formed after that as well.