[llvm-dev] clang -xc++ foo.o

Jay K via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 23 17:24:28 PDT 2018


Easier said than done, given the layers of build system (automake). :(


 - Jay



________________________________
From: Justin Bogner
Sent: Thursday, August 23, 2018 9:17 PM
To: Jay K via llvm-dev
Cc: Jay K
Subject: Re: [llvm-dev] clang -xc++ foo.o

Jay K via llvm-dev <llvm-dev at lists.llvm.org> writes:
> clang -xc++ -c 1.c 2.c
>
> clang -xc++ main.c 1.o 2.o
> 1.o:1:1: error: source file is not valid UTF-8
>
> Would be nice, albeit I realize kinda proby/non-deterministic/big, if
> .o files were recognized and -xc++ did not apply to them.

The -x flags only apply to files later on the command line than they
are, so this works:

clang -xc++ -c 1.c 2.c
clang 1.o 2.o -xc++ main.c

You may also be able to switch back to autodetection with -xnone, though
I haven't tried this:

clang -xc++ -c 1.c 2.c
clang -xc++ main.c -xnone 1.o 2.o

> I'm converting C to C++ and don't want to rename files, at least at
> this point, maybe forever.
>
> For now I've compromised and main remains C. It is much smaller than
> the various libraries, so -xc++ is almost a complete solution.
>
>  Thank you,
>  - Jay
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180824/d603f6d0/attachment.html>


More information about the llvm-dev mailing list