]> granicus.if.org Git - clang/log
clang
13 years agoAdd r130624 back now that ELF has been fixed to work with -fno-dwarf2-cfi-asm.
Rafael Espindola [Sun, 1 May 2011 15:45:27 +0000 (15:45 +0000)]
Add r130624 back now that ELF has been fixed to work with -fno-dwarf2-cfi-asm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130659 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBased on the new information in the AST provided by r130628, write
Chandler Carruth [Sun, 1 May 2011 09:53:37 +0000 (09:53 +0000)]
Based on the new information in the AST provided by r130628, write
3 lines of code and improve a bunch of information in the libclang view
of the code.

Updates the two tests that exercise this with the new data, checking
that each new source location actually points back to the declared
template parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130656 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove several more type traits' implementations into the AST. A few were
Chandler Carruth [Sun, 1 May 2011 09:29:58 +0000 (09:29 +0000)]
Move several more type traits' implementations into the AST. A few were
already present in the AST, and I added the ones that weren't.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130655 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch __is_scalar to use the isScalarType predicate rather than
Chandler Carruth [Sun, 1 May 2011 09:29:55 +0000 (09:29 +0000)]
Switch __is_scalar to use the isScalarType predicate rather than
duplicating its logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130654 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHave the array type traits build an expression with type 'size_t'
Chandler Carruth [Sun, 1 May 2011 08:48:21 +0000 (08:48 +0000)]
Have the array type traits build an expression with type 'size_t'
instead of 'int'.

The Embarcadero spec says 'unsigned int', not 'int'. That's what
'size_t' is on Windows, but for Clang using a 'size_t' that can be
larger than int seems more appropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130653 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove an inapplicable and completely out of place comment. The type is in fact ...
Chandler Carruth [Sun, 1 May 2011 08:48:19 +0000 (08:48 +0000)]
Remove an inapplicable and completely out of place comment. The type is in fact 'bool'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130652 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove more dead code for emitting diagnostics. The callers of these
Chandler Carruth [Sun, 1 May 2011 08:41:10 +0000 (08:41 +0000)]
Remove more dead code for emitting diagnostics. The callers of these
functions already precluded dependent types from reaching them.

Also change one of the callers to not error when a trait is applied to
a dependent type. This is a perfectly reasonable pattern, and both Unary
and Binary type traits already support dependent types (by populating
the AST with a nonce value).

Remove the actual diagnostic, since these aren't errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130651 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove traversing of BlockExprs in RecursiveASTVisitor.
Argyrios Kyrtzidis [Sun, 1 May 2011 08:06:46 +0000 (08:06 +0000)]
Improve traversing of BlockExprs in RecursiveASTVisitor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130650 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSimplify the flow of some of the array type trait code.
Chandler Carruth [Sun, 1 May 2011 07:49:26 +0000 (07:49 +0000)]
Simplify the flow of some of the array type trait code.

Completely remove a switch which selected between the same two types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130649 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConvert the expression trait evaluation to a static function and
Chandler Carruth [Sun, 1 May 2011 07:44:20 +0000 (07:44 +0000)]
Convert the expression trait evaluation to a static function and
a switch with any default case. This both warns when an enumerator is
missing and asserts if a value sneaks through despite the warning.

While in there fix a bunch of coding style issues with this code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130648 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove the default case from the unary type trait evaluation function,
Chandler Carruth [Sun, 1 May 2011 07:44:17 +0000 (07:44 +0000)]
Remove the default case from the unary type trait evaluation function,
adding an unreachable annotation. Remarkably this one was already
enumarting every trait.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130647 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove a few more bogus returns when the switch covers all the
Chandler Carruth [Sun, 1 May 2011 07:23:23 +0000 (07:23 +0000)]
Remove a few more bogus returns when the switch covers all the
enumerators.

Also remove a default that led to llvm_unreachable to make another
switch warn if any enumerators fail to be covered.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130646 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove another default and a *completely* bogus return from a switch
Chandler Carruth [Sun, 1 May 2011 07:23:20 +0000 (07:23 +0000)]
Remove another default and a *completely* bogus return from a switch
over type traits.

Add the missing trait from this switch that Clang's warning uncovered.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130645 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMark that this function ends in a covering switch statement with every
Chandler Carruth [Sun, 1 May 2011 07:23:17 +0000 (07:23 +0000)]
Mark that this function ends in a covering switch statement with every
case returning a value.

Silences a GCC warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130644 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove the type traits UTT_IsLvalueExpr and UTT_IsRvalueExpr.
Chandler Carruth [Sun, 1 May 2011 07:23:14 +0000 (07:23 +0000)]
Remove the type traits UTT_IsLvalueExpr and UTT_IsRvalueExpr.

As might be surmised from their names, these aren't type traits, they're
expression traits. Amazingly enough, they're expression traits that we
have, and fully implement. These "type" traits are even parsed from the
same tokens as the expression traits. Luckily, the parser only tried the
expression trait parsing for these tokens, so this was all just a pile
of dead code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130643 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFully implement delegating constructors!
Sean Hunt [Sun, 1 May 2011 07:04:31 +0000 (07:04 +0000)]
Fully implement delegating constructors!

As far as I know, this implementation is complete but might be missing a
few optimizations. Exceptions and virtual bases are handled correctly.

Because I'm an optimist, the web page has appropriately been updated. If
I'm wrong, feel free to downgrade its support categories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130642 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMore cleanup of the type traits implementation.
Chandler Carruth [Sun, 1 May 2011 06:51:22 +0000 (06:51 +0000)]
More cleanup of the type traits implementation.
1) Moved the completeness checking routine above the evaluation routine
   so the reader sees that we do in fact check for complete types when
   necessary.
2) Remove the FIXME comment about not doing this.
3) Make the arguments to the evaluate function agree in order with those
   to the completeness checking function.
4) Completely specify the enumerators for the completeness checking
   function rather than relying on a default.
5) Remove a check for the Borland language to only require complete
   types in a few places. Borland's own documentation doesn't agree with
   this: some of the previously unspecified traits *do* require
   a complete type, some don't.
6) Correctly split the traits which do not require complete types from
   those that do, clarifying comments and citations to the standard or
   other documentation where relevant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130641 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOrder the type traits according to the standard's listing of unary type
Chandler Carruth [Sun, 1 May 2011 06:11:07 +0000 (06:11 +0000)]
Order the type traits according to the standard's listing of unary type
traits where possible. For the rest, group them and add some
documentation regarding their origins.

No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130639 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBegin cleaning up type trait expression implementations and settling on
Chandler Carruth [Sun, 1 May 2011 06:11:03 +0000 (06:11 +0000)]
Begin cleaning up type trait expression implementations and settling on
a single pattern for implementing each.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130638 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a triple to this test, otherwise it fails under MSVC because wchar_t is unsigned...
Francois Pichet [Sun, 1 May 2011 04:32:34 +0000 (04:32 +0000)]
Add a triple to this test, otherwise it fails under MSVC because wchar_t is unsigned with the i686-pc-win32 triple.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130636 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove the documentation for the two ObjCDeclQualifiers so that I
John McCall [Sun, 1 May 2011 03:04:29 +0000 (03:04 +0000)]
Improve the documentation for the two ObjCDeclQualifiers so that I
stop considering whether I can compress them. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130633 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCompress some bits. Only matters for MSVC, or if we ever
John McCall [Sun, 1 May 2011 02:13:58 +0000 (02:13 +0000)]
Compress some bits.  Only matters for MSVC, or if we ever
devirtualize Decl (because bits can't get laid out in base
classes if the base is POD).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130632 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch the interface name for both TemplateTypeParmType and
Chandler Carruth [Sun, 1 May 2011 01:05:51 +0000 (01:05 +0000)]
Switch the interface name for both TemplateTypeParmType and
SubstTemplateTypeParmType to be 'getIdentifier' instead of 'getName' as
it returns an identifier. This makes them more consistent with the
NamedDecl interface.

Also, switch back to using this interface to acquire the indentifier in
TypePrinter.cpp. I missed this in r130628.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130629 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRe-applies the patch first applied way back in r106099, with
Chandler Carruth [Sun, 1 May 2011 00:51:33 +0000 (00:51 +0000)]
Re-applies the patch first applied way back in r106099, with
accompanying fixes to make it work today.

The core of this patch is to provide a link from a TemplateTypeParmType
back to the TemplateTypeParmDecl node which declared it. This in turn
provides much more precise information about the type, where it came
from, and how it functions for AST consumers.

To make the patch work almost a year after its first attempt, it needed
serialization support, and it now retains the old getName() interface.
Finally, it requires us to not attempt to instantiate the type in an
unsupported friend decl -- specifically those coming from template
friend decls but which refer to a specific type through a dependent
name.

A cleaner representation of the last item would be to build
FriendTemplateDecl nodes for these, storing their template parameters
etc, and to perform proper instantation of them like any other template
declaration. They can still be flagged as unsupported for the purpose of
access checking, etc.

This passed an asserts-enabled bootstrap for me, and the reduced test
case mentioned in the original review thread no longer causes issues,
likely fixed at somewhere amidst the 24k revisions that have elapsed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130628 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert the previous patch while I figure out how to make llvm-gcc
Rafael Espindola [Sat, 30 Apr 2011 23:07:10 +0000 (23:07 +0000)]
Revert the previous patch while I figure out how to make llvm-gcc
less agressive about disabling cfi on linux :-(

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130627 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate for cfi.
Rafael Espindola [Sat, 30 Apr 2011 22:30:24 +0000 (22:30 +0000)]
Update for cfi.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130624 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove unused function.
Benjamin Kramer [Sat, 30 Apr 2011 19:55:59 +0000 (19:55 +0000)]
Remove unused function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130622 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove noisy semicolons.
Benjamin Kramer [Sat, 30 Apr 2011 19:55:55 +0000 (19:55 +0000)]
Remove noisy semicolons.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130621 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPR9792: Make sure to use the right definition of wchar_t when the default
Eli Friedman [Sat, 30 Apr 2011 19:24:24 +0000 (19:24 +0000)]
PR9792: Make sure to use the right definition of wchar_t when the default
wchar_t is an unsigned type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130620 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSome small improvements to the builtin (-ffreestanding) stdint.h; in
Eli Friedman [Sat, 30 Apr 2011 19:02:59 +0000 (19:02 +0000)]
Some small improvements to the builtin (-ffreestanding) stdint.h; in
particular, make sure to handle WCHAR_MIN correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130618 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPass -fno-dwarf2-cfi-asm and use FileCheck.
Rafael Espindola [Sat, 30 Apr 2011 18:47:32 +0000 (18:47 +0000)]
Pass -fno-dwarf2-cfi-asm and use FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130617 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement -fno-dwarf2-cfi-asm.
Rafael Espindola [Sat, 30 Apr 2011 18:35:43 +0000 (18:35 +0000)]
Implement -fno-dwarf2-cfi-asm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130616 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen comparing parameters of reference-to-qualified type during
Douglas Gregor [Sat, 30 Apr 2011 17:07:52 +0000 (17:07 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130612 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReplace a literal 8 with Context->getCharWidth() in
Ken Dyck [Sat, 30 Apr 2011 16:08:27 +0000 (16:08 +0000)]
Replace a literal 8 with Context->getCharWidth() in
SynthesizeByrefCopyDestroyHelper(). No change in functionality intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130608 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake type-traits reflect that Clang's vectors act like scalar types.
Chandler Carruth [Sat, 30 Apr 2011 10:46:26 +0000 (10:46 +0000)]
Make type-traits reflect that Clang's vectors act like scalar types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130606 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch the type-trait like APIs on the AST to only check for incomplete
Chandler Carruth [Sat, 30 Apr 2011 10:31:50 +0000 (10:31 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130605 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoExtract a function to impose the completeness requirement on unary type
Chandler Carruth [Sat, 30 Apr 2011 10:07:32 +0000 (10:07 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130604 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRename the last '[hH]asStandardLayout' entites to '[iI]sStandardLayout'
Chandler Carruth [Sat, 30 Apr 2011 10:07:30 +0000 (10:07 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130603 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHoist all of the type-specific trait logic for __is_standard_layout into
Chandler Carruth [Sat, 30 Apr 2011 09:17:49 +0000 (09:17 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130602 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCompletely re-implement the core logic behind the __is_standard_layout
Chandler Carruth [Sat, 30 Apr 2011 09:17:45 +0000 (09:17 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130601 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInitialize HasStandardLayout.
Benjamin Kramer [Sat, 30 Apr 2011 08:55:35 +0000 (08:55 +0000)]
Initialize HasStandardLayout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130600 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove the SelfInit checker to the 'cocoa.experimental' package.
Ted Kremenek [Sat, 30 Apr 2011 06:46:45 +0000 (06:46 +0000)]
Move the SelfInit checker to the 'cocoa.experimental' package.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130598 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin: Don't link -lgcc_s.1 when compiling as iOS for the simulator,
Daniel Dunbar [Sat, 30 Apr 2011 04:25:16 +0000 (04:25 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130595 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin: When using -mios-simulator-version-min, explicitly pass this on
Daniel Dunbar [Sat, 30 Apr 2011 04:22:58 +0000 (04:22 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130594 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin: Reject invalid arch combinations with
Daniel Dunbar [Sat, 30 Apr 2011 04:20:40 +0000 (04:20 +0000)]
Driver/Darwin: Reject invalid arch combinations with
-mios-simulator-version-min.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130593 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin: Change Darwin toolchain to explicitly track is-ios-sim bit, and
Daniel Dunbar [Sat, 30 Apr 2011 04:18:16 +0000 (04:18 +0000)]
Driver/Darwin: Change Darwin toolchain to explicitly track is-ios-sim bit, and
update -mios-simulator-version-min to set it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130592 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin: Sketch initial support for a -mios-simulator-version-min= flag
Daniel Dunbar [Sat, 30 Apr 2011 04:15:58 +0000 (04:15 +0000)]
Driver/Darwin: Sketch initial support for a -mios-simulator-version-min= flag
and associated deployment target environment variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130591 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate API.
Rafael Espindola [Sat, 30 Apr 2011 03:46:18 +0000 (03:46 +0000)]
Update API.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130588 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix gcc 'warning: multi-line comment'.
Nico Weber [Sat, 30 Apr 2011 03:13:21 +0000 (03:13 +0000)]
Fix gcc 'warning: multi-line comment'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130583 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd lib/Tooling to the Makefile build.
Nico Weber [Sat, 30 Apr 2011 03:09:18 +0000 (03:09 +0000)]
Add lib/Tooling to the Makefile build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130581 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a Makefile to examples/Tooling for people who do not use cmake.
Nico Weber [Sat, 30 Apr 2011 03:03:12 +0000 (03:03 +0000)]
Add a Makefile to examples/Tooling for people who do not use cmake.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130577 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix Makefile build of examples/clang-interpreter.
Nico Weber [Sat, 30 Apr 2011 02:52:27 +0000 (02:52 +0000)]
Fix Makefile build of examples/clang-interpreter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130576 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a couple of assertions to make sure the bitfields can fit the value assigned...
Argyrios Kyrtzidis [Sat, 30 Apr 2011 02:28:27 +0000 (02:28 +0000)]
Add a couple of assertions to make sure the bitfields can fit the value assigned to them. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130573 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDocumentation for -Oz; Updated synopsis and item.
Chad Rosier [Sat, 30 Apr 2011 02:04:10 +0000 (02:04 +0000)]
Documentation for -Oz; Updated synopsis and item.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130570 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd documentation for -Oz flag.
Chad Rosier [Sat, 30 Apr 2011 01:40:58 +0000 (01:40 +0000)]
Add documentation for -Oz flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130569 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemoved redundant case statements
Chad Rosier [Sat, 30 Apr 2011 00:03:48 +0000 (00:03 +0000)]
Removed redundant case statements

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130564 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTie constructor defintion with its declaration using AT_specification.
Devang Patel [Fri, 29 Apr 2011 23:42:32 +0000 (23:42 +0000)]
Tie constructor defintion with its declaration using AT_specification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130561 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdjust test/Analysis/retain-release.m to also test the retain/release checker in...
Ted Kremenek [Fri, 29 Apr 2011 23:15:53 +0000 (23:15 +0000)]
Adjust test/Analysis/retain-release.m to also test the retain/release checker in Objective-C++ mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130559 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd -Oz option and use it to set the inline threshold to 25.
Bob Wilson [Fri, 29 Apr 2011 22:49:50 +0000 (22:49 +0000)]
Add -Oz option and use it to set the inline threshold to 25.
Radar 9333566.  Patch by Chad Rosier!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130554 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoremoves a meaningless comment.
Fariborz Jahanian [Fri, 29 Apr 2011 22:11:28 +0000 (22:11 +0000)]
removes a meaningless comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130550 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoblock variables on lhs need be ir-gen'ed after the
Fariborz Jahanian [Fri, 29 Apr 2011 21:53:21 +0000 (21:53 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130545 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGuard in USRGenerator::GenLoc() against null Decl* from invalid code.
Ted Kremenek [Fri, 29 Apr 2011 21:35:23 +0000 (21:35 +0000)]
Guard in USRGenerator::GenLoc() against null Decl* from invalid code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130541 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDisable -Wnon-pod-memset for now while I try to reduce the false
Chandler Carruth [Fri, 29 Apr 2011 20:58:14 +0000 (20:58 +0000)]
Disable -Wnon-pod-memset for now while I try to reduce the false
positives still further.

The plan is to:

1) Create a more targeted warning for memset of memory pointing at
   a type with virtual methods or bases where a vptr would be
   overwritten.
2) Consider turning the above warning back on by default.
3) Evaluate whether any false positives in the existing warning can be
   detected and white listed in the warning implementation.
4) If #3 lowers the noise floor enough, enable the full warning in -Wall
   or -Wextra.

Comments or suggestions welcome. Even more welcome are specific test
cases which trigger the warning and shouldn't.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130538 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoChange -Wparentheses to not imply -Widiomatic-parentheses. Users rarely want to...
Ted Kremenek [Fri, 29 Apr 2011 20:30:39 +0000 (20:30 +0000)]
Change -Wparentheses to not imply -Widiomatic-parentheses.  Users rarely want to see these warnings, and often explicitly pass -Wparentheses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130535 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSerialize/deserialize the HasStandardLayout bit when writing/reading PCHs.
Anders Carlsson [Fri, 29 Apr 2011 18:37:25 +0000 (18:37 +0000)]
Serialize/deserialize the HasStandardLayout bit when writing/reading PCHs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130525 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/cc1as: Forward -mllvm arguments when compiling assembly files.
Daniel Dunbar [Fri, 29 Apr 2011 17:53:18 +0000 (17:53 +0000)]
Driver/cc1as: Forward -mllvm arguments when compiling assembly files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130516 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove comments about __int8 and friends from the mangler. Turns out we don't
Charles Davis [Fri, 29 Apr 2011 15:50:52 +0000 (15:50 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130509 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhite-list yet more type trait names, since they're used as
Douglas Gregor [Fri, 29 Apr 2011 15:31:39 +0000 (15:31 +0000)]
White-list yet more type trait names, since they're used as
identifiers in libc++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130508 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't crash if the AST doesn't have a sensible ObjC id type.
David Chisnall [Fri, 29 Apr 2011 14:10:35 +0000 (14:10 +0000)]
Don't crash if the AST doesn't have a sensible ObjC id type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130500 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRelax the non-POD memset warning to use the less restrictive C++11
Chandler Carruth [Fri, 29 Apr 2011 09:46:08 +0000 (09:46 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130492 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agor130381 follow up: accept __uuidof expression for template argument reference.
Francois Pichet [Fri, 29 Apr 2011 09:08:14 +0000 (09:08 +0000)]
r130381 follow up: accept __uuidof expression for template argument reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130491 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a decl update when a static data member of a class template is instantiated in...
Sebastian Redl [Fri, 29 Apr 2011 08:19:30 +0000 (08:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130488 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse std::vector for ASTReader's ASTBuffers, instead of std::deque.
Sebastian Redl [Fri, 29 Apr 2011 08:19:19 +0000 (08:19 +0000)]
Use std::vector for ASTReader's ASTBuffers, instead of std::deque.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130487 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse -emit-llvm-only as suggested by Argyrios.
Sebastian Redl [Fri, 29 Apr 2011 08:19:03 +0000 (08:19 +0000)]
Use -emit-llvm-only as suggested by Argyrios.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130486 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't assume that the AST methods will only be invoked on C++ types.
Chandler Carruth [Fri, 29 Apr 2011 07:47:42 +0000 (07:47 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130483 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOops
Douglas Gregor [Fri, 29 Apr 2011 01:50:40 +0000 (01:50 +0000)]
Oops

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130469 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agolibstdc++ 4.2 also uses __is_same as a struct name, which conflicts with our new...
Douglas Gregor [Fri, 29 Apr 2011 01:38:03 +0000 (01:38 +0000)]
libstdc++ 4.2 also uses __is_same as a struct name, which conflicts with our new type trait __is_same

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130468 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse DirectoryLookup::getName() rather than getDir()->getName() in a context where...
Douglas Gregor [Fri, 29 Apr 2011 00:45:09 +0000 (00:45 +0000)]
Use DirectoryLookup::getName() rather than getDir()->getName() in a context where we don't know whether we have a normal directory

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130467 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEnhance clang_getCXTUResourceUsage() to report the sizes of the memory buffers used...
Ted Kremenek [Thu, 28 Apr 2011 23:46:20 +0000 (23:46 +0000)]
Enhance clang_getCXTUResourceUsage() to report the sizes of the memory buffers used by PCH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130460 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFixes debug info generation problem for ms_struct structs.
Fariborz Jahanian [Thu, 28 Apr 2011 23:43:23 +0000 (23:43 +0000)]
Fixes debug info generation problem for ms_struct structs.
// rdar://8823265

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130458 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCut down unnecessary zero'ing when value-initializing arrays of C++ objects.
Argyrios Kyrtzidis [Thu, 28 Apr 2011 22:57:55 +0000 (22:57 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130453 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoms_struct patch for initialization and field access irgen.
Fariborz Jahanian [Thu, 28 Apr 2011 22:49:46 +0000 (22:49 +0000)]
ms_struct patch for initialization and field access irgen.
// rdar://8823265 - wip.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130451 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRaise ARM byval minimum size from 32 to 64, addressing a performance
Stuart Hastings [Thu, 28 Apr 2011 21:35:59 +0000 (21:35 +0000)]
Raise ARM byval minimum size from 32 to 64, addressing a performance
regression in mason.  rdar://problem/7662569

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130444 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin/ld: Set the deployment target following the version information in
Daniel Dunbar [Thu, 28 Apr 2011 21:23:41 +0000 (21:23 +0000)]
Driver/Darwin/ld: Set the deployment target following the version information in
the tool chain, instead of based on the translated arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130440 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agotests: Tweak test to not write to the same temporary twice, in the hopes of avoiding...
Daniel Dunbar [Thu, 28 Apr 2011 21:23:38 +0000 (21:23 +0000)]
tests: Tweak test to not write to the same temporary twice, in the hopes of avoiding sporadic win32 failures about renaming a temporary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130439 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEnhance clang_getCXTUResourceUsage() to report how much memory is used by SourceManag...
Ted Kremenek [Thu, 28 Apr 2011 20:36:42 +0000 (20:36 +0000)]
Enhance clang_getCXTUResourceUsage() to report how much memory is used by SourceManager's memory buffers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130433 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGet the base element type even in multidimensional arrays.
Argyrios Kyrtzidis [Thu, 28 Apr 2011 20:07:15 +0000 (20:07 +0000)]
Get the base element type even in multidimensional arrays.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130427 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse StringRef::substr() and unbounded StringRef::compare() instead of bounded version...
Lenny Maiorani [Thu, 28 Apr 2011 19:31:12 +0000 (19:31 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130425 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake the top-level driver ignore -fobjc-default-synthesize-properties while this...
Ted Kremenek [Thu, 28 Apr 2011 19:26:03 +0000 (19:26 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130424 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReplace unitary array with scalar. rdar://problem/7662569
Stuart Hastings [Thu, 28 Apr 2011 19:24:47 +0000 (19:24 +0000)]
Replace unitary array with scalar.  rdar://problem/7662569

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130423 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEliminates an assert in the strncpy/strncat checker caused by not validating a cast...
Lenny Maiorani [Thu, 28 Apr 2011 18:59:43 +0000 (18:59 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130422 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen value-initializing the elements of an array not not included in the initializer...
Argyrios Kyrtzidis [Thu, 28 Apr 2011 18:53:58 +0000 (18:53 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130421 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't waste memory if the initializer expression is empty.
Argyrios Kyrtzidis [Thu, 28 Apr 2011 18:53:55 +0000 (18:53 +0000)]
Don't waste memory if the initializer expression is empty.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130420 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReplace SmallVector with an array, as suggested by Frits van Bommel. rdar://problem...
Stuart Hastings [Thu, 28 Apr 2011 18:16:06 +0000 (18:16 +0000)]
Replace SmallVector with an array, as suggested by Frits van Bommel.  rdar://problem/7662569

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130417 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen determining whether two types are reference-compatible, check
Douglas Gregor [Thu, 28 Apr 2011 17:56:11 +0000 (17:56 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130411 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFixes ArrayTypeTraitExpr (-Wnon-virtual-dtor).
Manuel Klimek [Thu, 28 Apr 2011 17:03:03 +0000 (17:03 +0000)]
Fixes ArrayTypeTraitExpr (-Wnon-virtual-dtor).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130407 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOnly call the MacroExpands callback when we're actually going to
Douglas Gregor [Thu, 28 Apr 2011 16:36:13 +0000 (16:36 +0000)]
Only call the MacroExpands callback when we're actually going to
expand the macro, based on a patch by Ori Avtalion. Fixes PR9799.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130402 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agolibstdc++ 4.4 uses __is_signed as an identifier, while Clang treats it
Douglas Gregor [Thu, 28 Apr 2011 15:48:45 +0000 (15:48 +0000)]
libstdc++ 4.4 uses __is_signed as an identifier, while Clang treats it
as a keyword for the __is_signed type trait. Cope with this conflict
via some hackish recovery: if we see a declaration of the form

 static const bool __is_signed

then we stop treating __is_signed as a keyword and instead treat it as
an identifier. It's ugly, but it's better than making the __is_signed
type trait conditional on some language flag. Fixes PR9804.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130399 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplements strcasecmp() checker in Static Analyzer.
Lenny Maiorani [Thu, 28 Apr 2011 15:09:11 +0000 (15:09 +0000)]
Implements strcasecmp() checker in Static Analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130398 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSilence more -Wnon-pod-memset given its current implementation. I may be
Chandler Carruth [Thu, 28 Apr 2011 08:19:45 +0000 (08:19 +0000)]
Silence more -Wnon-pod-memset given its current implementation. I may be
able to revert these based on a patch I'm working on, but no reason for
people to be spammed with warnings in the interim.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130394 91177308-0d34-0410-b5e6-96231b3b80d8