summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Give explicit sections for string constants used in NSStrings.Rafael Espindola2014-01-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without them they can be merged with non unnamed_addr constants during LTO. The resulting constant is not unnamed_addr and goes in a different section, which causes ld64 to crash. A testcase that would crash before: * file1.mm: void g(id notification) { [notification valueForKey:@"name"]; } * file2.cpp: extern const char js_name_str[] = "name"; * file3.cpp extern bool JS_GetProperty(const char *name); extern const char js_name_str[]; bool js_ReportUncaughtException() { JS_GetProperty(js_name_str); } run clang file1.mm -o file1.o -c -w -emit-llvm clang file2.cpp -o file2.o -c -w -emit-llvm clang file3.cpp -o file3.o -c -w ld -dylib -o XUL file1.o file2.o file3.o -undefined dynamic_lookup. llvm-svn: 199688
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-206-36/+36
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. llvm-svn: 199686
* Simplify further.Rafael Espindola2014-01-201-7/+5
| | | | | | Thanks to David Blaikie for the push. llvm-svn: 199685
* Remove virtual methods that were added in 2009 and still had 1 implementation.Rafael Espindola2014-01-201-7/+9
| | | | llvm-svn: 199665
* Refactor ABI argument lowering a littleReid Kleckner2014-01-181-57/+60
| | | | | | | | | Currently it tracks the number of free registers, but soon it will track stack offsets for inalloca lowering. No functional change. llvm-svn: 199532
* Revert "Revert r199416, "MS ABI: Improve selection of an inheritance model""David Majnemer2014-01-171-39/+50
| | | | | | | | | | This reverts commit r199475 (which reverted r199416) with fixes for the breakages. We wouldn't lock an inheritance model if we saw a pointer-to-member formed as a result of the address-of operator. llvm-svn: 199482
* Revert r199416, "MS ABI: Improve selection of an inheritance model"NAKAMURA Takumi2014-01-171-50/+39
| | | | | | | | | | | | It broke tests for targeting x86_64-pc-win32: Clang Tools :: clang-modernize/LoopConvert/array.cpp Clang :: CodeGenCXX/2010-05-10-Var-DbgInfo.cpp Clang :: CodeGenCXX/member-call-parens.cpp Clang :: CodeGenCXX/ptr-to-datamember.cpp Clang :: SemaTemplate/instantiate-function-1.cpp llvm-svn: 199475
* Debug info: Refactor NoLocation and ArtificialLocation to use a common baseAdrian Prantl2014-01-174-31/+39
| | | | | | | | | class and use it pervasively to restore debug locations. Fixes an interaction between cleanup and EH that caused the location to not be restored properly after emitting a landing pad. rdar://problem/15208190 llvm-svn: 199444
* MS ABI: Improve selection of an inheritance modelDavid Majnemer2014-01-161-39/+50
| | | | | | | | | | | | | | | | | | | | | | | | The MSVC ABI is rather finicky about the exact representation of it's pointer-to-member representation. The exact position of when and where it will go with one representation versus another appears to be when it desires the pointer-to-member to be complete. To properly implement this in clang, do several things: - Give up on tracking the polymorphic nature of the class. It isn't useful to Sema and is only pertinent when choosing CodeGen-time details like whether the field-offset can be 0 instead of -1. - Insist on locking-in the inheritance model when we ask our pointer-to-member type to be complete. From there, grab the underlying CXXRecordDecl and try to make *that* complete. Once we've done this, we can calculate it's inheritance model and apply it using an attribute. N.B. My first bullet point is a lie. We will eventually care about the specifics of whether or not a CXXRecordDecl is or is not polymorphic because MSVC compatible mangling of such things depends on it. However, I believe we will handle this in a rather different way. llvm-svn: 199416
* [asan] Remove -fsanitize-address-zero-base-shadow command lineEvgeniy Stepanov2014-01-161-4/+2
| | | | | | | | | | | | | | | | flag from clang, and disable zero-base shadow support on all platforms where it is not the default behavior. - It is completely unused, as far as we know. - It is ABI-incompatible with non-zero-base shadow, which means all objects in a process must be built with the same setting. Failing to do so results in a segmentation fault at runtime. - It introduces a backward dependency of compiler-rt on user code, which is uncommon and complicates testing. This is the Clang part of a larger change. llvm-svn: 199372
* Make -fno-inline attach NoInline attribute to all functions that are notRoman Divacky2014-01-151-3/+8
| | | | | | | | | | marked as AlwaysInline or ForceInline. This moves us to what gcc does with -fno-inline. The attribute approach was discussed to be better than switching to InlineAlways inliner in presence of LTO. llvm-svn: 199324
* CodeGen: Simplify CodeGenFunction::EmitCaseStmtJustin Bogner2014-01-153-52/+0
| | | | | | | | | | | | | Way back in r129652 we tried to avoid emitting an empty block at -O0 for switch cases that did nothing but break. This led to a poor debugging experience as reported in PR9796, so we disabled the optimization for -O0 but left it in for higher optimization levels in r154420. Since the whole point of this was to improve -O0, it's silly to keep the complexity at all. llvm-svn: 199302
* Improve comment.Fariborz Jahanian2014-01-141-3/+3
| | | | llvm-svn: 199258
* ObjectiveC. add comment.Fariborz Jahanian2014-01-141-3/+3
| | | | llvm-svn: 199257
* Simplifying the OpenCL image attribute. It does not need a semantic integer ↵Aaron Ballman2014-01-141-2/+2
| | | | | | parameter because the required information is encoded in the spelling. Added an appropriate subject to the attribute, and simplified the semantic checking (which will likely be expanded upon in a future patch). Also, removed the GNU spelling since it was unsupported in the first place. llvm-svn: 199229
* Update CodeGen to use DLL storage class for dllimport/dllexportNico Rieck2014-01-141-9/+17
| | | | | | | With the old linkage types removed, set the linkage to external for both dllimport and dllexport to reflect what's currently supported. llvm-svn: 199220
* [ms-abi] Remove duplicated vbptr offset codeReid Kleckner2014-01-141-39/+5
| | | | | | | | | Record layout will tell us the offset of a shared vbptr inside a non-virtual base. No functionality change. llvm-svn: 199171
* [ms-abi] Always generate complete constructors in the Microsoft C++ ABIReid Kleckner2014-01-132-5/+11
| | | | | | | | Fixes PR18435, where we generated a base ctor instead of a complete ctor, and so failed to construct virtual bases when constructing the complete object. llvm-svn: 199160
* CodeGen: Clarify a comment about PGO in case statement rangesJustin Bogner2014-01-131-3/+4
| | | | llvm-svn: 199140
* CodeGen: Rename adjustFallThroughCount -> adjustForControlFlowJustin Bogner2014-01-137-24/+24
| | | | | | | | adjustFallThroughCount isn't a good name, and the documentation was even worse. This commit attempts to clarify what it's for and when to use it. llvm-svn: 199139
* CodeGen: Introduce CodeGenPGO::setCurrentRegionUnreachableJustin Bogner2014-01-133-9/+13
| | | | | | | | There are a number of places where we do PGO.setCurrentRegionCount(0) directly after an unconditional branch. Give this operation a name so that it's clearer why we're doing this. llvm-svn: 199138
* CodeGen: Remove a superfluous setCurrentRegionCountJustin Bogner2014-01-131-1/+0
| | | | | | | | This call looks like it was an artifact of an earlier change, and doesn't actually make sense. We begin a new region immediately anyway, so it was mostly harmless. llvm-svn: 199137
* CodeGen: Remove some unnecessary bracesJustin Bogner2014-01-131-2/+1
| | | | llvm-svn: 199136
* Update for getLazyBitcodeModule API change.Rafael Espindola2014-01-131-3/+5
| | | | llvm-svn: 199126
* [cleanup] Update the include of Dominators.h to reflect its move to theChandler Carruth2014-01-131-1/+1
| | | | | | IR library in LLVM r199082. llvm-svn: 199083
* [PM] Update Clang to reflect the new header for the bitcode writer passChandler Carruth2014-01-131-1/+1
| | | | | | added in LLVM r199078. llvm-svn: 199079
* [PM] Update the creation of an IR printing pass to reflect the APIChandler Carruth2014-01-121-1/+1
| | | | | | update in LLVM r199044. llvm-svn: 199045
* [PM] Update Clang to follow the header rename in LLVM r199041.Chandler Carruth2014-01-121-1/+1
| | | | llvm-svn: 199042
* SPARC passes non-trivial C++ objects indirectly like everybody else.Jakob Stoklund Olesen2014-01-121-0/+5
| | | | llvm-svn: 199037
* PR12208: Under -fno-elide-constructors, don't forget to actually copy an NRVORichard Smith2014-01-111-1/+2
| | | | | | | variable to the return slot. Patch by David Wiberg, with test case alterations by me. llvm-svn: 198991
* CGRecordLayoutBuilder.cpp: Clarify if-else. [-Wdangling-else]NAKAMURA Takumi2014-01-101-1/+2
| | | | llvm-svn: 198906
* [ms-abi] Fixing CGRecordLayoutBuilder w.r.t. MS NonVirutalBase LayoutWarren Hunt2014-01-091-1/+75
| | | | | | | | | | | | | | The MS abi lays out *all* non-virtual bases with leading vfptrs before laying out non-virutal bases without vfptrs. This guarantees that the primary base is laid out first. r198818 fixed RecordLayoutBuilder to produce compatiable layouts. This patch fixes CGRecordLayoutBuilder to be able to consume those layouts and produce meaningful output without tripping any asserts about assumed incoming layout. A test case is included that shows CGRecordLayoutBuilder in fact produces output in the compatiable order. llvm-svn: 198900
* Use getPointerSizeInBits.Rafael Espindola2014-01-091-2/+3
| | | | | | | I introduced this bug in 198815. Thanks for Mark Lacey for noticing. Unfortunately, I have no idea how to test this code. llvm-svn: 198891
* The OpenCL specification states that images are allocated Pekka Jaaskelainen2014-01-092-9/+17
| | | | | | | | | | | from the global address space (6.5.1 of the OpenCL 1.2 specification). This makes clang construct the image arguments in the global address space and generate the argument metadata with the correct address space descriptor. Patch by Pedro Ferreira! llvm-svn: 198868
* Fix leak in lib/CodeGen/CGException.cpp, PR18318Kostya Serebryany2014-01-092-0/+10
| | | | | | | | | | | | | | Summary: This fixes the leak described in http://llvm.org/bugs/show_bug.cgi?id=18318 Reviewers: chandlerc, dblaikie Reviewed By: chandlerc CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2474 llvm-svn: 198857
* [ms-abi] Refactor Microsoft Record LayoutWarren Hunt2014-01-092-3/+3
| | | | | | | | | This patch refactors microsoft record layout to be more "natural". The most dominant change is that vbptrs and vfptrs are injected after the fact. This simplifies the implementation and the math for the offest for the first base/field after the vbptr. llvm-svn: 198818
* Used the DataLayout methods instead of the Module methods.Rafael Espindola2014-01-091-4/+2
| | | | llvm-svn: 198815
* Re-applying r198699 after reverting r198461.Adrian Prantl2014-01-071-1/+2
| | | | | | | | Debug info: Implement a cleaner version of r198461. For symmetry with C and C++ don't emit an extra lexical scope for the compound statement that is the body of an Objective-C method. llvm-svn: 198715
* Revert "Debug info: Ensure that the last stop point in a function is still ↵Adrian Prantl2014-01-075-16/+8
| | | | | | | | within" This reverts commit r198461. llvm-svn: 198714
* Revert "Debug info: Implement a cleaner version of r198461. For symmetry with"Adrian Prantl2014-01-076-10/+15
| | | | | | This reverts commit 198699 so we can get a cleaner patch. llvm-svn: 198713
* Debug info: Implement a cleaner version of r198461. For symmetry withAdrian Prantl2014-01-076-15/+10
| | | | | | | | | C and C++ don't emit an extra lexical scope for the compound statement that is the body of an Objective-C method. rdar://problem/15010825 llvm-svn: 198699
* Remove unused include.Rafael Espindola2014-01-071-1/+0
| | | | llvm-svn: 198692
* Update Clang for the move of headers in r198688.Chandler Carruth2014-01-071-1/+1
| | | | llvm-svn: 198689
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-0711-12/+11
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Fix a -Wparentheses warning from GCC that caught a badly formed assert.Chandler Carruth2014-01-071-1/+1
| | | | | | | I have no idea why Clang's warning doesn't fire here, looks like a Clang bug. I'll investigate that separately. llvm-svn: 198677
* CodeGen: Include llvm/Config/config.h for strtoll on WindowsJustin Bogner2014-01-071-0/+1
| | | | llvm-svn: 198672
* update comment.Adrian Prantl2014-01-071-1/+1
| | | | llvm-svn: 198670
* Implement a new -fstandalone-debug option. rdar://problem/15685848Adrian Prantl2014-01-071-6/+6
| | | | | | | | | | | | | | It controls everything that -flimit-debug-info used to, plus the vtable type optimization. The old -fno-limit-debug-info option is now an alias to -fstandalone-debug and vice versa. Standalone is the default on Darwin until dtrace is updated to work with non-standalone debug info (rdar://problem/15758808). Note: I kept the LimitedDebugInfo name in CodeGenOptions::DebugInfoKind because NoStandaloneDebugInfo sounded even more confusing. llvm-svn: 198655
* CodeGen: Sentences end with a periodJustin Bogner2014-01-073-4/+4
| | | | llvm-svn: 198649
* Properly sort CMake list. NFC.Ted Kremenek2014-01-061-6/+6
| | | | llvm-svn: 198645
OpenPOWER on IntegriCloud