Граф коммитов

332 Коммитов

Автор SHA1 Сообщение Дата
Richard Smith 1664d540d1 PR12571: Objects of type clang::ConstantArrayType aren't always emitted with
type llvm::ArrayType -- sometimes we emit them as packed structs. Don't assert
if such a global array has an element type with a non-trivial destructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155305 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-22 05:51:36 +00:00
Duncan Sands 3c6ed1b5c5 Remove support for -fast-math metadata for the moment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154851 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-16 19:40:49 +00:00
Duncan Sands 10e675d482 Generate fpmath metadata when -ffast-math. Note that no optimizations are hooked
up to this yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154835 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-16 17:24:31 +00:00
Eli Friedman 377ecc7996 Propagate alignment on lvalues through EmitLValueForField. PR12395.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154789 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-16 03:54:45 +00:00
Chad Rosier 8fbe3855db [frontend] Add support for disabling the "inline" keyword using
-fno-inline-functions.

This behaves much like -fno-inline in gcc, but based on a discussion with 
Daniel it was decided that -fno-inline-functions should subsume -fno-inline.
Please speak up if you object.  The -fno-inline flag remains ignored.
Final part of rdar://10972766



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152754 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-14 23:32:11 +00:00
David Blaikie 4e4d08403c Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11 07:00:24 +00:00
Eli Friedman 23f0267e2d Implement "optimization" for lambda-to-block conversion which inlines the generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap.
Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal.  With ARC, the effect is much less obvious because the lifetime of blocks is already managed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151797 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-01 04:01:32 +00:00
Eli Friedman 64bee65a34 Work-in-progress for lambda conversion-to-block operator. Still need to implement the retain+autorelease outside of ARC, and there's a bug that causes the generated code to crash in ARC (which I think is unrelated to my code, although I'm not completely sure).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151428 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 02:48:22 +00:00
Chad Rosier 6e94f6c0f1 Remove redundant check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150855 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-18 00:37:07 +00:00
Douglas Gregor 27dd7d962b Rework the Sema/AST/IRgen dance for the lambda closure type's
conversion to function pointer. Rather than having IRgen synthesize
the body of this function, we instead introduce a static member
function "__invoke" with the same signature as the lambda's
operator() in the AST. Sema then generates a body for the conversion
to function pointer which simply returns the address of __invoke. This
approach makes it easier to evaluate a call to the conversion function
as a constant, makes the linkage of the __invoke function follow the
normal rules for member functions, and may make life easier down the
road if we ever want to constexpr'ify some of lambdas.

Note that IR generation is responsible for filling in the body of
__invoke (Sema just adds a dummy body), because the body can't
generally be expressed in C++.

Eli, please review!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150783 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-17 03:02:34 +00:00
Eli Friedman bd89f8c2ca Start of IRGen for lambda conversion operators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150649 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-16 01:37:33 +00:00
Eli Friedman df33a35f60 Remove useless if statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150459 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-14 03:54:45 +00:00
Eli Friedman cec5ebd4a6 Basic support for referring to captured variables from lambdas. Some simple examples seem to work. Tests coming up soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150293 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-11 02:57:39 +00:00
Benjamin Kramer af2771b147 CodeGen: Move EHPersonality from CGException.h into the cpp file, it has no other users.
While at it make it value-initializable to get rid of static ctors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150070 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08 12:41:24 +00:00
Chris Lattner 8b418685e9 simplify a bunch of code to use the well-known LLVM IR types computed by CodeGenModule.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149943 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-07 00:39:47 +00:00
Abramo Bagnara 5ff53b27df Fixed VLA code generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147933 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-11 08:19:46 +00:00
Abramo Bagnara 06284c1dc5 Fixed TypeofExpr AST and code generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147730 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-07 10:52:36 +00:00
Richard Smith 80d4b55db9 Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147318 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-28 19:48:30 +00:00
John McCall 1a343ebbf4 Enter the cleanups for a block outside the enclosing
full-expression.  Naturally they're inactive before we enter
the block literal expression.  This restores the intended
behavior that blocks belong to their enclosing scope.

There's a useful -O0 / compile-time optimization that we're
missing here with activating cleanups following straight-line
code from their inactive beginnings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144268 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-10 08:15:53 +00:00
Richard Smith 51f4708c00 Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143263 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-29 00:50:52 +00:00
Benjamin Kramer 2a04f1cf72 Fix mismatched new[]/delete[].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142803 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 17:22:36 +00:00
Eric Christopher 0625366431 Fix PR11073 by adding the argument type information to the decl we construct
for the function type. Update a testcase accordingly.

Patch initially by Anders Waldenborg!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142700 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 23:30:10 +00:00
Eric Christopher 73fb35003a Recommit:
Start handling debug line and scope information better:

    Migrate most of the location setting within the larger API in CGDebugInfo and
    update a lot of callers.
    Remove the existing file/scope change machinery in UpdateLineDirectiveRegion
    and replace it with DILexicalBlockFile usage.

    Finishes off the rest of rdar://10246360

after fixing a few bugs that were exposed in gdb testsuite testing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141893 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13 21:45:18 +00:00
Eli Friedman b001de7458 Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.
Thanks to Jeffrey Yasskin for the thorough review!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141330 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06 23:00:33 +00:00
Peter Collingbourne a4ae2294b6 CUDA: IR generation support for device stubs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141304 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-06 18:51:56 +00:00
Benjamin Kramer 578faa837b de-tmpify clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140637 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 21:06:10 +00:00
Bill Wendling 285cfd8953 Throw the switch to convert clang to the new exception handling model!
This model uses the 'landingpad' instruction, which is pinned to the top of the
landing pad. (A landing pad is defined as the destination of the unwind branch
of an invoke instruction.) All of the information needed to generate the correct
exception handling metadata during code generation is encoded into the
landingpad instruction.

The new 'resume' instruction takes the place of the llvm.eh.resume intrinsic
call. It's lowered in much the same way as the intrinsic is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140049 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 20:31:14 +00:00
Julien Lerouge 77f68bb90a Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: can
annotate global, local variables, struct fields, or arbitrary statements (using
the __builtin_annotation), rdar://8037476.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139423 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09 22:41:49 +00:00
Eric Christopher acae011241 Carry the debug information from single exit unified return block
along with the new insert point.

Fixes PR10829

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139416 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09 21:53:04 +00:00
Douglas Gregor bcfd1f55bf Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138985 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02 00:18:52 +00:00
John McCall 777d6e56ad Simplify EH control flow by observing that EH scopes form a simple
hierarchy of delegation, and that EH selector values are meaningful
function-wide (good thing, too, or inlining wouldn't work).
2,3d
1a
hierarchy of delegation and that EH selector values have the same
meaning everywhere in the function instead of being meaningful only
in the context of a specific selector.

This removes the need for routing edges through EH cleanups,
since a cleanup simply always branches to its enclosing scope.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137293 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-11 02:22:43 +00:00
Chris Lattner 5f9e272e63 remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 10:55:15 +00:00
Jay Foad 0f6ac7cf7b Convert IRBuilder::CreateGEP and IRBuilder::CreateInBoundsGEP to use
ArrayRef.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135761 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-22 08:16:57 +00:00
Chris Lattner 2acc6e3fed de-constify llvm::Type, patch by David Blaikie!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 04:24:23 +00:00
Benjamin Kramer 8dd55a3c3b Change intrinsic getter to take an ArrayRef, now that the underlying function in LLVM does.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135155 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 17:45:50 +00:00
Chris Lattner 9cbe4f0ba0 clang side to match the LLVM IR type system rewrite patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134831 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 17:41:47 +00:00
John McCall bdc4d80956 A number of array-related IR-gen cleanups.
- Emit default-initialization of arrays that were partially initialized
    with initializer lists with a loop, rather than emitting the default
    initializer N times;
  - support destroying VLAs of non-trivial type, although this is not
    yet exposed to users; and
  - support the partial destruction of arrays initialized with
    initializer lists when an initializer throws an exception.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134784 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 01:37:26 +00:00
John McCall bc8d40d85f Change the IR-generation of VLAs so that we capture bounds,
not sizes;  so that we use well-typed allocas;  and so that we
properly recurse through the full set of variably-modified types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133827 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 21:55:10 +00:00
John McCall f85e193739 Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-15 23:02:42 +00:00
John McCall 93c332a8ba Convert Clang over to resuming from landing pads with llvm.eh.resume.
It's quite likely that this will explode, but I need to know how. :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132269 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-28 21:13:02 +00:00
Benjamin Kramer 95d318c4c1 Eliminate temporary argument vectors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132260 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-28 14:26:31 +00:00
Ted Kremenek 7aa488a7fc Fix crash on C++ code when compiling with -finstrument-functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131435 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 23:49:20 +00:00
John McCall f2aac84709 Make CGF.getContext() inlinable, because it's trivial, and optimize
hasAggregateLLVMType.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131375 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-15 02:34:36 +00:00
Ken Dyck 79be76c0e3 Eliminate some literal 8s from EmitNullInitialization() by converting
variables to CharUnits. No change in functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130001 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-22 17:51:05 +00:00
Jay Foad 6f141659ca PR9214: Convert Metadata API to use ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129929 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 19:59:12 +00:00
Peter Collingbourne f111d93572 C1X: implement generic selections
As an extension, generic selection support has been added for all
supported languages.  The syntax is the same as for C1X.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 00:35:48 +00:00
Jay Foad bbf3bacb3e Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128538 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 11:28:58 +00:00
John McCall d26bc76c98 Use the "undergoes default argument promotion" bit on parameters to
simplify the logic of initializing function parameters so that we don't need
both a variable declaration and a type in FunctionArgList.  This also means
that we need to propagate the CGFunctionInfo down in a lot of places rather
than recalculating it from the FAL.  There's more we can do to eliminate
redundancy here, and I've left FIXMEs behind to do it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 04:27:21 +00:00
Devang Patel aa11289f75 DebugInfo can be enabled or disabled at function level (e.g. using an attribute). However, at module level it is determined by command line option and the state of command line option does not change during compilation. Make this layering explicit and fix accidental cases where the code generator was checking whether module has debug info enabled instead of checking whether debug info is enabled for this function or not.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127165 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 18:45:56 +00:00
Bill Wendling e3eb83b937 Initialize variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127039 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-04 21:46:03 +00:00