Commit Graph

7550 Commits

Author SHA1 Message Date
Daniel Dunbar 6f8362c6bf Frontend: Add CodeGenAction support for handling LLVM IR.
- This magically enables using 'clang -cc1' as a replacement for most of 'llvm-as', 'llvm-dis', 'llc' and 'opt' functionality.

For example, 'llvm-as' is:
  $ clang -cc1 -emit-llvm-bc FOO.ll -o FOO.bc
and 'llvm-dis' is:
  $ clang -cc1 -emit-llvm    FOO.bc -o -
and 'opt' is, e.g.:
  $ clang -cc1 -emit-llvm -O3 -o FOO.opt.ll FOO.ll
and 'llc' is, e.g.:
  $ clang -cc1 -S -o - FOO.ll

The nice thing about using the backend tools this way is that they are guaranteed to exactly match how the compiler generates code (for example, setting the same backend options).

llvm-svn: 105583
2010-06-07 23:27:59 +00:00
Fariborz Jahanian be21aa34a0 When using property-dot assignment syntax to call a setter method,
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778

llvm-svn: 105560
2010-06-07 22:02:01 +00:00
Fariborz Jahanian a2d7c34e93 Fixed a block regression caused by trying to use
an existing ir for load of a bock variable. This cannot be
done across basic blocks.
Fixes radar 8064140.

llvm-svn: 105549
2010-06-07 19:39:39 +00:00
Jordy Rose 3597b21f20 Catch free()s on non-regions and regions known to be not from malloc(), by checking the symbol type and memory space.
llvm-svn: 105547
2010-06-07 19:32:37 +00:00
Jeffrey Yasskin caa710dfd2 PR7245: Make binding a reference to a temporary without a usable copy
constructor into an extension warning into the error that C++98 requires.

llvm-svn: 105529
2010-06-07 15:58:05 +00:00
Jeffrey Yasskin 2f96e9f5c9 Add an extension to avoid an error when a global template has the same name as
a member template, and you try to call the member template with an explicit
template argument.  See PR7247 

For example, this downgrades the error to a warning in:

template<typename T> struct set{};
struct Value {
    template<typename T>
    void set(T value) {
    }
};
void foo() {
    Value v;
    v.set<double>(3.2);  // Warning here.
}

llvm-svn: 105518
2010-06-05 01:39:57 +00:00
Rafael Espindola e971b9a260 Correctly align large arrays in x86-64. This fixes PR5599.
llvm-svn: 105500
2010-06-04 23:15:27 +00:00
Anders Carlsson 76f513f862 When deciding whether reinterpret_cast casts away constness we need to look at array qualifiers. Fixes rdar://problem/8018292.
llvm-svn: 105494
2010-06-04 22:47:55 +00:00
John McCall a3cecb628f Add indexing support for the block and @property type location information
I just implemented.

llvm-svn: 105491
2010-06-04 22:33:30 +00:00
Fariborz Jahanian ea882cd92e Build AST for copy-construction of copied-in
class object in blocks and carry it to IRGen.

llvm-svn: 105487
2010-06-04 21:35:44 +00:00
John McCall 8e346702b6 Preserve more information from a block's original function declarator, if one
was given.  Remove some unnecessary accounting from BlockScopeInfo.  Handle
typedef'ed function types until such time as we decide not.

llvm-svn: 105478
2010-06-04 19:02:56 +00:00
Daniel Dunbar 7f3d95054b Driver: Change -dwarf-debug-flags option to pass the original command line
arguments after translation, instead of the -cc1 level arguments.

llvm-svn: 105476
2010-06-04 18:47:06 +00:00
Daniel Dunbar 6beaf5110f Driver/Darwin: Model dsymutil properly, as a separate action/tool kind which is
added as the last output step, instead of just hacking it into the link step.
 - Among other things, this fixes dSYM generation when using multiple -arch options.

llvm-svn: 105475
2010-06-04 18:28:41 +00:00
Fariborz Jahanian 64176c2c97 For C++ copied in objects, use copy constructors in
setting up block's descriptor. This is on going work to
support c++ specific issues in setting up blocks
various APIs.

llvm-svn: 105469
2010-06-04 16:10:00 +00:00
Douglas Gregor 2e87ca218f When checking for equality of template parameter lists, a template
type parameter pack is distinct from a template type parameter.

llvm-svn: 105464
2010-06-04 08:34:32 +00:00
Douglas Gregor 71b209dea6 Properly disambiguate between an elaborated-type-specifier and a
type-parameter within a template parameter list. Found by inspection. 

llvm-svn: 105462
2010-06-04 07:30:15 +00:00
Jordy Rose 2e22268904 Assignments to reference variables shouldn't kill the variable.
llvm-svn: 105452
2010-06-04 01:14:56 +00:00
David Chisnall b190a2c74a Fixed Objective-C type encoding for bitfields for the GNU runtime to match the encoding used by GCC.
llvm-svn: 105451
2010-06-04 01:10:52 +00:00
Eli Friedman 986b6ae96a Check the output of this test.
llvm-svn: 105434
2010-06-03 23:34:11 +00:00
Eli Friedman 4e7bd4a8a1 Think through my commit this time.
llvm-svn: 105433
2010-06-03 23:31:53 +00:00
Eli Friedman cd70980c8e Make sure this test doesn't break when we disallow throwing an exception
in -fno-exceptions mode.

llvm-svn: 105432
2010-06-03 23:22:25 +00:00
Eli Friedman 91a3d27ec0 Make sure to check the accessibility of and mark the destructor for the
operand of a throw expression.  Fixes PR7281.

llvm-svn: 105408
2010-06-03 20:39:03 +00:00
Eli Friedman cce5b81ce1 Don't intentionally try to ignore the value of a scalar expression when we
actually care about it. Fixes PR7291.

llvm-svn: 105404
2010-06-03 19:58:07 +00:00
John McCall 1c70e99a2c Hack in some really terrible C++ record PCH support that I need right now.
This is required in order to test:

The ASTImporter should set base classes after formally entering the definition.

llvm-svn: 105401
2010-06-03 19:28:45 +00:00
Anders Carlsson bcb2e4cb63 Don't try to explicitly zero out bit-fields.
llvm-svn: 105391
2010-06-03 15:36:07 +00:00
Zhongxing Xu 41cdf585c2 CFG: add all LHS of assingments as lvalue. This improves support for C++ reference. Patch by Jordy.
llvm-svn: 105383
2010-06-03 06:23:18 +00:00
Jeffrey Yasskin c9b9bdcc20 There is no dcl.init.ref p16. This test deals with p5.
llvm-svn: 105351
2010-06-02 22:01:22 +00:00
Fariborz Jahanian d1b378e08d Block C++ code gen. Adds support for block reference argument
types. Executable test will be added to LLVM test suite.
(radar 8041962).

llvm-svn: 105347
2010-06-02 21:35:17 +00:00
John McCall 6a7f9f5c8f Don't try to emit the vtable for a class just because we're emitting a
virtual function from it.

Fixes PR7241.

llvm-svn: 105345
2010-06-02 21:22:02 +00:00
Anders Carlsson b4d2cdbb46 Don't substitute 'St' for 'std' when the namespace is nested inside another namespace.
llvm-svn: 105330
2010-06-02 15:58:27 +00:00
Anders Carlsson a85c1469c7 When building RTTI descriptors for pointer types, we need to get the unqualified array type and the qualifiers from it.
llvm-svn: 105326
2010-06-02 15:44:35 +00:00
Douglas Gregor 876cec2898 typeid() produces type information for the cv-unqualified version of
the type. Thanks to Anders for the bug report!

llvm-svn: 105314
2010-06-02 06:16:02 +00:00
Anders Carlsson d951a7ebf8 Correctly mangle unsigned integer literals where the high bit is set.
llvm-svn: 105312
2010-06-02 05:07:26 +00:00
Anders Carlsson 728fe444f1 Correctly mangle variadic functions that don't have any other parameters.
llvm-svn: 105311
2010-06-02 04:40:13 +00:00
Anders Carlsson d563923cf1 When mangling member function pointers, fake adding a substitution corresponding to the function type.
llvm-svn: 105310
2010-06-02 04:29:50 +00:00
Zhongxing Xu 527ff6d1dc Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my
modification.

llvm-svn: 105264
2010-06-01 03:01:33 +00:00
Douglas Gregor 952cf9414f Tweak test for non-64-bit Darwin
llvm-svn: 105222
2010-05-31 14:58:57 +00:00
Douglas Gregor 990ccace5b When we see the a '[' in a postfix expression in Objective-C, perform
a simple, quick check to determine whether the expression starting
with '[' can only be an Objective-C message send. If so, don't parse
it as an array subscript expression. This improves recovery for, e.g.,

  [a method1]
  [a method2]

so that we now produce

  t.m:10:13: error: expected ';' after expression
  [a method]
            ^

instead of some mess about expecting ']'.

llvm-svn: 105221
2010-05-31 14:40:22 +00:00
Ted Kremenek 4708f5a89b After conversations with Zhongxing Xu and Jordy Rose, refine the logic in
RegionStoreManager::RetrieveElement() that handles indexing into a larger scalar
object to only consult the direct binding of a super region if it is a scalar.
This isn't perfect yet, and a big FIXME is attached to the code.  This causes
the test case for PR 7218 now to pass.

llvm-svn: 105195
2010-05-31 01:22:04 +00:00
Douglas Gregor fe4a4107d8 Improve our handling of NULL after an escaping '\' in a string
literal. Fixes <rdar://problem/8044135>.

llvm-svn: 105181
2010-05-30 22:59:50 +00:00
Douglas Gregor d5a479cbb5 Don't try to parse class template specializations in C. It can only
lead to heartache. Fixes <rdar://problem/8044088>.

llvm-svn: 105178
2010-05-30 22:30:21 +00:00
Douglas Gregor 2683c28ff6 Improve parser recovery when we try to parse a call expression but the
called function itself is invalid (e.g., because of a semantic error
referring to that declaration). Fixes <rdar://problem/8044142>.

llvm-svn: 105175
2010-05-30 22:23:08 +00:00
Anders Carlsson b1fcdd063c Turn on the new empty base subobject tracking code. It's a bit faster than the previous code. However, it still has quadratic performance, something which I intend to fix shortly in a subsequent patch.
llvm-svn: 105161
2010-05-30 06:52:33 +00:00
Eli Friedman c8731be34d Fix for PR7040: Don't try to compute the LLVM type for a function where it
isn't possible to compute.

This patch is mostly refactoring; the key change is the addition of the code
starting with the comment, "Check whether the function has a computable LLVM
signature."  The solution here is essentially the same as the way the
vtable code handles such functions.

llvm-svn: 105151
2010-05-30 06:03:20 +00:00
Douglas Gregor ad98fc9733 Unbreak non-Darwin builds
llvm-svn: 105137
2010-05-30 04:00:50 +00:00
Douglas Gregor 7aa6b229fe Teach code completion to adjust its completion priorities based on the
type that we expect to see at a given point in the grammar, e.g., when
initializing a variable, returning a result, or calling a function. We
don't prune the candidate set at all, just adjust priorities to favor
things that should type-check, using an ultra-simplified type system.

llvm-svn: 105128
2010-05-30 01:49:25 +00:00
Anders Carlsson 6b0d914ad0 Rework the way virtual primary bases are added when laying out classes. Instead of doing it as a separate step, we now use the BaseSubobjectInfo and use it when laying out the bases. This fixes a bug where we would either not add a primary virtual base at all, or add it at the wrong offset.
llvm-svn: 105110
2010-05-29 19:44:50 +00:00
Zhongxing Xu 94aec9381d Revert r105097. Thinking about a better fix.
llvm-svn: 105099
2010-05-29 06:49:04 +00:00
Zhongxing Xu 928a190a8e Fix PR7218. Patch by Jordy Rose.
llvm-svn: 105097
2010-05-29 06:23:24 +00:00
Fariborz Jahanian 9f718743a1 Changed text of 'empty enum' diagnostics to say so.
llvm-svn: 105013
2010-05-28 22:43:53 +00:00