History log of /external/clang/lib/CodeGen/CGExpr.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
/external/clang/lib/CodeGen/CGExpr.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/CodeGen/CGExpr.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/CodeGen/CGExpr.cpp
13ba7190c087d592104ca4f6b730a62647ee277e 22-Nov-2013 Bill Wendling <isanbard@gmail.com> Merging r195367:
------------------------------------------------------------------------
r195367 | joey | 2013-11-21 09:09:05 -0800 (Thu, 21 Nov 2013) | 17 lines

Fix a crash in EmitStoreThroughExtVectorComponentLValue for vectors of odd sizes.

In OpenCL a vector of 3 elements, acts like a vector of four elements.
So for a vector of size 3 the '.hi' and '.odd' accessors, would access
the elements {2, 3} and {1, 3} respectively.
However, in EmitStoreThroughExtVectorComponentLValue we are still operating on
a vector of size 3, so we should only access {2} and {1}. We do this by checking
the last element to be accessed, and ignore it if it is out-of-bounds.

EmitLoadOfExtVectorElementLValue doesn't have a similar problem, because it does
a direct shufflevector with undef, so an out-of-bounds access just gives an undef
value.

Patch by Anastasia Stulova!



------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@195386 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
562d45ce29e8904e686e4caf18b8e6c4d6d3798d 08-Nov-2013 Will Dietz <wdietz2@illinois.edu> ubsan: Only emit constants for filenames and type descriptors once.

Produces neater IR in significantly less time.

(~18% faster -O0 compile time for sqlite3 with -fsanitize=undefined)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bafa74f360cb3ec82fa8c688845330f491d167fd 07-Nov-2013 David Majnemer <david.majnemer@gmail.com> [-fms-extensions] Add support for __FUNCDNAME__

Summary:
Similar to __FUNCTION__, MSVC exposes the name of the enclosing mangled
function name via __FUNCDNAME__. This implementation is very naive and
unoptimized, it is expected that __FUNCDNAME__ would be used rarely in
practice.

Reviewers: rnk, rsmith, thakis

CC: cfe-commits, silvas

Differential Revision: http://llvm-reviews.chandlerc.com/D2109

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3cebc73895daccea85984d8881b5b45c8f8df9c6 05-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y sized deallocation: if we have a use, but not a definition, of a sized
deallocation function (and the corresponding unsized deallocation function has
been declared), emit a weak discardable definition of the function that
forwards to the corresponding unsized deallocation.

This allows a C++ standard library implementation to provide both a sized and
an unsized deallocation function, where the unsized one does not just call the
sized one, for instance by putting both in the same object file within an
archive.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
69170e6e41e72c84fe5303540c1aa7ca9944ff18 23-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Split -fsanitize=bounds to -fsanitize=array-bounds (for the frontend-inserted
check using the ubsan runtime) and -fsanitize=local-bounds (for the middle-end
check which inserts traps).

Remove -fsanitize=local-bounds from -fsanitize=undefined. It does not produce
useful diagnostics and has false positives (PR17635), and is not a good
compromise position between UBSan's checks and ASan's checks.

Map -fbounds-checking to -fsanitize=local-bounds to restore Clang's historical
behavior for that flag.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b914e87377fd4d7642f544000a79f8648c6f06c9 20-Oct-2013 Peter Collingbourne <peter@pcc.me.uk> Implement function type checker for the undefined behavior sanitizer.

This uses function prefix data to store function type information at the
function pointer.

Differential Revision: http://llvm-reviews.chandlerc.com/D1338

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193058 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
feba9f2bdc5711894e452dfc67c9679482fbf897 08-Oct-2013 Manman Ren <manman.ren@gmail.com> TBAA: use the same format for scalar TBAA and struct-path aware TBAA.

An updated version of r191586 with bug fix.

Struct-path aware TBAA generates tags to specify the access path,
while scalar TBAA only generates tags to scalar types.

We should not generate a TBAA tag with null being the first field. When
a TBAA type node is null, the tag should be null too. Make sure we
don't decorate an instruction with a null TBAA tag.

Added a testing case for the bug reported by Richard with -relaxed-aliasing
and -fsanitizer=thread.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8dd4baacf584b1fc7b0e2c79a0b8b197a4fb5fab 07-Oct-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Fix objectsize tests after r192117

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4ee7dc2369c1f0257a73b2e83a7d38fdebdd9176 02-Oct-2013 Nick Lewycky <nicholas@mxc.ca> Thread a SourceLocation into the EmitCheck for "load_invalid_value". This occurs
when scalars are loaded / undergo lvalue-to-rvalue conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5d4a7559df106959dd721744c8971547f0f09097 01-Oct-2013 Nick Lewycky <nicholas@mxc.ca> No functionality change. Reflow lines that could fit on one line. Break lines
that had 80-column violations. Remove spurious emacs mode markers on .cpp files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191797 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2bb6dad4a44569dd2f86e7500a5ba21680718736 11-Sep-2013 Evgeniy Stepanov <eugeni.stepanov@gmail.com> Fix 2 cases of uninitialized reads of an invalid PresumedLoc.

The code in CGExpr was added back in 2012 (r165536) but not exercised in tests
until recently.

Detected on the MemorySanitizer bootstrap bot.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3b8e0b7f96164e8c49d2a833da26edd960f5da1f 30-Aug-2013 Yunzhong Gao <Yunzhong_Gao@playstation.sony.com> Revert r189649 because it was breaking sanitizer bots.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
51a31e1da76cc0906e4708ae15e2f7ecf1ba5f13 30-Aug-2013 Yunzhong Gao <Yunzhong_Gao@playstation.sony.com> Fixing a bug where debug info for a local variable gets emitted at file scope.

The patch was discussed in Phabricator. See:
http://llvm-reviews.chandlerc.com/D1281



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c7971a9efdf9880448a69aabb5182c3c27eecf6d 28-Aug-2013 David Blaikie <dblaikie@gmail.com> Revert "PR14569: Omit debug info for thunks"

This reverts commit r189320.

Alexey Samsonov and Dmitry Vyukov presented some arguments for keeping
these around - though it still seems like those tasks could be solved by
a tool just using the symbol table. In a very small number of cases,
thunks may be inlined & debug info might be able to save profilers &
similar tools from misclassifying those cases as part of the caller.

The extra changes here plumb through the VarDecl for various cases to
CodeGenFunction - this provides better fidelity through a few APIs but
generally just causes the CGF::StartFunction to fallback to using the
name of the IR function as the name in the debug info.

The changes to debug-info-global-ctor-dtor.cpp seem like goodness. The
two names that go missing (in favor of only emitting those names as
linkage names) are names that can be demangled - emitting them only as
the linkage name should encourage tools to do just that.

Again, thanks to Dinesh Dwivedi for investigation/work on this issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189421 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
15b2674896371ac2a0fe707b538a1a29dec9d8e4 26-Aug-2013 Wei Pan <wei.pan@intel.com> Handle predefined expression for a captured statement

- __func__ or __FUNCTION__ returns captured statement's parent
function name, not the one compiler generated.

Differential Revision: http://llvm-reviews.chandlerc.com/D1491

Reviewed by bkramer



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
28bdbf0861fefb33474fddbda1d3c66ee29be2af 21-Aug-2013 Benjamin Kramer <benny.kra@googlemail.com> Sema: Use the right type for PredefinedExpr when it's in a lambda.

1. We now print the return type of lambdas and return type deduced functions
as "auto". Trailing return types with decltype print the underlying type.
2. Use the lambda or block scope for the PredefinedExpr type instead of the
parent function. This fixes PR16946, a strange mismatch between type of the
expression and the actual result.
3. Verify the type in CodeGen.
4. The type for blocks is still wrong. They are numbered and the name is not
known until CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188900 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8effeda3d2cfd92abaebc5ac46fc3693c69f66f3 15-Aug-2013 David Majnemer <david.majnemer@gmail.com> CodeGen: __uuidof should work even with an incomplete _GUID type

Summary:
We would crash in CodeGen::CodeGenModule::EmitUuidofInitializer
because our attempt to enter CodeGen::CodeGenModule::EmitConstantValue
will be foiled: the type of the constant value is incomplete.

Instead, create an unnamed type with the proper layout on all platforms.
Punt the problem of wrongly defined struct _GUID types to the user.
(It's impossible because the TU may never get to see the type and thus
we can't verify that it is suitable.)

This fixes PR16856.

Reviewers: rsmith, rnk, thakis

Reviewed By: rnk

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1375

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8593e7821c02bd429964d2daf7a6acccb8040fb2 08-Aug-2013 Filipe Cabecinhas <me@filcab.net> UBSan: Fix alignment checks emitted in downcasts.

Summary:
UBSan was checking for alignment of the derived class on the pointer to
the base class, before converting. With some class hierarchies, this could
generate false positives.

Added test-case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b0e603c63813c8378e35a75408ab4cefe71e93e2 26-Jul-2013 Adrian Prantl <aprantl@apple.com> Debug Info / EmitCallArgs: arguments may modify the debug location.
Restore it after each argument is emitted. This fixes the scope info for
inlined subroutines inside of function argument expressions. (E.g.,
anything STL).

rdar://problem/12592135

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187240 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1cc87df9747f31d1b300a29920aa8b62144b7bb2 26-Jul-2013 Craig Topper <craig.topper@gmail.com> Remove trailing whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a5e660188a3c654cf0c88ed1093b28207e870b2b 20-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Make IgnoreParens() look through ChooseExprs.

This is the same way GenericSelectionExpr works, and it's generally a
more consistent approach.

A large part of this patch is devoted to caching the value of the condition
of a ChooseExpr; it's needed to avoid threading an ASTContext into
IgnoreParens().

Fixes <rdar://problem/14438917>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
336d9df5e628279425344d754dc68047fa5b00a7 11-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Simplify atomic load/store IRGen.

Also fixes a couple minor bugs along the way; see testcases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6b9240e058bf3451685df73fc8ce181b3046e92b 05-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl& for function arguments instead of SmallVector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185715 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1d7bb6c8b5b8f98fe79607718441f6543de598f1 28-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Delete dead code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185119 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3282b84296dba58e811741b63e4429980a98df8b 14-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Emit initializers for static-storage-duration temporaries as constants where
possible.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d4ec562b3aaf50ea9015f82c96ebfd05a35fc7ef 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Simplify: we don't need any special-case lifetime extension when initializing
declarations of reference type; they're handled by the general case handling of
MaterializeTemporaryExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7c3e615f01e8f9f587315800fdaf2305ed824568 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR12086, PR15117

Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8a07cd3f59a0ede54906bdc8ed21724815db27ad 12-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Reapply r183721, reverted in r183776, with a fix for a bug in the former (we
were lacking ExprWithCleanups nodes in some cases where the new approach to
lifetime extension needed them).

Original commit message:

Rework IR emission for lifetime-extended temporaries. Instead of trying to walk
into the expression and dig out a single lifetime-extended entity and manually
pull its cleanup outside the expression, instead keep a list of the cleanups
which we'll need to emit when we get to the end of the full-expression. Also
emit those cleanups early, as EH-only cleanups, to cover the case that the
full-expression does not terminate normally. This allows IR generation to
properly model temporary lifetime when multiple temporaries are extended by the
same declaration.

We have a pre-existing bug where an exception thrown from a temporary's
destructor does not clean up lifetime-extended temporaries created in the same
expression and extended to automatic storage duration; that is not fixed by
this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a57be5617a0735a654d4c8145be1fd752f776772 11-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Revert r183721. It caused cleanups to be delayed too long in some cases.
Testcase to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b6f521aeb4defc018aef5c80f7c571fc413ba16b 11-Jun-2013 Benjamin Kramer <benny.kra@googlemail.com> Silence GCC warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
85af7cecadbf5d4b905d6b3b4b1b6fa684183aff 11-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Rework IR emission for lifetime-extended temporaries. Instead of trying to walk
into the expression and dig out a single lifetime-extended entity and manually
pull its cleanup outside the expression, instead keep a list of the cleanups
which we'll need to emit when we get to the end of the full-expression. Also
emit those cleanups early, as EH-only cleanups, to cover the case that the
full-expression does not terminate normally. This allows IR generation to
properly model temporary lifetime when multiple temporaries are extended by the
same declaration.

We have a pre-existing bug where an exception thrown from a temporary's
destructor does not clean up lifetime-extended temporaries created in the same
expression and extended to automatic storage duration; that is not fixed by
this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
34f94f93dc20e08c9327441e4b5bcbce9ba23e9c 04-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Remove some unreachable (and wrong) code and replace it with an assertion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183206 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4e43dec4df9d7dd8e07b47bb15967f1b733a9bc6 03-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix handling of pointers-to-members and comma expressions when
lifetime-extending temporaries in reference bindings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
524387ae3dfc0c4cf2b095f83f9e47aa549b7e55 09-May-2013 Ben Langmuir <ben.langmuir@intel.com> CodeGen for CapturedStmts

EmitCapturedStmt creates a captured struct containing all of the captured
variables, and then emits a call to the outlined function. This is similar in
principle to EmitBlockLiteral.

GenerateCapturedFunction actually produces the outlined function. It is based
on GenerateBlockFunction, but is much simpler. The function type is determined
by the parameters that are in the CapturedDecl.

Some changes have been added to this patch that were reviewed as part of the
serialization patch and moving the parameters to the captured decl.

Differential Revision: http://llvm-reviews.chandlerc.com/D640


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f5ebf9bf1df10ac15ba32a4b24dfe171b7848c58 03-May-2013 John McCall <rjmccall@apple.com> Correctly emit certain implicit references to 'self' even within
a lambda.

Bug #1 is that CGF's CurFuncDecl was "stuck" at lambda invocation
functions. Fix that by generally improving getNonClosureContext
to look through lambdas and captured statements but only report
code contexts, which is generally what's wanted. Audit uses of
CurFuncDecl and getNonClosureAncestor for correctness.

Bug #2 is that lambdas weren't specially mapping 'self' when inside
an ObjC method. Fix that by removing the requirement for that
and using the normal EmitDeclRefLValue path in LoadObjCSelf.

rdar://13800041

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
975d83c291821de340eef3c3498104172b375f79 27-Apr-2013 Manman Ren <mren@apple.com> Struct-path aware TBAA: fix handling of may_alias attribute.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c3bf52ced9652f555aa0767bb822ec4c64546212 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: Allow aggregates to have default initializers.

Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in
CXXCtorInitializers and in InitListExprs to represent a default initializer.

There's an additional complication here: because the default initializer can
refer to the initialized object via its 'this' pointer, we need to make sure
that 'this' points to the right thing within the evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b80a16eadd0dacabfc1c32412e243ccb99dd664d 19-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement CodeGen for C++11 thread_local, following the Itanium ABI specification as discussed on cxx-abi-dev.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179858 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
04e517650569598e847c2ab609672e6df93effe5 15-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> CodeGen support for function-local static thread_local variables with
non-constant constructors or non-trivial destructors. Plus bugfixes for
thread_local references bound to temporaries (the temporaries themselves are
lifetime-extended to become thread_local), and the corresponding case for
std::initializer_list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
38afbc7361d861968232defaeaf8e302af75b5ee 13-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Annotate flavor of TLS variable (statically or dynamically initialized) onto the AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ca835180412eb4382fe4cc97e9374489b9ad3946 12-Apr-2013 Manman Ren <mren@apple.com> Struct-path aware TBAA: uniformize scalar tag and path tag.

For struct-path aware TBAA, we used to use scalar type node as the scalar tag,
which has an incompatible format with the struct path tag. We now use the same
format: base type, access type and offset.

We also uniformize the scalar type node and the struct type node: name, a list
of pairs (offset + pointer to MDNode). For scalar type, we have a single pair.
These are to make implementaiton of aliasing rules easier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179335 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1fd1e288d0f45b86d191d8f53f569e5143f3a18a 11-Apr-2013 Jordan Rose <jordan_rose@apple.com> Force a load when creating a reference to a temporary copied from a bitfield.

For this source:
const int &ref = someStruct.bitfield;

We used to generate this AST:

DeclStmt [...]
`-VarDecl [...] ref 'const int &'
`-MaterializeTemporaryExpr [...] 'const int' lvalue
`-ImplicitCastExpr [...] 'const int' lvalue <NoOp>
`-MemberExpr [...] 'int' lvalue bitfield .bitfield [...]
`-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X'

Notice the lvalue inside the MaterializeTemporaryExpr, which is very
confusing (and caused an assertion to fire in the analyzer - PR15694).

We now generate this:

DeclStmt [...]
`-VarDecl [...] ref 'const int &'
`-MaterializeTemporaryExpr [...] 'const int' lvalue
`-ImplicitCastExpr [...] 'int' <LValueToRValue>
`-MemberExpr [...] 'int' lvalue bitfield .bitfield [...]
`-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X'

Which makes a lot more sense. This allows us to remove code in both
CodeGen and AST that hacked around this special case.

The commit also makes Clang accept this (legal) C++11 code:

int &&ref = std::move(someStruct).bitfield

PR15694 / <rdar://problem/13600396>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
29a11f45849aa87959e780abb0014a1876e0b39e 06-Apr-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13325066> Destroy std::initializer_list temporaries whose lifetime has been extended by reference binding.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b37a73d5c6a0c8bb1f6e363d3b53980e4fa0cead 04-Apr-2013 Manman Ren <mren@apple.com> Initial support for struct-path aware TBAA.

Added TBAABaseType and TBAAOffset in LValue. These two fields are initialized to
the actual type and 0, and are updated in EmitLValueForField.
Path-aware TBAA tags are enabled for EmitLoadOfScalar and EmitStoreOfScalar.
Added command line option -struct-path-tbaa.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178797 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7cc0a110bcf3fe9c4d1269ea2ae7e72aa7f37531 04-Apr-2013 Manman Ren <mren@apple.com> revert r178784 since it does not have a commit message

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178796 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ab4ffe242935ae0dd66fbe0dcc792c1ad38b00c1 04-Apr-2013 Manman Ren <mren@apple.com> Index: include/clang/Driver/CC1Options.td
===================================================================
--- include/clang/Driver/CC1Options.td (revision 178718)
+++ include/clang/Driver/CC1Options.td (working copy)
@@ -161,6 +161,8 @@
HelpText<"Use register sized accesses to bit-fields, when possible.">;
def relaxed_aliasing : Flag<["-"], "relaxed-aliasing">,
HelpText<"Turn off Type Based Alias Analysis">;
+def struct_path_tbaa : Flag<["-"], "struct-path-tbaa">,
+ HelpText<"Turn on struct-path aware Type Based Alias Analysis">;
def masm_verbose : Flag<["-"], "masm-verbose">,
HelpText<"Generate verbose assembly output">;
def mcode_model : Separate<["-"], "mcode-model">,
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td (revision 178718)
+++ include/clang/Driver/Options.td (working copy)
@@ -587,6 +587,7 @@
Flags<[CC1Option]>, HelpText<"Disable spell-checking">;
def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group<f_Group>;
def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group<f_Group>;
+def fstruct_path_tbaa : Flag<["-"], "fstruct-path-tbaa">, Group<f_Group>;
def fno_strict_enums : Flag<["-"], "fno-strict-enums">, Group<f_Group>;
def fno_strict_overflow : Flag<["-"], "fno-strict-overflow">, Group<f_Group>;
def fno_threadsafe_statics : Flag<["-"], "fno-threadsafe-statics">, Group<f_Group>,
Index: include/clang/Frontend/CodeGenOptions.def
===================================================================
--- include/clang/Frontend/CodeGenOptions.def (revision 178718)
+++ include/clang/Frontend/CodeGenOptions.def (working copy)
@@ -85,6 +85,7 @@
VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified.
CODEGENOPT(RelaxAll , 1, 0) ///< Relax all machine code instructions.
CODEGENOPT(RelaxedAliasing , 1, 0) ///< Set when -fno-strict-aliasing is enabled.
+CODEGENOPT(StructPathTBAA , 1, 0) ///< Whether or not to use struct-path TBAA.
CODEGENOPT(SaveTempLabels , 1, 0) ///< Save temporary labels.
CODEGENOPT(SanitizeAddressZeroBaseShadow , 1, 0) ///< Map shadow memory at zero
///< offset in AddressSanitizer.
Index: lib/CodeGen/CGExpr.cpp
===================================================================
--- lib/CodeGen/CGExpr.cpp (revision 178718)
+++ lib/CodeGen/CGExpr.cpp (working copy)
@@ -1044,7 +1044,8 @@
llvm::Value *CodeGenFunction::EmitLoadOfScalar(LValue lvalue) {
return EmitLoadOfScalar(lvalue.getAddress(), lvalue.isVolatile(),
lvalue.getAlignment().getQuantity(),
- lvalue.getType(), lvalue.getTBAAInfo());
+ lvalue.getType(), lvalue.getTBAAInfo(),
+ lvalue.getTBAABaseType(), lvalue.getTBAAOffset());
}

static bool hasBooleanRepresentation(QualType Ty) {
@@ -1106,7 +1107,9 @@

llvm::Value *CodeGenFunction::EmitLoadOfScalar(llvm::Value *Addr, bool Volatile,
unsigned Alignment, QualType Ty,
- llvm::MDNode *TBAAInfo) {
+ llvm::MDNode *TBAAInfo,
+ QualType TBAABaseType,
+ uint64_t TBAAOffset) {
// For better performance, handle vector loads differently.
if (Ty->isVectorType()) {
llvm::Value *V;
@@ -1158,8 +1161,11 @@
Load->setVolatile(true);
if (Alignment)
Load->setAlignment(Alignment);
- if (TBAAInfo)
- CGM.DecorateInstruction(Load, TBAAInfo);
+ if (TBAAInfo) {
+ llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
+ TBAAOffset);
+ CGM.DecorateInstruction(Load, TBAAPath);
+ }

if ((SanOpts->Bool && hasBooleanRepresentation(Ty)) ||
(SanOpts->Enum && Ty->getAs<EnumType>())) {
@@ -1217,7 +1223,8 @@
bool Volatile, unsigned Alignment,
QualType Ty,
llvm::MDNode *TBAAInfo,
- bool isInit) {
+ bool isInit, QualType TBAABaseType,
+ uint64_t TBAAOffset) {

// Handle vectors differently to get better performance.
if (Ty->isVectorType()) {
@@ -1268,15 +1275,19 @@
llvm::StoreInst *Store = Builder.CreateStore(Value, Addr, Volatile);
if (Alignment)
Store->setAlignment(Alignment);
- if (TBAAInfo)
- CGM.DecorateInstruction(Store, TBAAInfo);
+ if (TBAAInfo) {
+ llvm::MDNode *TBAAPath = CGM.getTBAAStructTagInfo(TBAABaseType, TBAAInfo,
+ TBAAOffset);
+ CGM.DecorateInstruction(Store, TBAAPath);
+ }
}

void CodeGenFunction::EmitStoreOfScalar(llvm::Value *value, LValue lvalue,
bool isInit) {
EmitStoreOfScalar(value, lvalue.getAddress(), lvalue.isVolatile(),
lvalue.getAlignment().getQuantity(), lvalue.getType(),
- lvalue.getTBAAInfo(), isInit);
+ lvalue.getTBAAInfo(), isInit, lvalue.getTBAABaseType(),
+ lvalue.getTBAAOffset());
}

/// EmitLoadOfLValue - Given an expression that represents a value lvalue, this
@@ -2494,9 +2505,12 @@

llvm::Value *addr = base.getAddress();
unsigned cvr = base.getVRQualifiers();
+ bool TBAAPath = CGM.getCodeGenOpts().StructPathTBAA;
if (rec->isUnion()) {
// For unions, there is no pointer adjustment.
assert(!type->isReferenceType() && "union has reference member");
+ // TODO: handle path-aware TBAA for union.
+ TBAAPath = false;
} else {
// For structs, we GEP to the field that the record layout suggests.
unsigned idx = CGM.getTypes().getCGRecordLayout(rec).getLLVMFieldNo(field);
@@ -2508,6 +2522,8 @@
if (cvr & Qualifiers::Volatile) load->setVolatile(true);
load->setAlignment(alignment.getQuantity());

+ // Loading the reference will disable path-aware TBAA.
+ TBAAPath = false;
if (CGM.shouldUseTBAA()) {
llvm::MDNode *tbaa;
if (mayAlias)
@@ -2541,6 +2557,16 @@

LValue LV = MakeAddrLValue(addr, type, alignment);
LV.getQuals().addCVRQualifiers(cvr);
+ if (TBAAPath) {
+ const ASTRecordLayout &Layout =
+ getContext().getASTRecordLayout(field->getParent());
+ // Set the base type to be the base type of the base LValue and
+ // update offset to be relative to the base type.
+ LV.setTBAABaseType(base.getTBAABaseType());
+ LV.setTBAAOffset(base.getTBAAOffset() +
+ Layout.getFieldOffset(field->getFieldIndex()) /
+ getContext().getCharWidth());
+ }

// __weak attribute on a field is ignored.
if (LV.getQuals().getObjCGCAttr() == Qualifiers::Weak)
Index: lib/CodeGen/CGValue.h
===================================================================
--- lib/CodeGen/CGValue.h (revision 178718)
+++ lib/CodeGen/CGValue.h (working copy)
@@ -157,6 +157,11 @@

Expr *BaseIvarExp;

+ /// Used by struct-path-aware TBAA.
+ QualType TBAABaseType;
+ /// Offset relative to the base type.
+ uint64_t TBAAOffset;
+
/// TBAAInfo - TBAA information to attach to dereferences of this LValue.
llvm::MDNode *TBAAInfo;

@@ -175,6 +180,10 @@
this->ImpreciseLifetime = false;
this->ThreadLocalRef = false;
this->BaseIvarExp = 0;
+
+ // Initialize fields for TBAA.
+ this->TBAABaseType = Type;
+ this->TBAAOffset = 0;
this->TBAAInfo = TBAAInfo;
}

@@ -232,6 +241,12 @@
Expr *getBaseIvarExp() const { return BaseIvarExp; }
void setBaseIvarExp(Expr *V) { BaseIvarExp = V; }

+ QualType getTBAABaseType() const { return TBAABaseType; }
+ void setTBAABaseType(QualType T) { TBAABaseType = T; }
+
+ uint64_t getTBAAOffset() const { return TBAAOffset; }
+ void setTBAAOffset(uint64_t O) { TBAAOffset = O; }
+
llvm::MDNode *getTBAAInfo() const { return TBAAInfo; }
void setTBAAInfo(llvm::MDNode *N) { TBAAInfo = N; }

Index: lib/CodeGen/CodeGenFunction.h
===================================================================
--- lib/CodeGen/CodeGenFunction.h (revision 178718)
+++ lib/CodeGen/CodeGenFunction.h (working copy)
@@ -2211,7 +2211,9 @@
/// the LLVM value representation.
llvm::Value *EmitLoadOfScalar(llvm::Value *Addr, bool Volatile,
unsigned Alignment, QualType Ty,
- llvm::MDNode *TBAAInfo = 0);
+ llvm::MDNode *TBAAInfo = 0,
+ QualType TBAABaseTy = QualType(),
+ uint64_t TBAAOffset = 0);

/// EmitLoadOfScalar - Load a scalar value from an address, taking
/// care to appropriately convert from the memory representation to
@@ -2224,7 +2226,9 @@
/// the LLVM value representation.
void EmitStoreOfScalar(llvm::Value *Value, llvm::Value *Addr,
bool Volatile, unsigned Alignment, QualType Ty,
- llvm::MDNode *TBAAInfo = 0, bool isInit=false);
+ llvm::MDNode *TBAAInfo = 0, bool isInit = false,
+ QualType TBAABaseTy = QualType(),
+ uint64_t TBAAOffset = 0);

/// EmitStoreOfScalar - Store a scalar value to an address, taking
/// care to appropriately convert from the memory representation to
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp (revision 178718)
+++ lib/CodeGen/CodeGenModule.cpp (working copy)
@@ -227,6 +227,20 @@
return TBAA->getTBAAStructInfo(QTy);
}

+llvm::MDNode *CodeGenModule::getTBAAStructTypeInfo(QualType QTy) {
+ if (!TBAA)
+ return 0;
+ return TBAA->getTBAAStructTypeInfo(QTy);
+}
+
+llvm::MDNode *CodeGenModule::getTBAAStructTagInfo(QualType BaseTy,
+ llvm::MDNode *AccessN,
+ uint64_t O) {
+ if (!TBAA)
+ return 0;
+ return TBAA->getTBAAStructTagInfo(BaseTy, AccessN, O);
+}
+
void CodeGenModule::DecorateInstruction(llvm::Instruction *Inst,
llvm::MDNode *TBAAInfo) {
Inst->setMetadata(llvm::LLVMContext::MD_tbaa, TBAAInfo);
Index: lib/CodeGen/CodeGenModule.h
===================================================================
--- lib/CodeGen/CodeGenModule.h (revision 178718)
+++ lib/CodeGen/CodeGenModule.h (working copy)
@@ -501,6 +501,11 @@
llvm::MDNode *getTBAAInfo(QualType QTy);
llvm::MDNode *getTBAAInfoForVTablePtr();
llvm::MDNode *getTBAAStructInfo(QualType QTy);
+ /// Return the MDNode in the type DAG for the given struct type.
+ llvm::MDNode *getTBAAStructTypeInfo(QualType QTy);
+ /// Return the path-aware tag for given base type, access node and offset.
+ llvm::MDNode *getTBAAStructTagInfo(QualType BaseTy, llvm::MDNode *AccessN,
+ uint64_t O);

bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor);

Index: lib/CodeGen/CodeGenTBAA.cpp
===================================================================
--- lib/CodeGen/CodeGenTBAA.cpp (revision 178718)
+++ lib/CodeGen/CodeGenTBAA.cpp (working copy)
@@ -21,6 +21,7 @@
#include "clang/AST/Mangle.h"
#include "clang/AST/RecordLayout.h"
#include "clang/Frontend/CodeGenOptions.h"
+#include "llvm/ADT/SmallSet.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
@@ -225,3 +226,87 @@
// For now, handle any other kind of type conservatively.
return StructMetadataCache[Ty] = NULL;
}
+
+/// Check if the given type can be handled by path-aware TBAA.
+static bool isTBAAPathStruct(QualType QTy) {
+ if (const RecordType *TTy = QTy->getAs<RecordType>()) {
+ const RecordDecl *RD = TTy->getDecl()->getDefinition();
+ // RD can be struct, union, class, interface or enum.
+ // For now, we only handle struct.
+ if (RD->isStruct() && !RD->hasFlexibleArrayMember())
+ return true;
+ }
+ return false;
+}
+
+llvm::MDNode *
+CodeGenTBAA::getTBAAStructTypeInfo(QualType QTy) {
+ const Type *Ty = Context.getCanonicalType(QTy).getTypePtr();
+ assert(isTBAAPathStruct(QTy));
+
+ if (llvm::MDNode *N = StructTypeMetadataCache[Ty])
+ return N;
+
+ if (const RecordType *TTy = QTy->getAs<RecordType>()) {
+ const RecordDecl *RD = TTy->getDecl()->getDefinition();
+
+ const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
+ SmallVector <std::pair<uint64_t, llvm::MDNode*>, 4> Fields;
+ // To reduce the size of MDNode for a given struct type, we only output
+ // once for all the fields with the same scalar types.
+ // Offsets for scalar fields in the type DAG are not used.
+ llvm::SmallSet <llvm::MDNode*, 4> ScalarFieldTypes;
+ unsigned idx = 0;
+ for (RecordDecl::field_iterator i = RD->field_begin(),
+ e = RD->field_end(); i != e; ++i, ++idx) {
+ QualType FieldQTy = i->getType();
+ llvm::MDNode *FieldNode;
+ if (isTBAAPathStruct(FieldQTy))
+ FieldNode = getTBAAStructTypeInfo(FieldQTy);
+ else {
+ FieldNode = getTBAAInfo(FieldQTy);
+ // Ignore this field if the type already exists.
+ if (ScalarFieldTypes.count(FieldNode))
+ continue;
+ ScalarFieldTypes.insert(FieldNode);
+ }
+ if (!FieldNode)
+ return StructTypeMetadataCache[Ty] = NULL;
+ Fields.push_back(std::make_pair(
+ Layout.getFieldOffset(idx) / Context.getCharWidth(), FieldNode));
+ }
+
+ // TODO: This is using the RTTI name. Is there a better way to get
+ // a unique string for a type?
+ SmallString<256> OutName;
+ llvm::raw_svector_ostream Out(OutName);
+ MContext.mangleCXXRTTIName(QualType(Ty, 0), Out);
+ Out.flush();
+ // Create the struct type node with a vector of pairs (offset, type).
+ return StructTypeMetadataCache[Ty] =
+ MDHelper.createTBAAStructTypeNode(OutName, Fields);
+ }
+
+ return StructMetadataCache[Ty] = NULL;
+}
+
+llvm::MDNode *
+CodeGenTBAA::getTBAAStructTagInfo(QualType BaseQTy, llvm::MDNode *AccessNode,
+ uint64_t Offset) {
+ if (!CodeGenOpts.StructPathTBAA)
+ return AccessNode;
+
+ const Type *BTy = Context.getCanonicalType(BaseQTy).getTypePtr();
+ TBAAPathTag PathTag = TBAAPathTag(BTy, AccessNode, Offset);
+ if (llvm::MDNode *N = StructTagMetadataCache[PathTag])
+ return N;
+
+ llvm::MDNode *BNode = 0;
+ if (isTBAAPathStruct(BaseQTy))
+ BNode = getTBAAStructTypeInfo(BaseQTy);
+ if (!BNode)
+ return StructTagMetadataCache[PathTag] = AccessNode;
+
+ return StructTagMetadataCache[PathTag] =
+ MDHelper.createTBAAStructTagNode(BNode, AccessNode, Offset);
+}
Index: lib/CodeGen/CodeGenTBAA.h
===================================================================
--- lib/CodeGen/CodeGenTBAA.h (revision 178718)
+++ lib/CodeGen/CodeGenTBAA.h (working copy)
@@ -35,6 +35,14 @@
namespace CodeGen {
class CGRecordLayout;

+ struct TBAAPathTag {
+ TBAAPathTag(const Type *B, const llvm::MDNode *A, uint64_t O)
+ : BaseT(B), AccessN(A), Offset(O) {}
+ const Type *BaseT;
+ const llvm::MDNode *AccessN;
+ uint64_t Offset;
+ };
+
/// CodeGenTBAA - This class organizes the cross-module state that is used
/// while lowering AST types to LLVM types.
class CodeGenTBAA {
@@ -46,8 +54,13 @@
// MDHelper - Helper for creating metadata.
llvm::MDBuilder MDHelper;

- /// MetadataCache - This maps clang::Types to llvm::MDNodes describing them.
+ /// MetadataCache - This maps clang::Types to scalar llvm::MDNodes describing
+ /// them.
llvm::DenseMap<const Type *, llvm::MDNode *> MetadataCache;
+ /// This maps clang::Types to a struct node in the type DAG.
+ llvm::DenseMap<const Type *, llvm::MDNode *> StructTypeMetadataCache;
+ /// This maps TBAAPathTags to a tag node.
+ llvm::DenseMap<TBAAPathTag, llvm::MDNode *> StructTagMetadataCache;

/// StructMetadataCache - This maps clang::Types to llvm::MDNodes describing
/// them for struct assignments.
@@ -89,9 +102,49 @@
/// getTBAAStructInfo - Get the TBAAStruct MDNode to be used for a memcpy of
/// the given type.
llvm::MDNode *getTBAAStructInfo(QualType QTy);
+
+ /// Get the MDNode in the type DAG for given struct type QType.
+ llvm::MDNode *getTBAAStructTypeInfo(QualType QType);
+ /// Get the tag MDNode for a given base type, the actual sclar access MDNode
+ /// and offset into the base type.
+ llvm::MDNode *getTBAAStructTagInfo(QualType BaseQType,
+ llvm::MDNode *AccessNode, uint64_t Offset);
};

} // end namespace CodeGen
} // end namespace clang

+namespace llvm {
+
+template<> struct DenseMapInfo<clang::CodeGen::TBAAPathTag> {
+ static clang::CodeGen::TBAAPathTag getEmptyKey() {
+ return clang::CodeGen::TBAAPathTag(
+ DenseMapInfo<const clang::Type *>::getEmptyKey(),
+ DenseMapInfo<const MDNode *>::getEmptyKey(),
+ DenseMapInfo<uint64_t>::getEmptyKey());
+ }
+
+ static clang::CodeGen::TBAAPathTag getTombstoneKey() {
+ return clang::CodeGen::TBAAPathTag(
+ DenseMapInfo<const clang::Type *>::getTombstoneKey(),
+ DenseMapInfo<const MDNode *>::getTombstoneKey(),
+ DenseMapInfo<uint64_t>::getTombstoneKey());
+ }
+
+ static unsigned getHashValue(const clang::CodeGen::TBAAPathTag &Val) {
+ return DenseMapInfo<const clang::Type *>::getHashValue(Val.BaseT) ^
+ DenseMapInfo<const MDNode *>::getHashValue(Val.AccessN) ^
+ DenseMapInfo<uint64_t>::getHashValue(Val.Offset);
+ }
+
+ static bool isEqual(const clang::CodeGen::TBAAPathTag &LHS,
+ const clang::CodeGen::TBAAPathTag &RHS) {
+ return LHS.BaseT == RHS.BaseT &&
+ LHS.AccessN == RHS.AccessN &&
+ LHS.Offset == RHS.Offset;
+ }
+};
+
+} // end namespace llvm
+
#endif
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp (revision 178718)
+++ lib/Driver/Tools.cpp (working copy)
@@ -2105,6 +2105,8 @@
options::OPT_fno_strict_aliasing,
getToolChain().IsStrictAliasingDefault()))
CmdArgs.push_back("-relaxed-aliasing");
+ if (Args.hasArg(options::OPT_fstruct_path_tbaa))
+ CmdArgs.push_back("-struct-path-tbaa");
if (Args.hasFlag(options::OPT_fstrict_enums, options::OPT_fno_strict_enums,
false))
CmdArgs.push_back("-fstrict-enums");
Index: lib/Frontend/CompilerInvocation.cpp
===================================================================
--- lib/Frontend/CompilerInvocation.cpp (revision 178718)
+++ lib/Frontend/CompilerInvocation.cpp (working copy)
@@ -324,6 +324,7 @@
Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
OPT_fuse_register_sized_bitfield_access);
Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
+ Opts.StructPathTBAA = Args.hasArg(OPT_struct_path_tbaa);
Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
Opts.NoCommon = Args.hasArg(OPT_fno_common);
Index: test/CodeGen/tbaa.cpp
===================================================================
--- test/CodeGen/tbaa.cpp (revision 0)
+++ test/CodeGen/tbaa.cpp (working copy)
@@ -0,0 +1,217 @@
+// RUN: %clang_cc1 -O1 -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -O1 -struct-path-tbaa -disable-llvm-optzns %s -emit-llvm -o - | FileCheck %s -check-prefix=PATH
+// Test TBAA metadata generated by front-end.
+
+#include <stdint.h>
+typedef struct
+{
+ uint16_t f16;
+ uint32_t f32;
+ uint16_t f16_2;
+ uint32_t f32_2;
+} StructA;
+typedef struct
+{
+ uint16_t f16;
+ StructA a;
+ uint32_t f32;
+} StructB;
+typedef struct
+{
+ uint16_t f16;
+ StructB b;
+ uint32_t f32;
+} StructC;
+typedef struct
+{
+ uint16_t f16;
+ StructB b;
+ uint32_t f32;
+ uint8_t f8;
+} StructD;
+
+typedef struct
+{
+ uint16_t f16;
+ uint32_t f32;
+} StructS;
+typedef struct
+{
+ uint16_t f16;
+ uint32_t f32;
+} StructS2;
+
+uint32_t g(uint32_t *s, StructA *A, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i32 4, i32* %{{.*}}, align 4, !tbaa !4
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa !5
+ *s = 1;
+ A->f32 = 4;
+ return *s;
+}
+
+uint32_t g2(uint32_t *s, StructA *A, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i16 4, i16* %{{.*}}, align 2, !tbaa !5
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// PATH: store i16 4, i16* %{{.*}}, align 2, !tbaa !8
+ *s = 1;
+ A->f16 = 4;
+ return *s;
+}
+
+uint32_t g3(StructA *A, StructB *B, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i32 4, i32* %{{.*}}, align 4, !tbaa !4
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !5
+// PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa !9
+ A->f32 = 1;
+ B->a.f32 = 4;
+ return A->f32;
+}
+
+uint32_t g4(StructA *A, StructB *B, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i16 4, i16* %{{.*}}, align 2, !tbaa !5
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !5
+// PATH: store i16 4, i16* %{{.*}}, align 2, !tbaa !11
+ A->f32 = 1;
+ B->a.f16 = 4;
+ return A->f32;
+}
+
+uint32_t g5(StructA *A, StructB *B, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i32 4, i32* %{{.*}}, align 4, !tbaa !4
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !5
+// PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa !12
+ A->f32 = 1;
+ B->f32 = 4;
+ return A->f32;
+}
+
+uint32_t g6(StructA *A, StructB *B, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i32 4, i32* %{{.*}}, align 4, !tbaa !4
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !5
+// PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa !13
+ A->f32 = 1;
+ B->a.f32_2 = 4;
+ return A->f32;
+}
+
+uint32_t g7(StructA *A, StructS *S, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i32 4, i32* %{{.*}}, align 4, !tbaa !4
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !5
+// PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa !14
+ A->f32 = 1;
+ S->f32 = 4;
+ return A->f32;
+}
+
+uint32_t g8(StructA *A, StructS *S, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i16 4, i16* %{{.*}}, align 2, !tbaa !5
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !5
+// PATH: store i16 4, i16* %{{.*}}, align 2, !tbaa !16
+ A->f32 = 1;
+ S->f16 = 4;
+ return A->f32;
+}
+
+uint32_t g9(StructS *S, StructS2 *S2, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i32 4, i32* %{{.*}}, align 4, !tbaa !4
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !14
+// PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa !17
+ S->f32 = 1;
+ S2->f32 = 4;
+ return S->f32;
+}
+
+uint32_t g10(StructS *S, StructS2 *S2, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i16 4, i16* %{{.*}}, align 2, !tbaa !5
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !14
+// PATH: store i16 4, i16* %{{.*}}, align 2, !tbaa !19
+ S->f32 = 1;
+ S2->f16 = 4;
+ return S->f32;
+}
+
+uint32_t g11(StructC *C, StructD *D, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i32 4, i32* %{{.*}}, align 4, !tbaa !4
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !20
+// PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa !22
+ C->b.a.f32 = 1;
+ D->b.a.f32 = 4;
+ return C->b.a.f32;
+}
+
+uint32_t g12(StructC *C, StructD *D, uint64_t count) {
+// CHECK: define i32 @{{.*}}(
+// CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa !4
+// CHECK: store i32 4, i32* %{{.*}}, align 4, !tbaa !4
+// TODO: differentiate the two accesses.
+// PATH: define i32 @{{.*}}(
+// PATH: store i32 1, i32* %{{.*}}, align 4, !tbaa !9
+// PATH: store i32 4, i32* %{{.*}}, align 4, !tbaa !9
+ StructB *b1 = &(C->b);
+ StructB *b2 = &(D->b);
+ // b1, b2 have different context.
+ b1->a.f32 = 1;
+ b2->a.f32 = 4;
+ return b1->a.f32;
+}
+
+// CHECK: !1 = metadata !{metadata !"omnipotent char", metadata !2}
+// CHECK: !2 = metadata !{metadata !"Simple C/C++ TBAA"}
+// CHECK: !4 = metadata !{metadata !"int", metadata !1}
+// CHECK: !5 = metadata !{metadata !"short", metadata !1}
+
+// PATH: !1 = metadata !{metadata !"omnipotent char", metadata !2}
+// PATH: !4 = metadata !{metadata !"int", metadata !1}
+// PATH: !5 = metadata !{metadata !6, metadata !4, i64 4}
+// PATH: !6 = metadata !{metadata !"_ZTS7StructA", i64 0, metadata !7, i64 4, metadata !4}
+// PATH: !7 = metadata !{metadata !"short", metadata !1}
+// PATH: !8 = metadata !{metadata !6, metadata !7, i64 0}
+// PATH: !9 = metadata !{metadata !10, metadata !4, i64 8}
+// PATH: !10 = metadata !{metadata !"_ZTS7StructB", i64 0, metadata !7, i64 4, metadata !6, i64 20, metadata !4}
+// PATH: !11 = metadata !{metadata !10, metadata !7, i64 4}
+// PATH: !12 = metadata !{metadata !10, metadata !4, i64 20}
+// PATH: !13 = metadata !{metadata !10, metadata !4, i64 16}
+// PATH: !14 = metadata !{metadata !15, metadata !4, i64 4}
+// PATH: !15 = metadata !{metadata !"_ZTS7StructS", i64 0, metadata !7, i64 4, metadata !4}
+// PATH: !16 = metadata !{metadata !15, metadata !7, i64 0}
+// PATH: !17 = metadata !{metadata !18, metadata !4, i64 4}
+// PATH: !18 = metadata !{metadata !"_ZTS8StructS2", i64 0, metadata !7, i64 4, metadata !4}
+// PATH: !19 = metadata !{metadata !18, metadata !7, i64 0}
+// PATH: !20 = metadata !{metadata !21, metadata !4, i64 12}
+// PATH: !21 = metadata !{metadata !"_ZTS7StructC", i64 0, metadata !7, i64 4, metadata !10, i64 28, metadata !4}
+// PATH: !22 = metadata !{metadata !23, metadata !4, i64 12}
+// PATH: !23 = metadata !{metadata !"_ZTS7StructD", i64 0, metadata !7, i64 4, metadata !10, i64 28, metadata !4, i64 32, metadata !1}


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178784 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bf8487a3c290203ae54fd81d35a94be0ff211235 22-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> ubsan: Pass floating-point arguments to the runtime by value if they fit the
value argument. If not, be sure we don't accidentally use a dynamic alloca.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6b6a9b3f7b54e1df0976027ab623bafa3d769638 15-Mar-2013 Adrian Prantl <aprantl@apple.com> Force column info only for direct inlined functions. This should strike
the balance between expected behavior and compatibility with the gdb
testsuite.
(GDB gets confused if we break an expression into multiple debug
stmts so we enable this behavior only for inlined functions. For the
full experience people can still use -gcolumn-info.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5b07e8077a20b80fee90bd76c43c6150c676e4a8 13-Mar-2013 John McCall <rjmccall@apple.com> Tighten up the rules for precise lifetime and document
the requirements on the ARC optimizer.

rdar://13407451

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
00df5eaa9f4f7cc0809fd47c95311b532fbe63c6 12-Mar-2013 Adrian Prantl <aprantl@apple.com> Force column info to be generated for call expressions so we can
differentiate multiple inlined call sites on the same line
in the debug info.

Fixes rdar://problem/13036237

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176895 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2c39b0605fff0600714532d348d24aa42a55477f 09-Mar-2013 Benjamin Kramer <benny.kra@googlemail.com> Make helper function static.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9eda3abe7e183b05834947391c0cdc291f4ee0d8 07-Mar-2013 John McCall <rjmccall@apple.com> Promote atomic type sizes up to a power of two, capped by
MaxAtomicPromoteWidth. Fix a ton of terrible bugs with
_Atomic types and (non-intrinsic-mediated) loads and stores
thereto.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
fafaaef243322b1e598a72d7dbfaf2ca0c139174 07-Mar-2013 John McCall <rjmccall@apple.com> Move the atomics code into its own file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9d232c884ea9872d6555df0fd7359699819bc1f1 07-Mar-2013 John McCall <rjmccall@apple.com> Change hasAggregateLLVMType, which conflates complex and
aggregate types in a profoundly wrong way that has to be
worked around in every call site, to getEvaluationKind,
which classifies and distinguishes between all of these
cases.

Also, normalize the API for loading and storing complexes.

I'm working on a larger patch and wanted to pull these
changes out, but it would have be annoying to detangle
them from each other.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bd7370a78604e9a20d698bfe328c1e43f12a0613 28-Feb-2013 John McCall <rjmccall@apple.com> Use the actual ABI-determined C calling convention for runtime
calls and declarations.

LLVM has a default CC determined by the target triple. This is
not always the actual default CC for the ABI we've been asked to
target, and so we sometimes find ourselves annotating all user
functions with an explicit calling convention. Since these
calling conventions usually agree for the simple set of argument
types passed to most runtime functions, using the LLVM-default CC
in principle has no effect. However, the LLVM optimizer goes
into histrionics if it sees this kind of formal CC mismatch,
since it has no concept of CC compatibility. Therefore, if this
module happens to define the "runtime" function, or got LTO'ed
with such a definition, we can miscompile; so it's quite
important to get this right.

Defining runtime functions locally is quite common in embedded
applications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5956bcc31ad0b1f570e04f7e19e817112f7274c5 24-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15338: Don't assert if -fsanitize=bounds sees array indexing on an incomplete
array type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175982 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a0a628f839cf50844cc0f226bd9cb72485f98f91 23-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> ubsan: Emit bounds checks for array indexing, vector indexing, and (in really simple cases) pointer arithmetic. This augments the existing bounds checking with language-level array bounds information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c764830bdb6de82baed068889096bd3e52d4cbda 13-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> ubsan: Add checking for invalid downcasts. Per [expr.static.cast]p2 and p11,
base-to-derived casts have undefined behavior if the object is not actually an
instance of the derived type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
802e22682c17c4a9df3f747abd224db38e382e39 02-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't forget to run destructors when we create an array temporary of class type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c4c62fd78a4728c9e4d4df14911a2ced9bdd2031 31-Jan-2013 Bill Wendling <isanbard@gmail.com> Make sure that the Attribute object represents one attribute only.

Several places were still treating the Attribute object as respresenting
multiple attributes. Those places now use the AttributeSet to represent
multiple attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cb5620c9b213f4bd323912159fdddda35e258a14 30-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Move UTF conversion routines from clang/lib/Basic to llvm/lib/Support

This is required to use them in TableGen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
78d85b1c5830a881c0a20a1b3fea99ee73149590 30-Jan-2013 Chad Rosier <mcrosier@apple.com> [ubsan] Implement the -fcatch-undefined-behavior flag using a trapping
implementation; this is much more inline with the original implementation
(i.e., pre-ubsan) and does not require run-time library support.

The trapping implementation can be invoked using either '-fcatch-undefined-behavior'
or '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error', with the latter
being preferred. Eventually, the -fcatch-undefined-behavior' flag will be removed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173848 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e6b9d802fb7b16d93474c4f1c179ab36202e8a8b 20-Jan-2013 Guy Benyei <guy.benyei@intel.com> Implement OpenCL event_t as Clang builtin type, including event_t related OpenCL restrictions (OpenCL 1.2 spec 6.9)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4f45bc099f2665bc6e4bcbb169aa452390dbf3fe 18-Jan-2013 Will Dietz <wdietz2@illinois.edu> [ubsan] Add support for -fsanitize-blacklist

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cc41a94688615b551505e0e7c287e1c444f53a3f 16-Jan-2013 David Greene <greened@obbligato.org> Avoid unsigned Compare to int

Cast arithmetic results to avoid comparison of an unsigned to an int.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cfa88f893915ceb8ae4ce2f17c46c24a4d67502f 12-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f91cbd54c97fceaf84539e7234b27ad54bba735b 10-Jan-2013 Nick Lewycky <nicholas@mxc.ca> Don't assert in codegen on static data members which have NoLinkage. Fixes
PR14825!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172031 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4a5984cc6d176d8356529e7e5aee4856088d79f0 09-Jan-2013 Will Dietz <wdietz2@illinois.edu> [ubsan] Make static check data non-const so it can be used for deduplication.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171947 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3b844ba7d5be205a9b4f5f0b0d1b7978977f4b8c 02-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to
reflect the migration in r171366.

Re-sort the #include lines to reflect the new paths.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0db661e67f613f49d047cdf53da29b9741234ad8 21-Dec-2012 Rafael Espindola <rafael.espindola@gmail.com> Don't eagerly emit a global static merged with a local extern.

When we are visiting the extern declaration of 'i' in

static int i = 99;
int foo() {
extern int i;
return i;
}

We should not try to handle it as if it was an function static. That is, we
must consider the written storage class.

Fixing this then exposes that the assert in EmitGlobalVarDeclLValue and the
if leading to its call are not completely accurate. They were passing before
because the second decl was marked as having external storage. I changed them
to check the linkage, which I find easier to understand.

Last but not least, there is something strange going on with cuda and opencl.
My guess is that the linkage computation for these languages needs to be
audited, but I didn't want to change that in this patch so I just updated
the storage classes to keep the current behavior.

Thanks to Reed Kotler for reporting this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170827 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
72390b39c545426023ec104afe8706395d732bad 20-Dec-2012 Bill Wendling <isanbard@gmail.com> Rename llvm::Attributes to llvm::Attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ad017fa7a4df7389d245d02a49b3c79ed70bedb9 20-Dec-2012 Bill Wendling <isanbard@gmail.com> Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
094dbf917127a1228147587076d59ca45b7c258d 19-Dec-2012 Bill Wendling <isanbard@gmail.com> Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e538d48957b10bfaac46bc6138b78cfcc28ee89e 19-Dec-2012 Eli Friedman <eli.friedman@gmail.com> Make sure CodeGen uses a value of the correct type as the result of
of assignment to a bool bitfield. PR14638.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e77372ac818cf202571dcbf8ab656c8f47ba3423 18-Dec-2012 Eli Bendersky <eliben@google.com> Similar to 170440 - fix build warning with gcc


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170461 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c92384f871597902b8d5ffc33a662e8ac0d25db0 18-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix typo (thanks to Jordan for spotting it!).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
073fec91b73f08ba86ad46573141be14c7a0d262 18-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Rein ubsan's vptr sanitizer back a bit. Per core issue 453, binding a reference
to an object outside its lifetime does not have undefined behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170387 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1bdbe4d23ed90f601772edd4aa00b8d757c6d6ca 15-Dec-2012 Will Dietz <wdietz2@illinois.edu> [ubsan] Emit branch weight metadata to hint towards common case.

Results in better block placement that helps close the
performance gap when making ubsan checks recoverable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
463b48ba7eab6d7c96d23b59caea7f25de548293 13-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> ubsan: Add -fsanitize=bool and -fsanitize=enum, which check for loads of
bit-patterns which are not valid values for enumerated or boolean types.
These checks are the ubsan analogue of !range metadata.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170108 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cdc2e82c317163693c99a8cbef76685e86420395 13-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Simplify. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e56bb36e8eea89bae7dfe6eb6ea0455af126bf4a 07-Dec-2012 John McCall <rjmccall@apple.com> Fix the required args count for variadic blocks.

We were emitting calls to blocks as if all arguments were
required --- i.e. with signature (A,B,C,D,...) rather than
(A,B,...). This patch fixes that and accounts for the
implicit block-context argument as a required argument.
In addition, this patch changes the function type under which
we call unprototyped functions on platforms like x86-64 that
guarantee compatibility of variadic functions with unprototyped
function types; previously we would always call such functions
under the LLVM type T (...)*, but now we will call them under
the type T (A,B,C,D,...)*. This last change should have no
material effect except for making the type conventions more
explicit; it was a side-effect of the most convenient implementation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169588 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
72d2dab6058467036df73a5f668036a519043e5b 06-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Rework the bitfield access IR generation to address PR13619 and
generally support the C++11 memory model requirements for bitfield
accesses by relying more heavily on LLVM's memory model.

The primary change this introduces is to move from a manually aligned
and strided access pattern across the bits of the bitfield to a much
simpler lump access of all bits in the bitfield followed by math to
extract the bits relevant for the particular field.

This simplifies the code significantly, but relies on LLVM to
intelligently lowering these integers.

I have tested LLVM's lowering both synthetically and in benchmarks. The
lowering appears to be functional, and there are no really significant
performance regressions. Different code patterns accessing bitfields
will vary in how this impacts them. The only real regressions I'm seeing
are a few patterns where the LLVM code generation for loads that feed
directly into a mask operation don't take advantage of the x86 ability
to do a smaller load and a cheap zero-extension. This doesn't regress
any benchmark in the nightly test suite on my box past the noise
threshold, but my box is quite noisy. I'll be watching the LNT numbers,
and will look into further improvements to the LLVM lowering as needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
55fc873017f10f6f566b182b70f6fc22aefa3464 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
73593eb5c68e28e0eaa4f2b6251dae167eef3a83 03-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix test failure when building Clang with g++4.7 -- don't use a Twine temporary
after its lifetime has ended!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169170 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ad95481b2769ad61f23afc5e2c31f11c66090657 02-Dec-2012 Will Dietz <wdietz2@illinois.edu> [ubsan] Add flag to enable recovery from checks when possible.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169114 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bbe89d5670b458fc1e2fff49e96e119ffb1622c8 30-Nov-2012 Aaron Ballman <aaron@aaronballman.com> Fixing a precedence issue with my previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
99ecd9f50dc28cd8db90ddaab39e2c8843dc3500 30-Nov-2012 Aaron Ballman <aaron@aaronballman.com> Fixing an MSVC warning about an unsafe mixture of Boolean and unsigned types in a logical operator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
82c458ea76bf8f0981e3d1b5070c0b0e5878d784 28-Nov-2012 Fariborz Jahanian <fjahanian@apple.com> objective-C arc: load of a __weak object happens via call to
objc_loadWeak. This retains and autorelease the weakly-refereced
object. This hidden autorelease sometimes makes __weak variable alive even
after the weak reference is erased, because the object is still referenced
by an autorelease pool. This patch overcomes this behavior by loading a
weak object via call to objc_loadWeakRetained(), followng it by objc_release
at appropriate place, thereby removing the hidden autorelease. // rdar://10849570


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168740 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7baa711e61258a762db42e449e424bd0928318a6 17-Nov-2012 Benjamin Kramer <benny.kra@googlemail.com> Enable inlining of 4 byte atomic ops on ppc32, 8 byte atomic ops on ppc64.

Also fixes a bit/byte mismatch when checking if a target supports atomic ops of a certain size.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8187c7e488837698c5fb7a84107e3347d276f73f 13-Nov-2012 Eli Friedman <eli.friedman@gmail.com> Fix IR generation for bool on PPC (and any other target where bool is not 8 bits in memory).

PR11777.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d6396a681c9acbe56bc41bbc2bed2db45755bcd7 05-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Use the individual -fsanitize=<...> arguments to control which of the UBSan
checks to enable. Remove frontend support for -fcatch-undefined-behavior,
-faddress-sanitizer and -fthread-sanitizer now that they don't do anything.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7edf9e38b91917b661277601c0e448eef0eb2b56 01-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Simplify: replace getContext().getLangOpts() with just getLangOpts().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167261 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cc305617e952f8c3a06b63d9225d0dd7769341b7 01-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Split emission of -ftrapv checks and -fcatch-undefined-behavior checks into
separate functions, since they share essentially no code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
292d67bb69e878104d2cdc1a1f72264e4fc2852a 01-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> -fcatch-undefined-behavior: Start checking loads and stores for null pointers.
We want the diagnostic, and if the load is optimized away, we still want to
trap it. Stop checking non-default address spaces; that doesn't work in
general.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ee1ea80a9091050c6d0a21be9d06a5f97d3ea715 30-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Don't crash on bad atomic operations. PR14176.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0a7dd835184343ec9149277b668ecdc5d49fe8b0 27-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Move two helper functions to AST so that sema can use them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
034653c867d2369c05a286fffe3182190a999f7b 27-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Refactor some code into a new findMaterializedTemporary function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
582e185a5a9dc5fb9c347f370f530499d1fe5181 27-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Refactor some code into a new skipRValueSubobjectAdjustments function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166848 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ecccc1e286b56330c75b443a3a14b93e1d3bdedd 27-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Delay codegen to after collecting all SubobjectAdjustment so that the collection
can be refactored and used in Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166847 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8e1cee6f23e2552b96b81e5ef419ab3f69c5b5c2 25-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> -fcatch-undefined-behavior checking for appropriate vptr value: Clang CodeGen side.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166661 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5016a70c183a50845a0421802d161093dd0643f6 20-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1472: A reference isn't odr-used if it has preceding initialization,
initialized by a reference constant expression.

Our odr-use modeling still needs work here: we don't yet implement the 'set of
potential results of an expression' DR.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166361 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0d5833921cc728bc1d2e45fbaf7b3e11cddbf99d 15-Oct-2012 Bill Wendling <isanbard@gmail.com> Move the Attributes::Builder outside of the Attributes class and into its own class named AttrBuilder. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
50e6b18f99c45b31e6216ab221f6b3911b24fa1f 15-Oct-2012 Bill Wendling <isanbard@gmail.com> Attributes Rewrite

Convert the uses of the Attributes class over to the new format. The
Attributes::get method call now takes an LLVM context so that the attributes
object can be uniquified and stored.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165918 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c5f804636e367ef744fd24cf88f7c956a5af0434 11-Oct-2012 Nico Weber <nicolasweber@gmx.de> Add codegen support for __uuidof().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165710 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
603571a2d6daca43162bf1d9469baf919697c00a 10-Oct-2012 Bill Wendling <isanbard@gmail.com> Remove the final bits of Attributes being declared in the Attribute
namespace. Use the attribute's enum value instead. No functionality change
intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165611 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dc47bdc43c62bf2ff01bc71c811a66cb5376d318 10-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> -fcatch-undefined-behavior: store the type name directly at the end of a type descriptor. 5% binary size reduction due to fewer relocations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4def70d3040e73707c738f7c366737a986135edf 09-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> -fcatch-undefined-behavior: emit calls to the runtime library whenever one of the checks fails.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
25a6a84cf5067b32c271e3ba078676dee838798d 08-Oct-2012 Micah Villmow <villmow@gmail.com> Move TargetData to DataLayout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e5f0588840b20897631cc8110344fd2745ef4caa 08-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> When a bad UTF-8 encoding or bogus escape sequence is encountered in a
string literal, produce a diagnostic pointing at the erroneous character
range, not at the start of the literal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7ac9ef1c82c779a5348ed11b3d10e01c58803b35 08-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> -fcatch-undefined-behavior: Factor emission of the creation of, and branch to,
the trap BB out of the individual checks and into a common function, to prepare
for making this code call into a runtime library. Rename the existing EmitCheck
to EmitTypeCheck to clarify it and to move it out of the way of the new
EmitCheck.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163451 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a6c66cedc022c9e5d45a937d6b8cff491a6bf81b 31-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Change the representation of builtin functions in the AST
(__builtin_* etc.) so that it isn't possible to take their address.
Specifically, introduce a new type to represent a reference to a builtin
function, and a new cast kind to convert it to a function pointer in the
operand of a call. Fixes PR13195.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2c9f87ca5cccbfdaad82762368af5b2323320653 24-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> New -fcatch-undefined-behavior features:
* when checking that a pointer or reference refers to appropriate storage for a type, also check the alignment and perform a null check
* check that references are bound to appropriate storage
* check that 'this' has appropriate storage in member accesses and member function calls


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c58dcdc8facb646d88675bb6fbcb5c787166c4be 16-Aug-2012 Tanya Lattner <tonic@nondot.org> Convert loads and stores of vec3 to vec4 to achieve better code generation. Add test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162002 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
859c65cdbe730fd0e940b71ab4ba4884d44a8298 08-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Fix an assertion failure with a C++ constructor initializing a
member of reference type in an anonymous struct. PR13154.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161473 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6bebe5aca3c45c741303dd0ae12d0225bddbe2e6 16-Jul-2012 Chandler Carruth <chandlerc@gmail.com> Update Clang to reflect the move of MDBuilder in r160237.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0f3d0970dcdf6cf17550b86838dff12813968dbc 07-Jul-2012 John McCall <rjmccall@apple.com> Distinguish more carefully between free functions and C++ instance methods
in the ABI arrangement, and leave a hook behind so that we can easily
tweak CCs on platforms that use different CCs by default for C++
instance methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
402a6d5613b3df364ba252416d5a022dee95f0ba 03-Jul-2012 Matt Beaumont-Gay <matthewbg@google.com> Silence warning in -Asserts build

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159635 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
941e47cef26fb6300a8d3e366f7c5694277e5849 03-Jul-2012 Nico Weber <nicolasweber@gmx.de> Share ConvertUTF8toWide() between Lex and CodeGen.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e0c1168ec7910a1a7ed08df4d4f0c58c2fa2ecd1 03-Jul-2012 John McCall <rjmccall@apple.com> Significantly simplify CGExprAgg's logic about ignored results:
if we want to ignore a result, the Dest will be null. Otherwise,
we must copy into it. This means we need to ensure a slot when
loading from a volatile l-value.

With all that in place, fix a bug with chained assignments into
__block variables of aggregate type where we were losing insight into
the actual source of the value during the second assignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f4bcfa1b1850711d5eb092f2b0639331ef9f09f1 27-Jun-2012 Eli Friedman <eli.friedman@gmail.com> Propagate lvalue alignment into bitfields. Per report on cfe-dev.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159295 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
28ad063b279378b19cb0704f977429df366a151e 23-Jun-2012 Nico Weber <nicolasweber@gmx.de> Support L__FUNCTION__ in microsoft mode, PR11789

Heavily based on a patch from
Aaron Wishnick <aaron.s.wishnick@gmail.com>.

I'll clean up the duplicated function in CodeGen as
a follow-up, later today or tomorrow.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
32f498a675df990901e6659d610dc740f9423228 16-Jun-2012 Eli Friedman <eli.friedman@gmail.com> Make the ".*" operator work correctly when the base is a prvalue and the field has a non-trivial copy constructor. PR13097.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ec22f56f2031c3e61100d42133b06f9b9f020ee6 07-Jun-2012 Fariborz Jahanian <fjahanian@apple.com> User better API for vla in compund literals.
// rdar://11485774


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2ccc0f9c23e6b948a4db6ffe46aefa098e1a2956 07-Jun-2012 Fariborz Jahanian <fjahanian@apple.com> When emitting compund literal of vla pointer elements, make
sure to emit vla size to prevent an irgen crash.
// rdar://11485774


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
def18494b97f554ea0d95db75627c3e77b74307f 22-May-2012 Nuno Lopes <nunoplopes@sapo.pt> wire -fbounds-checking to the new LLVM bounds checking pass

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3e86a0433db4c664d29f2b19eb977138e071a68a 22-May-2012 Nuno Lopes <nunoplopes@sapo.pt> revert the usage of the objectsize intrinsic with 3 parameters (to match LLVM r157255)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
13ec9100ca6bc03b5ce8832e4a0fcb724d47bcb1 14-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement IRGen for C++11's "T{1, 2, 3}", where T is an aggregate and the
expression is treated as an lvalue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
08a9ae95ba7e0a87e667f97ccc5bac646df9a705 09-May-2012 Nuno Lopes <nunoplopes@sapo.pt> update calls to objectsize intrinsic to match LLVM r156473
add a test for -fbounds-checking code generation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b3198a841e7f356f171f1e11faff014b2deb1eb8 09-May-2012 Nuno Lopes <nunoplopes@sapo.pt> add -fbounds-checking option.
When enabled, clang generates bounds checks for array and pointers dereferences. Work to follow in LLVM's backend.

OK'ed by Chad; thanks for the review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d7fb96e3bfeeaae7e28666b2838b430ff8c26397 07-May-2012 Nuno Lopes <nunoplopes@sapo.pt> remove code to add bound checks for simple array accesses, since those are already covered by the check with the objectsize builtin
remove the comparison of objectsize with -1. since it's an unsigned comparison, it will always succeed if objectsize returns -1, which is enough to have the check removed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cf18ae57176a827b668e059d559ee5f1d6f8f910 01-May-2012 Ted Kremenek <kremenek@apple.com> Push variable declaration into nested scope (the only place where it is used). Found by static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155922 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
20bb175cb8ae5844034828db094fb948c0e3454a 01-May-2012 John McCall <rjmccall@apple.com> Abstract the emission of global destructors into ABI-specific code
and only consider using __cxa_atexit in the Itanium logic. The
default logic is to use atexit().

Emit "guarded" initializers in Microsoft mode unconditionally.
This is definitely not correct, but it's closer to correct than
just not emitting the initializer.

Based on a patch by Timur Iskhodzhanov!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
60c77079d4767133a587c1c9390f2f5fd43fba9f 16-Apr-2012 Duncan Sands <baldrick@free.fr> Adjust for LLVM name tweaks requested by Chandler.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154824 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
377ecc7996dce6803f7b7b6208cab5e197c9c5b8 16-Apr-2012 Eli Friedman <eli.friedman@gmail.com> Propagate alignment on lvalues through EmitLValueForField. PR12395.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2d7cb069fe101da3971a07900ff583380bcac184 15-Apr-2012 Duncan Sands <baldrick@free.fr> Use MDBuilder to help with metadata creation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9bb1d34e34e3a428d8fb9a20922a1000ad42fd0c 14-Apr-2012 Duncan Sands <baldrick@free.fr> Rename "fpaccuracy" metadata to the more generic "fpmath". That's because I'm
thinking of generalizing it to be able to specify other freedoms beyond accuracy
(such as that NaN's don't have to be respected). I'd like the 3.1 release (the
first one with this metadata) to have the more generic name already rather than
having to auto-upgrade it in 3.2.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
eaf856db5d1a272dc7188937206ef4572836f82a 13-Apr-2012 Anton Korobeynikov <asl@math.spbu.ru> Step forward with supporting of ARM homogenous aggregates:
- Handle unions
- Handle C++ classes


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
51b92401c9f95023a2ef27064fd5a60fd99175f5 13-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement __atomic_fetch_nand and __atomic_nand_fetch to complete our set of
GNU __atomic builtins.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2c39d71bb7cefdfe6116fa52454f3b3dc5abd517 13-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement the missing pieces needed to support libstdc++4.7's <atomic>:
__atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_*
predefined macros.

Implement library fallback for __atomic_is_lock_free and
__c11_atomic_is_lock_free, and implement __atomic_always_lock_free.

Contrary to their documentation, GCC's __atomic_fetch_add family don't
multiply the operand by sizeof(T) when operating on a pointer type.
libstdc++ relies on this quirk. Remove this handling for all but the
__c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins.

Contrary to their documentation, __atomic_test_and_set and __atomic_clear
take a first argument of type 'volatile void *', not 'void *' or 'bool *',
and __atomic_is_lock_free and __atomic_always_lock_free have an argument
of type 'const volatile void *', not 'void *'.

With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite,
except for a couple of libstdc++ bugs and some cases where libc++'s test
suite tests for properties which implementations have latitude to vary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
47bfcca2d6972d98a1b25239cd1aa658b60680e2 12-Apr-2012 Douglas Gregor <dgregor@apple.com> Fix some i1/i8 confusion within _Atomic(bool) in IR generation, both
in general (such an atomic has boolean representation) and
specifically for IR generation of __c11_atomic_init. The latter also
means actually using initialization semantics for this initialization,
rather than just creating a store.

On a related note, make sure we actually put in non-atomic-to-atomic
conversions when performing an implicit conversion sequence. IR
generation is far too kind here, but we still want the ASTs to make
sense.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ff34d401ff385ef7173ca612432b4ea717fff690 12-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement support for 18 of the GNU-compatible __atomic builtins.

This is not quite sufficient for libstdc++'s <atomic>: we still need
__atomic_test_and_set and __atomic_clear, and may need a more complete
__atomic_is_lock_free implementation.

We are also missing an implementation of __atomic_always_lock_free,
__atomic_nand_fetch, and __atomic_fetch_nand, but those aren't needed
for libstdc++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5d70cfddc8a8a450d1425e190f10512a51352e5d 11-Apr-2012 David Chisnall <csdavec@swan.ac.uk> Make __atomic_init() (soon to be __c11_atomic_init()) work with non-scalar types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154507 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8250016fb9491fcfde7fce05230d66e267944484 10-Apr-2012 Duncan Sands <baldrick@free.fr> Express the number of ULPs in fpaccuracy metadata as a real rather than a
rational number, eg as 2.5 rather than 5, 2. OK'd by Peter Collingbourne.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3a7d69bf666140e45ea7d75b6887d4b67eecd68e 29-Mar-2012 David Chisnall <csdavec@swan.ac.uk> Call out to GCC-compatible runtime functions for atomic ops that we can't use
LLVM intrinsics for.

I have an implementation of these functions, which wants to go in a libgcc_s
equivalent in compiler-rt. It's currently here:

http://people.freebsd.org/~theraven/atomic.c

It will be committed to compiler-rt as soon as I work out where would be a
sensible place to put it...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
649b4a1a9b5e6f768ca0cb84bd97b00f51083e15 29-Mar-2012 Chad Rosier <mcrosier@apple.com> Revert r153613 as it's causing large compile-time regressions on the nightly testers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
57cd1b89cd91433ce1991a5bff36fe776a263796 29-Mar-2012 John McCall <rjmccall@apple.com> When we can't prove that the target of an aggregate copy is
a complete object, the memcpy needs to use the data size of
the structure instead of its sizeof() value. Fixes PR12204.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
82fe6aea407a5a09a6131452ce622087ba83880d 28-Mar-2012 Chandler Carruth <chandlerc@gmail.com> Move the emission of strict enum range metadata behind a flag (the same
flag as GCC uses: -fstrict-enums). There is a *lot* of code making
unwarranted assumptions about the underlying type of enums, and it
doesn't seem entirely reasonable to eagerly break all of it.

Much more importantly, the current state of affairs is *very* good at
optimizing based upon this information, which causes failures that are
very distant from the actual enum. Before we push for enabling this by
default, I think we need to implement -fcatch-undefined-behavior support
for instrumenting and trapping whenever we store or load a value outside
of the range. That way we can track down the misbehaving code very
quickly.

I discussed this with Rafael, and currently the only important cases he
is aware of are the bool range-based optimizations which are staying
hard enabled. We've not seen any issue with those either, and they are
much more important for performance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c3f8955d7da1019dbe16b0bdf3e49d2e08d988e9 24-Mar-2012 Rafael Espindola <rafael.espindola@gmail.com> Add back r153360 with a fix for enums that cover all the 32 bit values.
Thanks to NAKAMURA Takumi for finding it!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153383 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
88a569a9781e0472a1f1c392f6c94ed0c068d946 24-Mar-2012 NAKAMURA Takumi <geek4civic@gmail.com> Revert r153360 (and r153380), "Second part of PR12251. Produce the range metadata in clang for booleans and".

For i686 targets (eg. cygwin), I saw "Range must not be empty!" in verifier.

It produces (i32)[0x80000000:0x80000000) from (uint64_t)[0xFFFFFFFF80000000ULL:0x0000000080000000ULL), for signed i32 on MDNode::Range.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153382 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e27af29401da15cc2e9a92825cb24adb1aef7091 24-Mar-2012 Rafael Espindola <rafael.espindola@gmail.com> Second part of PR12251. Produce the range metadata in clang for booleans and
c++ enums.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e5a8aeb4ad762b9383f9e9544c619dc386951e18 22-Mar-2012 Eli Friedman <eli.friedman@gmail.com> Make sure we correctly set the alignment for vector loads and stores associated with vector element lvalues. Patch by Kevin Schoedel (with some minor modifications by me).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153285 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4e4d08403ca5cfd4d558fa2936215d3a4e5a528d 11-Mar-2012 David Blaikie <dblaikie@gmail.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
f4b88a45902af1802a1cb42ba48b1c474474f228 10-Mar-2012 John McCall <rjmccall@apple.com> Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
track whether the referenced declaration comes from an enclosing
local context. I'm amenable to suggestions about the exact meaning
of this bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dd2ecee313b558a9b621ec003b45e0fbc83508d7 10-Mar-2012 John McCall <rjmccall@apple.com> Unify the BlockDeclRefExpr and DeclRefExpr paths so that
we correctly emit loads of BlockDeclRefExprs even when they
don't qualify as ODR-uses. I think I'm adequately convinced
that BlockDeclRefExpr can die.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152479 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9fcce65e7e1307b5b8da9be13e4092d6bb94dc1d 07-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this
representation.

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152211 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ac1303eca6cbe3e623fb5ec6fe7ec184ef4b0dfa 22-Feb-2012 Douglas Gregor <dgregor@apple.com> Generate an AST for the conversion from a lambda closure type to a
block pointer that returns a block literal which captures (by copy)
the lambda closure itself. Some aspects of the block literal are left
unspecified, namely the capture variable (which doesn't actually
exist) and the body (which will be filled in by IRgen because it can't
be written as an AST).

Because we're switching to this model, this patch also eliminates
tracking the copy-initialization expression for the block capture of
the conversion function, since that information is now embedded in the
synthesized block literal. -1 side tables FTW.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dfb80ded6767f7b79a0f1fa4f6921d543ff0a643 18-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix wrong-code bug: __imag on a scalar lvalue should produce a zero rvalue,
rather than an lvalue referring to the scalar.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
de5d3c717684f3821b8db58037bc7140acf134aa 17-Feb-2012 John McCall <rjmccall@apple.com> Whether an argument is required (in contrast with being an
optional argument passed through the variadic ellipsis)
potentially affects how we need to lower it. Propagate
this information down to the various getFunctionInfo(...)
overloads on CodeGenTypes. Furthermore, rename those
overloads to clarify their distinct purposes, and make
sure we're calling the right one in the right place.
This has a nice side-effect of making it easier to construct
a function type, since the 'variadic' bit is no longer
separable.

This shouldn't really change anything for our existing
platforms, with one minor exception --- we should now call
variadic ObjC methods with the ... in the "right place"
(see the test case), which I guess matters for anyone
running GNUStep on MIPS. Mostly it's just a substantial
clean-up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150788 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4d4e5c1ae83f4510caa486b3ad19de13048f9f04 15-Feb-2012 John McCall <rjmccall@apple.com> Split reinterpret_casts of member pointers out from CK_BitCast; this
is general goodness because representations of member pointers are
not always equivalent across member pointer types on all ABIs
(even though this isn't really standard-endorsed).

Take advantage of the new information to teach IR-generation how
to do these reinterprets in constant initializers. Make sure this
works when intermingled with hierarchy conversions (although
this is not part of our motivating use case). Doing this in the
constant-evaluator would probably have been better, but that would
require a *lot* of extra structure in the representation of
constant member pointers: you'd really have to track an arbitrary
chain of hierarchy conversions and reinterpretations in order to
get this right. Ultimately, this seems less complex. I also
wasn't quite sure how to extend the constant evaluator to handle
foldings that we don't actually want to treat as extended
constant expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150551 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
14c598268ff7534d3753ae84eba9b8a81bf0bf8f 14-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Use a simpler (and more efficient) pattern to pad vectors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cec5ebd4a6a89a7023d04cec728fd340b541ed61 11-Feb-2012 Eli Friedman <eli.friedman@gmail.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
4c5d8afd100189b6cce4fd89bfb8aec5700acb50 09-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Refactor lambda IRGen so AggExprEmitter::VisitLambdaExpr does the right thing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150146 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c6a6369b82db5b51769c4eaa29f8b0199142577a 09-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Basic IRGen for LambdaExprs with captures.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150141 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
31a3702618ab49578542cffee20ba0c8859b9d1e 08-Feb-2012 Eli Friedman <eli.friedman@gmail.com> A little bit of lambda IRGen.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150058 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8b418685e9e4f02f4eb2a76e1ec063e07552b68d 07-Feb-2012 Chris Lattner <sabre@nondot.org> 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
/external/clang/lib/CodeGen/CGExpr.cpp
f7ccbad5d9949e7ddd1cbef43d482553b811e026 05-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import SmallString<> into clang namespace

(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
89f42834092621ab6ebac24e09b17b61ac000b6b 30-Jan-2012 Chris Lattner <sabre@nondot.org> Simplify code by using the new getAggregateElement method that got added
recently. This also conveniently gets clang ready for a change about to
land in mainline.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
516bbd42e62d709013824d6fb8445a0cfda3129a 26-Jan-2012 Peter Collingbourne <peter@pcc.me.uk> Use function pointers, rather than references, to pass Destroyers
around, in the process cleaning up the various gcc/msvc compiler
workarounds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
edf5a7b4ebbb2a49c941ca11a131790f50cc55f9 25-Jan-2012 NAKAMURA Takumi <geek4civic@gmail.com> Fixup r148926, for -Asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2ce8842641cc312628c4be836d34eb250e7c3f78 25-Jan-2012 Chris Lattner <sabre@nondot.org> reapply r148902:

"use the new ConstantVector::getSplat method where it makes sense."

Also simplify a bunch of code to use the Builder->getInt32 instead
of doing it the hard and ugly way. Much more progress could be made
here, but I don't plan to do it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2c0c745709c9f258f4c968bcf3e891faa9acbca6 25-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Fix a crash for an edge case of the GNU ?: extension.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148923 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
af521dae8ee15ebf4ecceae3d25f66a475104a07 25-Jan-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert 148902 which was part of 148901 which was reverted in r148906.

Original log:
use the new ConstantVector::getSplat method where it makes sense.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9ddc6246b5f3dbb1a1e05d012361dc2c6d403381 25-Jan-2012 Chris Lattner <sabre@nondot.org> use the new ConstantVector::getSplat method where it makes sense.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148902 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
416de514f8a7a9c121e45ae450d0faef9e5a0ef9 21-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Add an assertion that our use-marking actually covers all uses of a variable. The assertion doesn't cover quite as much as it should, but it's a good start, at least.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148625 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3026348bd4c13a0f83b59839f64065e0fcbea253 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7a7ee3033e44b45630981355460ef89efa0bdcc4 16-Jan-2012 David Chisnall <csdavec@swan.ac.uk> Some improvements to the handling of C11 atomic types:

- Add atomic-to/from-nonatomic cast types
- Emit atomic operations for arithmetic on atomic types
- Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load
- Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function.
- Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it.

Still to do:

- Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg.
- Add a signal fence builtin
- Properly set the fenv state in atomic operations on floating point values
- Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context)
- Fix the many remaining corner cases



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
44a239973dfe86a0d2432ca2502b7878fadfe23e 04-Jan-2012 Chris Lattner <sabre@nondot.org> implement rdar://10639962 by keeping track of increased alignment
information even in subscripting operations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147557 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4cac9e169bd85bea592a49a0f4a0d2f37260b29a 19-Dec-2011 Chris Lattner <sabre@nondot.org> Fix PR5279 - don't sliently drop alignment information on stores of types that have alignment less than the natural alignment of the type when it comes from a typedef.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146908 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6da2c716017d5c8530ec99779524491ebc5dadb8 03-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Switch LValue so that it exposes alignment in CharUnits. (No functional change.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145753 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d7722d9d76a851e7897f4127626616d3b1b8e530 03-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Switch the Alignment argument on AggValueSlot over to CharUnits, per John's review comment.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f394078fde147dcf27e9b6a7965517388d64dcb6 03-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Track alignment in AggValueSlot. No functional change in this patch, but I'll be introducing uses of the specified alignment soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145736 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3ed7903d27f0e7e0cd3a61c165d39eca70f3cff5 01-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Don't use a varargs convention for calls unprototyped functions where one of the arguments is an AVX vector.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145574 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
86811609d9353e3aed198045d56e790eb3b6118c 27-Nov-2011 Peter Collingbourne <peter@pcc.me.uk> When destroying temporaries, instead of a custom cleanup use the
generic pushDestroy function.

This would reduce the number of useful declarations in
CGTemporaries.cpp to one. Since CodeGenFunction::EmitCXXTemporary
does not deserve its own file, move it to CGCleanup.cpp and delete
CGTemporaries.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145202 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
13dc8f98f6108dca8aaa9721567ed5a2d9911e0f 27-Nov-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Reference initialization with initializer lists.

This supports single-element initializer lists for references according to DR1288, as well as creating temporaries and binding to them for other initializer lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7401cf524cdb7aad4951d8727d280f8b271af5a2 22-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Use static storage duration for file-scope compound literals, even when they
appear in non-constant initializers in C++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145087 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2f77b3d57031ded0de2b7b977fb63b4660f82624 16-Nov-2011 Eli Friedman <eli.friedman@gmail.com> Fix a bunch of really nasty bugs in how we compute alignment for reference lvalues. PR11376.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1a343ebbf413e8eae6b2737b2b2d79cbf5765571 10-Nov-2011 John McCall <rjmccall@apple.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
a5493f885095bd63d525a7035ad1c224de3ae5f2 08-Nov-2011 John McCall <rjmccall@apple.com> Bind function "r-values" as l-values when emitting them as
opaque values. Silly C type system.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7864435ef2bce200224120bd1df3aed98ea5b99a 07-Nov-2011 John McCall <rjmccall@apple.com> Rip out CK_GetObjCProperty.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
db45806b991013280a03057025c9538de64d5dfb 07-Nov-2011 John McCall <rjmccall@apple.com> Rip the ObjCPropertyRef l-value kind out of IR-generation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143908 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4b9c2d235fb9449e249d74f48ecfec601650de93 06-Nov-2011 John McCall <rjmccall@apple.com> Change the AST representation of operations on Objective-C
property references to use a new PseudoObjectExpr
expression which pairs a syntactic form of the expression
with a set of semantic expressions implementing it.
This should significantly reduce the complexity required
elsewhere in the compiler to deal with these kinds of
expressions (e.g. IR generation's special l-value kind,
the static analyzer's Message abstraction), at the lower
cost of specifically dealing with the odd AST structure
of these expressions. It should also greatly simplify
efforts to implement similar language features in the
future, most notably Managed C++'s properties and indexed
properties.

Most of the effort here is in dealing with the various
clients of the AST. I've gone ahead and simplified the
ObjC rewriter's use of properties; other clients, like
IR-gen and the static analyzer, have all the old
complexity *and* all the new complexity, at least
temporarily. Many thanks to Ted for writing and advising
on the necessary changes to the static analyzer.

I've xfailed a small diagnostics regression in the static
analyzer at Ted's request.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143867 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c637d738897b1745af3bad7fc551f26b98da838c 02-Nov-2011 Fariborz Jahanian <fjahanian@apple.com> back out changes in r143399 and r143475.
rvale-references are captured by reference
in blocks. // rdar://9971124.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143583 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d8c4551fa22a9c346e6a9e56333915197c97e394 01-Nov-2011 Fariborz Jahanian <fjahanian@apple.com> Adds IRGen support for captured rvalue references in blocks.
In this case, temporary value is copied into block descriptor
as their own copy to work on. // rdar://9971124


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c5096cbf7a42e0f9012945b00d9037a5b5a88d72 27-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Annotate imprecise FP division with fpaccuracy metadata

The OpenCL single precision division operation is only required to
be accurate to 2.5ulp. Annotate the fdiv instruction with metadata
which signals to the backend that an imprecise divide instruction
may be used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2be460723940f8184ec36529b6f6ddf59c04e411 14-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Misc fixes for atomics. Biggest fix is doing alignment correctly for _Atomic types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142002 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
73fb35003aad027492e661a3749e921b5d1ecaf9 13-Oct-2011 Eric Christopher <echristo@apple.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
28e06354b5d4dd539be6781e388ff27c0dffd807 12-Oct-2011 Eric Christopher <echristo@apple.com> Revert file/scope handling patches. gdb testing revealed a couple of bugs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141796 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4b2d5498729a74a8e952bdf762e6f2d8c6b52690 12-Oct-2011 Eric Christopher <echristo@apple.com> 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9e3c20b2b600af7b2b8c65fb12362ba2046caf10 11-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Silence some -Wuninitialized false positives with gcc.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141701 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
276b061970939293f1abaf694bd3ef05b2cbda79 11-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Initial implementation of __atomic_* (everything except __atomic_is_lock_free).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6c0aa5ff6e6253db0f993053599e2a52b5b93b2d 06-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> CUDA: IR generation support for kernel call expressions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141300 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ccae76c8214c5ff469e0291371127084d252ac7a 30-Sep-2011 Fariborz Jahanian <fjahanian@apple.com> objc gc: assigning to an objc object struct member through an ivar
pointer to this struct must go through the none ivar writer barrier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140867 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5321bc492b2f29deecb6cb0bc68b7887164ee8a6 29-Sep-2011 Eric Christopher <echristo@apple.com> Rename EmitStopPoint in CGDebugInfo to EmitLocation. "stop points" don't
exist anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
414ee4bb74957b4c5fe05e11848028e4701b51f7 29-Sep-2011 Eric Christopher <echristo@apple.com> Call UpdateLineDirectiveRegion every time we want to emit a stop
point in the code. Ensures that we don't miss any places and the
check is reasonably cheap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
578faa837b552403e2002b97fdfbfde14f2448e5 27-Sep-2011 Benjamin Kramer <benny.kra@googlemail.com> de-tmpify clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140637 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
eb2d1f1c88836bd5382e5d7aa8f6b85148a88b27 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Removing a bunch of dead returns/breaks after llvm_unreachables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b219cfc4d75f0a03630b7c4509ef791b7e97b2c8 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Switch assert(0/false) llvm_unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
01f151e0ffba72bcad770bea5f563a9b68ca050e 21-Sep-2011 John McCall <rjmccall@apple.com> ANSI C requires that a call to an unprototyped function type succeed
if the definition has a non-variadic prototype with compatible
parameters. Therefore, the default rule for such calls must be to
use a non-variadic convention. Achieve this by casting the callee to
the function type with which it is required to be compatible, unless
the target specifically opts out and insists that unprototyped calls
should use the variadic rules. The only case of that I'm aware of is
the x86-64 convention, which passes arguments the same way in both
cases but also sets a small amount of extra information; here we seek
to maintain compatibility with GCC, which does set this when calling
an unprototyped function.

Addresses PR10810 and PR10713.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140241 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e289d81369914678db386f6aa86faf8f178e245d 13-Sep-2011 Douglas Gregor <dgregor@apple.com> Switch LangOptions over to a .def file that describes header of the
language options. Use that .def file to declare the LangOptions class
and initialize all of its members, eliminating a source of annoying
initialization bugs.

AST serialization changes are next up.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
33e56f3273457bfa22c7c50bc46cf5a18216863d 10-Sep-2011 John McCall <rjmccall@apple.com> Rename the ARC cast kinds to start with "ARC".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dc05b11c67331016473fbc7909827b1b89c9616b 10-Sep-2011 John McCall <rjmccall@apple.com> When converting a block pointer to an Objective-C pointer type, extend
the lifetime of the block by copying it to the heap, or else we'll get
a dangling reference because the code working with the non-block-typed
object will not know it needs to copy.

There is some danger here, e.g. with assigning a block literal to an
unsafe variable, but, well, it's an unsafe variable.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139451 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
77f68bb90af93b95045fb994e7cd68137adcc132 10-Sep-2011 Julien Lerouge <jlerouge@apple.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
1d9b3b25f7ac0d0195bba6b507a684fe5e7943ee 09-Sep-2011 John McCall <rjmccall@apple.com> Give conversions of block pointers to ObjC pointers a different cast kind
than conversions of C pointers to ObjC pointers. In order to ensure that
we've caught every case, add asserts to CastExpr that strictly determine
which cast kind is used for which kind of bit cast.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6aff47db98890aa537edfb579b21d11d5ea3d1cd 08-Sep-2011 Eric Christopher <echristo@apple.com> Formatting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139296 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1ddc9c4674b7c737ec65241a531df8c64e40b0a9 06-Sep-2011 Douglas Gregor <dgregor@apple.com> When extracting the callee declaration from a call expression, be sure
to look through SubstNonTypeTemplateParmExprs. Then, update the IR
generation of CallExprs to actually use CallExpr::getCalleeDecl()
rather than attempting to mimick its behavior (badly).

Fixes <rdar://problem/10063539>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139185 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cec52f0623d57f090e3477941acebe4932fa7abd 26-Aug-2011 John McCall <rjmccall@apple.com> Slight optimization enabled by the previous assert:
emit all gl-value arguments as reference bindings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138655 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
fd71fb81c5f9382caf0131946e890b133e12ceb5 26-Aug-2011 John McCall <rjmccall@apple.com> What say we document some of these AggValueSlot flags a bit
better.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
90b2bdf3b96892ea44e5bf6869a92a08d09a6545 26-Aug-2011 John McCall <rjmccall@apple.com> An initialization does not alias.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
410ffb2bc5f072d58a73c14560345bcf77dec1cc 26-Aug-2011 John McCall <rjmccall@apple.com> Track whether an AggValueSlot is potentially aliased, and do not
emit call results into potentially aliased slots. This allows us
to properly mark indirect return slots as noalias, at the cost
of requiring an extra memcpy when assigning an aggregate call
result into a l-value. It also brings us into compliance with
the x86-64 ABI.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138599 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7c2349be2d11143a2e59a167fd43362a3bf4585e 25-Aug-2011 John McCall <rjmccall@apple.com> Use stronger typing for the flags on AggValueSlot and require
creators to tell us whether something needs GC barriers.
No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138581 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> 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
/external/clang/lib/CodeGen/CGExpr.cpp
0f6ac7cf7bc6a02c1a5c19d2c90ec0d1dd7786e7 22-Jul-2011 Jay Foad <jay.foad@gmail.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
cb8095f766f1fe3d664d90ec450093468933f23c 20-Jul-2011 Chris Lattner <sabre@nondot.org> as eli points out, we're not doing memory stuff here. While ConvertType
and ConvertTypeForMem are the same for pointers, it is best to just
use ConvertType. Thanks Eli!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2d 18-Jul-2011 Chris Lattner <sabre@nondot.org> 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
/external/clang/lib/CodeGen/CGExpr.cpp
91a5755ad73c5dc1dfb167e448fdd74e75a6df56 15-Jul-2011 John McCall <rjmccall@apple.com> Create a new expression node, SubstNonTypeTemplateParmExpr,
to represent a fully-substituted non-type template parameter.
This should improve source fidelity, as well as being generically
useful for diagnostics and such.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135243 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8dd55a3c3b28d195717c87bbc60e765951d408fe 14-Jul-2011 Benjamin Kramer <benny.kra@googlemail.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
0d516767a3af70538a40a297577960034e6ad66f 12-Jul-2011 Benjamin Kramer <benny.kra@googlemail.com> Add more compiler workarounds. Should fix the build with old GCCs and MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9928c4805aa8d5fabd488d0d0c5aeb64fd50f0e3 12-Jul-2011 John McCall <rjmccall@apple.com> Switch field destruction over to use the new destroyer-based API
and kill a lot of redundant code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134988 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a98742c32c159a8c76f842947c02a79c530a1d4b 12-Jul-2011 Chandler Carruth <chandlerc@gmail.com> Work around a problem with a static helper's formulation in release
builds introduced in r134972:

lib/CodeGen/CGExpr.cpp:1294:7: error: no matching function for call to 'EmitBitCastOfLValueToProperType'
lib/CodeGen/CGExpr.cpp:1278:1: note: candidate function not viable: no known conversion from 'CGBuilderTy' (aka 'IRBuilder<false>') to 'llvm::IRBuilder<> &' for 1st argument

This fixes the issue by passing CodeGenFunction on down, and using its
builder directly rather than passing just the builder down.

This may not be the best / cleanest fix, Chris please review. It at
least fixes builds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3a2b657088de9413714a51bff153a59565adb3ef 12-Jul-2011 Chris Lattner <sabre@nondot.org> Fix a problem Eli ran into where we now reject incomplete arrays of
uncompleted struct types. We now do what llvm-gcc does and compile
them into [i8 x 0]. If the type is later completed, we make sure that
it is appropriately cast.

We compile the terrible example to something like this now:

%struct.A = type { i32, i32, i32 }

@g = external global [0 x i8]

define void @_Z1fv() nounwind {
entry:
call void @_Z3fooP1A(%struct.A* bitcast ([0 x i8]* @g to %struct.A*))
ret void
}

declare void @_Z3fooP1A(%struct.A*)

define %struct.A* @_Z2f2v() nounwind {
entry:
ret %struct.A* getelementptr inbounds ([0 x %struct.A]* bitcast ([0 x i8]* @g to [0 x %struct.A]*), i32 0, i64 1)
}





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134972 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1b5ba858e4628049a7105257fa712b4ab93c0a62 10-Jul-2011 Chris Lattner <sabre@nondot.org> enhance EmitLValueForFieldInitialization to do the proper pointer adjustment, allowing
us to revert the other half of r134860. Now things are back to a relatively tidy state.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134865 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
aa01d26e6bf177aba365a7adce62cea6ceccfa5b 10-Jul-2011 Chris Lattner <sabre@nondot.org> revert part of r134860, which is empirically unnecessary after the proper fix


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134864 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
74339dfbfe3fa9c1839ce02e3427e4dc5478a3ae 10-Jul-2011 Chris Lattner <sabre@nondot.org> change EmitLValueForField to cast the returned lvalue to the right
type, even when in the struct case. This was one root issue that was
causing type mismatches throughout the compiler.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
12569fb55db2a8181711ac134b7479155db4f838 10-Jul-2011 Chris Lattner <sabre@nondot.org> when emitting pointer load from an lvalue or storing to an lvalue,
do an explicit bitcast to whatever ConvertType produces. This will
go with the next patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9cbe4f0ba01ec304e1e3d071c071f7bca33631c0 09-Jul-2011 Chris Lattner <sabre@nondot.org> 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
/external/clang/lib/CodeGen/CGExpr.cpp
7e5e5f4cc36fe50f46ad76dca7a266434c94f475 07-Jul-2011 John McCall <rjmccall@apple.com> In ARC, reclaim all return values of retainable type, not just those
where we have an immediate need of a retained value.

As an exception, don't do this when the call is made as the immediate
operand of a __bridge retain. This is more in the way of a workaround
than an actual guarantee, so it's acceptable to be brittle here.

rdar://problem/9504800



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e4330726b8070bb7094414507a1040972ee52474 07-Jul-2011 Nick Lewycky <nicholas@mxc.ca> Sort #includes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e6d134b244cd666c47a3d2dd78f82ff0824188bd 27-Jun-2011 John McCall <rjmccall@apple.com> Fix PR10204 in a better way.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9d11e6f4754848cd74b9a08d40d4a9e0fe68e29d 27-Jun-2011 Nico Weber <nicolasweber@gmx.de> Revert parts of r133860 to fix a crash. Add a test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
545d996ec5a3113f046944f11b27cc2d6cb055b4 25-Jun-2011 John McCall <rjmccall@apple.com> LValue carries a type now, so simplify the main EmitLoad/Store APIs
by removing the redundant type parameter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
913dab2525cc705e5238023a446f5371fa411883 25-Jun-2011 John McCall <rjmccall@apple.com> Mark the multiply which occurs as part of performing pointer
arithmetic on a VLA as 'nsw', per discussion with djg, and
implement pointer arithmetic (other than array accesses) and
pointer subtraction for VLA types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bc8d40d85f3fa1e34569834916f18fecaa635152 24-Jun-2011 John McCall <rjmccall@apple.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
d7b23167763f43d3e76b0de26141b1e52613ee3c 22-Jun-2011 Douglas Gregor <dgregor@apple.com> When binding a reference to an Automatic Reference Counting temporary,
retain/release the temporary object appropriately. Previously, we
would only perform the retain/release operations when the reference
would extend the lifetime of the temporary, but this does the wrong
thing across calls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133620 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0b5810882bd34183c2b764676cafa4c2ce324740 21-Jun-2011 Douglas Gregor <dgregor@apple.com> A few tweaks to MaterializeTemporaryExpr suggested by John.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133528 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
03e80030515c800d1ab44125b9052dfffd1bd04c 21-Jun-2011 Douglas Gregor <dgregor@apple.com> Introduce a new AST node describing reference binding to temporaries.

MaterializeTemporaryExpr captures a reference binding to a temporary
value, making explicit that the temporary value (a prvalue) needs to
be materialized into memory so that its address can be used. The
intended AST invariant here is that a reference will always bind to a
glvalue, and MaterializeTemporaryExpr will be used to convert prvalues
into glvalues for that binding to happen. For example, given

const int& r = 1.0;

The initializer of "r" will be a MaterializeTemporaryExpr whose
subexpression is an implicit conversion from the double literal "1.0"
to an integer value.

IR generation benefits most from this new node, since it was
previously guessing (badly) when to materialize temporaries for the
purposes of reference binding. There are likely more refactoring and
cleanups we could perform there, but the introduction of
MaterializeTemporaryExpr fixes PR9565, a case where IR generation
would effectively bind a const reference directly to a bitfield in a
struct. Addresses <rdar://problem/9552231>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
19bd77c64937d6818c61f2aa9e6a9d51c65d0356 18-Jun-2011 Benjamin Kramer <benny.kra@googlemail.com> Remove dead variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d510fd2dde3cd0fdda9b87772adbfb0d7d26a551 18-Jun-2011 Benjamin Kramer <benny.kra@googlemail.com> 80 cols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133345 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a07398ed98ea2b55ad7a505a3aab18aed93b149f 16-Jun-2011 John McCall <rjmccall@apple.com> Restore correct use of GC barriers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f85e193739c953358c865005855253af4f68a497 16-Jun-2011 John McCall <rjmccall@apple.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
431e4b35fb222fad17702775df4cd50648697229 15-Jun-2011 Eli Friedman <eli.friedman@gmail.com> Use isAnyComplexType here so we don't pass complex numbers into the aggregate handling code; found by inspection.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b644425e4c337f5fcffc00b2d4914d3e4012c45a 23-May-2011 Chris Lattner <sabre@nondot.org> fix 80 col violation


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
575a1c9dc8dc5b4977194993e289f9eda7295c39 20-May-2011 Douglas Gregor <dgregor@apple.com> Introduce Type::isSignedIntegerOrEnumerationType() and
Type::isUnsignedIntegerOrEnumerationType(), which are like
Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also
consider the underlying type of a C++0x scoped enumeration type.

Audited all callers to the existing functions, switching those that
need to also handle scoped enumeration types (e.g., those that deal
with constant values) over to the new functions. Fixes PR9923 /
<rdar://problem/9447851>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ba0f1012c4d7dfff2de8f1b728c47bc080e81712 02-May-2011 Nick Lewycky <nicholas@mxc.ca> Remove dead variable, flagged by gcc's -Wunused-but-set-variable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130674 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b9e6b2c215d0a7930ad160b054bc86353da4a517 24-Apr-2011 Ken Dyck <kd@kendyck.com> Convert AccessInfo::AccessAlignment to CharUnits. No change in functionality
intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130087 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
28ebde58dd94b5ed2a6d149251202ab2c602a4a6 24-Apr-2011 Ken Dyck <kd@kendyck.com> Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change in
functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f111d935722ed488144600cea5ed03a6b5069e8f 15-Apr-2011 Peter Collingbourne <peter@pcc.me.uk> 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
/external/clang/lib/CodeGen/CGExpr.cpp
755d8497e39071aa24acc173ff07083e3256b8f8 12-Apr-2011 John McCall <rjmccall@apple.com> After some discussion with Doug, we decided that it made a lot more sense
for __unknown_anytype resolution to destructively modify the AST. So that's
what it does now, which significantly simplifies some of the implementation.
Normal member calls work pretty cleanly now, and I added support for
propagating unknown-ness through &.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
379b5155b4566f63679e1da6b0ceb5fdfa2aec6d 11-Apr-2011 John McCall <rjmccall@apple.com> More __unknown_anytype work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129269 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
575b374fdbfc2c2224fd3047ac11ffc4b8db9ae5 11-Apr-2011 Anders Carlsson <andersca@mac.com> Remove CK_DynamicToNull.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7d99bc37e77157523e3bfbc6c077842b74e6690f 10-Apr-2011 Anders Carlsson <andersca@mac.com> As a first step towards fixing PR9641, add a CK_DynamicToNull cast kind which
represents a dynamic cast where we know that the result is always null.

For example:

struct A {
virtual ~A();
};
struct B final : A { };
struct C { };

bool f(B* b) {
return dynamic_cast<C*>(b);
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1de4d4e8cb2e9c88809fea8092bc6e835a5473d2 07-Apr-2011 John McCall <rjmccall@apple.com> Basic, untested implementation for an "unknown any" type requested by LLDB.
The idea is that you can create a VarDecl with an unknown type, or a
FunctionDecl with an unknown return type, and it will still be valid to
access that object as long as you explicitly cast it at every use. I'm
still going back and forth about how I want to test this effectively, but
I wanted to go ahead and provide a skeletal implementation for the LLDB
folks' benefit and because it also improves some diagnostic goodness for
placeholder expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129065 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d553408ff15b38710a1ba0947efbf4c5637018ab 01-Apr-2011 Daniel Dunbar <daniel@zuster.org> IRgen: Reapply r128691 with a fix to ensure we don't increase alignment past
that of the array element type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
457c838b7252dd3deeec8a924dcb0e47b8c6df23 01-Apr-2011 Daniel Dunbar <daniel@zuster.org> Revert r128691, "IRgen: Improve GCC compatibility when dealing with packed
arrays by propagating", it's breaking test in ways I don't understand yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b23a5a0a043b852ad643d366a0bb5b4c5a5c8881 01-Apr-2011 Daniel Dunbar <daniel@zuster.org> IRgen: Improve GCC compatibility when dealing with packed arrays by propagating
the array alignment to the array access.
- This is more or less the best we can do without having alignment present in
the type system, but is a long way from truly matching how GCC handles this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128691 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
68af13f3ca39947e3f285f864fe3b76640fddf69 30-Mar-2011 Fariborz Jahanian <fjahanian@apple.com> Fix IRGen issues related to using property-dot syntax
for prperty reference types. // rdar://9208606.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128551 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bbf3bacb3e0c1ebb3e8a4a8b1330404a7e379315 30-Mar-2011 Jay Foad <jay.foad@gmail.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
207f4d8543529221932af82836016a2ef066c917 18-Mar-2011 Peter Collingbourne <peter@pcc.me.uk> Add support for language-specific address spaces. On top of that,
add support for the OpenCL __private, __local, __constant and
__global address spaces, as well as the __read_only, _read_write and
__write_only image access specifiers. Patch originally by ARM;
language-specific address space support by myself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127915 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
545aa7a0f57d2bb2fc0eef83daa499300273d983 16-Mar-2011 Eli Friedman <eli.friedman@gmail.com> PR9494: Get rid of bitcast which was both unnecessary and written incorrectly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
aa11289f754d220c9c155b68a4f84cdcfcefef6a 07-Mar-2011 Devang Patel <dpatel@apple.com> 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
/external/clang/lib/CodeGen/CGExpr.cpp
5de7a0e8800b89780e565c1013e566414f11546a 07-Mar-2011 Devang Patel <dpatel@apple.com> Do not emit stop point for CXXDefaultArgExpr. It results in suboptimial user experience.

21 int main() {
22 A a;

For example, here user would expect to stop at line 22, even if A's constructor leads to a call through CXXDefaultArgExpr.

This fixes ostream-defined.exp regression from gdb testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
79bfb4b564dc3636aae15aafa6340f9430881121 04-Mar-2011 Devang Patel <dpatel@apple.com> Emit a stop point before a call expression so that debugger has some chance of getting some footing when user wants to stop at 2nd bar() in following expression when all function calls are inlined.
= bar() + ... + bar() + ...

clang keeps track of column numbers, so we could put location entries for all subexpressions but that will significantly bloat debug info in general, but a location for call expression is helpful here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9c6082fe89c61af697f017aa80937581cc2128d8 02-Mar-2011 Tilmann Scheller <tilmann.scheller@googlemail.com> Revert "Add CC_Win64ThisCall and set it in the necessary places."

This reverts commit 126863.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
88d117c2eedd7c5bec57ac983a98d5e12bdd2cc6 02-Mar-2011 Tilmann Scheller <tilmann.scheller@googlemail.com> Add CC_Win64ThisCall and set it in the necessary places.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126863 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2cb4222338669a3e70b546ef264fbd5d3f96aef5 01-Mar-2011 Chris Lattner <sabre@nondot.org> -fwrapv should turn off the inbounds markers from geps used for pointer
arithmetic. This is part of PR9256, it would be great if someone else
wired up -fno-strict-overflow in the driver to -fwrapv.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126718 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c2c90011a688c04a4e980282f08c267e081c4b00 28-Feb-2011 Chris Lattner <sabre@nondot.org> Change the interface to ConstantFoldsToSimpleInteger to not encode
a bool + success into one tri-state integer, simplifying things.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126592 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bc7fbf0d37b286b37d96b033dfaaabf9c729bca8 26-Feb-2011 John McCall <rjmccall@apple.com> Pretty up the emission of field l-values and use volatile and TBAA when
loading references as part of that. Use 'char' TBAA when accessing
(immediate!) fields of a may_alias struct; fixes PR9307.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7cc25fe47290dc302157e15b04a1f95395f43ab5 21-Feb-2011 John McCall <rjmccall@apple.com> Bind references to opaque r-values correctly. Add a few test cases
for ?: on record types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cf0b2d83666804b377dbe05370a5c9b9bafaaa5a 17-Feb-2011 John McCall <rjmccall@apple.com> Remove the "conditional save" hashtables from IR generation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125761 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
56ca35d396d8692c384c785f9aeebcf22563fe1e 17-Feb-2011 John McCall <rjmccall@apple.com> Change the representation of GNU ?: expressions to use a different expression
class and to bind the shared value using OpaqueValueExpr. This fixes an
unnoticed problem with deserialization of these expressions where the
deserialized form would lose the vital pointer-equality trait; or rather,
it fixes it because this patch also does the right thing for deserializing
OVEs.

Change OVEs to not be a "temporary object" in the sense that copy elision is
permitted.

This new representation is not totally unawkward to work with, but I think
that's really part and parcel with the semantics we're modelling here. In
particular, it's much easier to fix things like the copy elision bug and to
make the CFG look right.

I've tried to update the analyzer to deal with this in at least some
obvious cases, and I think we get a much better CFG out, but the printing
of OpaqueValueExprs probably needs some work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125744 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e996ffd240f20a1048179d7727a6ee3227261921 16-Feb-2011 John McCall <rjmccall@apple.com> Save a copy expression for non-trivial copy constructions of catch variables.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125661 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5936e33bf74dd6bf126ceee0f6169a2593d03a69 15-Feb-2011 John McCall <rjmccall@apple.com> Assorted cleanup:
- Have CGM precompute a number of commonly-used types
- Have CGF copy that during initialization instead of recomputing them
- Use TBAA info when initializing a parameter variable
- Refactor the scalar ++/-- code



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125562 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
fb018d153cbf12fd2a4a278cbf7614b9a2e2835e 15-Feb-2011 Chris Lattner <sabre@nondot.org> update for ConstantVector API change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e69b09955acbde87470eea8bc99b580195569dc0 14-Feb-2011 Chris Lattner <sabre@nondot.org> revert my ConstantVector patch, it seems to have made the llvm-gcc
builders unhappy.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125505 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1970d5fe94889a1c5ded3d821564363eb5c21020 14-Feb-2011 Chris Lattner <sabre@nondot.org> update for ConstantVector::get API change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f0be979bddb8baa28e77693a3dc931e487b2a9f2 11-Feb-2011 Rafael Espindola <rafael.espindola@gmail.com> For consistency, use llvm::raw_ostream in the rest of the mangle api.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d16c2cf1cafa413709aa487cbbd5dc392f1ba1ff 08-Feb-2011 John McCall <rjmccall@apple.com> Reorganize CodeGen{Function,Module} to eliminate the unfortunate
Block{Function,Module} base class. Minor other refactorings.

Fixed a few address-space bugs while I was there.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6b5a61b6dc400027fd793dcadceeb9da944a37ea 07-Feb-2011 John McCall <rjmccall@apple.com> A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
- BDREs no longer store copy expressions
- BlockDecls now store a list of captured variables, information about
how they're captured, and a copy expression if necessary

With that in hand, change IR generation to use the captures data in
blocks instead of walking the block independently.

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125005 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5808ce43f8d7e71f5acacc9ca320268c4f37565a 03-Feb-2011 John McCall <rjmccall@apple.com> More capturing of 'this': implicit member expressions. Getting that
right for anonymous struct/union members led to me discovering some
seemingly broken code in that area of Sema, which I fixed, partly by
changing the representation of member pointer constants so that
IndirectFieldDecls aren't expanded. This led to assorted cleanups with
member pointers in CodeGen, and while I was doing that I saw some random
other things to clean up.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b3d5e2f181269656c1b2dbc09eab1f449d5074aa 28-Jan-2011 Douglas Gregor <dgregor@apple.com> When producing IR for a lvalue-to-rvalue cast *as an lvalue*, only
non-class prvalues actually require the realization of a
temporary. For everything else, we already have an lvalue (or class
prvalue) in the subexpression.

Note: we're missing some move elision in this case. I'll tackle that next.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
52a80e19ad688091723a52ad53337767bb0ac684 27-Jan-2011 Fariborz Jahanian <fjahanian@apple.com> Fixes an IRgen bug where __block variable is
referenced in the block-literal initializer
of that variable. // rdar://8893785


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f99a3915389109a716caafacb41fd9c4a3b8f432 26-Jan-2011 John McCall <rjmccall@apple.com> Un-nest the meat of this function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
150b462afc7a713edd19bcbbbb22381fe060d4f5 26-Jan-2011 John McCall <rjmccall@apple.com> Better framework for conditional cleanups; untested as yet.
I'm separately committing this because it incidentally changes some
block orderings and minor IR issues, like using a phi instead of
an unnecessary alloca.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124277 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
da29e091650dc011df5209578d7c049549e5e34b 22-Jan-2011 Douglas Gregor <dgregor@apple.com> Send code generation for xvalues down the same path as lvalues

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
fe71008c2764768f25478b16c1802755189ed7c9 19-Jan-2011 Ken Dyck <kd@kendyck.com> Replace calls to getTypeSize() and getTypeAlign() with their 'InChars'
counterparts where char units are needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dec0984fce504a39a7f085774fb67cfd9957be58 18-Jan-2011 Jeffrey Yasskin <jyasskin@google.com> Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
-Wint-to-pointer-cast.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123719 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4765fa05b5652fcc4356371c2f481d0ea9a1b007 06-Dec-2010 John McCall <rjmccall@apple.com> Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cd940a1e13e588a43973cd7ae33b5c33a3062739 06-Dec-2010 John McCall <rjmccall@apple.com> __block variables require us to evaluate the RHS of an assignment before
the LHS, or else the pointer might be invalid. This is kindof dumb, but
go ahead and make sure we're doing that for l-value scalar assignment,
which fixes a miscompile of obj-c++.dg/block-seq.mm.

Leave a FIXME for how to solve this problem for agg __blocks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2a41637a995affa1563f4d82a8b026e326a2faa0 05-Dec-2010 John McCall <rjmccall@apple.com> Fix a bug in the emission of __real/__imag l-values on scalar operands.
Fix a bug in the emission of complex compound assignment l-values.
Introduce a method to emit an expression whose value isn't relevant.
Make that method evaluate its operand as an l-value if it is one.
Fixes our volatile compliance in C++.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
00eb3f9c5b33e3d99aee1f8b75dd9c9678fdd66b 04-Dec-2010 Francois Pichet <pichet2000@gmail.com> More anonymous struct/union redesign. This one deals with anonymous field used in a constructor initializer list:

struct X {
X() : au_i1(123) {}
union {
int au_i1;
float au_f1;
};
};

clang will now deal with au_i1 explicitly as an IndirectFieldDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120900 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0e800c9c20d1a658a91096c756c4a4a9e90264fc 04-Dec-2010 John McCall <rjmccall@apple.com> Remove some defensive calls to EmitLoadOfPropertyRefLValue that shouldn't
be required, and then fix up some missing loads on overloaded-operator
paths which that exposed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f6a1648197562e0b133440d612d9af297d0a86cc 04-Dec-2010 John McCall <rjmccall@apple.com> Although we currently have explicit lvalue-to-rvalue conversions, they're
not actually frequently used, because ImpCastExprToType only creates a node
if the types differ. So explicitly create an ICE in the lvalue-to-rvalue
conversion code in DefaultFunctionArrayLvalueConversion() as well as several
other new places, and consistently deal with the consequences throughout the
compiler.

In addition, introduce a new cast kind for loading an ObjCProperty l-value,
and make sure we emit those nodes whenever an ObjCProperty l-value appears
that's not on the LHS of an assignment operator.

This breaks a couple of rewriter tests, which I've x-failed until future
development occurs on the rewriter.

Ted Kremenek kindly contributed the analyzer workarounds in this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e68b9842d2d6adc2c72c81c845a2c68e58d9d3a4 04-Dec-2010 John McCall <rjmccall@apple.com> Test case for the l-value base only being evaluated once.

Also, move the l-value emission code into CGObjC.cpp and teach it, for
completeness, to store away self for a super send.

Also, inline the super cases for property gets and sets and make them
use the correct result type for implicit getter/setter calls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
119a1c6c4029d30cae7b31a2826aa0ff70d01668 04-Dec-2010 John McCall <rjmccall@apple.com> Kill the KVC l-value kind and calculate the base expression when emitting
the l-value.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
12f78a6741a4cb3d904340f8d3d2714568b50e7a 02-Dec-2010 John McCall <rjmccall@apple.com> Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120643 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0ae287a498b8cec2086fe6b7e753cbb3df63e74a 01-Dec-2010 John McCall <rjmccall@apple.com> Restore the lvalue-to-rvalue conversion patch with a minimal fix.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120555 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
20fbe7c4772d537c1f779b1ff89cbb57d1d9afff 30-Nov-2010 John McCall <rjmccall@apple.com> L-value to r-value conversion is not ready for prime-time.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7e4857931bfe27bb355275bc7ec1eaa44612dfff 30-Nov-2010 John McCall <rjmccall@apple.com> Introduce an r-value to l-value cast kind. I'm not promising anything
about the reliability of this yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120422 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
54353f48939327a4aa41ea3f3ec07b936bd02ef5 25-Nov-2010 Benjamin Kramer <benny.kra@googlemail.com> Hide a bunch of symbols.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7eb0a9eb0cde8444b97f9c5b713d9be7a6f1e607 24-Nov-2010 John McCall <rjmccall@apple.com> Switch a lot of call-sites over to using the new value-kind calculations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
75f91d6c5d654cb8570e299e19b18fe8aff4bba6 19-Nov-2010 Fariborz Jahanian <fjahanian@apple.com> Minor cleanup. No change otherwise.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119814 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a762514563bcbf52a016f7e6b6730cac035ac92c 18-Nov-2010 Fariborz Jahanian <fjahanian@apple.com> Fix a bug where write-barriers for assignment through reference
types was not being generated for objc pointers.
// rdar://8681766.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
83ce9d4a552987d34cbd500e983db8d770232379 17-Nov-2010 John McCall <rjmccall@apple.com> Support compound complex operations as l-values in C++. Add a test
case based on CodeGen/volatile-1.c which tests the current C++
semantics, and note the many, many places we fall short of them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b418d74c11498b7e1044103131e2e3be4d63512e 16-Nov-2010 John McCall <rjmccall@apple.com> Simplify some complex emission and implement correct semantics for
assignment to volatiles in C. This in effect reverts some of mjs's
work in and around r72572. Basically, the C++ standard is quite
clear, except that it lies about volatile behavior approximating
C's, whereas the C standard is almost actively misleading.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e2b768877b77fa4e00171ee6e6443722e0f3d111 16-Nov-2010 John McCall <rjmccall@apple.com> Kill CK_Unknown and flesh out the documentation for the existing CastKinds.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
daa8e4e888758d55a7a759dd4a91b83921cef222 15-Nov-2010 John McCall <rjmccall@apple.com> Assorted work leading towards the elimination of CK_Unknown.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f3ea8cfe6b1c2ef0702efe130561e9e66708d799 14-Nov-2010 John McCall <rjmccall@apple.com> Add a few more complex-related cast kinds that arise due to arbitrary
implicit conversions; the last batch was specific to promotions.
I think this is the full set we need. I do think dividing the cast
kinds into floating and integral is probably a good idea.

Annotate a *lot* more C casts with useful cast kinds.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2bb5d00fcf71a7b4d478d478be778fff0494aff6 13-Nov-2010 John McCall <rjmccall@apple.com> Introduce five new cast kinds for various conversions into and
between complex types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
404cd1669c3ba138a9ae0a619bd689cce5aae271 13-Nov-2010 John McCall <rjmccall@apple.com> Introduce a null-to-pointer implicit cast kind.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
981b6fde6992567d8be03ba77dabe1efc3ff33d1 09-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix miscompilation regarding VLAs; subscription of VLA pointers was incorrect.
Fixes rdar://8644873 & http://llvm.org/PR8567.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
26815d97c5743481e317f17a8d53a6819d061862 27-Oct-2010 John McCall <rjmccall@apple.com> Restore r117403 (fixing IR gen for bool atomics), this time being less
aggressive about the form we expect bools to be in. I don't really have
time to fix all the sources right now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117486 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
11893327d056a7ebd820da8f00a3286e7430a91c 27-Oct-2010 Rafael Espindola <rafael.espindola@gmail.com> Revert r117403 as it caused PR8480.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117456 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
789a1597250e57d7f35f253467165913c68979ad 27-Oct-2010 John McCall <rjmccall@apple.com> Extract procedures to do scalar-to-memory and memory-to-scalar conversions
in IR gen, and use those to fix a correctness issue with bool atomic
intrinsics. rdar://problem/8461234



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b31c289678a3fe0f062656015dbcd57272f60742 25-Oct-2010 Dan Gohman <gohman@apple.com> Trim an unnecessary #include.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117321 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b6bbcc9995186799a60ce17d0c1acff31601653a 15-Oct-2010 John McCall <rjmccall@apple.com> Death to blocks, or at least the word "block" in one particular obnoxiously
ambiguous context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3d5aff5d3036b0ff09d114857cd2276134b3d8c9 15-Oct-2010 Dan Gohman <gohman@apple.com> Experimental TBAA support.

This enables metadata generation by default, however the TBAA pass
in the optimizer is still disabled for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8ac2d449820fd0df00fcbde5bf82165c1f49854d 14-Oct-2010 Fariborz Jahanian <fjahanian@apple.com> Eliminate usage of ObjCSuperExpr used for
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116483 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1274ccd90aec0b205fc838c3d504821ccfb55482 09-Oct-2010 Douglas Gregor <dgregor@apple.com> Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked a
bit by me).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116122 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0b78710636671eeb2c5c4dedffa4ad1d58fa4bb8 21-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> IRgen for gnu extension's conditional lvalue expression
with missing LHS. radar 8453812. Executable test is checked
into llvm test suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dc5ea09c4d0a23b1cd28f763869ef2bcb5dc119a 18-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Fixes IRgen bug in objc++ reference binding of a
getter expression.
Fixes // rdar://8437240


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
fc1e6c79bbfe0e9a58bb792996d51f42e36e3d6a 18-Sep-2010 John McCall <rjmccall@apple.com> Fix a bug with binding l-values to elided temporaries, and leave a couple
helpful asserts behind.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
558d2abc7f9fd6801cc7677200992313ae90b5d8 15-Sep-2010 John McCall <rjmccall@apple.com> one piece of code is responsible for the lifetime of every aggregate
slot. The easiest way to do that was to bundle up the information
we care about for aggregate slots into a new structure which demands
that its creators at least consider the question.

I could probably be convinced that the ObjC 'needs GC' bit should
be rolled into this structure.
Implement generalized copy elision. The main obstacle here is that
IR-generation must be much more careful about making sure that exactly



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
09349145d7e9b2142a9cef94e30eb8b70ce99bdc 08-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Local static block variable referecned in its
block-literal initializer expression causes IRgen to crash.
This patch fixes by saving it in StaticLocalDecl map
already used for such purposes. (radar 8390455).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d0db03a561671b8b466b07026cc8fbbb037bb639 06-Sep-2010 Chris Lattner <sabre@nondot.org> clean up some formatting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
469a20de757ff872c90ff6b1134f6346909ff652 04-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Truncate block variable of bool type to i1 when its
value is used. This matches with non-block variable
use of bool type. (Fixes radar 8390062).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7925561e702430c0d632c5e5db1a74673b44ea18 03-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Cope with llvm's reference to bool type of 'i1' vs. clang's
type of 'i8' for the same for __block variables of
type bool. refixes radar 8382559.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113015 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
98c9d1fa3776204a94c013f1dc25f62d75c00573 01-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Fix IRGen when property-dot syntax used to access
a c++ class object 'ivar'. Fixes radar 8366604.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112729 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6c2ab1d578c6cc1f3ddcc948532cd625f1092ef2 31-Aug-2010 John McCall <rjmccall@apple.com> Amusingly, I missed this point of abstraction in all my earlier
member-pointer refactoring: dereferencing a member data pointer.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4c40d98ab7acf5f27fa89b17bd8fc0ef7683df37 31-Aug-2010 John McCall <rjmccall@apple.com> Teach IR generation to return 'this' from constructors and destructors
under the ARM ABI.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112588 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2de56d1d0c3a504ad1529de2677628bdfbb95cd4 25-Aug-2010 John McCall <rjmccall@apple.com> GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b6c504b9101251bcb364dd9becbb887c97db27d3 23-Aug-2010 Chris Lattner <sabre@nondot.org> fix rdar://8340348, a miscompile of boost that was exposed by r109848.
That revision started classifying truly empty structs like "Y" and "X"
as being NoClass/NoClass and turning them into 'ignore'. The call code
turns around and allocates space for the ignored argument with
GetUndefRValue. The bug is that GetUndefRValue would return the address
as undef, instead of returning an object with a defined address but
undefined contents.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0bab0cdab751248ca389a5592bcb70eac5d39260 23-Aug-2010 John McCall <rjmccall@apple.com> Abstract out everything having to do with member pointers into the ABI
class; they should just be completely opaque throughout IR gen now,
although I haven't really audited that.

Fix a bug apparently inherited from gcc-4.2 where we failed to null-check
member data pointers when performing derived-to-base or base-to-derived
conversions on them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d608cdb7c044365cf4e8764ade1e11e99c176078 22-Aug-2010 John McCall <rjmccall@apple.com> Experiment with using first-class aggregates to represent member function
pointers. I find the resulting code to be substantially cleaner, and it
makes it very easy to use the same APIs for data member pointers (which I have
conscientiously avoided here), and it avoids a plethora of potential
inefficiencies due to excessive memory copying, but we'll have to see if it
actually works.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e9fd7eb6c67676dc27e84eac429aec4f3be51f26 22-Aug-2010 John McCall <rjmccall@apple.com> Extract member function pointer comparison and null comparison into
the ABI code. Implement correct semantics for these on ARM.

I believe this completes the implementation of member function pointers
on ARM.

I think I'm going to switch member function pointers over to be
non-aggregates while I have all this in mind.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
983e3d7dac99aed376939f1a4daadef98e09c3b9 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Set the alignment correctly when creating LValue for a decls.
- Fixes PR5598.
- Review appreciated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111726 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3491b3d38b9569ab19f417ed2c3c8a86885345a2 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Move remaining LValue::Set... methods to LValue::set... (non-static) methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6d5eb76059c6251ffbb8f0cbac8d7fe9a3efabce 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Move remaining MakeAddr() calls to MakeAddrLValue().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
333d42d5d7eeafd84e620a263be7a4689e673c30 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen: The CVR qualifiers in a subobject adjustment should just come from the
field (I think).
- Doug, please check.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ea619177353e0a9f35b7d926a92df0e103515dbe 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen/LValue: Add LValue::setNonGC instead of SetObjCNonGC, for consistency with isNonGC().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111718 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
79c3928d816f317dd27109fb92e7d190c1c68329 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Switch more MakeAddr() users to MakeAddrLValue; this time for calls which were previously not computing the qualifier list. In most cases, I don't think it matters, but I believe this is conservatively more correct / consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9f553f5b3bd45304dfda6bdc5cd2baac64b3315b 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Switch a bunch of trivial MakeAddr calls to use MakeAddrLValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3ec0bafda37da00aac370e24f9fff9efb90861d2 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Eliminate EmitPredefinedFunctionName(), it doesn't need to be factored out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111715 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9f4f7cfe40edd5ed9d8ea7b8ce7c3dd988c7e310 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen/CGValue: Add alignment to LValue, and use that alignment when generating lvalue load/stores.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111710 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
91a16fa3265686b90054715eea504d9b4a13438b 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Change Emit{Load,Store}OfScalar to take a required Alignment argument and
update callers as best I can.
- This is a work in progress, our alignment handling is very horrible / sketchy -- I am just aiming for monotonic improvement.
- Serious review appreciated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111707 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5990b5455b5e309a029a6a44889ded4e9d549f24 18-Aug-2010 Chris Lattner <sabre@nondot.org> fix typo


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d7241c77d388f798c5db29848396109ea1aa83d2 18-Aug-2010 Chris Lattner <sabre@nondot.org> Fix PR7889 by generalizing some over specialized code. There is no
reason that this should be limited to simple lvalues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5c12c7bde7e39758fb127ac7089ac88097408e8e 18-Aug-2010 Chris Lattner <sabre@nondot.org> fix PR7892, a crash on valid in c++ codegen of __PRETTY_FUNCTION__


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
569c3166874324c24011f8ade6978421f0d39b3c 07-Aug-2010 Douglas Gregor <dgregor@apple.com> Allow reference binding of a reference of Objective-C object type to
an lvalue of another, compatible Objective-C object type (e.g., a
subclass). Introduce a new initialization sequence step kind to
describe this binding, along with a new cast kind. Fixes PR7741.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f871d0cc377a1367b519a6cce26be74607566eba 07-Aug-2010 John McCall <rjmccall@apple.com> Store inheritance paths after CastExprs instead of inside them.
This takes some trickery since CastExpr has subclasses (and indeed,
is abstract).

Also, smoosh the CastKind into the bitfield from Expr.

Drops two words of storage from Expr in the common case of expressions
which don't need inheritance paths. Avoids a separate allocation and
another word of overhead in cases needing inheritance paths. Also has
the advantage of not leaking memory, since destructors for AST nodes are
never run.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110507 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
81407d404a3fc8d24d0e2a052d85cae183033e2b 21-Jul-2010 John McCall <rjmccall@apple.com> Switch the destructor for a temporary arising from a reference binding over to
using a lazy cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
021a7a63984f0f912dc9e9dae2a1b3e1509a40ce 20-Jul-2010 Fariborz Jahanian <fjahanian@apple.com> Adopt objc_assign_threadlocal() for __thread variables of GC types.
Implements radar 8203301.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108917 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6c552c1d5f47fbba00e6268d96a26ad026f2da2a 20-Jul-2010 Chris Lattner <sabre@nondot.org> implement rdar://5739832 - operator new should check for overflow in multiply,
causing clang to compile this code into something that correctly throws a
length error, fixing a potential integer overflow security attack:

void *test(long N) {
return new int[N];
}

int main() {
test(1L << 62);
}

We do this even when exceptions are disabled, because it is better for the
code to abort than for the attack to succeed.

This is heavily based on a patch that Fariborz wrote.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108915 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7c7a79303b62f51c1ff02f9ce41d81211a69d3b4 15-Jul-2010 Douglas Gregor <dgregor@apple.com> Reinstate the scalar-cast-to-const-reference improvements, this time
with the proper spelling of "non-class prvalue". Silly me, I think
class rvalues were xvalues rather than prvalues!

Hah hah hah.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108443 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
928d69f2927c32e2f57a882a96c2bef1de79aa4b 15-Jul-2010 Douglas Gregor <dgregor@apple.com> Revert r108431 and r108433 (the cast-to-const-reference fixes), which
broke nightlytest.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
06de03756380413c1137dd2ccee5348d206f71b2 15-Jul-2010 Douglas Gregor <dgregor@apple.com> Spell isPRValue() properly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5467209f23097d5b0fc628c18aaa85e73d386598 15-Jul-2010 Douglas Gregor <dgregor@apple.com> Teach CodeGenFunction::EmitCastLValue() to handle casts to an lvalue
that involve binding a reference to a pure rvalue temporary (e.g., not
a class temporary), by creating a new temporary and copying the result
there. Fixes PR6024.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
24978863d13e12278799df62edaa2ddf33ff2fba 15-Jul-2010 Douglas Gregor <dgregor@apple.com> CK_BitCast is not an lvalue bitcast any longer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e39a3894513349908cdb3beba2614e53cb288e6c 14-Jul-2010 Douglas Gregor <dgregor@apple.com> Introduce a new cast kind for an "lvalue bitcast", which handles
reinterpret_casts (possibly indirectly via C-style/functional casts)
on values, e.g.,

int i;
reinterpret_cast<short&>(i);

The IR generated for this is essentially the same as for

*reinterpret_cast<short*>(&i).

Fixes PR6437, PR7593, and PR7344.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ed8abf18329df67b0abcbb3a10458bd8c1d2a595 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107857 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
84745677f64863e025a6733cb29d0b94bc3a6ae2 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Revert r107828 and r107827, the fix for PR7556, which seems to be
breaking bootstrap on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107837 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
016a4a90c8e75d59de731fa3aa98f0a55656e66c 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
newly-narrowed scope. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f1549f66a8216a78112286e3978cea2c29d6334c 06-Jul-2010 John McCall <rjmccall@apple.com> Validated by nightly-test runs on x86 and x86-64 darwin, including after
self-host. Hopefully these results hold up on different platforms.

I tried to keep the GNU ObjC runtime happy, but it's hard for me to test.
Reimplement how clang generates IR for exceptions. Instead of creating new
invoke destinations which sequentially chain to the previous destination,
push a more semantic representation of *why* we need the cleanup/catch/filter
behavior, then collect that information into a single landing pad upon request.

Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional
control flow) are generated, since it's actually fairly closely tied in with
the former. Remove the need to track which cleanup scope a block is associated
with.

Document a lot of previously poorly-understood (by me, at least) behavior.

The new framework implements the Horrible Hack (tm), which requires every
landing pad to have a catch-all so that inlining will work. Clang no longer
requires the Horrible Hack just to make exceptions flow correctly within
a function, however. The HH is an unfortunate requirement of LLVM's EH IR.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
121b3facb4e0585d23766f9c1e4fdf9018a4b217 05-Jul-2010 Chris Lattner <sabre@nondot.org> in the "coerce" case, the ABI handling code ends up making the
alloca for an argument. Make sure the argument gets the proper
decl alignment, which may be different than the type alignment.

This fixes PR7567


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107627 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1d110e05e0ff48c1c7a483d6b7fd094cdf28316a 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Remove unnecessary ASTContext parameter from
CXXRecordDecl::getDestructor(); no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
045a6d84a0fa672eb5d914be1bb8f3baa226beb3 27-Jun-2010 Anders Carlsson <andersca@mac.com> Correctly destroy reference temporaries with global storage. Remove ErrorUnsupported call when binding a global reference to a non-lvalue. Fixes PR7326.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106983 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
656746cd8c3a45901bcdec89ca1eb4495ee79b36 27-Jun-2010 Anders Carlsson <andersca@mac.com> Add a CreateReferenceTemporary that will do the right thing for variables with global storage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106982 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dca7ab2ea50a57545976e9d4c0472279fa397917 27-Jun-2010 Anders Carlsson <andersca@mac.com> Simplify CodeGenFunction::EmitReferenceBindingToExpr as a first step towards fixing PR7326.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106981 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cc09785424b056196c397862fca85806dd6ccc84 27-Jun-2010 Anders Carlsson <andersca@mac.com> Reduce indentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106980 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
77b89b87c3b9220fea1bc80f6d6598d2003cc8a8 27-Jun-2010 Chris Lattner <sabre@nondot.org> finally get around to doing a significant cleanup to irgen:
have CGF create and make accessible standard int32,int64 and
intptr types. This fixes a ton of 80 column violations
introduced by LLVMContextification and cleans up stuff a lot.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9269d5c05bebe634dc9f08a37b192c6977fbc067 27-Jun-2010 Chris Lattner <sabre@nondot.org> Implement rdar://7530813 - collapse multiple GEP instructions in IRgen

This avoids generating two gep's for common array operations. Before
we would generate something like:

%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arraydecay = getelementptr inbounds [100 x i32]* %A, i32 0, i32 0 ; <i32*> [#uses=1]
%arrayidx = getelementptr inbounds i32* %arraydecay, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]

Now we generate:

%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]

Less IR is better at -O0.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a4d94ab50ff3164bcbf4709a92a98e06c23a7459 27-Jun-2010 Chris Lattner <sabre@nondot.org> minor cleanup: don't emit the base of an array subscript until after
we're done diddling around with the index stuff. Use a cheaper type
comparison.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8c11a65c18ae607b7073e1e451264492d2297726 27-Jun-2010 Chris Lattner <sabre@nondot.org> move scalar inc/dec codegen into ScalarExprEmitter instead
of being in CGF. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7f215c12af4c3e7f81b24102a676aabfdb4e1566 26-Jun-2010 Chris Lattner <sabre@nondot.org> use more efficient type comparison predicates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106958 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
32f36baa6c8d491c374af622b4e3ac28d597453c 26-Jun-2010 Anders Carlsson <andersca@mac.com> Change EmitReferenceBindingToExpr to take a decl instead of a boolean.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7e70fb217dcdf96faf34df3e197c3831c86f8089 21-Jun-2010 Anders Carlsson <andersca@mac.com> Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
353b33b2bbd9e8715c7a0231681921bcfdfe4cbf 18-Jun-2010 Fariborz Jahanian <fjahanian@apple.com> objective-C++ IRGen: property reference as an
lvalue when performing a derived-to-base conversion.
Fixes radar 7501812. Added an executable test to
llvm-test suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
03b2960c14aede6ac82bdef32247094ebb72fa69 17-Jun-2010 Fariborz Jahanian <fjahanian@apple.com> Objective-c++ IRGen. Support for @selector expression as
an lvalue. Fixes PR7390.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106235 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
06057cef0bcd7804e80f3ce2bbe352178396c715 16-Jun-2010 Chandler Carruth <chandlerc@gmail.com> Move CodeGenOptions.h *back* into Frontend. This should have been done when the
dependency edge was reversed such that CodeGen depends on Frontend.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106065 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1884eb0b5c55edda4893ddec45e7dbad79758782 22-May-2010 Anders Carlsson <andersca@mac.com> Re-land the fix for PR7139.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2d6b0e94db30c0e2754d270753c6f75478e451bf 22-May-2010 Douglas Gregor <dgregor@apple.com> Improve our handling of reference binding for subobjects of
temporaries. There are actually several interrelated fixes here:

- When converting an object to a base class, it's only an lvalue
cast when the original object was an lvalue and we aren't casting
pointer-to-derived to pointer-to-base. Previously, we were
misclassifying derived-to-base casts of class rvalues as lvalues,
causing various oddities (including problems with reference binding
not extending the lifetimes of some temporaries).

- Teach the code for emitting a reference binding how to look
through no-op casts and parentheses directly, since
Expr::IgnoreParenNoOpCasts is just plain wrong for this. Also, make
sure that we properly look through multiple levels of indirection
from the temporary object, but destroy the actual temporary object;
this fixes the reference-binding issue mentioned above.

- Teach Objective-C message sends to bind the result as a temporary
when needed. This is actually John's change, but it triggered the
reference-binding problem above, so it's included here. Now John
can actually test his return-slot improvements.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104434 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
892fa6c5e152dd22e4ba460d5c8cd5c79d657e87 22-May-2010 Anders Carlsson <andersca@mac.com> Unbreak self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
db9b12e32c988e4a6ac49404fd2513d0b05bba32 21-May-2010 Anders Carlsson <andersca@mac.com> Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle setting null data member pointers correctly. Fixes PR7139.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104387 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a9976d3b192690db20f59dc44099ac4ca939bdb7 21-May-2010 John McCall <rjmccall@apple.com> When emitting an lvalue for an anonymous struct or union member during
class initialization, drill down through an arbitrary number of anonymous
records.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
60dcb8432cff2455488b9226b9cc65b80356146e 20-May-2010 Douglas Gregor <dgregor@apple.com> Rework our handling of binding a reference to a temporary
subobject. Previously, we could only properly bind to a base class
subobject while extending the lifetime of the complete object (of a
derived type); for non-static data member subobjects, we could memcpy
(!) the result and bind to that, which is rather broken.

Now, we pull apart the expression that we're binding to, to figure out
which subobject we're accessing, then construct the temporary object
(adding a destruction if needed) and, finally, dig out the subobject
we actually meant to access.

This fixes yet another instance where we were memcpy'ing rather than
doing the right thing. However, note the FIXME in references.cpp:
there's more work to be done for binding to subobjects, since the AST
is incorrectly modeling some member accesses in base classes as
lvalues when they are really rvalues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c12c5bba6ceb6acd4e51e7a0fc03257da9cfd44e 15-May-2010 John McCall <rjmccall@apple.com> Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
one of {primitive-id, primitive-Class, user-defined @class}
with
a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared). ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet. Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
84c580f6f387523684d56f60c84ec866dca63035 11-May-2010 Fariborz Jahanian <fjahanian@apple.com> Minor refactoring of my last patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b3ebe946d3bf1e06d3ccbecd11cc16c75b128342 11-May-2010 Fariborz Jahanian <fjahanian@apple.com> Objective-C++ Code gen. Handle code gen. for property
reference dot-syntax notation in a varierty of cases.
Fixes radar 7964490.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103440 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8e6404ca28d6bbb76e97ea2a53a74816c2a74665 03-May-2010 Anders Carlsson <andersca@mac.com> Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102882 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a04efdf635d35d88e65041fad007225d8c8d64a5 24-Apr-2010 Anders Carlsson <andersca@mac.com> Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
fc89c31a329eb6b36c6dbd8b7cb945d1a831650e 24-Apr-2010 Anders Carlsson <andersca@mac.com> Convert more call sites over to the new GetAddressOfBaseClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6a03e345bb3c971750920e34a0d7d1ea7c9eceb7 23-Apr-2010 Douglas Gregor <dgregor@apple.com> Handle compound assignment expressions (i += j) as lvalues, which is
permitted in C++ but not in C. Fixes PR6900. Clang can now handle all
of Boost.Lambda's regression tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102170 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ac418162692a951ca3796d6830496a85a2d12493 22-Apr-2010 John McCall <rjmccall@apple.com> Call PerformCopyInitialization to properly initialize the exception temporary
in a throw expression. Use EmitAnyExprToMem to emit the throw expression,
which magically elides the final copy-constructor call (which raises a new
strict-compliance bug, but baby steps). Give __cxa_throw a destructor pointer
if the exception type has a non-trivial destructor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3d3ec1c099ec8bfac3aa1fb0126fe515b7c7fa05 21-Apr-2010 John McCall <rjmccall@apple.com> Miscellaneous codegen cleanups. Mostly, don't create new basic blocks
just to save the current insertion state! This change significantly
simplifies the IR CFG in exceptions code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
63326a53418b4853a83b360ce1dbdb10c5739fc7 19-Apr-2010 Fariborz Jahanian <fjahanian@apple.com> Some renaming of methods, fixes typo
(related to PR6769).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
65ad5a42cca954e070428dcc499b62393aa7a6d3 18-Apr-2010 Fariborz Jahanian <fjahanian@apple.com> Local static variables must be available module-wise
as they are accessible in static methods in a class
local to the same function. Fixes PR6769.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4803535dfef2626d2aec18ef92450b5008945352 17-Apr-2010 Anders Carlsson <andersca@mac.com> Fix an assert when assigning a boolean value to a bitfield of type _Bool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2677261656b2f3325218d38bdd9d102ad732da92 15-Apr-2010 Daniel Dunbar <daniel@zuster.org> IRgen: (Reapply 101222, with fixes) Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.

- No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.

The new fixes from r101222 are:

1. The shift to the target position needs to occur after the value is extended to the correct size. This broke Clang bootstrap, among other things no doubt.

2. Swap the order of arguments to OR, to get a tad more constant folding.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101339 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
96c250a9d2f3bcff800500c22a8cf75579395588 14-Apr-2010 Daniel Dunbar <daniel@zuster.org> Speculatively revert "IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.", I think it might be breaking bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101235 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
89cdaa94ecac5e83197c5889830ee37ff1faea58 14-Apr-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.

- No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101222 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ecdb41ebc30e781ccbd3d89674caebc4fd35f023 14-Apr-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Move EmitLoadOfBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- This lets the method focus slightly more on emitting clean IR to honor the policy which has been selected. On 403.gcc's combine.c, x86_64, -O0, this reduces the number of lines in the .ll file (~= # of instructions) by 2.5%.

- No intended functionality change -- at -O3 this should produce equivalent if not identical output. On 403.gcc's combine.c, x86_64, -O3, this isn't quite true and some of the changes are regressions, but I'm not going to worry about that until we move to a new access policy.

- There is still some room for improvement in the generated IR, in particular we can usually fold the sign-extension of the bit-field into one of the component access. See the FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101192 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c24b9c46558919e98f4398ecbd45bc7b05f9acd9 10-Apr-2010 Chris Lattner <sabre@nondot.org> fix PR6805: llvm.objectsize changed to take an i1 instead of an i32.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100938 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7f2896406c8f14bf123578610043a919ba1a1c8a 08-Apr-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Move the bit-field access type into CGBitFieldInfo, and change bit-field LValues to just store the base address of object containing the bit-field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
efbf487da83883c2da81181cac6f040928aa4289 06-Apr-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Move BitFieldIsSigned bit into CGBitFieldInfo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8bea3efe46be55f6632aa2cd1906c21e41ce3737 06-Apr-2010 Daniel Dunbar <daniel@zuster.org> Simplify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f0fe5bc0e46038dc79cdd27fcf0c77ad4789fdff 05-Apr-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Move BitField LValues to just hold a reference to the CGBitFieldInfo.
- Unfortunately, this requires some horrible code in CGObjCMac which always
allocats a CGBitFieldInfo because we don't currently build a proper layout
for Objective-C classes. It needs to be cleaned up, but I don't want the
bit-field cleanups to be blocked on that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2eec0b2e3e931de6cefbb266a7652a0622fe95b2 05-Apr-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Lift BitFieldInfo to CGBitFieldInfo at namespace level.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
198bcb44b6271c92fd856403f34b518828100aac 31-Mar-2010 Daniel Dunbar <daniel@zuster.org> IRGen: Move the auxiliary data structures tracking AST -> LLVM mappings out of CodeGenTypes, to per-record CGRecordLayout structures.
- I did a cursory check that this was perf neutral, FWIW.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
23cba801e11b03929c44f8cf54578305963a3476 31-Mar-2010 John McCall <rjmccall@apple.com> Introduce a new kind of derived-to-base cast which bypasses the need for
null checks, and make sure we elide null checks when accessing base class
members.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f858da63ace0c810b6d6c67b3784b230c7d2417b 31-Mar-2010 Daniel Dunbar <daniel@zuster.org> Minor formatting/FIXME cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99944 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6a836706c40a31c716952b74785102c90fd6afa7 04-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> Fix PR6473.

Clang's support for weakref is now better than llvm-gcc's :-)

We don't introduce a new symbol and we correctly mark undefined references weak only if there is no
definition or regular undefined references in the same file.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97733 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9bd4da2cfa8b956b851200db8f9a37e175edbb15 16-Feb-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Add CreateIRTemp, which creates a temporary alloca but with type converted "not-for-memory". Dunno a better name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
150065722a5f010adb0f801d26d8a129a5243669 16-Feb-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Switch EmitCompoundLiteralLValue to use CreateMemTemp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96373 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
63efd334081c03a29d351e4aefa00dfaf6966d8a 15-Feb-2010 John McCall <rjmccall@apple.com> When emitting an aggregate into a temporary, make sure we set the alignment
on the alloca.

The fact that codegen makes this class of bug so wonderfully easy to make is
embarrassing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
848fa64143fbe5ae62a601ad61277f741e54dfab 11-Feb-2010 Anders Carlsson <andersca@mac.com> More vtable layout dumper improvements. Handle destructors, dump the complete function type of the member functions (using PredefinedExpr::ComputeName.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
195337d2e5d4625ae9dc1328c7cdbc7115b0261b 09-Feb-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.

- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!

PR6240.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95648 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e86bcf0d9ea62cc75e545787896083f8a6bc81a1 08-Feb-2010 Daniel Dunbar <daniel@zuster.org> Reapply r95393, without the change to CGExpr. I was wrong in assuming that the
element type always matched the converted LLVM type for ExprType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95596 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
04a67a6aa3dfdc92d57f7f8d93ba397348c868a4 05-Feb-2010 John McCall <rjmccall@apple.com> Standardize the parsing of function type attributes in a way that
follows (as conservatively as possible) gcc's current behavior: attributes
written on return types that don't apply there are applied to the function
instead, etc. Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks). Consistently consume CC/noreturn
information throughout codegen; enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a5002106fbe5563aa59eba007416074d5b1ffecf 05-Feb-2010 Douglas Gregor <dgregor@apple.com> Revert r95393, which broke Clang's self-host.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b2cd777d4885b5b863863f892cef85b4884ee677 05-Feb-2010 Daniel Dunbar <daniel@zuster.org> IRgen: A few more ConvertType cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95423 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
18aba0dd518e486d8b50523e7dafb4b5657135d2 05-Feb-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Factor out EmitAggExprToLValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95416 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ea48522e979957889fdaaa550beb4385601f66d3 05-Feb-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Fix some CreateTempAlloca calls to use ConvertTypeForMem when that is
conceptually correct. Review appreciated (Chris, Eli, Anders).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95401 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
16c4f3c7d44289e30f5066dce7ce9efe7ff67bbc 05-Feb-2010 Charles Davis <cdavis@mines.edu> Now that we store calling conventions in the types, use them instead of
getting the calling convention from the target function, which may or may not
exist. Fixes PR5280.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
027627115ca1c486e420db7cd8439f25531135bb 05-Feb-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Use hasAggregateLLVMType instead of isSingleValueType() for cases that
need to deal with aggregates specially; this is consistent with the rest of IRgen.

Also, simplify EmitParmDecl and don't worry about using Decl::getNameAsString.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95393 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0dc736627614b476ec696fa216dd2a524d0bafad 04-Feb-2010 Anders Carlsson <andersca@mac.com> When binding an lvalue to a reference, we always need to pop temporaries.

With this fix, and the other fixes committed today a make check-all with a clang-built LLVM now gives:

Expected Passes : 6933
Expected Failures : 46
Unsupported Tests : 40
Unexpected Failures: 27

which means that we pass 99.96% of all tests :) The resulting 27 tests are all LLVMC tests and seem to be because of differences in the clang and gcc drivers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95313 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c1b32f69687ed289fb1150df34965ada250caf70 04-Feb-2010 Anders Carlsson <andersca@mac.com> Fix a bug where we would not mark temporaries as conditional when emitting a conditional operator as an lvalue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a64a869312066ff6119d1d7ae03f88ce499e3f82 03-Feb-2010 Anders Carlsson <andersca@mac.com> Revert the new reference binding code; I came up with a way simpler solution for the reference binding bug that is preventing self-hosting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
45147d0098a34c3705f74ca121b27d7736ac113a 02-Feb-2010 Anders Carlsson <andersca@mac.com> Move pointer to data member emission to CodeGenModule and use it in CGExprConstant. Fixes PR5674.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3aba09376c5f49c4c8d176109ea4835bc2c528ee 31-Jan-2010 Anders Carlsson <andersca@mac.com> Start creating CXXBindReferenceExpr nodes when binding complex types to references.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94964 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
06a2970e9480c6d02b367b2f970baff29b9f9721 29-Jan-2010 Anders Carlsson <andersca@mac.com> Add a new EmitLValueForFieldInitialization that will be used for initializing fields (and reference type fields in particular).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e6d2a534851a649485cb087e9dfcaf8a65886858 29-Jan-2010 Anders Carlsson <andersca@mac.com> Simplify EmitLValueForField - we can get whether the field is part of a union or not from the FieldDecl (through its DeclContext).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
eb60edffa147e061278c436e513b0df9b4c4e7f6 29-Jan-2010 Anders Carlsson <andersca@mac.com> Add an CXXBindReferenceExpr (not used just yet).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94791 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3228f42b12c24c76f5d5ae4ebf80837b752d1683 26-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Use CharUnits for alignment in EmitNullInitializationLValue().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
199c3d6cd16aebbb9c7f0d42af9d922c9628bf70 11-Jan-2010 Ken Dyck <ken.dyck@onsemi.com> Roll out ASTContext::getTypeSizeInChars(), replacing instances of
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate.

Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType,
fromQuantity(), and getQuantity() for clarity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
197a338f57a9a44efd5f025ce3d462430d260016 09-Jan-2010 Chris Lattner <sabre@nondot.org> implement codegen support for preinc as an lvalue, PR5514.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dd36d328730d8c02915d0884541b45ec6ca0049d 09-Jan-2010 Chris Lattner <sabre@nondot.org> refactor pre/postinc logic into CGF and require the caller to pass in the
lvalue to poke, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
302c3c23905de41c3720158cca262e8f87e52014 04-Jan-2010 Daniel Dunbar <daniel@zuster.org> Fix -Asserts warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8e274bd14bcca8466542477844b88e90e90cde1a 25-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Minor optimization; emit proper unsupported messages for a couple of cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ab189950908fc08dd2533692f0e8253e807c73ac 25-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Some small improvements to dead code elimination; helps a bit on
LLVM-Code-Symbols test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a1736c0c750d4514a5d8fda36670addf1e4de54a 24-Dec-2009 Anders Carlsson <andersca@mac.com> Pass the return value slot to all call exprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d2490a91341b57df7a7e54f8a707e7ecde2eeb4e 24-Dec-2009 Anders Carlsson <andersca@mac.com> Fill in the return value slot in CGExprAgg::VisitCallExpr. This takes us halfway towards fixing PR5824.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92142 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f3c47c9525153aea2de0ec4bd615b9cf2d81c103 24-Dec-2009 Anders Carlsson <andersca@mac.com> Pass ReturnValueSlot to EmitCall. No functionality change yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
31777a2540879051a3c643b90e02c3fd3d315243 24-Dec-2009 Anders Carlsson <andersca@mac.com> Add a ReturnValueSlot class. Change the argument order in EmitCall to match the other overload better.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0ad57fb93ae53ac94ebcd247201f60d87600188f 23-Dec-2009 Chris Lattner <sabre@nondot.org> simplify my previous patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
998eab186790b7246a572a9950174f7f36442c06 23-Dec-2009 Chris Lattner <sabre@nondot.org> fix opencl extvector element extraction on rvalues. We previously
error_unsupported on test10 and crashed on test11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
27a9b72bf1e4fe9f1d3ee9a5db1b9d614b0ee01c 19-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix for PR5524: make reference binding in default argument work correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91733 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b14e62d5aee7522b98c410ee65bd750c2cfe6f01 16-Dec-2009 Mike Stump <mrs@apple.com> Implement additional undefined checks for additional loads and stores. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91498 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a7fa7cd3eaa5459dfb2d1495384ece9786f8434c 15-Dec-2009 Fariborz Jahanian <fjahanian@apple.com> Fixes a code gen bug related to accessing a now
non-existing 'isa' field of a non-existing struct type
all related to legacy type definition for 'id' which we have
dropped in clang in favor of a built-in type.
(fixes radar 7470820).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91455 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0ece491d8f62ce67f047491a6703fac0d3bd4ff4 15-Dec-2009 Anders Carlsson <andersca@mac.com> ShouldDestroyTemporaries? I don't think so.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d8af3601a5cddad7c6cf9a0e4a8563dcc6484664 15-Dec-2009 Mike Stump <mrs@apple.com> Fix spacing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91386 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
41513444fe9d032dc74660c581d3689865bf32d3 15-Dec-2009 Mike Stump <mrs@apple.com> Ensure we preserve line information for each trap for
-fcatch-undefined-behavior if we aren't optimizing. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91382 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
15037caa1542bb810ad54c653aeb80f61df7b00c 15-Dec-2009 Mike Stump <mrs@apple.com> Switch codegen for -fcatch-undefined-bahavior over to __builtin_trap
instead of abort to improve codesize and codegen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
750c85ea8efd0f899cdf7ba9060d1286ba14be9a 14-Dec-2009 Mike Stump <mrs@apple.com> We have to allow one to form an address for one past the end. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91347 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
96a063a70ca6374c401642c2a88ec1f11697b7ae 14-Dec-2009 Mike Stump <mrs@apple.com> Simplifiy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9c276ae0f24d4cee8f7954069d4b8eae45d0447d 12-Dec-2009 Mike Stump <mrs@apple.com> Implement runtime checks for undefined behavior. WIP.

This implements a new flag -fcatch-undefined-behavior. The flag turns
on additional runtime checks for:

T a[I];

a[i] abort when i < 0 or i >= I.

Future stuff includes shifts by >= bitwidth amounts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91198 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3a1737030e3c8d209987325c61dacb8e4a65123b 11-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Move the code for converting a member pointer to a bool so that it is usable
for logical not.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91112 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6ec687d2ad8b4968675f7baec15ba302b4d7e199 11-Dec-2009 Anders Carlsson <andersca@mac.com> When extending the lifetime of a temporary, make sure to emit a branch to the cleanup exit block. This fixes a broken module error in LLVMCConfigurationEmitter.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
820bca41c3899374775d2a1dfc2ef2e22aaf1c7b 10-Dec-2009 Fariborz Jahanian <fjahanian@apple.com> Code gen for ObjCIsaExpr AST used as lvalue.
(fixes radar 7457534).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d88ea5687968640ada2bc5a10211cbeb68a671ec 09-Dec-2009 Mike Stump <mrs@apple.com> Add cleanups for exceptional edges. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c4451dbb4fd3858a3ee7354fcca4ab452192ddb4 08-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix some direct checks of expressions which might be surrounded by parentheses.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90825 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
130c69e969a785ff3be9e909f8eba7f89e42ac10 07-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Make the comma operator consistently call EnsureInsertPoint.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
86b85b20349c8d931a0a25d85cb35b93a945fa64 06-Dec-2009 Chris Lattner <sabre@nondot.org> use new helpers to simplify code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90709 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2b06d3485e20fffdeea7ebc0eb7dc9a489c3fb44 01-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Make EmitStoreOfScalar generate a more sane representation of boolean stores.
"Fixes" PR5645.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2da84ff228a231adbd3f6f236b857f752d02959a 29-Nov-2009 Daniel Dunbar <daniel@zuster.org> Don't pass false (default) for isVolatile parameter to CreateLoad.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9a14630714da7176c981e3c8d050f82bc42c2643 26-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Implement IRGen for MemberExpr referring to static member function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89938 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
99e9b4d172f6877e6ba5ebe75bb8238721f5e01c 25-Nov-2009 Douglas Gregor <dgregor@apple.com> Eliminate CXXConditionDeclExpr with extreme prejudice.

All statements that involve conditions can now hold on to a separate
condition declaration (a VarDecl), and will use a DeclRefExpr
referring to that VarDecl for the condition expression. ForStmts now
have such a VarDecl (I'd missed those in previous commits).

Also, since this change reworks the Action interface for
if/while/switch/for, use FullExprArg for the full expressions in those
expressions, to ensure that we're emitting

Note that we are (still) not generating the right cleanups for
condition variables in for statements. That will be a follow-on
commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89817 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d5782d5013ef5dbe033d1c3d1334e01c5996e06b 24-Nov-2009 Douglas Gregor <dgregor@apple.com> Rename CleanupScope -> DelayedCleanupBlock. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89769 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a3697c9c155bda93fd2802f37084b620f4738822 23-Nov-2009 Anders Carlsson <andersca@mac.com> Handle base-to-derived casts. Will land test case shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1c5c1a09a4a224c5c01f0a2a0d69224c8356f0be 18-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Clean up EmitPointerToDataMemberBinaryExpr a bit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0ed303c918915cbe2c611cddbfabd00404664831 17-Nov-2009 Anders Carlsson <andersca@mac.com> More const is always good.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89033 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c849c052d6b4b70f2651c1969531861a5f230053 16-Nov-2009 Mike Stump <mrs@apple.com> Implement most of dynamic_cast. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88901 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
eaae78a6fbd762c0ac6e75fa6fdfa4d167ceb4f2 16-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Some minor cleanup for EmitCastLValue.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c2e84ae9a6d25cea3e583c768e576b4c981ec028 15-Nov-2009 Mike Stump <mrs@apple.com> Implement typeid for class types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88843 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
658e8123a80d0e62f227a0c1532f2a4f106b3e73 14-Nov-2009 Anders Carlsson <andersca@mac.com> Handle CK_BitCast in EmitCastLValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88810 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
370e53864aaed0288afdf532e127efe35d4b49f1 14-Nov-2009 Anders Carlsson <andersca@mac.com> Handle CXXDefaultArgExprs in EmitLValue. Fixes PR5484.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e401cd5a487feee1165d3977aa3f4b68f44a3ca7 09-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Explicitly note that pre-inc/dec lvalues are not supported yet, so that it
doesn't crash. (Such expressions are valid in C++, but not in C.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d2113f279b9e4bdc4a3d4f2226797be2322aa238 08-Nov-2009 Daniel Dunbar <daniel@zuster.org> Add clarifying parens.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
589f9e3f7845c2a1bf97ae4357aec5b457a5ea19 08-Nov-2009 Anders Carlsson <andersca@mac.com> Handle member expressions where the member declaration is actually a static variable. Fixes PR5392.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86414 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ce53f7dbe7406a253c6b2d93ff2727079087d9cc 08-Nov-2009 Anders Carlsson <andersca@mac.com> More LValue related code cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1e74c4f0333b4730f44197d5e4615ea2b06599f4 07-Nov-2009 Anders Carlsson <andersca@mac.com> More cleanup, the code is much easier to follow now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86412 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0bc7049d636f63b4b0e9ee0a2edf37541f5e3bee 07-Nov-2009 Anders Carlsson <andersca@mac.com> Reduce nesting, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86411 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a59869b277f9fb8d6e062cab97b6bafe7c199900 07-Nov-2009 Anders Carlsson <andersca@mac.com> We only need to call SetObjCNonGC for local variables. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
909fbf70223ea04a5ec8d449789f3683a89701ff 07-Nov-2009 Anders Carlsson <andersca@mac.com> Change EmitPointerToDataMemberLValue to take a FieldDecl. No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
eb99b0189710d996216df7d485f11939e9f1c842 28-Oct-2009 Chris Lattner <sabre@nondot.org> random tidying


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
67665869ccf238df4c709536bf62fca25957257b 28-Oct-2009 Chris Lattner <sabre@nondot.org> adjust for a pending LLVM change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85373 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
52f08bcbb81c750ed62b53ed0b34aff16143b877 26-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Add Code gen support for '->*' operator which fell
through the crack.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85160 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a2813cec2605ce7878d1b13471d685f689b251af 23-Oct-2009 Douglas Gregor <dgregor@apple.com> Eliminate QualifiedDeclRefExpr, which captured the notion of a
qualified reference to a declaration that is not a non-static data
member or non-static member function, e.g.,

namespace N { int i; }
int j = N::i;

Instead, extend DeclRefExpr to optionally store the qualifier. Most
clients won't see or care about the difference (since
QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the
number of top-level expression types that clients need to cope with,
brings the implementation of DeclRefExpr into line with MemberExpr,
and simplifies and unifies our handling of declaration references.

Extended DeclRefExpr to (optionally) store explicitly-specified
template arguments. This occurs when naming a declaration via a
template-id (which will be stored in a TemplateIdRefExpr) that,
following template argument deduction and (possibly) overload
resolution, is replaced with a DeclRefExpr that refers to a template
specialization but maintains the template arguments as written.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
00a1ad9a34f1006d8729aa3fab4fb5f233ab5a55 23-Oct-2009 John McCall <rjmccall@apple.com> Emit calls using the canonical prototype of the called function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84947 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8bfd31f9dad09cd52225d868bbd92a9bebe87775 23-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Complete code gen for '.*' binary expression for
both scalar and aggregates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
39762951ad2abfed7b743c01c672fac85034b856 21-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Expand on code gen. for pointer to data members so it works
for base classe members as well. Test case enhanced for this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84780 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a63629930177da7a0eb99c3fdfb35d8618808ca1 21-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Code gen for pointer-to-datamember - WIP.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
48620bafe4ba879f96c2d17caefeb79f3fae2eea 21-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Code-gen for CXXZeroInitValueExpr AST passed
as argument to a function call. Removes a FIXME.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
86aa0cdfd5aa7b099efbcd612a014d1b5f0ff799 19-Oct-2009 Anders Carlsson <andersca@mac.com> Handle emitting the assignment operator when the lhs is a reference. Fixes PR5227.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84518 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
259e9ccf882d11491ad149aec5e6d7a061c9f938 19-Oct-2009 Daniel Dunbar <daniel@zuster.org> Twinify CodeGenFunction::CreateTempAlloca

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84456 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e1b7ea1b025c54b082f838ede2f483e657481fdc 19-Oct-2009 Anders Carlsson <andersca@mac.com> When binding a reference to a temporary, it's important that other temporaries created as on the RHS are destroyed before emitting the dtor for the temporary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84451 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b3f744252a460c45e2e77053491285978286c384 15-Oct-2009 Anders Carlsson <andersca@mac.com> Handle

struct A { };
struct B : A { };

void f() {
const A& a = B();
}

correctly. (This now does the offset conversion if necessary and calls the destructor when a goes out of scope).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3c0ef8cc0dc246bd3083e8cdd63005e8873d36d2 13-Oct-2009 Benjamin Kramer <benny.kra@googlemail.com> Simplify pointer creation with the new Type::getInt*Ptr methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83964 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d35e2e0c35432bd3a8c195fe62d53a1c3bbf37c0 13-Oct-2009 Devang Patel <dpatel@apple.com> There is no need to attach debug location info with alloca instruction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83913 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bbd9fa4b4a0fea47f94ac3eb4eaf5cc8079defe1 06-Oct-2009 Devang Patel <dpatel@apple.com> Add support to attach debug info to an instruction.
This is not yet enabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
75b08f169fa47285ce5381091367793ed611195c 30-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> <rdar://problem/7263113> Make clang produce gcc's objc_assign_StrongCast as a result of type-cast of an ivar in assignment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
76368e843cdf7db9c0d534384bf7a114fa260ffc 25-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Fixed another code gen bug in objc's new write-barrier API.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6c7a1f364796ce1acb988714e9e42076d1ce332e 25-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Patch fixes a code gen. bug in generation of objc_assign_ivar
(objc GC's API).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82724 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0953e767ff7817f97b3ab20896b229891eeff45b 24-Sep-2009 John McCall <rjmccall@apple.com> Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right; many more remain.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
183700f494ec9b6701b6efe82bcb25f4c79ba561 22-Sep-2009 John McCall <rjmccall@apple.com> Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b924259cc53e4d38e493616715e7b3e95bdee1ef 22-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Removed -fobjc-newgc-api option. clang now conforms to
gcc-style write-barrier api only.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
fd02ed702e754f8dd0b4c979325ba99c2234f270 21-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Miscellanous fixes in generatation of objc gc's write-barriers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1c1afc4ed3ec30fc99e172220c8bb74a13b117b0 18-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Fixed a bug in generation of the new write-barriers when
array syntax is used to derefernce and assign to ivar pointee.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82183 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dbf3cfd39dd5234f90235e263ba2ff4cc61258bd 17-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> patch for generating objc'2 objc_assign_ivar. WIP.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82090 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b123ea395ee607de85161f84c6e78595946304a5 16-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Starting patch to generate more specific API for objc's
GC. Currently, new API will be generated under
clang-cc's -fobjc-newgc-api flag which will eventually
become the default. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8e674aea310ab0f79e02973857f63c2dd695202c 16-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Removed a superfluous check before setting
a flag (objc GC).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82052 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6fcec8b58d0571866fcb162db947b029cc539ec4 15-Sep-2009 Anders Carlsson <andersca@mac.com> Code generation of Conditional operators that are lvalues (but that aren't bitfields).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81867 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b9ea0b53d323cdca2b8284ff986a878e195cb97f 14-Sep-2009 Anders Carlsson <andersca@mac.com> Implement CodeGenFunction::EmitCXXExprWithTemporariesLValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0a23d76999f838257f70bd43dc7f1e2242147609 13-Sep-2009 Daniel Dunbar <daniel@zuster.org> Don't use the PredefinedExpr string as the global variable name, these don't
make very nice symbols, just use the function name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81653 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0ee33cf81eb7e7e53a897efb772edf4d53af5bf1 12-Sep-2009 Anders Carlsson <andersca@mac.com> Handle CK_DerivedToBase when emitting lvalue casts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
18be84c37b2b796fddfb36447c2b29141d7fdd18 12-Sep-2009 Anders Carlsson <andersca@mac.com> Add support for __block variables with alignment greater than __alignof(void *).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7814e6d6645d587891293d59ecf6576defcfac92 12-Sep-2009 Douglas Gregor <dgregor@apple.com> Remove unnecessary ASTContext parameter from FunctionDecl::isBuiltinID

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81590 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8a9f3fd8bb14a64a31a29bf5cf5376b643218b71 12-Sep-2009 Daniel Dunbar <daniel@zuster.org> Set the calling convention based on the CGFunctionInfo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81582 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
555b4bb2749aea2ec8e2adc351a71ec1cb9bdc33 11-Sep-2009 Anders Carlsson <andersca@mac.com> GlobalDecl doesn't have an explicit constructor anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0aebc81e02397a5987aaa8e8c7acbdb01a31d7c3 09-Sep-2009 Anders Carlsson <andersca@mac.com> If a cast expression needs either a conversion function or a constructor to be called, generate implicit child expressions that call them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81383 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
db52dcdae7d2e25565096d07ee74fa307061cc32 09-Sep-2009 Mike Stump <mrs@apple.com> Reflow comments and some minor whitespace fixups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3a082d81006e7a2e01a6e431a22e21c78490ff8f 08-Sep-2009 Anders Carlsson <andersca@mac.com> Vastly improve PredefinedExpr output, both in Sema and CodeGen. Patch by Sam Weinig!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a71d819bb8f50c28938db0f2867d3fb6e2ce5910 04-Sep-2009 Douglas Gregor <dgregor@apple.com> Implement AST, semantics, and CodeGen for C++ pseudo-destructor
expressions, e.g.,

p->~T()

when p is a pointer to a scalar type.

We don't currently diagnose errors when pseudo-destructor expressions
are used in any way other than by forming a call.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
faf86648bfab7e0fa975e2b32c10fe1d8b461e8c 01-Sep-2009 Anders Carlsson <andersca@mac.com> Handle member expressions that return references correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80723 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d2e1eb064cfb8d361ea1dd4f6253a4e20f24d88d 01-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Fixed a property getter ir-gen crash.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80681 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
83f6faf37d9bf58986bedc9bc0ea897a56b4dbad 01-Sep-2009 Douglas Gregor <dgregor@apple.com> Eliminate CXXAdornedMemberExpr entirely. Instead, optionally allocate
space within the MemberExpr for the nested-name-specifier and its
source range. We'll do the same thing with explicitly-specified
template arguments, assuming I don't flip-flop again.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0979c805475d1ba49b5d6ef93c4d2ce6d2eab6ed 31-Aug-2009 Douglas Gregor <dgregor@apple.com> Rename CXXQualifiedMemberExpr -> CXXAdornedMemberExpr, since we will
also be adding explicit template arguments as an additional
"adornment". No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
31976591dee494994f2546c72c23e1e35a9c1555 29-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> Patch for code gen. for c-style cast which ends in
using class's conversion functions [12.3.2-p2]


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4fc7ab364110d6ad1c10dd38dbeb0597fed7e2f5 28-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> ir-gen related patch for type conversion
with class type conversion methods. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a77a07e49366628b3eaf27cf72c4e94762cfddc9 27-Aug-2009 Eli Friedman <eli.friedman@gmail.com> Clean up CodeGenFunction::EmitCastLValue to use the cast kind. Error
out for user-defined conversions instead of crashing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80282 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bd4c4aebe6035e7a7125470cc9f0f92511230ee3 27-Aug-2009 Douglas Gregor <dgregor@apple.com> When a member reference expression includes a qualifier on the member
name, e.g.,

x->Base::f()

retain the qualifier (and its source range information) in a new
subclass of MemberExpr called CXXQualifiedMemberExpr. Provide
construction, transformation, profiling, printing, etc., for this new
expression type.

When a virtual function is called via a qualified name, don't emit a
virtual call. Instead, call that function directly. Mike, could you
add a CodeGen test for this, too?



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
09105f52b1f28cbb1374c27c3c70f5517e2c465d 20-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> Using "ObjCImplicitSetterGetterRefExpr" instead of "ObjCImplctSetterGetterRefExpr".
A field rename and more comments.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
154440e6a8fa6ac5bca395876d79b530b39a2c1c 18-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.
Removed an unnecessary loop to get to setters incoming
argument. Added DoxyGen comments. Still more work
to do in this area (WIP).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2da76936a7d17c3e2274412117ab44a95a093ccb 16-Aug-2009 Anders Carlsson <andersca@mac.com> Only do this for initializers of course.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8478ce6d3f2416a694e39f791655a473c3907d62 16-Aug-2009 Anders Carlsson <andersca@mac.com> Destroy bound temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
14c5cbf59cffee52275230922283a247de407712 16-Aug-2009 Anders Carlsson <andersca@mac.com> Add an IsInitializer flag to EmitAnyExpr. This is used to prevent temporaries from being destroyed when they're bound to a reference variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79179 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
881eb9ce336c1fe29cab92c06a1900fccd0951d1 15-Aug-2009 Chris Lattner <sabre@nondot.org> use GetVLASize instead of accessing VLASizeMap directly, this gets an assert if
VLASize isn't populated for the type yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0032b2781b4deb131f8c9b7968f2030bf2489cdd 13-Aug-2009 Owen Anderson <resistor@mac.com> Update for LLVM API change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78946 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
664f8934e06cf10de98083b4526aef7bce191a3f 12-Aug-2009 Dan Gohman <gohman@apple.com> Use the inbounds variant of getelementptr for common pointer arithmetic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
03e205031b08669f05c41eed5b896fc94c4a12bb 31-Jul-2009 Owen Anderson <resistor@mac.com> Update for LLVM API changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77638 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b3589f44c5d295cd41de2c83f3475116835eeebd 31-Jul-2009 Mike Stump <mrs@apple.com> Canonicalize else spacing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d254a25bc1793a2387e37b96568285883fb12eff 30-Jul-2009 Eli Friedman <eli.friedman@gmail.com> Remove bogus "unsupported" case for vectors (which shouldn't
ever trigger). Add an "unsupported" case that triggers for C++ code.

It would be nice if someone would implement this properly... it
shouldn't be too hard, but I haven't looked closely at the relevant
code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77562 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
96e0fc726c6fe7538522c60743705d5e696b40af 30-Jul-2009 Owen Anderson <resistor@mac.com> Update for LLVM API change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6217b80b7a1379b74cced1c076338262c3c980b3 29-Jul-2009 Ted Kremenek <kremenek@apple.com> Change uses of:
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsRecordType() -> Type::getAs<RecordType>()
Type::getAsPointerType() -> Type::getAs<PointerType>()
Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
Type::getAsTagType() -> Type::getAs<TagType>()

And remove Type::getAsReferenceType(), etc.

This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
98a541e80848d3b7d1131237ac04e698faffd151 29-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to provide cast of objects in member access
excpression, if needed, and remove some ir-gen code
now unnencessary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a91d6a6619a91d0ca7102d8ab5678d855f04d850 29-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Code refactoring to define getCXXRecordDeclForPointerType
and use it in several places.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77411 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4a28932dba03132dabbe70abdadcaae468dd7933 28-Jul-2009 Owen Anderson <resistor@mac.com> Update for LLVM API change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1c698e0d4f9bf3d141c019d33d9040085a8a67dd 28-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> More cleanup of data member access and then some.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9e809e7da2448c08aa11f15be4680226754678ce 28-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> More work toward data member access ir-gen.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4a28d5deeba33722aa009eab488591fb9055cc7e 25-Jul-2009 Owen Anderson <resistor@mac.com> Update for LLVM API change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77012 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8330ceeebb3bfac31116b387b90ff2ce3cef85e4 23-Jul-2009 Anders Carlsson <andersca@mac.com> Move the LLVM field number for bit fields into the BitFieldInfo structure, since it's meaning is completely different than for non-bit fields.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76882 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c6a38a47bf3908ab2183d7946498138d8b07c886 22-Jul-2009 Mon P Wang <wangmp@apple.com> Preserve address space information through member accesses, e.g.,
__attribute__((address_space(1))) struct {int arr[ 3 ]; } *p1;
... = p1->arr[2]; // load from address space 1


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
35366a67baa970c287c714c957cf78a4131cf60d 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1a1a6e2bd4c5aefd7fd643cf25915f9623a02e59 16-Jul-2009 Ted Kremenek <kremenek@apple.com> Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
This method is intended to eventually replace the individual
Type::getAsXXXType<> methods.

The motivation behind this change is twofold:

1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of
them are basically copy-and-paste.

2) By centralizing the implementation of the getAs<Type> logic we can more
smoothly move over to Doug Gregor's proposed canonical type smart pointer
scheme.

Along with this patch:

a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>.
b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f49545602089be5b1f744e04326b8a566f6d8773 16-Jul-2009 Steve Naroff <snaroff@apple.com> Remove ASTContext::isObjCObjectPointerType().
Convert all clients to use the new predicate on Type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d720046f18878f933b51fa21612f95114d602962 16-Jul-2009 Owen Anderson <resistor@mac.com> Update for LLVM API change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a1cf15f4680e5cf39e72e28c5ea854fcba792e84 15-Jul-2009 Owen Anderson <resistor@mac.com> Update for LLVM API change, and contextify a bunch of related stuff.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
14108da7f7fc059772711e4ffee1322a27b152a7 11-Jul-2009 Steve Naroff <snaroff@apple.com> This patch includes a conceptually simple, but very intrusive/pervasive change.

The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches.

This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic.

By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time.

Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
40b598eea1310ec9ed554d56ce3e25b34c585458 30-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove the ASTContext parameter from the attribute-related methods of Decl.
The implementations of these methods can Use Decl::getASTContext() to get the ASTContext.

This commit touches a lot of files since call sites for these methods are everywhere.
I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6e5dd866469d577811f3080f43407c12a21db83f 26-Jun-2009 Nate Begeman <natebegeman@mac.com> OpenCL 1.0 Support: fix a bug with lvalue swizzles


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
68584ed35ad819a1668e3f527ba7f5dd4ae6a333 18-Jun-2009 Douglas Gregor <dgregor@apple.com> Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5db7ae59bb0115ccc420ff1d688abc8706559b57 13-Jun-2009 Chris Lattner <sabre@nondot.org> Fix PR4372, another case where non-prototyped functions can prevent
always_inline from working.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
61d004a12eba93df9d393c80a6836d20bc0b1be5 06-Jun-2009 Eli Friedman <eli.friedman@gmail.com> PR4339: make sure to properly extend/trunc the index of a vector element
insert/extract; the relevant instructions are defined to take only an
i32.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73005 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
102e390bcb5a1fb1a8fdbc8505e6dfd905374bbd 01-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> A corner case of objc2 gc's write-barrier generation
for the Next runtime.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3fbc473e1e76ead199c7333bdbf02dfa1c7dc420 01-Jun-2009 Eli Friedman <eli.friedman@gmail.com> PR4289: Make sure "&func" has the right LLVM type when "func" is a
K&R-style definition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72690 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
543ac0c4d24a81fb2b7b6e83370aa8e4cbc93054 31-May-2009 Anders Carlsson <andersca@mac.com> Emit destructors correctly for temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72655 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e61c9e80a108b5db7e5f0e702f0e455d737c6390 31-May-2009 Anders Carlsson <andersca@mac.com> Add lvalue irgen support for CXXBindTemporaryExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b58d017f2b9eeed33f2ab3ede968b89cf5296bf2 31-May-2009 Anders Carlsson <andersca@mac.com> More temporary support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72648 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2be586108bb401019647791feca19ea03fd477ce 30-May-2009 Eli Friedman <eli.friedman@gmail.com> Some small fixes for fields of reference type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72636 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7f79f9be5916c51c35da4f126b7c12596a101607 29-May-2009 Mike Stump <mrs@apple.com> Fixup the rest of the trivial cases of the codegen of volatile. If
any body can spot codegen bugs with volatile, or knows of any in the
bug database, let me know.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
529677703214454e85c9089440c1c77200c53772 27-May-2009 Fariborz Jahanian <fjahanian@apple.com> Change a confusing variable name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72491 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0f294632f36459174199b77699e339715244b5ab 27-May-2009 Anders Carlsson <andersca@mac.com> Handle operator call expressions where the callee is a member function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
482656833a71b63f67f3e93ee8c2d45b3d351ca8 27-May-2009 Anders Carlsson <andersca@mac.com> Add support for emitting calls to functions that return references (as lvalues only for now)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72449 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
986477149db76e6d9f8d3c9859c9880c11b680ae 27-May-2009 Anders Carlsson <andersca@mac.com> Rename an EmitCallExpr function to EmitCall to make it clear that it doesn't emit an expr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
49d1cd5a09ed3df353371fd7f206674a85e0fb45 27-May-2009 Mike Stump <mrs@apple.com> Fixup codegen for volatile structs in the trivial cases (a a=a and a=a=a).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f1b97f28a53ee09fa2bc38790d964cda3811bdc6 23-May-2009 Mike Stump <mrs@apple.com> More volatile fixes. Can't testcase these yet as ultimately volatile
is still ignored.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e226534b06dc18a50deae0a1b5221984e7911137 23-May-2009 Daniel Dunbar <daniel@zuster.org> Initialize Obj-C GC attributes when emitting BlockDeclRefExprs.
- Otherwise we may incorrectly miss generation of some write barriers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72313 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5df0d426026b3820b5f0b13a8d4e60e9373d8d9d 20-May-2009 Eli Friedman <eli.friedman@gmail.com> Handle the remaining unhandled cases in EmitReferenceBindingToExpr.

It would be nice if someone could write an ObjC++ testcase for the case
of passing a property returning a struct to a function taking a const
reference.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72159 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7cd3a648b3d3057805c022b9470bbdfe21d732a5 20-May-2009 Anders Carlsson <andersca@mac.com> irgen for references to complex rvales (Very important...)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
38d068e8f13a119b89a3b8b0f79f35cab1ffd09a 20-May-2009 Anders Carlsson <andersca@mac.com> Create a temporary if the lvalue is a bitfield. Reported by Eli.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72155 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e04d1c77ae15a6e973e2fac7723f6c364884f58d 20-May-2009 Anders Carlsson <andersca@mac.com> Add support for binding references to scalar rvalues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4bbab92167713bf4f79c0b14dcc4e83d08ac4019 20-May-2009 Anders Carlsson <andersca@mac.com> Bind references to lvalues correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4029ca7ae9d3ffd7738fe2ed8782bebc30f36fd6 20-May-2009 Anders Carlsson <andersca@mac.com> Add EmitReferenceBindingToExpr. Have EmitCallArg use it for now. Doesn't support anything but at least we don't crash ;)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c8667a866bfc1d9f807282f2de5644d6aa4e9423 19-May-2009 Anders Carlsson <andersca@mac.com> Improve support for irgen of references.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3bb423bb7f809c9182be3ba79adfbb38854afa64 19-May-2009 Anders Carlsson <andersca@mac.com> Only do the bitcast in EmitStoreOfScalar if the type is a boolean.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72125 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b4aa4664ec851573624a7a29c6c750fc1d5cc268 19-May-2009 Anders Carlsson <andersca@mac.com> Pass the destination QualType to EmitStoreOfScalar. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72118 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f5408fe484495ee4efbdd709c8a2c2fdbbbdb328 16-May-2009 Mike Stump <mrs@apple.com> Reflow some comments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71937 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7a574ccd5247189693e0764bf1f5711d33ca6064 12-May-2009 Chris Lattner <sabre@nondot.org> implement l-value codegen of comma expr


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b4880bab7fc1b61267cfd9a0ad52188e7a828cb3 12-May-2009 Chris Lattner <sabre@nondot.org> push GlobalDecl through enough of the CodeGenModule interfaces
to allow us to support generation of deferred ctors/dtors.
It looks like codegen isn't emitting a call to the dtor in
member-functions.cpp:test2, but when it does, its body should
get emitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71594 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bf63b87ecf1e62ab8871a81325978377c84e1835 05-May-2009 Fariborz Jahanian <fjahanian@apple.com> Provide basic support for generation of objc2's
objc_assign_global API when assigning to global
objective-c object pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
31ccf377f4a676eb6c205b47eef435de616d5e2d 03-May-2009 Anders Carlsson <andersca@mac.com> Make codegen for constructors work again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
654599454c8e6cc83b1b9b3af43c49c2f66a26cb 25-Apr-2009 Chris Lattner <sabre@nondot.org> fix PR4067: [Linux kernel] cannot aggregate codegen stmtexpr as lvalue


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2a866251a80a8d88f6908f7dc68ce06d1023ec1d 25-Apr-2009 Daniel Dunbar <daniel@zuster.org> Fix pointer addressing and array subscripting of Objective-C interface
types.
- I broke this in the switch to representing interfaces with opaque
types.

- <rdar://problem/6822660> clang crashes on subscript of interface in
32-bit mode


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7cabee5b18212bd3106aea8415b044b2b3b43518 24-Apr-2009 Sanjiv Gupta <sanjiv.gupta@microchip.com> Clang part of r69947. Reverting back 69574 as it is no longer needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b5437d238752dc297e42410e98d38d5250fe0463 23-Apr-2009 Chris Lattner <sabre@nondot.org> the logic for computing __func__ and friends is really broken:
the type assigned by sema (and is visible with sizeof(__func__) for
example) has nothing to do with what codegen ends up producing.
We should eventually add a method on PredefinedExpr to handle this.
In the meantime, just set up some framework and add some fixme's.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2a03192a02dbf4fdff438d1e658356bde871aba4 22-Apr-2009 Daniel Dunbar <daniel@zuster.org> Make ObjCInterfaceDecl's const in some more places.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f1c97eb52e55d2d1340a0345ed91e345fddcb65d 21-Apr-2009 Chris Lattner <sabre@nondot.org> use of predefined identifiers like __func__ at global scope warn in sema,
but crashed codegen. Fix this to report the name of the llvm function.
This fixes rdar://6808051


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69658 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
525c9b7baeeff022127cd1b167579f3bda73b3ed 21-Apr-2009 Daniel Dunbar <daniel@zuster.org> Kill ASTContext::[gs]etFieldForDecl, instead we just lookup things
when we need them -- which is exactly what some code was already
doing!
- No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69648 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6bf2ae05c777052e5ec05649710380dea263e7e0 21-Apr-2009 Daniel Dunbar <daniel@zuster.org> Remove LateBoundIVars() runtime interface, it is unused.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f3ef07cbe8f154ba373f42291132048687f80bf0 18-Apr-2009 Daniel Dunbar <daniel@zuster.org> Use getAsPointerType instead of using getCanonicalType directly.
- <rdar://problem/6803995>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69435 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
26f074b249b7b113c78fad22e80b0e03289aa7d2 17-Apr-2009 Chris Lattner <sabre@nondot.org> tidy some code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b14095aa98c6fedd3625920c4ce834bcaf24d9f7 17-Apr-2009 Anders Carlsson <andersca@mac.com> Implement basic code generation of constructor calls. We can now compile:

struct S {
S(int, int);
};

void f() {
S s(10, 10);
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
aa771a838a8f39633947ccc597e11d57e2839089 14-Apr-2009 Mike Stump <mrs@apple.com> Fixup whitespacing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f0c9083c04d9c7d7aa099813f06d339bdbb5eab9 14-Apr-2009 Mike Stump <mrs@apple.com> Use hasAttr instead of getAttr for conditionals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69021 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5466c7b0ca8ce662e2c0bc295cecba2b78d6957d 14-Apr-2009 Daniel Dunbar <daniel@zuster.org> Audit __private_extern__ handling.
- Exposed quite a few Sema issues and a CodeGen crash.

- See FIXMEs in test case, and in SemaDecl.cpp (PR3983).

I'm skeptical that __private_extern__ should actually be a storage
class value. I think that __private_extern__ basically amounts to
extern A __attribute__((visibility("hidden")))
and would be better off handled (a) as that, or (b) with an extra bit
in the VarDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69020 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f33651c2d79d47d8d05908185613fe33a3e18d89 14-Apr-2009 Mike Stump <mrs@apple.com> Fixup CodeGen for __weak __block variables. Radar 6756266


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b11fa0d25d86169f0e0a29d5398116c0212bb787 13-Apr-2009 Daniel Dunbar <daniel@zuster.org> Update to use hasAttr() instead of getAttr().
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
782f397c1459ef7d8b910c0fb6b95c5f1c19c14f 09-Apr-2009 Anders Carlsson <andersca@mac.com> Use the new EmitCallArgs function. No indented functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
75c47a5cdf480571a71935cf80d49f802fec15a3 08-Apr-2009 Sanjiv Gupta <sanjiv.gupta@microchip.com> Pointer width on targets like PIC16 is 16-bit, while the valid index size to GEP is only 32 or 64. So promote index to 32 in such cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68590 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8ac67a7725ef25f5df8a992277182f51316500e6 07-Apr-2009 Anders Carlsson <andersca@mac.com> Remove some dead code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68532 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6ab187a49a42de6d351248d8a6e0206e39743a0c 07-Apr-2009 Daniel Dunbar <daniel@zuster.org> Various fixes to symbols used for Obj-C x86_64 metadata.
- Changed method names to match gcc (categories names still aren't
mangled in).

- Expose correct name for class and metadata symbols (although
-fvisibility=hidden isn't yet correct).

- Remove several things from llvm.used that didn't need to be there
(I suspect this can still be trimmed).

- Don't use asm-prefix extension for _objc_empty_{cache,vtable} (not
needed).

- Hide EH type class info with -fvisibility=hidden

- Change setGlobal[Option]Visibility to not change the visibility of
functions with internal linkage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
774e7c6881ee6cb970cd42239d700dce87ed402a 04-Apr-2009 Anders Carlsson <andersca@mac.com> Add support for calling C++ member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68412 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9034558f2f9ac1dc6bd2e74f4481ca62fce28718 24-Mar-2009 Daniel Dunbar <daniel@zuster.org> Support member reference on ?: of struct type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67603 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f1466848dce9c4c75d96a6cabdc8db560e26aac8 22-Mar-2009 Chris Lattner <sabre@nondot.org> fix CreateTempAlloca to not set a name on the alloca for temporaries
in release-assert builds. For automatic variables, explicitly set
a name with setName that does not make a temporary std::string.

This speeds up -emit-llvm-only -disable-free on PR3810 by 4.6%


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e21c4b829c9e69c20f4baab4916e05cdb786d9ae 21-Mar-2009 Chris Lattner <sabre@nondot.org> simplify and comment some code better. Make BindRuntimeGlobals
more optimistic that it will work (optimizing for the common case).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67438 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
40f929242a58103f7883e7dbe2415787895b5cbe 18-Mar-2009 Chris Lattner <sabre@nondot.org> fix the more complex cases by actually codegen'ing the right expr :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
75dfedaf702822c9e51a4f3c5d3ecf2d2ad99272 18-Mar-2009 Chris Lattner <sabre@nondot.org> add codegen support for casting an element to a union.
There are some more complex cases (_Complex and structs)
that I'm still working on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67218 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c3953a61f7e2a9919ce18d418f8b26a8612e87f2 18-Mar-2009 Chris Lattner <sabre@nondot.org> teach codegen to handle noop casts as lvalues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7976932a1c256d447316ffac58e9821417725e34 04-Mar-2009 Eli Friedman <eli.friedman@gmail.com> Minor cleanup for choose expressions: add a helper that returns the
chosen sub-expression, rather than just evaluating the condition.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dab514fc30242c7afd6c03956e46136c400fb0d3 04-Mar-2009 Mike Stump <mrs@apple.com> Improved ABI compliance for __block variables. No testcases yet as we
still give an unsupported error for them due to the fact this is a
work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
31937a5f7cb689377ff39397f4d0a8cff22d7359 02-Mar-2009 Mike Stump <mrs@apple.com> Push checking down, also, give the user a hit as to which part of the
block literal is causing the problem, instead of the vague reference
to the entire block literal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a99038c0757a836c6faeeddaa5dfd249b32f6e9e 28-Feb-2009 Mike Stump <mrs@apple.com> First cut CodeGen support for __block variables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65688 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
eaf2bb89eb2aad3b80673de30febe52df43c10ec 24-Feb-2009 Chris Lattner <sabre@nondot.org> first wave of fixes for @encode sema support. This is part of PR3648.

The big difference here is that (like string literal) @encode has
array type, not pointer type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65391 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
207c5210eb0ac7b632609f0c006eb97ef2738948 23-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> We should not generate __weak write barrier on indirect reference
of a pointer to object; This patch does this odd behavior according to
gcc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
44baa8abba2a1552b6b50bf750a8750ab9da9f76 22-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> More objc gc work. Match gcc's treatment of ivar access
true a local pointer to objective-c object in generating
write barriers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
643887ab8de731c7096f48816f19a18017d05924 22-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> local array of objects are non-gc'able.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65251 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4f676edd08bf1f1281b162107424141afe143055 21-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Handle case of none gc'able objects regardless of their
type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dd7b89788c9d8a7484fd9f5c7443d4a2e3f0f826 20-Feb-2009 Daniel Dunbar <daniel@zuster.org> Shorten; no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c0ef9f59937c3971c48b6fed37cf5bd8985c024b 20-Feb-2009 Daniel Dunbar <daniel@zuster.org> Set call attribute for direct calls (i.e. noreturn).
- Remove an unused variant of EmitCallExpr overload.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65130 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4f54526a31458c19aad19e5d3fb4ba2a5275ecb6 20-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> More objc gc's ir-gen fixes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65097 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
a223cca7751637f8ec1a860010c4148757fb4752 20-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> More objc's gc ir-gen stuff.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
167fdc137edbfe57be11317b69c35b8d6bc33cf0 19-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Generate the conservative objc gc's API for now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c1debf333186f1307cd7d086c3db3e39d7da0a12 19-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Some code simplification. ir gen for gc'able array
of objects in objc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6ec3668a2608b63473207319f5ceff9bbd22ea51 19-Feb-2009 Douglas Gregor <dgregor@apple.com> Address Chris's comments regarding C++ name mangling.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64984 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4fd83ea566f4a0c083001c84b75da6cc8c99c1d6 18-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Some refactoring and simplificaiotn of objc's gc
ir gen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64954 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5934e75d98d99374f72722a69c5eefe026f35c74 18-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Start generating gc'able code using the new
objc gc type attributes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64935 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ba372b85524f712e5b97a176f6ce0197d365835d 18-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Cleanup objc's gc attributes code no longer needed.
This make warn-weak-field.m to fail (subject of
a followup patch).
attr-objc-gc.m no passes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64925 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bb7677391a9db7d062a7cc637db8960d89ec7c93 17-Feb-2009 Daniel Dunbar <daniel@zuster.org> 80-cols.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ef2abfee3ea16ec74942dc09e9e425f46aeb2582 16-Feb-2009 Daniel Dunbar <daniel@zuster.org> Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.

- Define pow[lf]?, sqrt[lf]? as builtins.

- Add -fmath-errno option which binds to LangOptions.MathErrno

- Add new builtin flag Builtin::Context::isConstWithoutErrno for
functions which can be marked as const if errno isn't respected for
math functions. Sema automatically marks these functions as const
when they are defined, if MathErrno=0.

- IRgen uses const attribute on sqrt and pow library functions to
decide if it can use the llvm intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64689 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1bd885efe4bfeadb1980b39315b026cefe2795c3 16-Feb-2009 Chris Lattner <sabre@nondot.org> fix volatile handling with ExtVectorElementExpr, so that we
emit two volatile loads for:
typedef __attribute__(( ext_vector_type(4) )) float float4;

float test(volatile float4 *P) {
return P->x+P->y;
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2140e904dbe53657339cb5b1cc13de563ca0d1fc 16-Feb-2009 Chris Lattner <sabre@nondot.org> introduce and use a new ExtVectorElementExpr::isArrow method, at Eli's suggestion


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64681 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
73525de7fd9bdd534382dc89a24f1f76db3e04b9 16-Feb-2009 Chris Lattner <sabre@nondot.org> enhance ExtVectorElementExpr to allow V->xxyy to work like (*V).xxyy


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3c385e5f8d9008fff18597ca302be19fa86e51f6 14-Feb-2009 Douglas Gregor <dgregor@apple.com> Add hook to add attributes to function declarations that we know
about, whether they are builtins or not. Use this to add the
appropriate "format" attribute to NSLog, NSLogv, asprintf, and
vasprintf, and to translate builtin attributes (from Builtins.def)
into actual attributes on the function declaration.

Use the "printf" format attribute on function declarations to
determine whether we should do format string checking, rather than
looking at an ad hoc list of builtins and "known" function names.

Be a bit more careful about when we consider a function a "builtin" in
C++.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3e41d60eb627dc227c770f1c1c87d06909cf05fd 14-Feb-2009 Douglas Gregor <dgregor@apple.com> Implicitly declare certain C library functions (malloc, strcpy, memmove,
etc.) when we perform name lookup on them. This ensures that we
produce the correct signature for these functions, which has two
practical impacts:

1) When we're supporting the "implicit function declaration" feature
of C99, these functions will be implicitly declared with the right
signature rather than as a function returning "int" with no
prototype. See PR3541 for the reason why this is important (hint:
GCC always predeclares these functions).

2) If users attempt to redeclare one of these library functions with
an incompatible signature, we produce a hard error.

This patch does a little bit of work to give reasonable error
messages. For example, when we hit case #1 we complain that we're
implicitly declaring this function with a specific signature, and then
we give a note that asks the user to include the appropriate header
(e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In
case #2, we show the type of the implicit builtin that was incorrectly
declared, so the user can see the problem. We could do better here:
for example, when displaying this latter error message we say
something like:

'strcpy' was implicitly declared here with type 'char *(char *, char
const *)'

but we should really print out a fake code line showing the
declaration, like this:

'strcpy' was implicitly declared here as:

char *strcpy(char *, char const *)

This would also be good for printing built-in candidates with C++
operator overloading.

The set of C library functions supported by this patch includes all
functions from the C99 specification's <stdlib.h> and <string.h> that
(a) are predefined by GCC and (b) have signatures that could cause
codegen issues if they are treated as functions with no prototype
returning and int. Future work could extend this set of functions to
other C library functions that we know about.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5f2bfd4811996abb783aa6c7254c56baa6930e8c 13-Feb-2009 Douglas Gregor <dgregor@apple.com> Add basic support for C++ name mangling according to the Itanium C++
ABI to the CodeGen library. Since C++ code-generation is so
incomplete, we can't exercise much of this mangling code. However, a
few smoke tests show that it's doing the same thing as GCC. When C++
codegen matures, we'll extend the ABI tester to verify name-mangling
as well, and complete the implementation here.

At this point, the major client of name mangling is in the uses of the
new "overloadable" attribute in C, which allows overloading. Any
"overloadable" function in C (or in an extern "C" block in C++) will
be mangled the same way that the corresponding C++ function would be
mangled.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
acfde805d644bc71dfeac54ddbc9f12cdae0bb02 12-Feb-2009 Anders Carlsson <andersca@mac.com> Add support for generating block call expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5b5c9ef865607e179413462dcd71bcebb5b7daae 11-Feb-2009 Daniel Dunbar <daniel@zuster.org> Support IRgen of va_arg of structure as l-value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64325 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f63aa3fd429cdb9145d78f0b656bc78754efedb9 10-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Some refactoring of Ivar offset code gen.
in preparation for nonfragile ivar offset work.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9d9cc874bcc168474757a8f90476684b4a93ed76 10-Feb-2009 Daniel Dunbar <daniel@zuster.org> Add util Emit{LoadOf,StoreTo}Scalar methods to encapsulate conversion
from LLVM memory type to/from LLVM temporary type.
- No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
13e81737a433b23f8c662d10d1d57356122a8caa 05-Feb-2009 Daniel Dunbar <daniel@zuster.org> Pull CodeGenFunction::GetUndefRValue() out of EmitUnsupportedRValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
598d3f61b6ca854e9d3c2f3359e24468502a61aa 03-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> ir-gen for nonfragile ivar bitfield access (objc2 nonfragile abi).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63644 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
45012a7ef5abf1042c893f3f2fa5c23cb5485ea9 03-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> objc2's ir-gen for nonfragile ivar access.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
541b63b1a9db77e4a8670e9823711c2c12e58afb 03-Feb-2009 Daniel Dunbar <daniel@zuster.org> Thread CGFunctionInfo construction through CodeGenTypes.
- Inefficient & leaks memory currently, will be cleaned up subsequently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
88b5396b0897f28d22ae3debf4a0d97b33b6c362 02-Feb-2009 Daniel Dunbar <daniel@zuster.org> More ABI API cleanup.
- Lift CGFunctionInfo creation above ReturnTypeUsesSret and
EmitFunction{Epi,Pro}log.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63553 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bb36d331f439f49859efcfb4435c61762fbba6f9 02-Feb-2009 Daniel Dunbar <daniel@zuster.org> ABI handling API changes.
- Lift CGFunctionInfo creation up to callers of EmitCall.

- Move isVariadic bit out of CGFunctionInfo, take as argument to
GetFunctionType instead.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0bb20361a321593887f067515dd04cf109f4c74a 02-Feb-2009 Fariborz Jahanian <fjahanian@apple.com> Refactored code gen for ivar access in preparation for
objc2 nonfragile ivar access code gen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6fe7c8aa8c7546743ecd0ac0138c2cf5d8155386 18-Jan-2009 Nate Begeman <natebegeman@mac.com> Vector codegen improvements


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
35c33293efae24750bccdb88798361c59618d97e 13-Jan-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to implement code gen for aggrgate-valued property used
to access a field of its type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62123 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8fa73ed04dfad53696813cbd68058478d6c0becf 09-Jan-2009 Daniel Dunbar <daniel@zuster.org> Implement EmitUnsupportedRValue to generate an appropriately typed RValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ce1d38b8163650e473d7084e0686ed5a7956057b 09-Jan-2009 Daniel Dunbar <daniel@zuster.org> Give "unsupported" error on calls through block pointers instead of
crashes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1a49af9681c350fef58e677f85ccb9a77e8e9d0a 06-Jan-2009 Douglas Gregor <dgregor@apple.com> Add QualifiedDeclRefExpr, which retains additional source-location
information for declarations that were referenced via a qualified-id,
e.g., N::C::value. We keep track of the location of the start of the
nested-name-specifier. Note that the difference between
QualifiedDeclRefExpr and DeclRefExpr does have an effect on the
semantics of function calls in two ways:
1) The use of a qualified-id instead of an unqualified-id suppresses
argument-dependent lookup
2) If the name refers to a virtual function, the qualified-id
version will call the function determined statically while the
unqualified-id version will call the function determined dynamically
(by looking up the appropriate function in the vtable).

Neither of these features is implemented yet, but we do print out
qualified names for QualifiedDeclRefExprs as part of the AST printing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6183a99b064b397d98297904fbd6cf00fe1f453d 21-Dec-2008 Anders Carlsson <andersca@mac.com> Add ASTContext::getBaseElementType and use it in CodeGenFunction::EmitArraySubscriptExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61303 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8b33c087fc6d97064b6620c96c732ebc5c003fb2 21-Dec-2008 Anders Carlsson <andersca@mac.com> Handle VLA indexing

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61295 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
86f194083504938df72135b5b66bf0c5cafd9498 21-Dec-2008 Douglas Gregor <dgregor@apple.com> Add support for member references (E1.E2, E1->E2) with C++ semantics,
which can refer to static data members, enumerators, and member
functions as well as to non-static data members.

Implement correct lvalue computation for member references in C++.
Compute the result type of non-static data members of reference type properly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
efc4c4bdbd8fee90b93deb3b5cfaeb044ae22557 18-Dec-2008 Fariborz Jahanian <fjahanian@apple.com> Removed a slot in ObjCMemRegExpr used in
code gen which did not belong there.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
fd64bb635dc221baa19f81d5d2a084f7eb269f7f 15-Dec-2008 Fariborz Jahanian <fjahanian@apple.com> Code gen. for ivar references; including bitfield
ivars.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
670a62cd1d51042ea076cda5e93f26a1d8327fb3 12-Dec-2008 Chris Lattner <sabre@nondot.org> Fix rdar://6095061 - gcc allows __builtin_choose_expr as an lvalue



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d9d22dd9c94618490dbffb0e2caf222530ca39d3 24-Nov-2008 Chris Lattner <sabre@nondot.org> Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName(). This upgrades a bunch of
diags to take DeclNames instead of std::strings.

This also tweaks a couple of diagnostics to be cleaner and changes
CheckInitializerTypes/PerformInitializationByConstructor to pass
around DeclarationNames instead of std::strings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59947 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
43f447098d5e6162fbfb97ed38365284207a7fbe 22-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> Implemented ir-gen for 'implicit' properties using the new AST nodes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2ab1968eb400331ffe47c560583326e4034aed4a 21-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> Fields of ivars of struct types are considered ivars
themselves for gc API generation purposes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d1cc8040ea57775e52d23765a9a6c1fa4b75526f 20-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> Support generation of objc_assign_ivar for ivar
write-barriers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59748 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
80b0b42a09c3de8392f9ba1e24ffcc35355a8dea 20-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> Added a test case for __weak field decls. Change SetVarDeclObjCAttribute
to static function. Added comments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
2682d8b3a0415d521d5ca11afb13a8bc5c559a31 20-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> More objc gc stuff. Read/Write barriers for local static/extern,
diagnostics on use of __weak attribute on fields,
Early support for read/write barriers for objc fields.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59682 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0c43f2681b13e32171f883b6e874da1a6ae340e9 19-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> More of objective-c's gc code-gen. Treat objective-c
objects as __strong when attribute unspecified.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59654 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
dbd32c20c529430fe1d22d87317f039849b8b0bb 19-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> Few more changes due to Daniel's feedback.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59645 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ed3849b456d64d124bddc7ac044f3ce590bd9d69 19-Nov-2008 Daniel Dunbar <daniel@zuster.org> Fix redundant load of bit-fields on assignment (to get the updated
value).
- Use extra argument to EmitStoreThroughLValue to provide place to
write update bit-field value if caller requires it.
- This fixes several FIXMEs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
58626500527695865683d1d65053743de8770b60 19-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> Generate strong write barriers for __strong objects.
Also, took care of Daniel's commments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3e283e344595e0bd499b13b30a92b7d9c10a2140 18-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> Patch for generation of weak write barriers for objc
__weak objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59560 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6dc2317b59cb1180a59f6c283d96b7a5dfeb5307 18-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> Generate objc_read_weak for __weak objc loads.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59553 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6d657c4809d9128be88705d32768de007b988212 18-Nov-2008 Fariborz Jahanian <fjahanian@apple.com> Some basic support toward objective-c's GC code gen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b4609806e9232593ece09ce08b630836e825865c 14-Nov-2008 Douglas Gregor <dgregor@apple.com> Add a new expression node, CXXOperatorCallExpr, which expresses a
function call created in response to the use of operator syntax that
resolves to an overloaded operator in C++, e.g., "str1 +
str2" that resolves to std::operator+(str1, str2)". We now build a
CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But
only for binary operators, where we actually implement overloading)

I decided *not* to refactor the current CallExpr to make it abstract
(with FunctionCallExpr and CXXOperatorCallExpr as derived
classes). Doing so would allow us to make CXXOperatorCallExpr a little
bit smaller, at the cost of making the argument and callee accessors
virtual. We won't know if this is going to be a win until we can parse
lots of C++ code to determine how much memory we'll save by making
this change vs. the performance penalty due to the extra virtual
calls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59306 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
f3edc2fa81b71c32fbc3546be6c0012ff77ec07c 13-Nov-2008 Daniel Dunbar <daniel@zuster.org> Easy IRgen improvement for bitfields, don't emit x >> 0.
- Logic such as this quite possibly should be optional builder
behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59213 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
cd9b46e5442a3ef17f83f75177d8545cb5b3e2b9 04-Nov-2008 Douglas Gregor <dgregor@apple.com> Add a new expression class, ObjCSuperExpr, to handle the Objective-C 'super'. Remove ObjCThis from PredefinedExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
961b03c95dfbfb055143a25e714144976f74d2a1 18-Oct-2008 Daniel Dunbar <daniel@zuster.org> Emit more descriptive unsupported error message on dot-syntax use of super.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
662b71ee82339c67f2c3689196e716c6560cf925 17-Oct-2008 Daniel Dunbar <daniel@zuster.org> Lift CodeGenFunction::EmitPredefinedFunctioName out of EmitPredefinedLValue.
- Shouldn't assume predefined expr is a function printing one.
- Uses CGM functionality to cache function names per module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
29e0bccf2bcce22b877f8b2ed173f564c116b97e 24-Sep-2008 Daniel Dunbar <daniel@zuster.org> Refactor some CodeGen functionality:
- Add CodeGenFunction::{EmitReturnOfRValue, EmitIvarOffset}
- Factor EmitLValueForIvar out of EmitObjCIvarRefLValue.

No non-error functionality change (some unsupported errors are
degraded to asserts for the time being).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
e3a09e6ad09f8d1387ecaa008aaf85527909da0a 10-Sep-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement CodeGen support for the 'CXXConditionDeclExpr' expression node, which represents a 'condition' declaration, e.g: "if (int x=0) {...}".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
17b708d61827cd86278e9580b041dd6cbadf07d3 10-Sep-2008 Daniel Dunbar <daniel@zuster.org> Move ABI specific code for functions / calls to CGCall.cpp:
- Factor out EmitFunction{Pro,Epi}log


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56031 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
46f45b9bec4a265ad8400a538e5ec3a5683617f1 09-Sep-2008 Daniel Dunbar <daniel@zuster.org> Change CodeGen to emit calls using (RValue,Type) list:
- Add CodeGenFunction::EmitAnyExprToTemp
o Like EmitAnyExpr, but emits aggregates to a temporary location if
none is available. Seems like this should be simpler (even aside
from using first class aggregates).

- Killed CodeGenFunction::EmitCallArg (just append the pair)

- Conversion of RValues to actual call arguments is now isolated in
CodeGenFunction::EmitCall.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55970 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0dbe227feccf6a8dbadfff8ca3f80416b7bf2f28 08-Sep-2008 Daniel Dunbar <daniel@zuster.org> Refactor parameter attribute handling:
- Add CGCall.h for dealing with ABI issues related to calls.
- Add CGFunctionInfo and CGCallInfo for capturing ABI relevant
information about functions and calls.
- Isolate LLVM parameter attribute handling inside CGCall.cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
80e62c29fe21cd06c93eba6e72b7e32dca06fcf9 04-Sep-2008 Daniel Dunbar <daniel@zuster.org> Implement codegen of aggregates as lvalues in binary expressions,
e.g. "(a = b).somefield".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
7f8ea5c5b3a6a4332a841eefdd86b0726722ea7b 30-Aug-2008 Daniel Dunbar <daniel@zuster.org> Add Objective-C property setter support.
- Change Obj-C runtime message API, drop the ObjCMessageExpr arg in
favor of just result type and selector. Necessary so it can be
reused in situations where we don't want to cons up an
ObjCMessageExpr.
- Update aggregate binary assignment to know about special property
ref lvalues.
- Add CodeGenFunction::EmitCallArg overload which takes an already
emitted rvalue.

Add CodeGenFunction::StoreComplexIntoAddr.

Disabled logic in Sema for parsing Objective-C dot-syntax that
accesses methods. This code does not search in the correct order and
the AST node has no way of properly representing its results.

Updated StmtDumper to print a bit more information about
ObjCPropertyRefExprs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
19cd87eb5fb3c197e631ce08fd52c446c4d4e8f1 30-Aug-2008 Daniel Dunbar <daniel@zuster.org> Refactor handling of calls:
- Added CodeGenFunction::EmitCall which just takes the callee, return
type, and a list of (Value*,QualType) pairs.
- Added CodeGenFunction::EmitCallArg which handles emitting code for
a call argument and turning it into an appropriate
(Value*,QualType) pair.
- Changed Objective-C runtime interface so that the actual emission
of arguments for message sends is (once again) done in the code to
emit a message send.

No intended functionality change, this is prep work for better ABI
support and for Objective-C property setter support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55560 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
85c59edda02df48fae8dc85049743319bc6e7e89 29-Aug-2008 Daniel Dunbar <daniel@zuster.org> Add special "property reference" CodeGen::LValue type for emitting
Objective-C property references.
- This handles property references "more correctly" but setters still
don't work.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55534 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6ba82a4a4b295e54cf192c3e98b28f39990c6194 25-Aug-2008 Daniel Dunbar <daniel@zuster.org> Support __PRETTY_FUNCTION__ and friends in Obj-C methods.

Add CodeGenFunction::EmitUnsupportedLValue
- Gives error and returns undef value.

Swap some asserts() over to using EmitUnsupportedLValue
- Rumor has it users (and even some developers) prefer carat
diagnostics to backtraces.
- Works better in Release-Asserts to boot.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55328 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
29b7e5071c4ac0979ba907d0db78f5bd7ff83fe8 25-Aug-2008 Anders Carlsson <andersca@mac.com> Make code generation of ivar ref exprs more like member exprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
0a04d77bde7e3a661c2b41b60630d125d09ed6ef 23-Aug-2008 Daniel Dunbar <daniel@zuster.org> Implement Obj-C ivar references to aggregates.

Implement Obj-C lvalue message sends (aggregate returns).

Update several places to emit more precise ErrorUnsupported warnings
for currently unimplemented Obj-C features (main missing chunks are
property references, Obj-C exception handling, and the for ... in
syntax).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
14c80b7ed64e0eddfbe81adf5113d5be5f9964bf 23-Aug-2008 Daniel Dunbar <daniel@zuster.org> NeXT: Fix message sends which return structures.
- Simplify the sending code a bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8f2926b73ed635afecd020da787af6a837601a2b 23-Aug-2008 Daniel Dunbar <daniel@zuster.org> Trim CGObjCRuntime::GenerateMessageSend[Super]
- Returns an RValue.
- Reduced to only taking the CodeGenFunction, Expr, and Receiver.
- Becomes responsible for emitting the arguments.

Add CodeGenFunction::EmitCallExprExt
- Takes optional extra arguments to insert at the head of the call.
- This allows the Obj-C runtimes to call into this and isolates the
argument and call instruction generation code to one place. Upshot
is that we now pass structures (more) correctly.

Also, fix one aspect of generating methods which take structure
arguments (for NeXT). This probably needs to be merged with the
SetFunctionAttributes code in CodeGenModule.cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
488e993a135ce700b982bf099c3d6b856301d642 16-Aug-2008 Daniel Dunbar <daniel@zuster.org> Change WarnUnsupported to ErrorUnsupported (in name and in practice).
- We are beyond the point where this shows up often and when it does
generating miscompiled files is bad.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54836 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
6143293fa4366ee95d7e47e61bd030a34bf68b55 14-Aug-2008 Daniel Dunbar <daniel@zuster.org> Add GetAddrOfConstantCString method
- Returns addr of constant for argument + '\0'.
- I couldn't think of a better name.
- Move appropriate users of GetAddrOfConstantString to this.

Rename getStringForStringLiteral to GetStringForStringLiteral.

Add GetAddrOfConstantStringFromLiteral
- This combines GetAddrOfConstantString and
GetStringForStringLiteral. This method can be, but is not yet, more
efficient.

Change GetAddrOfConstantString to not add terminating '\0'
- <rdar://problem/6140956>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
af2f62ce32e462f256855cd24b06dec4755d2827 13-Aug-2008 Daniel Dunbar <daniel@zuster.org> Change ObjCRuntime GenerateProtocol[Ref] methods to take
ObjCProtocolDecl directly.

Implement CodeGen support for forward protocol decls (no-ops are so
nice to implement).

Also moved CGObjCRuntime.h out of CodeGenModule.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54709 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
208ff5e8a073de2a5d15cbe03cab8a4c0d935e28 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> Change CodeGenModule to only create ObjC runtime for ObjC files
- Changed CodeGenModule::getObjCRuntime to return reference.
- Added CodeGenModule::hasObjCRuntime predicate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54645 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
acc5f3e42334525bf28c86471551f83dfce222d5 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> More #include cleaning
- Kill unnecessary #includes in .cpp files. This is an automatic
sweep so some things removed are actually used, but happen to be
included by a previous header. I tried to get rid of the obvious
examples and this was the easiest way to trim the #includes in one
fell swoop.
- We now return to regularly scheduled development.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c4a1dea2dc56bd1357ec91b829a0b9e68229a13e 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> More #include cleaning
- Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h
- Moved Sema::getCurMethodDecl() out of line (dependent on
ObjCMethodDecl via dyn_cast).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
de7fb8413b13651fd85b7125d08b3c9ac2816d9d 11-Aug-2008 Daniel Dunbar <daniel@zuster.org> More #include cleaning
- Remove internal uses of AST.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1e04976fc2611d8cc06986a81deed4c42183b870 10-Aug-2008 Daniel Dunbar <daniel@zuster.org> Back out r54608 (inline string literals were getting an extra '\0')
temporarily, I assumed GetAddrForConstantString literal was being
used consistently but it doesn't look like it is.

Factored out a CodeGenModule::getStringForStringLiteral which handles
extracting a std::string for the bytes of a StringLiteral, padded to
match the type.

Update EmitLValue to use getStringForStringLiteral, this was
previously not padding strings correctly. Good thing we only emit
strings in 4 different places!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54621 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d9f6910f4ef37c0e8eeee2a01287d9572c3176ef 10-Aug-2008 Chris Lattner <sabre@nondot.org> rename PreDefinedExpr -> PredefinedExpr



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
10e3dedb6f6bf999e23700f876f7e19e650ef642 06-Aug-2008 Daniel Dunbar <daniel@zuster.org> Fix bitfield accesses which straddle the boundary of the underlying
type.

- This generates somewhat less optimal code than before but this is
not hard to rectify once stable (at the cost of slightly more
complex code).

- This currently always uses little-endian ordering of the bitfield.

- This breaks the CodeGen/bitfield.c test because it was grepping for
hard-coded assembly instructions. Will fix once a better test case
is constructed (hard to do without execution).

- This fixes SingleSource/UnitTests/2006-01-23-InitializedBitField.c
and Regression/C/PR1386.c from the test suite.

- <rdar://problem/6085090>, <rdar://problem/6094169>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c63a1f276f7b324fd9a4be82098b1c8f7bf30733 04-Aug-2008 Chris Lattner <sabre@nondot.org> Finally fix PR2189. This makes a fairly invasive but important change to
move getAsArrayType into ASTContext instead of being a method on type.
This is required because getAsArrayType(const AT), where AT is a typedef
for "int[10]" needs to return ArrayType(const int, 10).

Fixing this greatly simplifies getArrayDecayedType, which is a good sign.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54317 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
05d2fb40859bbfc081ab08379452db876545bff6 31-Jul-2008 Chris Lattner <sabre@nondot.org> Fix a regression I introduced in r54107:
http://llvm.org/viewvc/llvm-project?view=rev&revision=54107


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bd012ff1fa088181646a784f385b28867372d434 30-Jul-2008 Daniel Dunbar <daniel@zuster.org> Rework codegen emission of globals
- No (intended) functionality change.

- Primary purpose is to clearly separate (lazy) construction of
globals that are a forward declaration or tentative definition from
those that are the final definition.

- Lazy construction is now encapsulated in
GetAddrOf{Function,GlobalVar} while final definitions are
constructed in EmitGlobal{Function,Var}Definition.

- External interface for dealing with globals is now limited to
EmitGlobal and GetAddrOf{Function,GlobalVar}.

- Also updated helper functions dealing with statics, annotations,
and ctors to be private.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54179 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9619662a1d42e2008b865d3459c0677e149dad1b 27-Jul-2008 Chris Lattner <sabre@nondot.org> remove uses of QualType::getCanonicalType() from codegen for PR2189


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54107 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
b77792eabf5882cf9af8cc810599b20432fda6c2 27-Jul-2008 Chris Lattner <sabre@nondot.org> change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4111024be81e7c0525e42dadcc126d27e5bf2425 17-Jun-2008 Chris Lattner <sabre@nondot.org> Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.
Patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52422 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
5549976193e34417d4474a5f4a514268ef6666c7 17-Jun-2008 Ted Kremenek <kremenek@apple.com> This patch is motivated by numerous strict-aliasing warnings when compiling
clang as a Release build.

The big change is that all AST nodes (subclasses of Stmt) whose children are
Expr* store their children as Stmt* or arrays of Stmt*. This is to remove
strict-aliasing warnings when using StmtIterator. None of the interfaces of any
of the classes have changed (except those with arg_iterators, see below), as the
accessor methods introduce the needed casts (via cast<>). While this extra
casting may seem cumbersome, it actually adds some important sanity checks
throughout the codebase, as clients using StmtIterator can potentially overwrite
children that are expected to be Expr* with Stmt* (that aren't Expr*). The casts
provide extra sanity checks that are operational in debug builds to catch
invariant violations such as these.

For classes that have arg_iterators (e.g., CallExpr), the definition of
arg_iterator has been replaced. Instead of it being Expr**, it is an actual
class (called ExprIterator) that wraps a Stmt**, and provides the necessary
operators for iteration. The nice thing about this class is that it also uses
cast<> to type-checking, which introduces extra sanity checks throughout the
codebase that are useful for debugging.

A few of the CodeGen functions that use arg_iterator (especially from
OverloadExpr) have been modified to take begin and end iterators instead of a
base Expr** and the number of arguments. This matches more with the abstraction
of iteration. This still needs to be cleaned up a little bit, as clients expect
that ExprIterator is a RandomAccessIterator (which we may or may not wish to
allow for efficiency of representation).

This is a fairly large patch. It passes the tests (except CodeGen/bitfield.c,
which was already broken) on both a Debug and Release build, but it should
obviously be reviewed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1e692ace08959399794363e77499b73da5494af9 14-Jun-2008 Eli Friedman <eli.friedman@gmail.com> Basic support for volatile loads and stores. Stores the volatile
qualifier in the lvalue, and changes lvalue loads/stores to honor
the volatile flag. Places which need some further attention are marked
with FIXMEs.

Patch by Cédric Venet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ff4a2d9e2c1ddbf87e00e2a36ae341faf03eafb3 01-Jun-2008 Eli Friedman <eli.friedman@gmail.com> First cut at setting attributes for functions and calls; this puts us
much closer to passing the gcc struct layout tests.

It might be possible to refactor this a bit, but I'm not sure there's
actually enough common code for that to be useful.

To get the calling convention completely correct, a bit of
platform-specific code is necessary even for x86-Linux. On x86-Linux, the
alignment of function parameters is extremely strange; as far as I can tell,
it's always 4 except for SSE vectors or structs containing SSE vectors. I'm
continuing to investigate this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51839 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bfe08e093babca58d905ffe4ebbdc44647781f42 01-Jun-2008 Eli Friedman <eli.friedman@gmail.com> Minor cleanup to use the ConvertTypeForMem helper.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51837 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
1e86b34f15f0502c13750ee1d6cf338def6e2242 29-May-2008 Eli Friedman <eli.friedman@gmail.com> Rearrange EmitLValueForField a bit to work properly for _Bool bitfields
in unions (we don't want to do the union-specific bitcast for
bit-fields).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51678 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
d79a726dc3c8af61b486948c97a183c7fe5b0179 23-May-2008 Dan Gohman <gohman@apple.com> Change uses of llvm::Type::isFirstClassType to use the new
llvm::Type::isSingleValueType. Currently these two functions have
the same behavior, but soon isFirstClassType will return true for
struct and array types.

Clang may some day want to use of isFirstClassType for some of
these some day as an optimization, but it'll require some
consideration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
4f8d123e3e2c260de3377208106ddba87cee28b4 22-May-2008 Dan Gohman <gohman@apple.com> Move getAccessedFieldNo out of lib/AST/Expr.cpp into
lib/CodeGen/CGExpr.cpp and to change include/clang/AST/Attr.h to
use its own enum for visibility types instead of using
llvm::GlobalValue::VisibilityTypes. These changes eliminate
dependencies in the AST library on LLVM's VMCore library.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51398 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
788d571f4de788403d669d373e5c17b8da07b1ad 21-May-2008 Eli Friedman <eli.friedman@gmail.com> Remove an unnecessary/buggy if check. Ran into this with some other
changes in my tree, so I don't have a testcase which affects trunk.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51371 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
922696f03ec9637449e2cba260493808b4977cd3 19-May-2008 Eli Friedman <eli.friedman@gmail.com> Fix the emission of expressions like char a[10] = "asdf"; previously,
they were causing bad code to be emitted. There are two fixes here: one
makes sure we emit a string that is long enough, and one makes sure we
properly handle string initialization in init lists.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
316bb1b9eb9dc3da60e930f50c9b7578411d4966 17-May-2008 Eli Friedman <eli.friedman@gmail.com> Fix support for _Bool bitfields. The issue is that the bitfield width
used for _Bool is not the same as the primitive width (which for _Bool
is 1 bit). The load and store changes add some casts to make the
types consistent. The EmitLValue changes make sure that the pointer is
of an appropriate type for loading the bitfield.

This isn't perfect, but it's an improvement, and getting everything
right depends on actually laying out structs in an ABI-compliant way.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
06e863f2902b8ba55b056308875c19f7ba3dab25 14-May-2008 Eli Friedman <eli.friedman@gmail.com> Add codegen support for block-level compound literals.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51081 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
3b8d116703db8018f855cbb4733ace426422623b 13-May-2008 Nate Begeman <natebegeman@mac.com> Remove AST dependency on VMCore by switching ExtVectorElementExpr off Constant.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51068 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
8a99764f9b778a54e7440b1ee06a1e48f25d76d8 09-May-2008 Nate Begeman <natebegeman@mac.com> Extend vector member references to include {.hi, .lo, .e, .o} which return a
vector of the same element type and half the width, with the high, low, even,
and odd elements respectively.

Allow member references to member references, so that .hi.hi gives you the high
quarter of a vector. This is fairly convenient syntax for some insert/extract
operations.

Remove some unnecessary methods/types in the ExtVectorElementExpr class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
213541a68a3e137d11d2cefb612c6cdb410d7e8e 19-Apr-2008 Nate Begeman <natebegeman@mac.com> OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
248a753f6b670692523c99afaeb8fe98f7ae3ca7 16-Apr-2008 Steve Naroff <snaroff@apple.com> Remove FileVarDecl and BlockVarDecl. They are replaced by VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl().

This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49748 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
9b2dc287177394a8f73833e2ad4f7ca8cd6f22bb 04-Apr-2008 Chris Lattner <sabre@nondot.org> Since isComplexType() no longer returns true for _Complex integers, the code
generator needs to call isAnyComplexType(). This fixes PR1960.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49220 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
c8aa5f1f264fb230c38182adab944232bb160c2b 04-Apr-2008 Chris Lattner <sabre@nondot.org> Codegen assignment to self correctly, patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49201 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
ce5605ecf76d8cde6372138f830bb144d174ced9 31-Mar-2008 Chris Lattner <sabre@nondot.org> some cleanups on top of David's patch. There are still two
remaining open issues I've communicated to him:

1) self can be assigned to, and his patch didn't handle it correctly.
2) CollectObjCIvarTypes is N^2 (because each subclass reprocesses
all parent class ivars) and flattens classes. If A derives from B,
and both have an int, I'd expect to get { {i32}, i32}, not { i32, i32}.

David, please review.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48970 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
391d77a26382dddf25da73e29fc1fa5aaaea4c6f 31-Mar-2008 Chris Lattner <sabre@nondot.org> Add initial support for objc codegen for methods, ivars, and the
etoile runtime, patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
36b6a0a63e87803a85080c639ad8b61e8bb5f9ee 19-Mar-2008 Chris Lattner <sabre@nondot.org> simplify the clang codegen by using the new Builder.CreateStructGEP method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48534 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp
bda0b626e74513950405c27525af87e214e605e2 16-Mar-2008 Chris Lattner <sabre@nondot.org> Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it. This follows the main
llvm tree, and allows the libraries to be built in parallel. The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in. This speeds
up parallel builds, particularly incremental ones.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGExpr.cpp