Commit Graph

315 Commits

Author SHA1 Message Date
Daniel Dunbar 10de9e6602 OpenBSD support.
- Patch by Jonathan Gray!

llvm-svn: 74453
2009-06-29 20:52:51 +00:00
Bill Wendling 1835107ed0 Make the StackProtector bitfield use enums instead of obscure numbers.
llvm-svn: 74414
2009-06-28 23:01:01 +00:00
Bill Wendling d63bbadbef Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.

llvm-svn: 74405
2009-06-28 07:36:13 +00:00
Nate Begeman 8b68d6fb83 OpenCL 1.0 Support: support "bool, true, false" tokens when compiling for OpenCL
llvm-svn: 74224
2009-06-25 23:25:15 +00:00
Argyrios Kyrtzidis 0e5ecbda69 Fix column checking for SourceManager::getLocation().
llvm-svn: 74194
2009-06-25 18:22:16 +00:00
Chris Lattner 46be2e1557 fix the type of wchar_t for windows, PR4417
llvm-svn: 74083
2009-06-24 17:12:15 +00:00
Daniel Dunbar 349db7bbcd Fix warning when building w/o asserts.
llvm-svn: 74020
2009-06-23 23:09:58 +00:00
Argyrios Kyrtzidis 33661d9f16 Introduce SourceManager::ísBeforeInTranslationUnit() which can compare 2 source locations and determine which one comes before the other, relative to the translation unit.
llvm-svn: 74014
2009-06-23 22:01:48 +00:00
Chris Lattner 2fe5b26414 __APPLE_CC__ should only be set when building for darwin targets.
llvm-svn: 73934
2009-06-23 00:43:21 +00:00
Argyrios Kyrtzidis 0152c6cbca In SourceManager::createFileID missed setting ContentCache's FirstFID in another place.
llvm-svn: 73931
2009-06-23 00:42:06 +00:00
Argyrios Kyrtzidis 69c2e0635a Slight modification to column checking inside SourceManager::getLocation().
llvm-svn: 73826
2009-06-20 08:40:15 +00:00
Argyrios Kyrtzidis 88f663c04d Introduce SourceManager::getLocation() to get a source location out of a "file:line:column" triplet.
llvm-svn: 73823
2009-06-20 08:09:57 +00:00
Chris Lattner 651a221cc2 follow-on to my patch: some targets (like sparc) do not
have target-specific builtins, and do not set the count.
Just default to 0 for these targets.

llvm-svn: 73510
2009-06-16 17:27:50 +00:00
Chris Lattner 4ef49c1d6e my refactoring of builtins changed target-specific builtins to only be
registered when PCH wasn't being used.  We should always install (in BuiltinInfo)
information about target-specific builtins, but we shouldn't register any builtin
identifier infos.  This fixes the build of apps that use PCH and target specific
builtins together.

llvm-svn: 73492
2009-06-16 16:18:48 +00:00
Douglas Gregor 15e08d8567 Base SFINAE error suppression counting on the class of an error, not
its (possibly-remapped) diagnostics. Thanks, Chris!

llvm-svn: 73390
2009-06-15 16:52:15 +00:00
Douglas Gregor 33834516f3 Update LLVM.
Implement support for C++ Substitution Failure Is Not An Error
(SFINAE), which says that errors that occur during template argument
deduction do *not* produce diagnostics and do not necessarily make a
program ill-formed. Instead, template argument deduction silently
fails. This is currently implemented for template argument deduction
during matching of class template partial specializations, although
the mechanism will also apply to template argument deduction for
function templates. The scheme is simple:

  - If we are in a template argument deduction context, any diagnostic
    that is considered a SFINAE error (or warning) will be
    suppressed. The error will be propagated up the call stack via the
    normal means.
  - By default, all warnings and errors are SFINAE errors. Add the
    NoSFINAE class to a diagnostic in the .td file to make it a hard
    error (e.g., for access-control violations).

Note that, to make this fully work, every place in Sema that emits an
error *and then immediately recovers* will need to check
Sema::isSFINAEContext() to determine whether it must immediately
return an error rather than recovering.

llvm-svn: 73332
2009-06-14 07:33:30 +00:00
Chris Lattner 15ba94987a Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc.  This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.

llvm-svn: 73319
2009-06-14 01:54:56 +00:00
Chris Lattner 5abdec7978 move the various builtins stuff from libast to libbasic. This
fixes a layering violation in lib/Basic/Targets.cpp.

llvm-svn: 73318
2009-06-14 01:05:48 +00:00
Daniel Dunbar eed62b7c4b Add stack alignment to x86_64 target data.
- <rdar://problem/6948443> WARNING: Linking two modules of different data
   layouts!

llvm-svn: 73093
2009-06-08 22:39:13 +00:00
Eli Friedman ebb9e4dc4d Minor tweaks to the Windows target.
llvm-svn: 73083
2009-06-08 21:16:17 +00:00
Eli Friedman cf432d3c7b PR4346: add "R" asm register constraint.
llvm-svn: 73081
2009-06-08 20:45:44 +00:00
Eli Friedman aa27a87ab3 Misc minor fixes for clang for the Windows target.
llvm-svn: 73050
2009-06-08 06:11:14 +00:00
Zhongxing Xu aaa86d07a0 Remove dead code: 'NewEntry' is not used.
llvm-svn: 73027
2009-06-07 11:18:14 +00:00
Eli Friedman 9ffd4a9b96 Move CharIsSigned from TargetInfo to LangOptions.
llvm-svn: 72928
2009-06-05 07:05:05 +00:00
Eli Friedman fd4b1559db Move a couple Darwin-specific defines into getDarwinDefines.
llvm-svn: 72900
2009-06-04 23:00:29 +00:00
Eli Friedman 3d2c8fd3a6 Back out r72764; I should have looked more carefully before committing
this.  The correct replacement for "Y" and "Yt" is "x".

llvm-svn: 72765
2009-06-03 10:41:42 +00:00
Eli Friedman ffc8748faa PR3678: Add support for "Yt" asm register constraint.
llvm-svn: 72764
2009-06-03 10:33:05 +00:00
Sanjiv Gupta 7c72007e2a Add floating point details to PIC16 Target.
llvm-svn: 72713
2009-06-02 04:43:46 +00:00
Eli Friedman 20da71e3b6 Add a couple missing ARM defines.
llvm-svn: 72583
2009-05-29 19:00:15 +00:00
Eli Friedman 7942674be0 A few more tweaks for Solaris; please correct me if it's wrong somehow.
llvm-svn: 72240
2009-05-22 01:12:57 +00:00
Douglas Gregor 4871c4739d Improve target support for Solaris.
llvm-svn: 72237
2009-05-21 23:51:30 +00:00
Daniel Dunbar 70f924df8a Avoid potential out-of-bounds access in SourceManager::getLineNumber.
- Chris, please see added FIXMEs.

llvm-svn: 72019
2009-05-18 17:30:52 +00:00
Eli Friedman 678d3bac03 Targets without long long should reduce the size of intmax_t
accordingly.

llvm-svn: 71966
2009-05-16 23:30:57 +00:00
Anton Korobeynikov 2f910827eb Provide dummy va_list typedef for msp430
llvm-svn: 71233
2009-05-08 18:24:57 +00:00
Daniel Dunbar f9d90275f9 Handle -march for the LLVM recognized cpu names.
- x86 target feature handling should not be feature complete, even if
   the code quality is lacking.

llvm-svn: 71123
2009-05-06 21:56:32 +00:00
Daniel Dunbar bb36aed06b More x86 target feature support.
- Apologies for the extremely gross code duplication, I want to get
   this working and then decide how to get this information out of the
   back end.

 - This replaces -m[no-]sse4[12] by -m[no-]sse4, it appears gcc
   doesn't distinguish them?

 - -msse, etc. now properly disable/enable related features.

 - Don't always define __SSE3__...

 - The main missing functionality bit here is that we don't initialize
   the features based on the CPU for all -march options.

llvm-svn: 71117
2009-05-06 21:07:50 +00:00
Daniel Dunbar e5ae096bf8 Tweak x86 -mcpu defaults.
- Default to yonah on Darwin (to get SSE3).

 - Default to Pentium4 (32-bit) and x86-64 (64-bit) on
   non-Darwin. Welcome to the 21st century.

llvm-svn: 71069
2009-05-06 04:58:14 +00:00
Chris Lattner dbcc5ca57f Fix rdar://6860124 - invalid input constraint 'J' in asm
This recognizes all the target-independent constant constraints
that have target-specific meanings.

llvm-svn: 71064
2009-05-06 04:33:31 +00:00
Daniel Dunbar 4dbaaa6f43 Improve handling of (X86) target features.
- This is a WIP...

 - This adds -march= handling to the driver, and fixes the defaulting
   of -mcpu on Darwin (which was using the wrong test).

Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
 -target-feature [+-]name

In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.

This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.

llvm-svn: 71061
2009-05-06 03:16:41 +00:00
Anton Korobeynikov a0f5437c03 Hook msp430 in
llvm-svn: 70774
2009-05-03 13:43:08 +00:00
Anton Korobeynikov 9d026dd985 Whitespace cleanup
llvm-svn: 70773
2009-05-03 13:42:53 +00:00
Chris Lattner 195f88386c when creating custom warning diagnostics, do not attempt to map
them with -Werror.  Custom diags cannot be mapped, and this makes
-Werror cause a determinstic crash for the checker and other
clients of the custom diagnostics machinery.  rdar://6816191

llvm-svn: 70639
2009-05-02 19:34:21 +00:00
Eli Friedman 2b680b43e9 Simplify the scheme used for keywords, and change the classification
scheme to be more useful.

The new scheme introduces a set of categories that should be more 
readable, and also reflects what we want to consider as an extension 
more accurately.  Specifically, it makes the "what is a keyword" 
determination accurately reflect whether the keyword is a GNU or 
Microsoft extension.

I also introduced separate flags for keyword aliases; this is useful 
because the classification of the aliases is mostly unrelated to the 
classification of the original keyword.

This patch treats anything that's in the implementation 
namespace (prefixed with "__", or "_X" where "X" is any upper-case 
letter) as a keyword without marking it as an extension.  This is 
consistent with the standards in that an implementation is allowed to define 
arbitrary extensions in the implementation namespace without violating 
the standard. This gets rid of all the nasty "extension used" warnings 
for stuff like __attribute__ in -pedantic mode.  We still warn for 
extensions outside of the the implementation namespace, like typeof.
If someone wants to implement -Wextensions or something like that, we 
could add additional information to the keyword table.

This also removes processing for the unused "Boolean" language option; 
such an extension isn't supported on any other C implementation, so I 
don't see any point to adding it.

The changes to test/CodeGen/inline.c are required because previously, we 
weren't actually disabling the "inline" keyword in -std=c89 mode.

I'll remove Boolean and NoExtensions from LangOptions in a follow-up 
commit.

llvm-svn: 70281
2009-04-28 03:13:54 +00:00
Douglas Gregor 0bc1293584 Be more careful in our teardown of the PCHReader after deciding to
ignore a PCH file.

llvm-svn: 70251
2009-04-27 21:28:04 +00:00
Douglas Gregor c504683237 Implement caching of stat() calls for precompiled headers, which is
essentially the same thing we do with pretokenized headers. stat()
caching improves performance of the Cocoa-prefixed "Hello, World" by
45%.

llvm-svn: 70223
2009-04-27 18:38:38 +00:00
Douglas Gregor 258ae54a5d Load most of the source manager's information lazily from the PCH
file. In particular, only eagerly load source location entries for
files and for the predefines buffer. Other buffers and
macro-instantiation source location entries are loaded lazily.

With the Cocoa-prefixed "Hello, World", we only load 815/26555 source
location entities. This halves the amount of user time we spend in
this "Hello, World" program with -fsyntax-only (down to .007s).

This optimization is part 1 of 2 for the source manager. This
eliminates most of the user time in loading a PCH file. We still spend
too much time initialize File structures (especially in the calls to
stat), so we need to either make the loading of source location
entries for files lazy or import the stat cache from the PTH
implementation.

llvm-svn: 70196
2009-04-27 06:38:32 +00:00
Douglas Gregor 70091b8f43 Some fixes for PCH (de-)serialization of Objective-C AST nodes:
- Deal with the Receiver/ClassInfo shared storage in ObjCMessageExpr
  - Implement PCH support for ImplicitParamDecl
  - Fix the handling of the body of an ObjCMethodDecl
  - Several cast -> cast_or_null fixes
  - Make Selector::getIdentifierInfoForSlot work for 1-argument, NULL
  selectors.
  - Make Selector::getAsString() work with NULL selectors.
  - Fix the names of VisitObjCAtCatchStmt and VisitObjCAtFinallyStmt
  in the PCH reader and writer; these were never getting called.

At this point, all of the pch-test tests pass for C and Objective-C.

llvm-svn: 70163
2009-04-26 22:20:50 +00:00
Chris Lattner 4c92b51089 in a tied operand, don't copy over the name or constraint string, just the flags.
llvm-svn: 70137
2009-04-26 18:05:25 +00:00
Chris Lattner c16d476b30 pull operands names "[foo]" into ConstraintInfo.
llvm-svn: 70136
2009-04-26 17:57:12 +00:00
Chris Lattner c3f4c7b1c5 pull the constraint string into the ConstraintInfo struct
instead of passing it around in addition to it.

llvm-svn: 70135
2009-04-26 17:19:08 +00:00