Commit Graph

19268 Commits

Author SHA1 Message Date
Rafael Espindola e264187cf2 Implement -fno-dwarf2-cfi-asm.
llvm-svn: 130616
2011-04-30 18:35:43 +00:00
Douglas Gregor 85894a8f85 When comparing parameters of reference-to-qualified type during
partial ordering of function templates, use a simple superset
relationship rather than the convertibility-implying
isMoreQualifiedThan/compatibilyIncludes relationship. Fixes partial
ordering between references and address-space-qualified references.

llvm-svn: 130612
2011-04-30 17:07:52 +00:00
Ken Dyck d9c83e6cdf Replace a literal 8 with Context->getCharWidth() in
SynthesizeByrefCopyDestroyHelper(). No change in functionality intended.

llvm-svn: 130608
2011-04-30 16:08:27 +00:00
Chandler Carruth 61f4cbf38a Make type-traits reflect that Clang's vectors act like scalar types.
llvm-svn: 130606
2011-04-30 10:46:26 +00:00
Chandler Carruth 7623757cd0 Switch the type-trait like APIs on the AST to only check for incomplete
types after looking through arrays. Arrays with an unknown bound seem to
be specifically allowed in the library type traits in C++0x, and GCC's
builtin __is_trivial returns 'true' for the type 'int[]'. Now Clang
agrees with GCC about __is_trivial here.

Also hardens these methods against dependent types by just returning false.

llvm-svn: 130605
2011-04-30 10:31:50 +00:00
Chandler Carruth b077620c02 Extract a function to impose the completeness requirement on unary type
trait arguments. Reflow the logic to use early exit instead of a complex
condition expression. Switch to a switch for acting on different type
traits and add a bunch of the recently implemented type traits here.
This fixes one of the regressions with the new __is_standard_layout
trait to again require a complete type. It also fixes some latent bugs
in other traits that never did impose this despite the standard
requiring it. However, all these bugs were hidden for non-borland
systems where the default is to require a complete type.

It's unclear to me what the best approach here is: providing an explicit
lists for the ones requiring complete types only w/ Borland and using
a default for the rest, or forcing this switch to enumerate the traits
and make it clear which way each one goes.

I'm still working on cleaning up the tests so that they actually catch
this, a much more comprehensive update to the tests will come once I've
worked through the bugs I'm finding via inspection.

llvm-svn: 130604
2011-04-30 10:07:32 +00:00
Chandler Carruth 583edf8843 Rename the last '[hH]asStandardLayout' entites to '[iI]sStandardLayout'
based on Doug's preferences when we discussed this in IRC. This brings
the wording more in line with the standard.

llvm-svn: 130603
2011-04-30 10:07:30 +00:00
Chandler Carruth c1ce4f58e6 Hoist all of the type-specific trait logic for __is_standard_layout into
a Type method isStandardLayoutType, to keep our user API matching the
type trait builtins as closely as possible. Also, implement it in terms
of other Type APIs rather than in terms of other type traits. This
models the implementation on that of isLiteralType and isTrivialType.
There remain some common problems with these traits still, so this is
a bit of a WIP. However, we can now fix all of these traits at the same
time and in a consistent manner.

llvm-svn: 130602
2011-04-30 09:17:49 +00:00
Chandler Carruth b196374f53 Completely re-implement the core logic behind the __is_standard_layout
type trait. The previous implementation suffered from several problems:

1) It implemented all of the logic in RecordType by walking over every
   base and field in a CXXRecordDecl and validating the constraints of
   the standard. This made for very straightforward code, but is
   extremely inefficient. It also is conceptually wrong, the logic tied
   to the C++ definition of standard-layout classes should be in
   CXXRecordDecl, not RecordType.
2) To address the performance problems with #1, a cache bit was added to
   CXXRecordDecl, and at the completion of every C++ class, the
   RecordType was queried to determine if it was a standard layout
   class, and that state was cached. Two things went very very wrong
   with this. First, the caching version of the query *was never
   called*. Even within the recursive steps of the walk over all fields
   and bases the caching variant was not called, making each query
   a full *recursive* walk. Second, despite the cache not being used, it
   was computed for every class declared, even when the trait was never
   used in the program. This probably significantly regressed compile
   time performance for edge-case files.
3) An ASTContext was required merely to query the type trait because
   querying it performed the actual computations.
4) The caching bit wasn't managed correctly (uninitialized).

The new implementation follows the system for all the other traits on
C++ classes by encoding all the state needed in the definition data and
building up the trait incrementally as each base and member are added to
the definition of the class.

The idiosyncracies of the specification of standard-layout classes
requires more state than I would like; currently 5 bits. I could
eliminate one of the bits easily at the expense of both clarity and
resilience of the code. I might be able to eliminate one of the other
bits by computing its state in terms of other state bits in the
definition. I've already done that in one place where there was a fairly
simple way to achieve it.

It's possible some of the bits could be moved out of the definition data
and into some other structure which isn't serialized if the serialized
bloat is a problem. That would preclude serialization of a partial class
declaration, but that's likely already precluded.

Comments on any of these issues welcome.

llvm-svn: 130601
2011-04-30 09:17:45 +00:00
Benjamin Kramer 08635fcc83 Initialize HasStandardLayout.
llvm-svn: 130600
2011-04-30 08:55:35 +00:00
Ted Kremenek 8067746554 Move the SelfInit checker to the 'cocoa.experimental' package.
llvm-svn: 130598
2011-04-30 06:46:45 +00:00
Daniel Dunbar 2f31fb99ef Driver/Darwin: Don't link -lgcc_s.1 when compiling as iOS for the simulator,
that library has never been in the SDK. Fortunately, it shouldn't be necessary,
since that library was also removed in 10.6.

llvm-svn: 130595
2011-04-30 04:25:16 +00:00
Daniel Dunbar 72ceb92aa3 Driver/Darwin: When using -mios-simulator-version-min, explicitly pass this on
to the linker.
 - Only do this explicitly with the argument for now, the linker will need to
   explicitly add support for this.

llvm-svn: 130594
2011-04-30 04:22:58 +00:00
Daniel Dunbar a9cbb6b9d5 Driver/Darwin: Reject invalid arch combinations with
-mios-simulator-version-min.

llvm-svn: 130593
2011-04-30 04:20:40 +00:00
Daniel Dunbar b1189434dd Driver/Darwin: Change Darwin toolchain to explicitly track is-ios-sim bit, and
update -mios-simulator-version-min to set it.

llvm-svn: 130592
2011-04-30 04:18:16 +00:00
Daniel Dunbar 9aaeb6400b Driver/Darwin: Sketch initial support for a -mios-simulator-version-min= flag
and associated deployment target environment variable.

llvm-svn: 130591
2011-04-30 04:15:58 +00:00
Nico Weber e8fdcac02c Add lib/Tooling to the Makefile build.
llvm-svn: 130581
2011-04-30 03:09:18 +00:00
Chad Rosier 3909e037ab Removed redundant case statements
llvm-svn: 130564
2011-04-30 00:03:48 +00:00
Devang Patel a3e3fded0a Tie constructor defintion with its declaration using AT_specification.
llvm-svn: 130561
2011-04-29 23:42:32 +00:00
Bob Wilson 9a5f84facb Add -Oz option and use it to set the inline threshold to 25.
Radar 9333566.  Patch by Chad Rosier!

llvm-svn: 130554
2011-04-29 22:49:50 +00:00
Fariborz Jahanian 52a8cca56f removes a meaningless comment.
llvm-svn: 130550
2011-04-29 22:11:28 +00:00
Fariborz Jahanian 99514b9168 block variables on lhs need be ir-gen'ed after the
rhs when its 'forwarding' pointer may be modified 
in rhs evaluation as result of call to Block_copy.
// rdar://9309454

llvm-svn: 130545
2011-04-29 21:53:21 +00:00
Anders Carlsson 73ad5bc9ea Serialize/deserialize the HasStandardLayout bit when writing/reading PCHs.
llvm-svn: 130525
2011-04-29 18:37:25 +00:00
Daniel Dunbar 252e8f9ac1 Driver/cc1as: Forward -mllvm arguments when compiling assembly files.
llvm-svn: 130516
2011-04-29 17:53:18 +00:00
Charles Davis 6c488f14f6 Remove comments about __int8 and friends from the mangler. Turns out we don't
actually have to implement them, since in modern versions of MSVC they're
aliases to the standard C types.

llvm-svn: 130509
2011-04-29 15:50:52 +00:00
Douglas Gregor f1fce5d3ef White-list yet more type trait names, since they're used as
identifiers in libc++.

llvm-svn: 130508
2011-04-29 15:31:39 +00:00
David Chisnall 10d2ded910 Don't crash if the AST doesn't have a sensible ObjC id type.
llvm-svn: 130500
2011-04-29 14:10:35 +00:00
Chandler Carruth c37485e6cb Relax the non-POD memset warning to use the less restrictive C++11
definition of POD. Specifically, this allows certain non-aggregate
types due to their data members being private.

The representation of C++11 POD testing is pretty gross. Any suggestions
for improvements there are welcome. Especially the name
'isCXX11PODType()' seems truly unfortunate.

llvm-svn: 130492
2011-04-29 09:46:08 +00:00
Francois Pichet c867975776 r130381 follow up: accept __uuidof expression for template argument reference.
llvm-svn: 130491
2011-04-29 09:08:14 +00:00
Sebastian Redl 2ac2c725e0 Add a decl update when a static data member of a class template is instantiated in a different PCH than its containing class. Otherwise we get double definition errors. Fixes a Boost.MPL problem that affects Boost.Accumulators and probably a lot more of Boost.
llvm-svn: 130488
2011-04-29 08:19:30 +00:00
Chandler Carruth efd5671a27 Don't assume that the AST methods will only be invoked on C++ types.
Teaches isLiteralType and isTrivialType to behave plausibly and most
importantly not crash on normal RecordDecls.

Sadly I have no real way to test this. I stumbled onto it by
mis-implementing a warning.

llvm-svn: 130483
2011-04-29 07:47:42 +00:00
Douglas Gregor 63180b1190 libstdc++ 4.2 also uses __is_same as a struct name, which conflicts with our new type trait __is_same
llvm-svn: 130468
2011-04-29 01:38:03 +00:00
Douglas Gregor 68dac4676d Use DirectoryLookup::getName() rather than getDir()->getName() in a context where we don't know whether we have a normal directory
llvm-svn: 130467
2011-04-29 00:45:09 +00:00
Ted Kremenek 5e1ed7b8dd Enhance clang_getCXTUResourceUsage() to report the sizes of the memory buffers used by PCH.
llvm-svn: 130460
2011-04-28 23:46:20 +00:00
Fariborz Jahanian 6d003c3041 Fixes debug info generation problem for ms_struct structs.
// rdar://8823265

llvm-svn: 130458
2011-04-28 23:43:23 +00:00
Argyrios Kyrtzidis 03535265ef Cut down unnecessary zero'ing when value-initializing arrays of C++ objects.
-C++ objects with user-declared constructor don't need zero'ing.
-We can zero-initialize arrays of C++ objects in "bulk" now, in which case don't zero-initialize each object again.

llvm-svn: 130453
2011-04-28 22:57:55 +00:00
Fariborz Jahanian 8409bce4ac ms_struct patch for initialization and field access irgen.
// rdar://8823265 - wip.

llvm-svn: 130451
2011-04-28 22:49:46 +00:00
Stuart Hastings 9f02fd9d8d Raise ARM byval minimum size from 32 to 64, addressing a performance
regression in mason.  rdar://problem/7662569

llvm-svn: 130444
2011-04-28 21:35:59 +00:00
Daniel Dunbar c44d313cff Driver/Darwin/ld: Set the deployment target following the version information in
the tool chain, instead of based on the translated arguments.

llvm-svn: 130440
2011-04-28 21:23:41 +00:00
Ted Kremenek 8d58790019 Enhance clang_getCXTUResourceUsage() to report how much memory is used by SourceManager's memory buffers.
llvm-svn: 130433
2011-04-28 20:36:42 +00:00
Argyrios Kyrtzidis 9d3c504078 Get the base element type even in multidimensional arrays.
llvm-svn: 130427
2011-04-28 20:07:15 +00:00
Lenny Maiorani 18470e3287 Use StringRef::substr() and unbounded StringRef::compare() instead of bounded version of StringRef::compare() because bounded version of StringRef::compare() is going to be removed.
llvm-svn: 130425
2011-04-28 19:31:12 +00:00
Ted Kremenek 414a2c0951 Make the top-level driver ignore -fobjc-default-synthesize-properties while this feature undergoes more review and development. This is still available as a -cc1 option for testing.
llvm-svn: 130424
2011-04-28 19:26:03 +00:00
Stuart Hastings dd77c8efa2 Replace unitary array with scalar. rdar://problem/7662569
llvm-svn: 130423
2011-04-28 19:24:47 +00:00
Lenny Maiorani ed2cc6ccbb Eliminates an assert in the strncpy/strncat checker caused by not validating a cast was successful. If the value of an argument was unknown, the cast would result in a NULL pointer which was later being dereferenced.
This fixes Bugzilla #9806.

llvm-svn: 130422
2011-04-28 18:59:43 +00:00
Argyrios Kyrtzidis e07425a5e7 When value-initializing the elements of an array not not included in the initializer make sure
that a non-trivial C++ constructor gets called.

Fixes rdar://9347552 & http://llvm.org/PR9801

llvm-svn: 130421
2011-04-28 18:53:58 +00:00
Argyrios Kyrtzidis fddbcfbec4 Don't waste memory if the initializer expression is empty.
llvm-svn: 130420
2011-04-28 18:53:55 +00:00
Stuart Hastings 4b21495e42 Replace SmallVector with an array, as suggested by Frits van Bommel. rdar://problem/7662569
llvm-svn: 130417
2011-04-28 18:16:06 +00:00
Douglas Gregor d517d55484 When determining whether two types are reference-compatible, check
non-CVR qualifiers as well as CVR qualifiers. For example, don't allow
a reference to an integer in address space 1 to bind to an integer in
address space 2.

llvm-svn: 130411
2011-04-28 17:56:11 +00:00
Douglas Gregor b6100f2bdc Only call the MacroExpands callback when we're actually going to
expand the macro, based on a patch by Ori Avtalion. Fixes PR9799.

llvm-svn: 130402
2011-04-28 16:36:13 +00:00