Compare commits

...

38 Commits

Author SHA1 Message Date
Tanya Lattner
bc12345cbe Merge r143770 from mainline to fix MSVC build.
llvm-svn: 144894
2011-11-17 07:40:32 +00:00
Bill Wendling
1b871840be Merging r142531:
------------------------------------------------------------------------
r142531 | rafael | 2011-10-19 07:50:34 -0700 (Wed, 19 Oct 2011) | 3 lines

Fix the signatures of vfork, __sigsetjmp and sigsetjmp.

Patch by Dimitry Andric.
------------------------------------------------------------------------

llvm-svn: 144262
2011-11-10 04:22:48 +00:00
Bill Wendling
a7d131fb47 Merging r143712:
------------------------------------------------------------------------
r143712 | efriedma | 2011-11-04 10:29:35 -0700 (Fri, 04 Nov 2011) | 3 lines

Add missing argument for atomic instructions in c++ backend.  PR11268, part 2.


------------------------------------------------------------------------

llvm-svn: 143999
2011-11-07 19:38:25 +00:00
Bill Wendling
0fbdb0ad4a Merging r143406:
------------------------------------------------------------------------
r143406 | efriedma | 2011-10-31 16:59:22 -0700 (Mon, 31 Oct 2011) | 3 lines

Add support for new atomics to cpp backend.  Misc other fixes while I'm here.  PR11268.


------------------------------------------------------------------------

llvm-svn: 143998
2011-11-07 19:38:01 +00:00
Chandler Carruth
5e5ca787a3 Merging r143917:
------------------------------------------------------------------------
r143917 | chandlerc | 2011-11-07 01:17:31 -0800 (Mon, 07 Nov 2011) | 12 lines

Rip out one of the features I added for the driver-include-management.
We don't actually need a separate flag for non-sysrooted paths as the
driver has to manage the sysroot anyways. The driver is not infrequently
adding paths to the header search based on their existence on the
filesystem. For that, it has to add the sysroot anyways, we should pass
it on down to CC1 already joined. More importantly, the driver cannot in
all cases distinguish between sysrooted paths and paths that are
relative to the Clang binary's installation directory. Essentially, we
always need to ignore the system root for these internal header search
options. It turns out in most of the places we were already providing
the system root in the driver, and then another one in CC1 so this fixes
several bugs.
------------------------------------------------------------------------

llvm-svn: 143956
2011-11-07 10:45:21 +00:00
Chandler Carruth
de9c697e1a Merging r143916:
------------------------------------------------------------------------
r143916 | chandlerc | 2011-11-07 01:01:17 -0800 (Mon, 07 Nov 2011) | 4 lines

Fix Linux libc++ usage. Somehow this slipped through during the port.

Test cases for this and all the rest of the port are still in the works,
but will wait for a fixed computer and post 3.0 merging...
------------------------------------------------------------------------

llvm-svn: 143955
2011-11-07 10:44:38 +00:00
Chandler Carruth
02591c29cf Merging r143897:
------------------------------------------------------------------------
r143897 | chandlerc | 2011-11-06 15:10:49 -0800 (Sun, 06 Nov 2011) | 2 lines

Remove an old OpenSUSE hack that is no longer needed -- it is exactly
the same as a directory added further down in the new logic.
------------------------------------------------------------------------

llvm-svn: 143954
2011-11-07 10:43:59 +00:00
Chandler Carruth
ce9034fb11 Merging r143896:
------------------------------------------------------------------------
r143896 | chandlerc | 2011-11-06 15:09:05 -0800 (Sun, 06 Nov 2011) | 3 lines

Remove the HasMultilib check. It was essentially useless. The driver now
looks for evidence of a multilib installation, and adds the appropriate
bits to the search paths.
------------------------------------------------------------------------

llvm-svn: 143953
2011-11-07 10:43:26 +00:00
Chandler Carruth
5aaaf48c94 Merging r143875:
------------------------------------------------------------------------
r143875 | chandlerc | 2011-11-06 02:51:30 -0800 (Sun, 06 Nov 2011) | 2 lines

The version objects need to actually store the version strings; they
aren't guaranteed to live long enough otherwise.
------------------------------------------------------------------------

llvm-svn: 143952
2011-11-07 10:41:56 +00:00
Chandler Carruth
f1c66f598f Merging r143874:
------------------------------------------------------------------------
r143874 | chandlerc | 2011-11-06 02:31:01 -0800 (Sun, 06 Nov 2011) | 16 lines

Throw the switch and move all Linux header search over to the GCC
detection system that is providing the library paths and crt object
files.

This, modulo any bugs that need to be shaken out, resolves numerous bugs
with how we handle header paths. Here are a few that I know of:
- We no longer need to enumerate all GCC versions searched.
- OpenSUSE searched GCC versions in the wrong order.
- There were typos when selecting various patterns, etc.
- We aren't stating quite some many directories now.
- SysRoot didn't always work in a reasonable way.

I'm working on tests for this, but the tests are making me and Lit sad.
The real testing for this type of driver change is to try it out on
various distributions. I'll hit the common ones right away, and start
more thorough testing tomorrow after some sleep.
------------------------------------------------------------------------

llvm-svn: 143951
2011-11-07 10:40:53 +00:00
Chandler Carruth
afa0e6fb42 Merging r143873:
------------------------------------------------------------------------
r143873 | chandlerc | 2011-11-06 02:30:58 -0800 (Sun, 06 Nov 2011) | 2 lines

Add a missing triple spotted by inspecting and testing of the include
path triples. Also order the 32-bit triples a bit more reasonably.
------------------------------------------------------------------------

llvm-svn: 143949
2011-11-07 10:40:08 +00:00
Chandler Carruth
c954a30696 Merging r143871:
------------------------------------------------------------------------
r143871 | chandlerc | 2011-11-06 01:39:46 -0800 (Sun, 06 Nov 2011) | 3 lines

Lift the GCCVersion type into the header file and start persisting it in
the detected GCC installation. This allows us to expose another aspect
of what we detected: the GCC version. This will be used shortly.
------------------------------------------------------------------------

llvm-svn: 143948
2011-11-07 10:39:29 +00:00
Chandler Carruth
421c8baa5f Merging r143869:
------------------------------------------------------------------------
r143869 | chandlerc | 2011-11-06 01:21:54 -0800 (Sun, 06 Nov 2011) | 2 lines

Switch some of these interfaces from std::string to StringRef and Twine.
This will facilitate further use and recombinations of them.
------------------------------------------------------------------------

llvm-svn: 143947
2011-11-07 10:38:50 +00:00
Chandler Carruth
9cab0c3e89 Merging r143866:
------------------------------------------------------------------------
r143866 | chandlerc | 2011-11-06 01:21:07 -0700 (Sun, 06 Nov 2011) | 4 lines

Take a better approach to detecting and selecting multiarch include
directories. This way we stop at the first multiarch directory found on
the system. This achieves the real intended result of pruning
non-existent directories.
------------------------------------------------------------------------

llvm-svn: 143946
2011-11-07 10:34:06 +00:00
Chandler Carruth
69c35faa45 Merging r143863:
------------------------------------------------------------------------
r143863 | chandlerc | 2011-11-05 23:59:15 -0700 (Sat, 05 Nov 2011) | 4 lines

This test was assuming that /usr/include was in the system header search
path. That assumption should never have been true, but it was until
I fixed it. Now that its fixed, add a triple here to get correct
behavior even on Windows.
------------------------------------------------------------------------

llvm-svn: 143945
2011-11-07 10:33:32 +00:00
Chandler Carruth
ae95127c7e Merging r143842:
------------------------------------------------------------------------
r143842 | chandlerc | 2011-11-05 16:29:28 -0700 (Sat, 05 Nov 2011) | 3 lines

Switch Lit to directly query the driver for the builtin inclue path.
Thanks to Peter for pointing out how easy this is to do. I'm now much
happier with this solution.
------------------------------------------------------------------------

llvm-svn: 143944
2011-11-07 10:32:55 +00:00
Chandler Carruth
c1c82eee94 Merging r143841:
------------------------------------------------------------------------
r143841 | chandlerc | 2011-11-05 16:24:30 -0700 (Sat, 05 Nov 2011) | 22 lines

Enhance the GCC version parsing and comparison logic to handle some more
edge cases and have better behavior. Specifically, we should actually
prefer the general '4.6' version string over the '4.6.1' string, as
'4.6.2' should be able to replace it without breaking rpaths or any
other place that these paths have been embedded. Debian-based
distributions are already using a path structure with symlinks to
achieve in-place upgrades for patch versions. Now our parsing reflects
this and we select the shorter paths instead of the longer paths.

A separate issue was that we would not parse a leading patch version
number even in the presence of a suffix. The above change makes this
more problematic as it would cause a suffix being added to make us treat
the entire thing as patch-version-agnostic, which it isn't. This changes
the logic to distinguish between '4.4.x' and 4.4.1-x', and retain that
the latter has *some* patch number information. Currently, we always
bias toward the shorter and more canonical version strings. If it
becomes important we can add more Debian like rules to produce sequences
such as '4.4.1b' > '4.4.1' > '4.4.1-rc3' > '4.4.1-rc2' > '4.4.1-pre5',
but I'm very doubtful this will ever matter or be desirable.

I've made the tests for this logic a bit more interesting, and added
some specific tests for logic that is now different.
------------------------------------------------------------------------

llvm-svn: 143943
2011-11-07 10:32:20 +00:00
Chandler Carruth
9eeddcf338 Merging r143840:
------------------------------------------------------------------------
r143840 | chandlerc | 2011-11-05 15:23:14 -0700 (Sat, 05 Nov 2011) | 4 lines

Remove a pointless member. I have no idea why I made this not a local
variable to begin with... As I'm planning to add include root
information to this object, this would have caused confusion. It didn't
even *actually* hold the include root by the time we were done with it.
------------------------------------------------------------------------

llvm-svn: 143942
2011-11-07 10:31:25 +00:00
Chandler Carruth
8d9c0888e2 Merging r143839:
------------------------------------------------------------------------
r143839 | chandlerc | 2011-11-05 15:23:11 -0700 (Sat, 05 Nov 2011) | 2 lines

Remove a no-longer needed helper function. Thanks for implementing this
Michael!
------------------------------------------------------------------------

llvm-svn: 143941
2011-11-07 10:30:25 +00:00
Chandler Carruth
bec38f0dc6 Merging r143838:
------------------------------------------------------------------------
r143838 | chandlerc | 2011-11-05 15:07:51 -0700 (Sat, 05 Nov 2011) | 10 lines

Move the GCC installation detection helper a member of the Linux
toolchain instead of merely using it in the constructor. This will allow
us to query it when building include paths as well as the file search
paths built in the constructor. I've lifted as little of it as I could
into the header file.

Eventually this will likely sink down into some of the Generic
toolchains and be used on more platforms, but I'm starting on Linux so
I can work out all the APIs needed there, where it is easiest to test
and we have the most pressing need.
------------------------------------------------------------------------

llvm-svn: 143940
2011-11-07 10:29:29 +00:00
Chandler Carruth
246dabacf2 Merging r143836:
------------------------------------------------------------------------
r143836 | chandlerc | 2011-11-05 14:26:18 -0700 (Sat, 05 Nov 2011) | 5 lines

Remove support for Gentoo subversion-ebuild installed llvm-gcc libstdc++
headers. As llvm-gcc is dead, and I have no idea if this ever really
worked, I think it's time for it to go. More importantly, it makes it
harder to generalize the include search logic. If someone really wants
these to work, they can set the CPLUS_INCLUDE_PATH environment variable.
------------------------------------------------------------------------

llvm-svn: 143939
2011-11-07 10:28:49 +00:00
Chandler Carruth
5fe100a8b5 Merging r143823:
------------------------------------------------------------------------
r143823 | chandlerc | 2011-11-05 13:55:50 -0700 (Sat, 05 Nov 2011) | 4 lines

Teach lit to ask the Clang it is running what version string to use
rather than presuming that it is 3.0. This is extra important as the
version should be 3.1, but CMake hasn't caught up with the times.
That'll be fixed in a separate commit.
------------------------------------------------------------------------

llvm-svn: 143938
2011-11-07 10:28:08 +00:00
Chandler Carruth
7507b8d3dc Merging r143822:
------------------------------------------------------------------------
r143822 | chandlerc | 2011-11-05 13:17:13 -0700 (Sat, 05 Nov 2011) | 12 lines

Move the Linux header searching from the Frontend to the Driver. This is
the first (and diff-noisiest) step to making Linux header searching
tremendously more principled and less brittle. Note that this step
should have essentially no functional impact. We still search the exact
same set of paths in the exact same order. The only change here is where
the code implementing such a search lives.

This has one obvious negative impact -- we now pass a ludicrous number
of flags to the CC1 layer. That should go away as I re-base this logic
on the logic to detect a GCC installation. I want to do this in two
phases so the bots can tell me if this step alone breaks something, and
so that the diffs of the refactoring make more sense.
------------------------------------------------------------------------

llvm-svn: 143937
2011-11-07 10:27:39 +00:00
Chandler Carruth
36cbea60ff Merging r143807:
------------------------------------------------------------------------
r143807 | chandlerc | 2011-11-05 03:41:42 -0700 (Sat, 05 Nov 2011) | 4 lines

Compute the path properly on different platforms. Specifically, compute
it the exact same way that the Clang code computes this path.

Hopefully with this, the MSVC bots will actually come back to life.
------------------------------------------------------------------------

llvm-svn: 143936
2011-11-07 10:21:56 +00:00
Chandler Carruth
4e61d20111 Merging r143806:
------------------------------------------------------------------------
r143806 | chandlerc | 2011-11-05 03:15:33 -0700 (Sat, 05 Nov 2011) | 15 lines

Change this test to reflect the state we are moving in. The Clang
builtin headers are no longer going to receive the old 'implicit extern
"C" block' semantics. This hint is actually ignored by both Clang and
GCC at this point, and Clang's own builtin headers can simply be changed
if there is any issue with this. Clang should be free to include these
however it wants, and so shorter and simpler is better.

Note: *nothing* is changing about the *system* stddef.h include. That
should always have the exact same include semantics, whether with Clang
or GCC or any other compiler. Only the compiler-builtin header search
path is changing.

If anyone knows of some risk that this introduces that I've not thought
of, please chime in. So far, only Windows has switched to the Brave New
World, but others should be switching soon.
------------------------------------------------------------------------

llvm-svn: 143935
2011-11-07 10:21:27 +00:00
Chandler Carruth
c71ec93cfd Merging r143805:
------------------------------------------------------------------------
r143805 | chandlerc | 2011-11-05 03:15:30 -0700 (Sat, 05 Nov 2011) | 4 lines

Switch these two tests to use the Clang driver instead of CC1. They want
to do "realistic" includes, and so need the header search logic now in
the driver. This in turn requires switching the CC1 options to the
actual driver options, and passing -Xclang where there is no analogy.
------------------------------------------------------------------------

llvm-svn: 143934
2011-11-07 10:20:49 +00:00
Chandler Carruth
1e38f1d014 Merging r143804:
------------------------------------------------------------------------
r143804 | chandlerc | 2011-11-05 03:15:27 -0700 (Sat, 05 Nov 2011) | 38 lines

Teach Lit to pass the CC1 invocation the builtin include directory. This
is a pretty gross hack, but I don't have any significantly cleaner ideas
for this. There are several things obviously gross about it:

1) Lit shouldn't know that Clang needs this. This really that bad, as
   Lit already knows about CC1 and other internal details.
2) This hard codes the '3.0' version number, which is pretty lame.
3) This hard codes every other aspect of the resource dir structure
   which is less lame than the version number, but still not great.

However, it should bring the MSVC tests back to life, and it should
unblock the rest of the move from Frontend to Driver, so I think it's
worth a bit of grossness that is isolated in our testing infrastructure
while we figure out the best long term approach. I have the following
ideas, some of which only solve part of the problem (and thus might need
to be combined with other ideas):

a) Create a symlink or other convenience path instead of a version
   number.
b) Run 'clang' directly in the lit.cfg, look at its resource dir, and use
   that.
c) Switch all the tests to use the driver instead of CC1.
d) Hack the frontend to synthesize builtin include directories when none
   are provided by the driver.

I don't like (d) because it feels very hackish and likely to break. We
can only solve a small part of the problem with (a). I wanted to vote
for (c), but lots of the tests in this bucket are really heavily using
internal-only flags like -verify and -triple. I'm loath to complicate
them with the full driver layer. Also, switching them to the driver adds
more than just builtin headers, but all of the rest of the system
headers!

This leaves me with (b). If others like (b), I'll switch to it, but it
felt a bit icky. Nothing concrete, and the other options look
significantly worse, but I felt icky enough that I wanted to start with
a more brain-dead patch to stop the bleeding, and gauge others' feelings
here.
------------------------------------------------------------------------

llvm-svn: 143933
2011-11-07 10:20:16 +00:00
Chandler Carruth
4fb21f4bd6 Merging r143801:
------------------------------------------------------------------------
r143801 | chandlerc | 2011-11-05 02:24:44 -0700 (Sat, 05 Nov 2011) | 20 lines

Fix a significant oversight in my move of MSVC includes to the driver:
actually manage the builtin header file includes as well as the system
ones.

This one is actually debatable whether it belongs in the driver or not,
as the builtin includes are really an internal bit of implementation
goop for Clang. However, they must be included at *exactly* the right
point in the sequence of header files, which makes it essentially
impossible to have this be managed by the Frontend and the rest by the
Driver. I have terrible ideas that would "work", but I think they're
worse than putting this in the driver and making the Frontend library
even more ignorant of the environment and system on which it is being
run.

Also fix the fact that we weren't properly respecting the flags which
suppress standard system include directories.

Note that this still leaves all of the Clang tests which run CC1
directly and include builtin header files broken on Windows. I'm working
on a followup patch to address that.
------------------------------------------------------------------------

llvm-svn: 143932
2011-11-07 10:19:48 +00:00
Chandler Carruth
c0b5d07324 Merging r143798:
------------------------------------------------------------------------
r143798 | chandlerc | 2011-11-05 01:30:29 -0700 (Sat, 05 Nov 2011) | 16 lines

Add two flags to the CC1 layer that I was hoping to avoid. We need to
encode the *exact* semantics which the header search paths internally
built by the Frontend layer have had, which is both non-user-provided,
and at times adding the implicit extern "C" bit to the directory entry.

There are lots of CC1 options that are very close, but none do quite
this, and they are all already overloaded for other purposes. In some
senses this makes the command lines more clean as it clearly indicates
which flags are exclusively used to implement internal detection of
"standard" header search paths.

Lots of the implementation of this is really crufty, due to the
surrounding cruft. It doesn't seem worth investing lots of time cleaning
this up as it isn't new, and hopefully *lots* of this code will melt
away as header search inside of the frontend becomes increasingly
trivial.
------------------------------------------------------------------------

llvm-svn: 143931
2011-11-07 10:18:59 +00:00
Chandler Carruth
720a948f4c Merging r143752:
------------------------------------------------------------------------
r143752 | chandlerc | 2011-11-04 16:49:05 -0700 (Fri, 04 Nov 2011) | 5 lines

Begin the migration of header search logic to the driver, starting with
Windows. There are still FIXMEs and lots of problems with this code.
Some of them will be addressed shortly by my follow-up patches, but most
are going to wait until we isolate this code and can fix it properly.
This version should be no worse than what we had before.
------------------------------------------------------------------------

llvm-svn: 143930
2011-11-07 10:15:39 +00:00
Chandler Carruth
2d8f608f6c Merging r143751:
------------------------------------------------------------------------
r143751 | chandlerc | 2011-11-04 16:49:01 -0700 (Fri, 04 Nov 2011) | 3 lines

Switch the C++ include interface in the ToolChain to use the same naming
as the system include interface before I start adding implementations of
it to individual ToolChain implementations.
------------------------------------------------------------------------

llvm-svn: 143929
2011-11-07 10:15:01 +00:00
Chandler Carruth
3854a32832 Merging r143687:
------------------------------------------------------------------------
r143687 | chandlerc | 2011-11-04 00:43:33 -0700 (Fri, 04 Nov 2011) | 16 lines

Sink the strange '-stdlib=...' flag handling into the C++ include
handling logic of the generic ToolChain. This flag, despite its name,
has *nothing* to do with the GCC flag '-nostdlib' that relates
(exclusively) to the linking behavior. It is a most unfortunate name in
that regard...

It is used to tell InitHeaderSearch.cpp *which* set of C++ standard
library header search paths to use -- those for libstdc++ from GCC's
installation, or those from a libc++ installation. As this logic is
hoisted out of the Frontend, and into the Driver as part of this
ToolChain, the generic method will be overridden for the platform, where
it can implement this logic directly. As such, hiding the CC1 option
passing in the generic space is a natural fit despite the odd naming.

Also, expand on the comments to clarify whats going on, and tidy up the
Tools.cpp code now that its simpler.
------------------------------------------------------------------------

llvm-svn: 143928
2011-11-07 10:13:50 +00:00
Chandler Carruth
35d7d54446 Merging r143686:
------------------------------------------------------------------------
r143686 | chandlerc | 2011-11-04 00:34:47 -0700 (Fri, 04 Nov 2011) | 4 lines

Sink the handling of -fobjc-arc-cxxlib to live with the other -fobjc-arc
implementation in the driver. This cleans up the signature and semantics
of the include flag adding component of the toolchain. Another step to
ready it for holding all the InitHeaderSearch logic.
------------------------------------------------------------------------

llvm-svn: 143927
2011-11-07 10:12:59 +00:00
Chandler Carruth
58d9326bad ------------------------------------------------------------------------
r143684 | chandlerc | 2011-11-04 00:12:53 -0700 (Fri, 04 Nov 2011) | 7 lines

Add a system include management interface to the toolchain, and call it
and the C++ include management routine from the proper place when
forming preprocessor options in the driver. This is the first step to
teaching the driver to manage all of the header search paths. Currently,
these methods remain just stubs in the abstract toolchain. Subsequent
patches will flesh them out with implementations for various toolchains
based on the current code in InitHeaderSearch.cpp.
------------------------------------------------------------------------

llvm-svn: 143926
2011-11-07 10:07:22 +00:00
Bill Wendling
90ba37cff6 Merging r143159:
------------------------------------------------------------------------
r143159 | efriedma | 2011-10-27 15:32:13 -0700 (Thu, 27 Oct 2011) | 3 lines

The default alias analysis is -noaa; update the docs to reflect that.  Patch by Michael Ilseman.


------------------------------------------------------------------------

llvm-svn: 143681
2011-11-04 06:30:50 +00:00
Bill Wendling
5eafd41d83 Merging r143349:
------------------------------------------------------------------------
r143349 | chapuni | 2011-10-31 06:04:26 -0700 (Mon, 31 Oct 2011) | 1 line

docs/*.html: Fix markups.
------------------------------------------------------------------------

llvm-svn: 143610
2011-11-03 06:43:54 +00:00
Bill Wendling
75981ed191 Merging r143348:
------------------------------------------------------------------------
r143348 | chapuni | 2011-10-31 04:21:59 -0700 (Mon, 31 Oct 2011) | 1 line

docs/*.html: Appease W3C Checker to add "charset=utf-8".
------------------------------------------------------------------------

llvm-svn: 143609
2011-11-03 06:43:23 +00:00
Bill Wendling
e8bdd73f80 Merging r143328:
------------------------------------------------------------------------
r143328 | nicholas | 2011-10-30 18:32:21 -0700 (Sun, 30 Oct 2011) | 2 lines

Close <div> that was indenting the rest of the page.

------------------------------------------------------------------------

llvm-svn: 143608
2011-11-03 06:42:43 +00:00
54 changed files with 1090 additions and 882 deletions

View File

@@ -672,16 +672,16 @@ LIBBUILTIN(rindex, "c*cC*i", "f", "strings.h", ALL_LANGUAGES)
LIBBUILTIN(bzero, "vv*z", "f", "strings.h", ALL_LANGUAGES)
// POSIX unistd.h
LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_LANGUAGES)
LIBBUILTIN(vfork, "iJ", "fj", "unistd.h", ALL_LANGUAGES)
LIBBUILTIN(vfork, "i", "fj", "unistd.h", ALL_LANGUAGES)
// POSIX setjmp.h
// In some systems setjmp is a macro that expands to _setjmp. We undefine
// it here to avoid having two identical LIBBUILTIN entries.
#undef setjmp
LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(__sigsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(__sigsetjmp, "iJi", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(sigsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(sigsetjmp, "iJi", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(setjmp_syscall, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(qsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)

View File

@@ -642,6 +642,17 @@ def isystem : JoinedOrSeparate<"-isystem">, MetaVarName<"<directory>">,
def iwithsysroot : JoinedOrSeparate<"-iwithsysroot">,MetaVarName<"<directory>">,
HelpText<"Add directory to SYSTEM include search path, "
"absolute paths are relative to -isysroot">;
def internal_isystem : JoinedOrSeparate<"-internal-isystem">,
MetaVarName<"<directory>">,
HelpText<"Add directory to the internal system include search path; these "
"are assumed to not be user-provided and are used to model system "
"and standard headers' paths.">;
def internal_externc_isystem : JoinedOrSeparate<"-internal-externc-isystem">,
MetaVarName<"<directory>">,
HelpText<"Add directory to the internal system include search path with "
"implicit extern \"C\" semantics; these are assumed to not be "
"user-provided and are used to model system and standard headers' "
"paths.">;
def iprefix : JoinedOrSeparate<"-iprefix">, MetaVarName<"<prefix>">,
HelpText<"Set the -iwithprefix/-iwithprefixbefore prefix">;
def iwithprefix : JoinedOrSeparate<"-iwithprefix">, MetaVarName<"<dir>">,

View File

@@ -195,15 +195,21 @@ public:
/// FIXME: this really belongs on some sort of DeploymentTarget abstraction
virtual bool hasBlocksRuntime() const { return true; }
/// \brief Add the clang cc1 arguments for system include paths.
///
/// This routine is responsible for adding the necessary cc1 arguments to
/// include headers from standard system header directories.
virtual void AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const;
// GetCXXStdlibType - Determine the C++ standard library type to use with the
// given compilation arguments.
virtual CXXStdlibType GetCXXStdlibType(const ArgList &Args) const;
/// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
/// the include paths to use for the given C++ standard library type.
virtual void AddClangCXXStdlibIncludeArgs(const ArgList &Args,
ArgStringList &CmdArgs,
bool ObjCXXAutoRefCount) const;
virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const;
/// AddCXXStdlibLibArgs - Add the system specific linker arguments to use
/// for the given C++ standard library type.

View File

@@ -49,10 +49,24 @@ public:
/// path.
unsigned IgnoreSysRoot : 1;
/// \brief True if this entry is an internal search path.
///
/// This typically indicates that users didn't directly provide it, but
/// instead it was provided by a compatibility layer for a particular
/// system. This isn't redundant with IsUserSupplied (even though perhaps
/// it should be) because that is false for user provided '-iwithprefix'
/// header search entries.
unsigned IsInternal : 1;
/// \brief True if this entry's headers should be wrapped in extern "C".
unsigned ImplicitExternC : 1;
Entry(StringRef path, frontend::IncludeDirGroup group,
bool isUserSupplied, bool isFramework, bool ignoreSysRoot)
bool isUserSupplied, bool isFramework, bool ignoreSysRoot,
bool isInternal, bool implicitExternC)
: Path(path), Group(group), IsUserSupplied(isUserSupplied),
IsFramework(isFramework), IgnoreSysRoot(ignoreSysRoot) {}
IsFramework(isFramework), IgnoreSysRoot(ignoreSysRoot),
IsInternal(isInternal), ImplicitExternC(implicitExternC) {}
};
/// If non-empty, the directory to use as a "virtual system root" for include
@@ -98,9 +112,10 @@ public:
/// AddPath - Add the \arg Path path to the specified \arg Group list.
void AddPath(StringRef Path, frontend::IncludeDirGroup Group,
bool IsUserSupplied, bool IsFramework, bool IgnoreSysRoot) {
bool IsUserSupplied, bool IsFramework, bool IgnoreSysRoot,
bool IsInternal = false, bool ImplicitExternC = false) {
UserEntries.push_back(Entry(Path, Group, IsUserSupplied, IsFramework,
IgnoreSysRoot));
IgnoreSysRoot, IsInternal, ImplicitExternC));
}
};

View File

@@ -21,5 +21,13 @@ add_clang_library(clangDriver
Types.cpp
)
IF(MSVC)
get_target_property(NON_ANSI_COMPILE_FLAGS clangDriver COMPILE_FLAGS)
string(REPLACE /Za
"" NON_ANSI_COMPILE_FLAGS
${NON_ANSI_COMPILE_FLAGS})
set_target_properties(clangDriver PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
ENDIF(MSVC)
add_dependencies(clangDriver ClangAttrList ClangDiagnosticDriver
ClangDriverOptions ClangCC1Options ClangCC1AsOptions)

View File

@@ -211,6 +211,11 @@ std::string ToolChain::ComputeEffectiveClangTriple(const ArgList &Args,
return ComputeLLVMTriple(Args, InputType);
}
void ToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
// Each toolchain should provide the appropriate include flags.
}
ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
StringRef Value = A->getValue(Args);
@@ -225,24 +230,18 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
return ToolChain::CST_Libstdcxx;
}
void ToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &Args,
ArgStringList &CmdArgs,
bool ObjCXXAutoRefCount) const {
CXXStdlibType Type = GetCXXStdlibType(Args);
// Header search paths are handled by the mass of goop in InitHeaderSearch.
switch (Type) {
case ToolChain::CST_Libcxx:
if (ObjCXXAutoRefCount)
CmdArgs.push_back("-fobjc-arc-cxxlib=libc++");
break;
case ToolChain::CST_Libstdcxx:
if (ObjCXXAutoRefCount)
CmdArgs.push_back("-fobjc-arc-cxxlib=libstdc++");
break;
}
void ToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
// Header search paths should be handled by each of the subclasses.
// Historically, they have not been, and instead have been handled inside of
// the CC1-layer frontend. As the logic is hoisted out, this generic function
// will slowly stop being called.
//
// While it is being called, replicate a bit of a hack to propagate the
// '-stdlib=' flag down to CC1 so that it can in turn customize the C++
// header search paths with it. Once all systems are overriding this
// function, the CC1 flag and this line can be removed.
DriverArgs.AddAllArgs(CC1Args, options::OPT_stdlib_EQ);
}
void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,

File diff suppressed because it is too large Load Diff

View File

@@ -372,6 +372,86 @@ public:
};
class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
/// \brief Struct to store and manipulate GCC versions.
///
/// We rely on assumptions about the form and structure of GCC version
/// numbers: they consist of at most three '.'-separated components, and each
/// component is a non-negative integer except for the last component. For
/// the last component we are very flexible in order to tolerate release
/// candidates or 'x' wildcards.
///
/// Note that the ordering established among GCCVersions is based on the
/// preferred version string to use. For example we prefer versions without
/// a hard-coded patch number to those with a hard coded patch number.
///
/// Currently this doesn't provide any logic for textual suffixes to patches
/// in the way that (for example) Debian's version format does. If that ever
/// becomes necessary, it can be added.
struct GCCVersion {
/// \brief The unparsed text of the version.
std::string Text;
/// \brief The parsed major, minor, and patch numbers.
int Major, Minor, Patch;
/// \brief Any textual suffix on the patch number.
std::string PatchSuffix;
static GCCVersion Parse(StringRef VersionText);
bool operator<(const GCCVersion &RHS) const;
bool operator>(const GCCVersion &RHS) const { return RHS < *this; }
bool operator<=(const GCCVersion &RHS) const { return !(*this > RHS); }
bool operator>=(const GCCVersion &RHS) const { return !(*this < RHS); }
};
/// \brief This is a class to find a viable GCC installation for Clang to
/// use.
///
/// This class tries to find a GCC installation on the system, and report
/// information about it. It starts from the host information provided to the
/// Driver, and has logic for fuzzing that where appropriate.
class GCCInstallationDetector {
bool IsValid;
std::string GccTriple;
// FIXME: These might be better as path objects.
std::string GccInstallPath;
std::string GccParentLibPath;
GCCVersion Version;
public:
GCCInstallationDetector(const Driver &D);
/// \brief Check whether we detected a valid GCC install.
bool isValid() const { return IsValid; }
/// \brief Get the GCC triple for the detected install.
StringRef getTriple() const { return GccTriple; }
/// \brief Get the detected GCC installation path.
StringRef getInstallPath() const { return GccInstallPath; }
/// \brief Get the detected GCC parent lib path.
StringRef getParentLibPath() const { return GccParentLibPath; }
/// \brief Get the detected GCC version string.
StringRef getVersion() const { return Version.Text; }
private:
static void CollectLibDirsAndTriples(llvm::Triple::ArchType HostArch,
SmallVectorImpl<StringRef> &LibDirs,
SmallVectorImpl<StringRef> &Triples);
void ScanLibDirForGCCTriple(llvm::Triple::ArchType HostArch,
const std::string &LibDir,
StringRef CandidateTriple);
};
GCCInstallationDetector GCCInstallation;
public:
Linux(const HostInfo &Host, const llvm::Triple& Triple);
@@ -380,6 +460,11 @@ public:
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA,
const ActionList &Inputs) const;
virtual void AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const;
virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const;
std::string Linker;
std::vector<std::string> ExtraOpts;
};
@@ -417,6 +502,12 @@ public:
virtual bool IsUnwindTablesDefault() const;
virtual const char *GetDefaultRelocationModel() const;
virtual const char *GetForcedPicModel() const;
virtual void AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const;
virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const;
};
} // end namespace toolchains

View File

@@ -364,16 +364,6 @@ void Clang::AddPreprocessingOptions(const Driver &D,
Args.AddAllArgs(CmdArgs, options::OPT_I_Group, options::OPT_F,
options::OPT_index_header_map);
// Add C++ include arguments, if needed.
types::ID InputType = Inputs[0].getType();
if (types::isCXX(InputType)) {
bool ObjCXXAutoRefCount
= types::isObjC(InputType) && isObjCAutoRefCount(Args);
getToolChain().AddClangCXXStdlibIncludeArgs(Args, CmdArgs,
ObjCXXAutoRefCount);
Args.AddAllArgs(CmdArgs, options::OPT_stdlib_EQ);
}
// Add -Wp, and -Xassembler if using the preprocessor.
// FIXME: There is a very unfortunate problem here, some troubled
@@ -428,6 +418,13 @@ void Clang::AddPreprocessingOptions(const Driver &D,
// OBJCPLUS_INCLUDE_PATH - system includes enabled when compiling ObjC++.
AddIncludeDirectoryList(Args, CmdArgs, "-objcxx-isystem",
::getenv("OBJCPLUS_INCLUDE_PATH"));
// Add C++ include arguments, if needed.
if (types::isCXX(Inputs[0].getType()))
getToolChain().AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
// Add system include arguments.
getToolChain().AddClangSystemIncludeArgs(Args, CmdArgs);
}
/// getARMTargetCPU - Get the (LLVM) name of the ARM cpu we are targeting.
@@ -1965,6 +1962,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (ARC) {
CmdArgs.push_back("-fobjc-arc");
// FIXME: It seems like this entire block, and several around it should be
// wrapped in isObjC, but for now we just use it here as this is where it
// was being used previously.
if (types::isCXX(InputType) && types::isObjC(InputType)) {
if (getToolChain().GetCXXStdlibType(Args) == ToolChain::CST_Libcxx)
CmdArgs.push_back("-fobjc-arc-cxxlib=libc++");
else
CmdArgs.push_back("-fobjc-arc-cxxlib=libstdc++");
}
// Allow the user to enable full exceptions code emission.
// We define off for Objective-CC, on for Objective-C++.
if (Args.hasFlag(options::OPT_fobjc_arc_exceptions,

View File

@@ -569,10 +569,18 @@ static void HeaderSearchOptsToArgs(const HeaderSearchOptions &Opts,
break;
}
} else {
if (E.Group != frontend::Angled && E.Group != frontend::System)
llvm::report_fatal_error("Invalid option set!");
Res.push_back(E.Group == frontend::Angled ? "-iwithprefixbefore" :
"-iwithprefix");
if (E.IsInternal) {
assert(E.Group == frontend::System && "Unexpected header search group");
if (E.ImplicitExternC)
Res.push_back("-internal-externc-isystem");
else
Res.push_back("-internal-isystem");
} else {
if (E.Group != frontend::Angled && E.Group != frontend::System)
llvm::report_fatal_error("Invalid option set!");
Res.push_back(E.Group == frontend::Angled ? "-iwithprefixbefore" :
"-iwithprefix");
}
}
Res.push_back(E.Path);
}
@@ -1462,6 +1470,15 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::ObjCXXSystem, true, false,
true);
// Add the internal paths from a driver that detects standard include paths.
for (arg_iterator I = Args.filtered_begin(OPT_internal_isystem,
OPT_internal_externc_isystem),
E = Args.filtered_end();
I != E; ++I)
Opts.AddPath((*I)->getValue(Args), frontend::System,
false, false, /*IgnoreSysRoot=*/true, /*IsInternal=*/true,
(*I)->getOption().matches(OPT_internal_externc_isystem));
}
void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,

View File

@@ -27,12 +27,9 @@
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Path.h"
#include "llvm/Config/config.h"
#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
using namespace clang;
using namespace clang::frontend;
@@ -207,219 +204,6 @@ void InitHeaderSearch::AddMinGW64CXXPaths(StringRef Base,
CXXSystem, true, false, false);
}
// FIXME: This probably should goto to some platform utils place.
#ifdef _MSC_VER
// Read registry string.
// This also supports a means to look for high-versioned keys by use
// of a $VERSION placeholder in the key path.
// $VERSION in the key path is a placeholder for the version number,
// causing the highest value path to be searched for and used.
// I.e. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$VERSION".
// There can be additional characters in the component. Only the numberic
// characters are compared.
static bool getSystemRegistryString(const char *keyPath, const char *valueName,
char *value, size_t maxLength) {
HKEY hRootKey = NULL;
HKEY hKey = NULL;
const char* subKey = NULL;
DWORD valueType;
DWORD valueSize = maxLength - 1;
long lResult;
bool returnValue = false;
if (strncmp(keyPath, "HKEY_CLASSES_ROOT\\", 18) == 0) {
hRootKey = HKEY_CLASSES_ROOT;
subKey = keyPath + 18;
} else if (strncmp(keyPath, "HKEY_USERS\\", 11) == 0) {
hRootKey = HKEY_USERS;
subKey = keyPath + 11;
} else if (strncmp(keyPath, "HKEY_LOCAL_MACHINE\\", 19) == 0) {
hRootKey = HKEY_LOCAL_MACHINE;
subKey = keyPath + 19;
} else if (strncmp(keyPath, "HKEY_CURRENT_USER\\", 18) == 0) {
hRootKey = HKEY_CURRENT_USER;
subKey = keyPath + 18;
}
else
return false;
const char *placeHolder = strstr(subKey, "$VERSION");
char bestName[256];
bestName[0] = '\0';
// If we have a $VERSION placeholder, do the highest-version search.
if (placeHolder) {
const char *keyEnd = placeHolder - 1;
const char *nextKey = placeHolder;
// Find end of previous key.
while ((keyEnd > subKey) && (*keyEnd != '\\'))
keyEnd--;
// Find end of key containing $VERSION.
while (*nextKey && (*nextKey != '\\'))
nextKey++;
size_t partialKeyLength = keyEnd - subKey;
char partialKey[256];
if (partialKeyLength > sizeof(partialKey))
partialKeyLength = sizeof(partialKey);
strncpy(partialKey, subKey, partialKeyLength);
partialKey[partialKeyLength] = '\0';
HKEY hTopKey = NULL;
lResult = RegOpenKeyEx(hRootKey, partialKey, 0, KEY_READ, &hTopKey);
if (lResult == ERROR_SUCCESS) {
char keyName[256];
int bestIndex = -1;
double bestValue = 0.0;
DWORD index, size = sizeof(keyName) - 1;
for (index = 0; RegEnumKeyEx(hTopKey, index, keyName, &size, NULL,
NULL, NULL, NULL) == ERROR_SUCCESS; index++) {
const char *sp = keyName;
while (*sp && !isdigit(*sp))
sp++;
if (!*sp)
continue;
const char *ep = sp + 1;
while (*ep && (isdigit(*ep) || (*ep == '.')))
ep++;
char numBuf[32];
strncpy(numBuf, sp, sizeof(numBuf) - 1);
numBuf[sizeof(numBuf) - 1] = '\0';
double value = strtod(numBuf, NULL);
if (value > bestValue) {
bestIndex = (int)index;
bestValue = value;
strcpy(bestName, keyName);
}
size = sizeof(keyName) - 1;
}
// If we found the highest versioned key, open the key and get the value.
if (bestIndex != -1) {
// Append rest of key.
strncat(bestName, nextKey, sizeof(bestName) - 1);
bestName[sizeof(bestName) - 1] = '\0';
// Open the chosen key path remainder.
lResult = RegOpenKeyEx(hTopKey, bestName, 0, KEY_READ, &hKey);
if (lResult == ERROR_SUCCESS) {
lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType,
(LPBYTE)value, &valueSize);
if (lResult == ERROR_SUCCESS)
returnValue = true;
RegCloseKey(hKey);
}
}
RegCloseKey(hTopKey);
}
}
else {
lResult = RegOpenKeyEx(hRootKey, subKey, 0, KEY_READ, &hKey);
if (lResult == ERROR_SUCCESS) {
lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType,
(LPBYTE)value, &valueSize);
if (lResult == ERROR_SUCCESS)
returnValue = true;
RegCloseKey(hKey);
}
}
return returnValue;
}
#else // _MSC_VER
// Read registry string.
static bool getSystemRegistryString(const char*, const char*, char*, size_t) {
return(false);
}
#endif // _MSC_VER
// Get Visual Studio installation directory.
static bool getVisualStudioDir(std::string &path) {
// First check the environment variables that vsvars32.bat sets.
const char* vcinstalldir = getenv("VCINSTALLDIR");
if (vcinstalldir) {
char *p = const_cast<char *>(strstr(vcinstalldir, "\\VC"));
if (p)
*p = '\0';
path = vcinstalldir;
return true;
}
char vsIDEInstallDir[256];
char vsExpressIDEInstallDir[256];
// Then try the windows registry.
bool hasVCDir = getSystemRegistryString(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$VERSION",
"InstallDir", vsIDEInstallDir, sizeof(vsIDEInstallDir) - 1);
bool hasVCExpressDir = getSystemRegistryString(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\$VERSION",
"InstallDir", vsExpressIDEInstallDir, sizeof(vsExpressIDEInstallDir) - 1);
// If we have both vc80 and vc90, pick version we were compiled with.
if (hasVCDir && vsIDEInstallDir[0]) {
char *p = (char*)strstr(vsIDEInstallDir, "\\Common7\\IDE");
if (p)
*p = '\0';
path = vsIDEInstallDir;
return true;
}
if (hasVCExpressDir && vsExpressIDEInstallDir[0]) {
char *p = (char*)strstr(vsExpressIDEInstallDir, "\\Common7\\IDE");
if (p)
*p = '\0';
path = vsExpressIDEInstallDir;
return true;
}
// Try the environment.
const char *vs100comntools = getenv("VS100COMNTOOLS");
const char *vs90comntools = getenv("VS90COMNTOOLS");
const char *vs80comntools = getenv("VS80COMNTOOLS");
const char *vscomntools = NULL;
// Try to find the version that we were compiled with
if(false) {}
#if (_MSC_VER >= 1600) // VC100
else if(vs100comntools) {
vscomntools = vs100comntools;
}
#elif (_MSC_VER == 1500) // VC80
else if(vs90comntools) {
vscomntools = vs90comntools;
}
#elif (_MSC_VER == 1400) // VC80
else if(vs80comntools) {
vscomntools = vs80comntools;
}
#endif
// Otherwise find any version we can
else if (vs100comntools)
vscomntools = vs100comntools;
else if (vs90comntools)
vscomntools = vs90comntools;
else if (vs80comntools)
vscomntools = vs80comntools;
if (vscomntools && *vscomntools) {
const char *p = strstr(vscomntools, "\\Common7\\Tools");
path = p ? std::string(vscomntools, p) : vscomntools;
return true;
}
return false;
}
// Get Windows SDK installation directory.
static bool getWindowsSDKDir(std::string &path) {
char windowsSDKInstallDir[256];
// Try the Windows registry.
bool hasSDKDir = getSystemRegistryString(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\$VERSION",
"InstallationFolder",
windowsSDKInstallDir,
sizeof(windowsSDKInstallDir) - 1);
// If we have both vc80 and vc90, pick version we were compiled with.
if (hasSDKDir && windowsSDKInstallDir[0]) {
path = windowsSDKInstallDir;
return(true);
}
return(false);
}
void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
const HeaderSearchOptions &HSOpts) {
llvm::Triple::OSType os = triple.getOS();
@@ -464,33 +248,10 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
}
switch (os) {
case llvm::Triple::Win32: {
std::string VSDir;
std::string WindowsSDKDir;
if (getVisualStudioDir(VSDir)) {
AddPath(VSDir + "\\VC\\include", System, false, false, false);
if (getWindowsSDKDir(WindowsSDKDir))
AddPath(WindowsSDKDir + "\\include", System, false, false, false);
else
AddPath(VSDir + "\\VC\\PlatformSDK\\Include",
System, false, false, false);
} else {
// Default install paths.
AddPath("C:/Program Files/Microsoft Visual Studio 10.0/VC/include",
System, false, false, false);
AddPath("C:/Program Files/Microsoft Visual Studio 9.0/VC/include",
System, false, false, false);
AddPath(
"C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include",
System, false, false, false);
AddPath("C:/Program Files/Microsoft Visual Studio 8/VC/include",
System, false, false, false);
AddPath(
"C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include",
System, false, false, false);
}
break;
}
case llvm::Triple::Linux:
case llvm::Triple::Win32:
llvm_unreachable("Include management is handled in the driver.");
case llvm::Triple::Haiku:
AddPath("/boot/common/include", System, true, false, false);
AddPath("/boot/develop/headers/os", System, true, false, false);
@@ -556,20 +317,6 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
}
break;
case llvm::Triple::Linux:
// Generic Debian multiarch support:
if (triple.getArch() == llvm::Triple::x86_64) {
AddPath("/usr/include/x86_64-linux-gnu", System, false, false, false);
AddPath("/usr/include/i686-linux-gnu/64", System, false, false, false);
AddPath("/usr/include/i486-linux-gnu/64", System, false, false, false);
} else if (triple.getArch() == llvm::Triple::x86) {
AddPath("/usr/include/x86_64-linux-gnu/32", System, false, false, false);
AddPath("/usr/include/i686-linux-gnu", System, false, false, false);
AddPath("/usr/include/i486-linux-gnu", System, false, false, false);
AddPath("/usr/include/i386-linux-gnu", System, false, false, false);
} else if (triple.getArch() == llvm::Triple::arm) {
AddPath("/usr/include/arm-linux-gnueabi", System, false, false, false);
}
default:
break;
}
@@ -630,6 +377,10 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOp
}
switch (os) {
case llvm::Triple::Linux:
case llvm::Triple::Win32:
llvm_unreachable("Include management is handled in the driver.");
case llvm::Triple::Cygwin:
// Cygwin-1.7
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4");
@@ -656,257 +407,6 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOp
break;
case llvm::Triple::DragonFly:
AddPath("/usr/include/c++/4.1", CXXSystem, true, false, false);
break;
case llvm::Triple::Linux:
//===------------------------------------------------------------------===//
// Debian based distros.
// Note: these distros symlink /usr/include/c++/X.Y.Z -> X.Y
//===------------------------------------------------------------------===//
// Ubuntu 11.11 "Oneiric Ocelot" -- gcc-4.6.0
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"x86_64-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"i686-linux-gnu", "", "64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"i486-linux-gnu", "", "64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"arm-linux-gnueabi", "", "", triple);
// Ubuntu 11.04 "Natty Narwhal" -- gcc-4.5.2
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
"x86_64-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
"i686-linux-gnu", "", "64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
"i486-linux-gnu", "", "64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
"arm-linux-gnueabi", "", "", triple);
// Ubuntu 10.10 "Maverick Meerkat" -- gcc-4.4.5
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"i686-linux-gnu", "", "64", triple);
// The rest of 10.10 is the same as previous versions.
// Ubuntu 10.04 LTS "Lucid Lynx" -- gcc-4.4.3
// Ubuntu 9.10 "Karmic Koala" -- gcc-4.4.1
// Debian 6.0 "squeeze" -- gcc-4.4.2
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"x86_64-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"i486-linux-gnu", "", "64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"arm-linux-gnueabi", "", "", triple);
// Ubuntu 9.04 "Jaunty Jackalope" -- gcc-4.3.3
// Ubuntu 8.10 "Intrepid Ibex" -- gcc-4.3.2
// Debian 5.0 "lenny" -- gcc-4.3.2
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
"x86_64-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
"i486-linux-gnu", "", "64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
"arm-linux-gnueabi", "", "", triple);
// Ubuntu 8.04.4 LTS "Hardy Heron" -- gcc-4.2.4
// Ubuntu 8.04.[0-3] LTS "Hardy Heron" -- gcc-4.2.3
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2",
"x86_64-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2",
"i486-linux-gnu", "", "64", triple);
// Ubuntu 7.10 "Gutsy Gibbon" -- gcc-4.1.3
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1",
"x86_64-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1",
"i486-linux-gnu", "", "64", triple);
//===------------------------------------------------------------------===//
// Redhat based distros.
//===------------------------------------------------------------------===//
// Fedora 15 (GCC 4.6.1)
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1",
"i686-redhat-linux", "", "", triple);
// Fedora 15 (GCC 4.6.0)
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0",
"i686-redhat-linux", "", "", triple);
// Fedora 14
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1",
"i686-redhat-linux", "", "", triple);
// RHEL5(gcc44)
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4",
"x86_64-redhat-linux6E", "32", "", triple);
// Fedora 13
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4",
"i686-redhat-linux","", "", triple);
// Fedora 12
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
"i686-redhat-linux","", "", triple);
// Fedora 12 (pre-FEB-2010)
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
"i686-redhat-linux","", "", triple);
// Fedora 11
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1",
"i586-redhat-linux","", "", triple);
// Fedora 10
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
"i386-redhat-linux","", "", triple);
// Fedora 9
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0",
"i386-redhat-linux", "", "", triple);
// Fedora 8
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2",
"x86_64-redhat-linux", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2",
"i386-redhat-linux", "", "", triple);
// RHEL 5
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.1",
"x86_64-redhat-linux", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.1",
"i386-redhat-linux", "", "", triple);
//===------------------------------------------------------------------===//
// Exherbo (2010-01-25)
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
"x86_64-pc-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
"i686-pc-linux-gnu", "", "", triple);
// openSUSE 11.1 32 bit
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
"i586-suse-linux", "", "", triple);
// openSUSE 11.1 64 bit
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
"x86_64-suse-linux", "32", "", triple);
// openSUSE 11.2
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"i586-suse-linux", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"x86_64-suse-linux", "", "", triple);
// openSUSE 11.4
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
"i586-suse-linux", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
"x86_64-suse-linux", "", "", triple);
// openSUSE 12.1
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"i586-suse-linux", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"x86_64-suse-linux", "", "", triple);
// Arch Linux 2008-06-24
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
"i686-pc-linux-gnu", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
"x86_64-unknown-linux-gnu", "", "", triple);
// Arch Linux gcc 4.6
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1",
"i686-pc-linux-gnu", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1",
"x86_64-unknown-linux-gnu", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0",
"i686-pc-linux-gnu", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0",
"x86_64-unknown-linux-gnu", "", "", triple);
// Slackware gcc 4.5.2 (13.37)
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.2",
"i486-slackware-linux", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.2",
"x86_64-slackware-linux", "", "", triple);
// Slackware gcc 4.5.3 (-current)
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.3",
"i486-slackware-linux", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.3",
"x86_64-slackware-linux", "", "", triple);
// Gentoo x86 gcc 4.5.2
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/g++-v4",
"i686-pc-linux-gnu", "", "", triple);
// Gentoo x86 gcc 4.4.5
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.4.5/include/g++-v4",
"i686-pc-linux-gnu", "", "", triple);
// Gentoo x86 gcc 4.4.4
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4",
"i686-pc-linux-gnu", "", "", triple);
// Gentoo x86 2010.0 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.4.3/include/g++-v4",
"i686-pc-linux-gnu", "", "", triple);
// Gentoo x86 2009.1 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4",
"i686-pc-linux-gnu", "", "", triple);
// Gentoo x86 2009.0 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4",
"i686-pc-linux-gnu", "", "", triple);
// Gentoo x86 2008.0 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4",
"i686-pc-linux-gnu", "", "", triple);
// Gentoo x86 llvm-gcc trunk
AddGnuCPlusPlusIncludePaths(
"/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1",
"i686-pc-linux-gnu", "", "", triple);
// Gentoo amd64 gcc 4.5.2
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4",
"x86_64-pc-linux-gnu", "32", "", triple);
// Gentoo amd64 gcc 4.4.5
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4",
"x86_64-pc-linux-gnu", "32", "", triple);
// Gentoo amd64 gcc 4.4.4
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4",
"x86_64-pc-linux-gnu", "32", "", triple);
// Gentoo amd64 gcc 4.4.3
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4",
"x86_64-pc-linux-gnu", "32", "", triple);
// Gentoo amd64 gcc 4.3.4
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.4/include/g++-v4",
"x86_64-pc-linux-gnu", "", "", triple);
// Gentoo amd64 gcc 4.3.2
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4",
"x86_64-pc-linux-gnu", "", "", triple);
// Gentoo amd64 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4",
"x86_64-pc-linux-gnu", "", "", triple);
// Gentoo amd64 llvm-gcc trunk
AddGnuCPlusPlusIncludePaths(
"/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1",
"x86_64-pc-linux-gnu", "", "", triple);
break;
case llvm::Triple::FreeBSD:
// FreeBSD 8.0
@@ -943,6 +443,19 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOp
void InitHeaderSearch::AddDefaultIncludePaths(const LangOptions &Lang,
const llvm::Triple &triple,
const HeaderSearchOptions &HSOpts) {
// NB: This code path is going away. All of the logic is moving into the
// driver which has the information necessary to do target-specific
// selections of default include paths. Each target which moves there will be
// exempted from this logic here until we can delete the entire pile of code.
switch (triple.getOS()) {
default:
break; // Everything else continues to use this routine's logic.
case llvm::Triple::Linux:
case llvm::Triple::Win32:
return;
}
if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes &&
HSOpts.UseStandardSystemIncludes) {
if (HSOpts.UseLibcxx) {
@@ -1145,8 +658,8 @@ void clang::ApplyHeaderSearchOptions(HeaderSearch &HS,
// Add the user defined entries.
for (unsigned i = 0, e = HSOpts.UserEntries.size(); i != e; ++i) {
const HeaderSearchOptions::Entry &E = HSOpts.UserEntries[i];
Init.AddPath(E.Path, E.Group, false, E.IsUserSupplied, E.IsFramework,
E.IgnoreSysRoot);
Init.AddPath(E.Path, E.Group, !E.ImplicitExternC, E.IsUserSupplied,
E.IsFramework, E.IgnoreSysRoot);
}
Init.AddDefaultIncludePaths(Lang, Triple, HSOpts);

View File

@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.cplusplus.Iterators -verify %s
// RUN: %clang --analyze -Xclang -analyzer-checker=core,experimental.cplusplus.Iterators -Xclang -verify %s
// XFAIL: win32
#include <vector>

View File

@@ -170,7 +170,7 @@ void test_strcat() {
//===----------------------------------------------------------------------===
typedef int __int32_t;
typedef __int32_t pid_t;
pid_t vfork(void); //expected-warning{{declaration of built-in function 'vfork' requires inclusion of the header <setjmp.h>}}
pid_t vfork(void);
void test_vfork() {
vfork(); //expected-warning{{Call to function 'vfork' is insecure as it can lead to denial of service situations in the parent process.}}

View File

@@ -137,3 +137,11 @@
// CHECK-GCC-VERSION3: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-GCC-VERSION3: "{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o"
// CHECK-GCC-VERSION3: "-L{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -ccc-host-triple i386-unknown-linux -m32 \
// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing4/bin \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION4 %s
// CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99/crtbegin.o"
// CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99"

View File

@@ -1,6 +1,8 @@
// RUN: %clang_cc1 -emit-pch -o %t -relocatable-pch -isysroot %S/libroot %S/libroot/usr/include/reloc.h
// RUN: %clang_cc1 -include-pch %t -isysroot %S/libroot %s -verify
// RUN: not %clang_cc1 -include-pch %t %s
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 --relocatable-pch -o %t \
// RUN: -isysroot %S/libroot %S/libroot/usr/include/reloc.h
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -fsyntax-only \
// RUN: -include-pch %t -isysroot %S/libroot %s -Xclang -verify
// RUN: not %clang -ccc-host-triple x86_64-apple-darwin10 -include-pch %t %s
#include <reloc.h>
@@ -8,7 +10,5 @@ int x = 2; // expected-error{{redefinition}}
int y = 5; // expected-error{{redefinition}}
// expected-note{{previous definition}}
// expected-note{{previous definition}}

View File

@@ -1,2 +1,2 @@
// RUN: %clang -fno-ms-extensions %s -E | grep 'stddef.h.*3.*4'
// RUN: %clang -fno-ms-extensions %s -E | grep 'stddef.h.*3'
#include <stddef.h>

View File

@@ -2,6 +2,9 @@
import os
import platform
import re
import subprocess
# Configuration file for the 'lit' test runner.
@@ -141,7 +144,23 @@ if lit.useValgrind:
config.clang = inferClang(config.environment['PATH']).replace('\\', '/')
if not lit.quiet:
lit.note('using clang: %r' % config.clang)
config.substitutions.append( ('%clang_cc1', config.clang + ' -cc1') )
# Note that when substituting %clang_cc1 also fill in the include directory of
# the builtin headers. Those are part of even a freestanding environment, but
# Clang relies on the driver to locate them.
def getClangBuiltinIncludeDir(clang):
# FIXME: Rather than just getting the version, we should have clang print
# out its resource dir here in an easy to scrape form.
cmd = subprocess.Popen([clang, '-print-file-name=include'],
stdout=subprocess.PIPE)
if not cmd.stdout:
lit.fatal("Couldn't find the include dir for Clang ('%s')" % clang)
return cmd.stdout.read().strip()
config.substitutions.append( ('%clang_cc1', '%s -cc1 -internal-isystem %s'
% (config.clang,
getClangBuiltinIncludeDir(config.clang))) )
config.substitutions.append( ('%clangxx', ' ' + config.clang +
' -ccc-clang-cxx -ccc-cxx '))
config.substitutions.append( ('%clang', ' ' + config.clang + ' ') )
@@ -175,10 +194,6 @@ if platform.system() not in ['Windows'] or lit.getBashPath() != '':
config.available_features.add('shell')
# Registered Targets
import subprocess
import re
import os
def getRegisteredTargets(tool):
set_of_targets = set()

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM Alias Analysis Infrastructure</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM Branch Weight Metadata</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM bugpoint tool: design and usage</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Building LLVM with CMake</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -1813,6 +1813,8 @@ $ llc -regalloc=pbqp file.bc -o pbqp.s;
<a name="proepicode">Prolog/Epilog Code Insertion</a>
</h3>
<div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="compact_unwind">Compact Unwind</a>
@@ -1927,6 +1929,8 @@ $ llc -regalloc=pbqp file.bc -o pbqp.s;
</div>
</div>
<!-- ======================================================================= -->
<h3>
<a name="latemco">Late Machine Code Optimizations</a>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="llvm.css" type="text/css">
<title>LLVM Coding Standards</title>
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Debugging JITed Code With GDB</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Extending LLVM: Adding instructions, intrinsics, types, etc.</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -746,7 +746,7 @@ idx3 = (char*) &amp;MyVar + 8
src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br/>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>
</body>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM gold plugin</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>How To Release LLVM To The Public</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>How to submit an LLVM bug report</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -1898,9 +1898,6 @@ in signal handlers).</p>
possible to have a two dimensional array, using an array as the element type
of another array.</p>
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="t_aggregate">Aggregate Types</a>
@@ -2208,6 +2205,8 @@ in signal handlers).</p>
</div>
</div>
<!-- *********************************************************************** -->
<h2><a name="constants">Constants</a></h2>
<!-- *********************************************************************** -->
@@ -6304,8 +6303,6 @@ declare void @llvm.va_end(i8*)
</div>
</div>
<!-- ======================================================================= -->
<h3>
<a name="int_gc">Accurate Garbage Collection Intrinsics</a>
@@ -7001,8 +6998,6 @@ LLVM</a>.</p>
</div>
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="int_exp">'<tt>llvm.exp.*</tt>' Intrinsic</a>
@@ -7067,6 +7062,9 @@ LLVM</a>.</p>
<p>This function returns the same values as the libm <tt>log</tt> functions
would, and handles error conditions in the same way.</p>
</div>
<!-- _______________________________________________________________________ -->
<h4>
<a name="int_fma">'<tt>llvm.fma.*</tt>' Intrinsic</a>
</h4>
@@ -7100,6 +7098,8 @@ LLVM</a>.</p>
</div>
</div>
<!-- ======================================================================= -->
<h3>
<a name="int_manip">Bit Manipulation Intrinsics</a>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM Link Time Optimization: Design and Implementation</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Advice on Packaging LLVM</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -226,11 +226,8 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print " <p>\n" if !
<a name="basicaa">-basicaa: Basic Alias Analysis (stateless AA impl)</a>
</h3>
<div>
<p>
This is the default implementation of the Alias Analysis interface
that simply implements a few identities (two different globals cannot alias,
etc), but otherwise does no analysis.
</p>
<p>A basic alias analysis pass that implements identities (two different
globals cannot alias, etc), but does no stateful analysis.</p>
</div>
<!-------------------------------------------------------------------------- -->
@@ -527,9 +524,10 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print " <p>\n" if !
</h3>
<div>
<p>
Always returns "I don't know" for alias queries. NoAA is unlike other alias
analysis implementations, in that it does not chain to a previous analysis. As
such it doesn't follow many of the rules that other alias analyses must.
This is the default implementation of the Alias Analysis interface. It always
returns "I don't know" for alias queries. NoAA is unlike other alias analysis
implementations, in that it does not chain to a previous analysis. As such it
doesn't follow many of the rules that other alias analyses must.
</p>
</div>

View File

@@ -879,9 +879,6 @@ elements (but could contain many), for example, it's much better to use
. Doing so avoids (relatively) expensive malloc/free calls, which dwarf the
cost of adding the elements to the container. </p>
</div>
<!-- ======================================================================= -->
<h3>
<a name="ds_sequential">Sequential Containers (std::vector, std::list, etc)</a>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Creating an LLVM Project</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>System Library</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>TableGen Fundamentals</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM Testing Infrastructure Guide</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -1,7 +1,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Using The LLVM Libraries</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Using The LLVM Libraries</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Documentation for the LLVM System at SVN head</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>

View File

@@ -1016,6 +1016,27 @@ std::string CppWriter::getOpName(const Value* V) {
return result;
}
static StringRef ConvertAtomicOrdering(AtomicOrdering Ordering) {
switch (Ordering) {
case NotAtomic: return "NotAtomic";
case Unordered: return "Unordered";
case Monotonic: return "Monotonic";
case Acquire: return "Acquire";
case Release: return "Release";
case AcquireRelease: return "AcquireRelease";
case SequentiallyConsistent: return "SequentiallyConsistent";
}
llvm_unreachable("Unknown ordering");
}
static StringRef ConvertAtomicSynchScope(SynchronizationScope SynchScope) {
switch (SynchScope) {
case SingleThread: return "SingleThread";
case CrossThread: return "CrossThread";
}
llvm_unreachable("Unknown synch scope");
}
// printInstruction - This member is called for each Instruction in a function.
void CppWriter::printInstruction(const Instruction *I,
const std::string& bbname) {
@@ -1237,15 +1258,33 @@ void CppWriter::printInstruction(const Instruction *I,
printEscapedString(load->getName());
Out << "\", " << (load->isVolatile() ? "true" : "false" )
<< ", " << bbname << ");";
if (load->getAlignment())
nl(Out) << iName << "->setAlignment("
<< load->getAlignment() << ");";
if (load->isAtomic()) {
StringRef Ordering = ConvertAtomicOrdering(load->getOrdering());
StringRef CrossThread = ConvertAtomicSynchScope(load->getSynchScope());
nl(Out) << iName << "->setAtomic("
<< Ordering << ", " << CrossThread << ");";
}
break;
}
case Instruction::Store: {
const StoreInst* store = cast<StoreInst>(I);
Out << " new StoreInst("
Out << "StoreInst* " << iName << " = new StoreInst("
<< opNames[0] << ", "
<< opNames[1] << ", "
<< (store->isVolatile() ? "true" : "false")
<< ", " << bbname << ");";
if (store->getAlignment())
nl(Out) << iName << "->setAlignment("
<< store->getAlignment() << ");";
if (store->isAtomic()) {
StringRef Ordering = ConvertAtomicOrdering(store->getOrdering());
StringRef CrossThread = ConvertAtomicSynchScope(store->getSynchScope());
nl(Out) << iName << "->setAtomic("
<< Ordering << ", " << CrossThread << ");";
}
break;
}
case Instruction::GetElementPtr: {
@@ -1447,6 +1486,60 @@ void CppWriter::printInstruction(const Instruction *I,
Out << "\", " << bbname << ");";
break;
}
case Instruction::Fence: {
const FenceInst *fi = cast<FenceInst>(I);
StringRef Ordering = ConvertAtomicOrdering(fi->getOrdering());
StringRef CrossThread = ConvertAtomicSynchScope(fi->getSynchScope());
Out << "FenceInst* " << iName
<< " = new FenceInst(mod->getContext(), "
<< Ordering << ", " << CrossThread << ", " << bbname
<< ");";
break;
}
case Instruction::AtomicCmpXchg: {
const AtomicCmpXchgInst *cxi = cast<AtomicCmpXchgInst>(I);
StringRef Ordering = ConvertAtomicOrdering(cxi->getOrdering());
StringRef CrossThread = ConvertAtomicSynchScope(cxi->getSynchScope());
Out << "AtomicCmpXchgInst* " << iName
<< " = new AtomicCmpXchgInst("
<< opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", "
<< Ordering << ", " << CrossThread << ", " << bbname
<< ");";
nl(Out) << iName << "->setName(\"";
printEscapedString(cxi->getName());
Out << "\");";
break;
}
case Instruction::AtomicRMW: {
const AtomicRMWInst *rmwi = cast<AtomicRMWInst>(I);
StringRef Ordering = ConvertAtomicOrdering(rmwi->getOrdering());
StringRef CrossThread = ConvertAtomicSynchScope(rmwi->getSynchScope());
StringRef Operation;
switch (rmwi->getOperation()) {
case AtomicRMWInst::Xchg: Operation = "AtomicRMWInst::Xchg"; break;
case AtomicRMWInst::Add: Operation = "AtomicRMWInst::Add"; break;
case AtomicRMWInst::Sub: Operation = "AtomicRMWInst::Sub"; break;
case AtomicRMWInst::And: Operation = "AtomicRMWInst::And"; break;
case AtomicRMWInst::Nand: Operation = "AtomicRMWInst::Nand"; break;
case AtomicRMWInst::Or: Operation = "AtomicRMWInst::Or"; break;
case AtomicRMWInst::Xor: Operation = "AtomicRMWInst::Xor"; break;
case AtomicRMWInst::Max: Operation = "AtomicRMWInst::Max"; break;
case AtomicRMWInst::Min: Operation = "AtomicRMWInst::Min"; break;
case AtomicRMWInst::UMax: Operation = "AtomicRMWInst::UMax"; break;
case AtomicRMWInst::UMin: Operation = "AtomicRMWInst::UMin"; break;
case AtomicRMWInst::BAD_BINOP: llvm_unreachable("Bad atomic operation");
}
Out << "AtomicRMWInst* " << iName
<< " = new AtomicRMWInst("
<< Operation << ", "
<< opNames[0] << ", " << opNames[1] << ", "
<< Ordering << ", " << CrossThread << ", " << bbname
<< ");";
nl(Out) << iName << "->setName(\"";
printEscapedString(rmwi->getName());
Out << "\");";
break;
}
}
DefinedValues.insert(I);
nl(Out);
@@ -1623,7 +1716,9 @@ void CppWriter::printFunctionBody(const Function *F) {
Out << "Value* " << getCppName(AI) << " = args++;";
nl(Out);
if (AI->hasName()) {
Out << getCppName(AI) << "->setName(\"" << AI->getName() << "\");";
Out << getCppName(AI) << "->setName(\"";
printEscapedString(AI->getName());
Out << "\");";
nl(Out);
}
}