[cfe-dev] add namespaces to C (in my local clang) OR "tag" a couple of functions

Jonas Gefele jonas at gefele.de
Sun Oct 23 23:14:48 PDT 2011


Hi,

> I can understand now why you don't want to compile as C++.  But I
> suggest you do it anyway from time to time, "When No One Is Looking".
> Adding C-Style Casts won't hurt your C.  Several years down the road
> you could surprise everyone that your C code suddenly builds as C++.

Unfortunately, I maintain the compiler but not the sources the compiler
should compile :)


> But a shorter-term possibility is that I understand CLang can be used
> to edit C source code in various ways
...
> Suppose you had the following C+Namespaces source:
...
> After being preprocessed somehow it would look like:

Sure, but I would already have clang to be able to parse "C+Namespaces"
which leads me back to my original problem:

Is it possible to change some "if(LangOpts.CPlusPlus)" into
"if(LangOpts.CPlusPlus || LangOpts.CWithNameSpace)" in the right places to
enable a "C+namespaces mode" or would this be a more complex problem?

Cheers,
Jonas




More information about the cfe-dev mailing list