summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Clarify comment.Adrian Prantl2013-05-161-4/+6
| | | | llvm-svn: 181959
* Cleanup: Use a member variable to store the SourceLocation for EH code.Adrian Prantl2013-05-161-1/+2
| | | | | | rdar://problem/13888152 llvm-svn: 181957
* CodeGen for CapturedStmtsBen Langmuir2013-05-091-0/+3
| | | | | | | | | | | | | | | | | 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 llvm-svn: 181536
* Don't crash in IRGen if a conditional with 'throw' in one of its branches isRichard Smith2013-05-071-0/+10
| | | | | | used as a branch condition. llvm-svn: 181368
* Reapply r180982 with repaired logic and an additional testcase.Adrian Prantl2013-05-031-10/+12
| | | | | | | | | | | | | | Un-break the gdb buildbot. - Use the debug location of the return expression for the cleanup code if the return expression is trivially evaluatable, regardless of the number of stop points in the function. - Ensure that any EH code in the cleanup still gets the line number of the closing } of the lexical scope. - Added a testcase with EH in the cleanup. rdar://problem/13442648 llvm-svn: 181056
* Correctly emit certain implicit references to 'self' even withinJohn McCall2013-05-031-8/+5
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 181000
* Revert "Attempt to un-break the gdb buildbot."Adrian Prantl2013-05-031-10/+10
| | | | | | This reverts commit 180982. llvm-svn: 180990
* Attempt to un-break the gdb buildbot.Adrian Prantl2013-05-031-10/+10
| | | | | | | | | | | | | - Use the debug location of the return expression for the cleanup code if the return expression is trivially evaluatable, regardless of the number of stop points in the function. - Ensure that any EH code in the cleanup still gets the line number of the closing } of the lexical scope. - Added a testcase with EH in the cleanup. rdar://problem/13442648 llvm-svn: 180982
* Ensure that the line table for functions with cleanups is sequential.Adrian Prantl2013-05-021-4/+24
| | | | | | | | | | | | | | | | If there is cleanup code, the cleanup code gets the debug location of the closing '}'. The subsequent ret IR-instruction does not get a debug location. The return _expression_ will get the debug location of the return statement. If the function contains only a single, simple return statement, the cleanup code may become the first breakpoint in the function. In this case we set the debug location for the cleanup code to the location of the return statement. rdar://problem/13442648 llvm-svn: 180932
* Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith2013-04-301-0/+3
| | | | | | | | are now two distinct canonical 'AutoType's: one is the undeduced 'auto' placeholder type, and the other is a deduced-but-dependent type. All deduced-to-a-non-dependent-type cases are still non-canonical. llvm-svn: 180789
* C++1y: Allow aggregates to have default initializers.Richard Smith2013-04-201-0/+1
| | | | | | | | | | | 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. llvm-svn: 179958
* Standardize accesses to the TargetInfo in IR-gen.John McCall2013-04-161-4/+3
| | | | | | Patch by Stephen Lin! llvm-svn: 179638
* Fix uninitialized read of CalleeWithThisReturn.Manman Ren2013-03-261-1/+2
| | | | | | | | | Initialize CalleeWithThisReturn to 0 in the constructor. Also revert r170815 since checking CalleeWithThisReturn is faster. PR15598 llvm-svn: 178053
* Simplify code. No functionality change.Benjamin Kramer2013-03-241-20/+7
| | | | llvm-svn: 177842
* Generate metadata to implement the -cl-kernel-arg-info option.Guy Benyei2013-03-241-7/+99
| | | | | | OpenCL 1.2 spec. 5.7.3. llvm-svn: 177839
* Make clang to mark static stack allocations with lifetime markers to enable ↵Nadav Rotem2013-03-231-1/+1
| | | | | | | | | a more aggressive stack coloring. Patch by John McCall with help by Shuxin Yang. rdar://13115369 llvm-svn: 177819
* Exploit this-return of a callsite in a this-return function.Manman Ren2013-03-201-0/+7
| | | | | | | | | | | | | | For constructors/desctructors that return 'this', if there exists a callsite that returns 'this' and is immediately before the return instruction, make sure we are using the return value from the callsite. We don't need to keep 'this' alive through the callsite. It also enables optimizations in the backend, such as tail call optimization. Updated from r177211. rdar://12818789 llvm-svn: 177541
* revert r177211 due to its potential issuesManman Ren2013-03-161-5/+0
| | | | llvm-svn: 177222
* Exploit this-return of a callsite in a this-return function.Manman Ren2013-03-161-0/+5
| | | | | | | | | | | | | For constructors/desctructors that return 'this', if there exists a callsite that returns 'this' and is immediately before the return instruction, make sure we are using the return value from the callsite. We don't need to keep 'this' alive through the callsite. It also enables optimizations in the backend, such as tail call optimization. rdar://12818789 llvm-svn: 177211
* ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose2013-03-081-6/+3
| | | | | | No (intended) functionality change. llvm-svn: 176726
* Add support for the OpenCL attribute 'vec_type_hint'.Joey Gouly2013-03-081-0/+17
| | | | | | Patch by Murat Bolat! llvm-svn: 176686
* Change hasAggregateLLVMType, which conflates complex andJohn McCall2013-03-071-31/+39
| | | | | | | | | | | | | | | 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. llvm-svn: 176656
* Use the actual ABI-determined C calling convention for runtimeJohn McCall2013-02-281-4/+7
| | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 176286
* Prefer 'and' over '&' in comments.David Blaikie2013-02-231-3/+4
| | | | | | Post commit code review feedback from Matt Beaumont-Gay on r174248. llvm-svn: 175969
* Re-apply r174919 - smarter copy/move assignment/construction, with fixes forLang Hames2013-02-171-0/+5
| | | | | | | | | | | bitfield related issues. The original commit broke Takumi's builder. The bug was caused by bitfield sizes being determined by their underlying type, rather than the field info. A similar issue with bitfield alignments showed up on closer testing. Both have been fixed in this patch. llvm-svn: 175389
* Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058Timur Iskhodzhanov2013-02-131-2/+3
| | | | llvm-svn: 175045
* Backing out r174919 while I investigate a self-host bug on Takumi's builder.Lang Hames2013-02-121-5/+0
| | | | llvm-svn: 174925
* When generating IR for default copy-constructors, copy-assignment operators,Lang Hames2013-02-111-0/+5
| | | | | | | | | | | | | | | | | | | | move-constructors and move-assignment operators, use memcpy to copy adjacent POD members. Previously, classes with one or more Non-POD members would fall back on element-wise copies for all members, including POD members. This often generated a lot of IR. Without padding metadata, it wasn't often possible for the LLVM optimizers to turn the element-wise copies into a memcpy. This code hasn't yet received any serious tuning. I didn't see any serious regressions on a self-hosted clang build, or any of the nightly tests, but I think it's important to get this out in the wild to get more testing. Insights, feedback and comments welcome. Many thanks to David Blaikie, Richard Smith, and especially John McCall for their help and feedback on this work. llvm-svn: 174919
* Revert r174246, accidentally committed.David Blaikie2013-02-021-1/+0
| | | | | | This reverts commit 1513eb9284c23acfd19cf742b95996fbb11ca741. llvm-svn: 174249
* Sentenc-ify comment added in r174206.David Blaikie2013-02-021-2/+2
| | | | | | Based on post-commit review by Paul Robinson. llvm-svn: 174248
* BasicsDavid Blaikie2013-02-021-0/+1
| | | | llvm-svn: 174246
* Fix exception handling line table problems introduced by r173593David Blaikie2013-02-011-6/+9
| | | | | | | | | | | | | r173593 made us a little too eager to associate all code at the end of a function with the user-written 'return' line. This caused problems with breakpoints as they'd be set in exception handling code preceeding the actual non-exception return handling code, leading to the breakpoint never being hit in non-exceptional execution. This change restores the pre-r173593 exception handling line information where the cleanup code is associated with the '}' not the return line. llvm-svn: 174206
* PR14566: Debug Info: avoid top level lexical blocks in functionsDavid Blaikie2013-01-261-6/+10
| | | | | | | | | | | | | | | One of the gotchas (see changes to CodeGenFunction) was due to the fix in r139416 (for PR10829). This only worked previously because the top level lexical block would set the location to the end of the function, the debug location would be updated (as per r139416), the location would be set to the end of the function again (but that would no-op, since it was the same as the previous location), then the return instruction would be emitted using the debug location. Once the top level lexical block was no longer emitted, the end-of-function location change was causing the debug loc to be updated, regressing that bug. llvm-svn: 173593
* [ubsan] Add support for -fsanitize-blacklistWill Dietz2013-01-181-6/+12
| | | | llvm-svn: 172808
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-4/+4
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-4/+4
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
* Rename llvm::Attributes to llvm::Attribute.Bill Wendling2012-12-201-1/+1
| | | | llvm-svn: 170722
* Revert r170500. It over-zealously converted *ALL* things named Attributes, ↵Bill Wendling2012-12-201-1/+1
| | | | | | which is wrong here. llvm-svn: 170721
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-1/+1
| | | | | | single attribute in the future. llvm-svn: 170500
* Unbreak the clang build after r169712.Benjamin Kramer2012-12-091-3/+3
| | | | llvm-svn: 169713
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-4/+4
| | | | | | | | | | | | | 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. llvm-svn: 169237
* Have clang use LLVM IR's fast-math flags when in FastMath or FiniteMathOnly ↵Michael Ilseman2012-12-041-0/+10
| | | | | | modes. Test cases included. llvm-svn: 169191
* remove trailing whitespaceMichael Ilseman2012-12-041-32/+32
| | | | llvm-svn: 169187
* [ubsan] Add flag to enable recovery from checks when possible.Will Dietz2012-12-021-2/+3
| | | | llvm-svn: 169114
* Simplify code. No functionality change.Benjamin Kramer2012-11-151-18/+12
| | | | llvm-svn: 168047
* When evaluating variably modified types for function parameters, dig out theEli Friedman2012-11-141-1/+10
| | | | | | | | | | type as written from the ParmVarDecl; it's unclear whether the standard (C99 6.9.1p10) requires this, but we're following the precedent set by gcc, and hopefully nobody will ever ask about this again. PR9559 / <rdar://problem/12621983>. llvm-svn: 167985
* Use the individual -fsanitize=<...> arguments to control which of the UBSanRichard Smith2012-11-051-4/+7
| | | | | | | checks to enable. Remove frontend support for -fcatch-undefined-behavior, -faddress-sanitizer and -fthread-sanitizer now that they don't do anything. llvm-svn: 167413
* Simplify: replace getContext().getLangOpts() with just getLangOpts().Richard Smith2012-11-011-5/+5
| | | | llvm-svn: 167261
* Cleanup some clang code to use new type functions instead of using cast<>.Micah Villmow2012-10-251-2/+1
| | | | llvm-svn: 166684
* Switch CodeGenOptions over to a .def file, like we do with LangOptions.Douglas Gregor2012-10-231-1/+1
| | | | llvm-svn: 166497
OpenPOWER on IntegriCloud