Introduction and a few questions

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?

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?

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.

For my first contribution, I’ve decided to work on type deduction via the ‘auto’ type keyword (as opposed to the ‘auto’ storage-specifier :slight_smile: ). 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.

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?

clang requires an assembler (for the moment) and linker, can't use the
MSVC assembler, and doesn't know how to use the MSVC linker. The
workaround is to download mingw and put it in your path. There's work
in progress which will allow everything to just work without gcc
installed, but it's not stable yet.

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.

If you can find a mingw gcc 4.2, the headers should be usable if you
get the include paths configured correctly. You can hack up
lib/Frontend/InitHeaderSearch.cpp to change the default include paths.

For my first contribution, I've decided to work on type deduction via the
'auto' type keyword (as opposed to the 'auto' storage-specifier :slight_smile: ). 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.

Initialization code on the trunk is stable; feel free to submit any changes.

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.

Cool.

-Eli

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 :slight_smile: ). 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

visual-stuido-linker.patch (9.45 KB)

run-clang-tests.thisisactuallyabatfilebutgmailisstupid (563 Bytes)