[cfe-dev] RFC: Clang driver redesign

David Chisnall csdavec at swan.ac.uk
Tue Nov 8 09:16:01 PST 2011


On 8 Nov 2011, at 16:50, Jean-Daniel Dupas wrote:

> As previously suggested in this discussion, I think it could be even better if clang can decide if it uses C or C++ mode not only based on the driver name, but also based on the compiled file language.
> 
> clang -o hello hello.cpp
> 
> should not result in nasty linker errors as it already knows it is compiling c++.

You'll still encounter problems if you do:

clang -c hello.cpp
clang -o hello hello.o

Which is what even a trivial Makefile of the form that students are usually expected to submit in their first C or C++ assignment will do if you use clang instead of clang++ for linking.  With your suggestion, it actually becomes worse, because now clang does work for linking C++ in some cases, but not in others.  

David



More information about the cfe-dev mailing list