When writing C++ code, I often start by writing full \'implementation\' code in my header files, then later need to refactor the implementation into a .cpp file.
Th
C++20 modules essentially do that for us
As mentioned at: https://quuxplusone.github.io/blog/2019/11/07/modular-hello-world/ clang 2019-11 implements it along:
clang++ -std=c++2a -c helloworld.cpp -Xclang -emit-module-interface -o helloworld.pcm
clang++ -std=c++2a -c -fprebuilt-module-path=. -o helloworld.o helloworld.cpp
clang++ -std=c++2a -fprebuilt-module-path=. -o main.out main.cpp helloworld.o
where:
helloworld.cpp
contains the implementationhelloworld.pcm
is a precompiled module, basically an auto-extracted header from the .cpp
(but in a clang internal language format) which gets used by main.cpp
without an .hpp
So basically clang is the tool, and thus parsing is perfect.