[cfe-dev] Introduction and a few questions

Michael Spencer bigcheesegs at gmail.com
Tue Aug 3 13:57:38 PDT 2010


On Tue, Aug 3, 2010 at 11:50 AM, Michael Price
<michael.b.price.dev at gmail.com> wrote:
> Hi List,
> I've been developing with C++ code for the past 5 years and was introduced
> to the idea behind clang/llvm late last year.  I've been following C++0x
> developments since early 2008 however, and I am quite excited about the
> (hopefully) forthcoming standard.  I decided recently to begin making
> contributions to open-source C++ compilers to advance the implementation
> level of the new standard so that it could be more widely adopted.  Seeing
> how GCC is doing pretty good without any help (and most of the "easy")
> topics are taken, I figured I'd help out some with clang.  I understand that
> C++0x will not be a priority until the previous standards are implemented,
> but it can't hurt to have a head start on C++0x implementation, right?  With
> that out of the way, here are some questions I have:
>
> I've built llvm/clang on Windows 7 x64 with Visual C++ 2010 Express (using
> cmake to create a VS solution file).  The build succeeded with no errors.  I
> have not run the test suite yet, but would like to do that soon as I have
> some code changes that I'd like to verify with the tests before I submit a
> patch.  Does anyone have any guidance on running the tests in the
> environment I've described?

I have almost the exact same setup (2010 Ultimate). I never could get
the check projects to work, so I wrote a simple batch script to run
the tests (attached). Note that you will need to change almost every
line to get it to work with your environment. First try building
clang-test from Visual Studio. This will build the lit config that the
batch script needs. Then just put in in your root build path. You can
pass the directory (relative to clang/test) to test.

> After building, I made a simple program (no #includes, simple main()
> returning 0).  When I compiled it with the command 'clang.exe
> clangtest.cpp', clang gave the following error:
> clang: error: unable to execute command: program not executable
> clang: error: assembler (via gcc) command failed due to signal 1 (use -v to
> see invocation)
> But, if I compile it with 'clang.exe clangtest.cpp -fsyntax-only', the
> compilation succeeds.  Any ideas what is screwed up with my environment?

As Eli said, it's looking for GCC. I've attached a patch that uses the
MSVC linker. Then pass -integrated-as on the clang command line to use
the LLVMMC integrated assembler. I've tested and had this work with
hello world, but other than that it's basically untested. You may want
to use the mingw tools if this doesn't work.

> Also, if I #include any standard library headers, clang will choke, since
> the VC++10 headers are implemented with some C++0x support (and some other
> weird errors occur).  If anyone is interested in helping me with this, I'll
> post the errors.  Otherwise, some direction on how to get either GCC library
> or libc++ compiling and working on my environment would be extremely
> helpful.

Same issue here, if you get any other stdlib implementation working
please tell me.

> For my first contribution, I've decided to work on type deduction via the
> 'auto' type keyword (as opposed to the 'auto' storage-specifier :) ).  After
> looking through the code, I've found the first "half" of an implementation,
> in that the type declaration was already present.  I have some code
> implemented which will modify the type of the declared variable (similar to
> how unsized-arrays are done) based on the type of the initializer.  I still
> need to review the latest standard proposal so that I can verify I've
> covered all the cases (I doubt I have), or at least know what tests to
> create so that it can be completed at a later date.  I browsed through the
> list archive and noticed that Doug was working on an initialization rewrite,
> but I don't see the results of that anywhere in the revision that I checked
> out.  I want to make sure I don't step on any toes in there.  After I run
> the tests, I'll build a patch and send it to the list for comments.
>
> The next thing that I'm considering implementing is the new function
> declaration syntax (auto func (param1, param2) -> rettype;), as I see it as
> a building block towards implemented lambdas.  I'd also consider finishing
> off any work on rvalue-references and move-constructors instead, as those
> are extremely valuable and important pieces of the new standard library (see
> unique_ptr).
>
> Hopefully I'll be able to help out just a little and get some degree of
> C++0x support in place before the C++0x goes through the entire process to
> become the next standard.

Thanks for helping with this!

- Michael Spencer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: visual-stuido-linker.patch
Type: application/octet-stream
Size: 9680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100803/e91179cf/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run-clang-tests.thisisactuallyabatfilebutgmailisstupid
Type: application/octet-stream
Size: 563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100803/e91179cf/attachment-0001.obj>


More information about the cfe-dev mailing list