summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [AMDGPU] Switch to the new addr space mapping by defaultYaxun Liu2018-02-0216-299/+286
| | | | | | | | This requires corresponding llvm change. Differential Revision: https://reviews.llvm.org/D40956 llvm-svn: 324102
* [CodeGen][va_args] Correct Vector Struct va-arg 'in_reg' code genErich Keane2018-02-022-6/+138
| | | | | | | | | | | | | | | | | | | | | | | | | When trying to track down a different bug, we discovered that calling __builtin_va_arg on a vec3f type caused the SROA pass to issue a warning that there was an illegal access. Further research showed that the vec3f type is alloca'ed as size '12', but the _builtin_va_arg code on x86_64 was always loading this out of registers as {double, double}. Thus, the 2nd store into the vec3f was storing in bytes 12-15! This patch alters the original implementation which always assumed {double, double} to use the actual coerced type instead, so the LLVM-IR generated is a load/GEP/store of a <2 x float> and a float, rather than a double and a double. Tests were added for all combinations I could think of that would fit in 2 FP registers, and all work exactly as expected. Differential Revision: https://reviews.llvm.org/D42811 llvm-svn: 324098
* [Index] fix USR generation for namespace{extern{X}}Sam McCall2018-02-022-1/+10
| | | | llvm-svn: 324093
* [AST] namespace ns { extern "C" { int X; }} prints as "ns::X", not as "X"Sam McCall2018-02-022-3/+11
| | | | llvm-svn: 324081
* [Sema] Add implicit members even for invalid CXXRecordDeclsIlya Biryukov2018-02-023-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It should be safe, since other code paths are already generating implicit members even in invalid CXXRecordDecls (e.g. lookup). If we don't generate implicit members on CXXRecordDecl's completion, they will be generated by next lookup of constructors. This causes a crash when the following conditions are met: - a CXXRecordDecl is invalid, - it is provided via ExternalASTSource (e.g. from PCH), - it has inherited constructors (they create ShadowDecls), - lookup of its constructors was not run before ASTWriter serialized it. This may require the ShadowDecls created for inherited constructors to be removed from the class, but that's no longer possible since class is provided by ExternalASTSource. See provided lit test for an example. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42810 llvm-svn: 324062
* [MinGW] Emit typeinfo locally for dllimported classes without key functionsMartin Storsjo2018-02-023-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | This fixes building Qt as shared libraries with clang in MinGW mode; previously subclasses of the QObjectData class (in other DLLs than the base DLL) failed to find the typeinfo symbols (that neither were emitted in the base DLL nor in the DLL containing the subclass). If the virtual destructor in the newly added testcase wouldn't be pure (or if there'd be another non-pure virtual method), it'd be a key function and things would work out even before this change. Make sure to locally emit the typeinfo for these classes as well. This matches what GCC does in this specific testcase. This fixes the root issue that spawned PR35146. (The difference to GCC that is initially described in that bug still is present though.) Differential Revision: https://reviews.llvm.org/D42641 llvm-svn: 324059
* [analyzer] Fix transitions in check::PreStmt<MemberExpr> checker callback.Artem Dergachev2018-02-021-5/+4
| | | | | | | | | | | No in-tree checkers use this callback so far, hence no tests. But better fix this now than remember to fix this when the checkers actually appear. Patch by Henry Wong! Differential Revision: https://reviews.llvm.org/D42785 llvm-svn: 324053
* [analyzer] Expose return statement from CallExit program pointGeorge Karpenkov2018-02-025-5/+52
| | | | | | | | | | | | | | | | If the return statement is stored, we might as well allow querying against it. Also fix the bug where the return statement is not stored if there is no return value. This change un-merges two ExplodedNodes during call exit when the state is otherwise identical - the CallExitBegin node itself and the "Bind Return Value"-tagged node. And expose the return statement through getStatement helper function. Differential Revision: https://reviews.llvm.org/D42130 llvm-svn: 324052
* Remove the change which accidentally crept in into the cherry-pickGeorge Karpenkov2018-02-021-1/+0
| | | | llvm-svn: 324050
* [analyzer] Expose exploration strategy through analyzer options.George Karpenkov2018-02-028-13/+74
| | | | | | Differential Revision: https://reviews.llvm.org/D42774 llvm-svn: 324049
* [analyzer] Fix yet-another-crash in body-farming std::call_onceGeorge Karpenkov2018-02-022-2/+54
| | | | | | | | | | | | | | Crash occurs when parameters to the callback and to std::call_once mismatch, and C++ is supposed to auto-construct an argument. Filed by Alexander Kornienko in https://bugs.llvm.org/show_bug.cgi?id=36149 rdar://37034403 Differential Revision: https://reviews.llvm.org/D42777 llvm-svn: 324046
* [coroutines] Fix application of NRVO to Coroutine "Gro" or return object.Eric Fiselier2018-02-013-5/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fix NRVO for Gro variable. Previously, we only marked the GRO declaration as an NRVO variable when its QualType and the function return's QualType matched exactly (using operator==). However, this was incorrect for two reasons: 1. We were marking non-class types, such as ints, as being NRVO variables. 2. We failed to handle cases where the canonical types were the same, but the actual `QualType` objects were different. For example, if one was represented by a typedef. (Example: https://godbolt.org/g/3UFgsL) This patch fixes these bugs by marking the Gro variable as supporting NRVO only when `BuildReturnStmt` marks the Gro variable as a coroutine candidate. Reviewers: rsmith, GorNishanov, nicholas Reviewed By: GorNishanov Subscribers: majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D42343 llvm-svn: 324037
* [analyzer] [tests] [NFC] Remove dead code from CmpRunsGeorge Karpenkov2018-02-011-21/+6
| | | | | | | | | | Indeed, "CHANGE" is not a thing yet, and we should probably not carry around dead code which does not do anything apart from confusing the reader. Differential Revision: https://reviews.llvm.org/D42819 llvm-svn: 324027
* [analyzer] [tests] Add an option to show the histogram of path differences ↵George Karpenkov2018-02-011-2/+42
| | | | | | | | between the analyzer runs Differential Revision: https://reviews.llvm.org/D42778 llvm-svn: 324021
* [analyzer] Don't communicate evaluation failures through memregion hierarchy.Artem Dergachev2018-02-014-53/+72
| | | | | | | | | | | | | | | | | | | | | | | We use CXXTempObjectRegion exclusively as a bailout value for construction targets when we are unable to find the correct construction region. Sometimes it works correctly, but rather accidentally than intentionally. Now that we want to increase the amount of situations where it works correctly, the first step is to introduce a different way of communicating our failure to find the correct construction region. EvalCallOptions are introduced for this purpose. For now EvalCallOptions are communicating two kinds of problems: - We have been completely unable to find the correct construction site. - We have found the construction site correctly, and there's more than one of them (i.e. array construction which we currently don't support). Accidentally find and fix a test in which the new approach to communicating failures produces better results. Differential Revision: https://reviews.llvm.org/D42457 llvm-svn: 324018
* PR36157: When injecting an implicit function declaration in C89, find the rightRichard Smith2018-02-013-0/+23
| | | | | | | | DeclContext rather than injecting it wherever we happen to be. This avoids creating functions whose DeclContext is a struct or similar. llvm-svn: 323998
* Mark fallthrough with LLVM_FALLTHROUGHAdrian Prantl2018-02-011-1/+1
| | | | llvm-svn: 323986
* Reverting patch rL323952 due to build errors that ISander de Smalen2018-02-0123-207/+75
| | | | | | haven't encountered in local builds. llvm-svn: 323956
* [DebugInfo] Enable debug information for C99 VLA typesSander de Smalen2018-02-0123-75/+207
| | | | | | | | | | | | | | | | | | | | | Summary: This patch enables debugging of C99 VLA types by generating more precise LLVM Debug metadata, using the extended DISubrange 'count' field that takes a DIVariable. This should implement: Bug 30553: Debug info generated for arrays is not what GDB expects (not as good as GCC's) https://bugs.llvm.org/show_bug.cgi?id=30553 Reviewers: echristo, aprantl, dexonsmith, clayborg, pcc, kristof.beyls, dblaikie Reviewed By: aprantl Subscribers: jholewinski, schweitz, davide, fhahn, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D41698 llvm-svn: 323952
* [CodeGen] Fix an assertion failure in CGRecordLowering.Akira Hatanaka2018-02-012-2/+50
| | | | | | | | | | | | | | This patch fixes a bug in CGRecordLowering::accumulateBitFields where it unconditionally starts a new run and emits a storage field when it sees a zero-sized bitfield, which causes an assertion in insertPadding to fail when -fno-bitfield-type-align is used. It shouldn't emit new storage if UseZeroLengthBitfieldAlignment and UseBitFieldTypeAlignment are both false. rdar://problem/36762205 llvm-svn: 323943
* [analyzer] [tests] Show the number of removed/added bug reportsGeorge Karpenkov2018-02-011-0/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D42718 llvm-svn: 323941
* PR36181: Teach CodeGen to properly ignore requests to emit dependent entities.Richard Smith2018-02-014-17/+29
| | | | | | | Previously, friend function definitions within class templates slipped through the gaps and caused the MS mangler to assert. llvm-svn: 323935
* [PR32482] Fix bitfield layout for -mms-bitfield and pragma packAlex Lorenz2018-01-313-3/+62
| | | | | | | | | | | The patch ensures that a new storage unit is created when the new bitfield's size is wider than the available bits. rdar://36343145 Differential Revision: https://reviews.llvm.org/D42660 llvm-svn: 323921
* [clang-format] Align preprocessor comments with #Mark Zeren2018-01-312-24/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: r312125, which introduced preprocessor indentation, shipped with a known issue where "indentation of comments immediately before indented preprocessor lines is toggled on each run". For example these two forms toggle: #ifndef HEADER_H #define HEADER_H #if 1 // comment # define A 0 #endif #endif #ifndef HEADER_H #define HEADER_H #if 1 // comment # define A 0 #endif #endif This happens because we check vertical alignment against the '#' yet indent to the level of the 'define'. This patch resolves this issue by aligning against the '#'. Reviewers: krasimir, klimek, djasper Reviewed By: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42408 llvm-svn: 323904
* Clarify that optimization levels -O2 and above are recommended for use of PGO.Eric Christopher2018-01-311-1/+2
| | | | llvm-svn: 323902
* [WebAssembly] Don't pass -ffunction-section/-fdata-sectionsSam Clegg2018-01-313-35/+6
| | | | | | | | | llvm currently forces both of these to true to passing them is redundant. Differential Revision: https://reviews.llvm.org/D37831 llvm-svn: 323897
* Revert "[AMDGPU] Add ds_fadd, ds_fmin, ds_fmax builtins functions"Daniil Fukalov2018-01-312-23/+0
| | | | | | | | This reverts https://reviews.llvm.org/rL323890 This reverts commit 251524ebd8c346a936f0e74b09d609d49fbaae4a. llvm-svn: 323896
* Revert "Revert rC322769: [RISCV] Propagate -mabi and -march values to GNU ↵Ana Pazos2018-01-312-0/+31
| | | | | | | | | | | | | | | | assembler." Summary: Bringing back the code change and simplified test cases to test 32/64 bit targets. Reviewers: asb, yroux, inouehrs, mgrang Reviewed By: yroux, inouehrs Subscribers: cfe-commits, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD Differential Revision: https://reviews.llvm.org/D42666 llvm-svn: 323894
* [AMDGPU] Add ds_fadd, ds_fmin, ds_fmax builtins functionsDaniil Fukalov2018-01-312-0/+23
| | | | | | | | Reviewed by arsenm Differential Revision: https://reviews.llvm.org/D42578 llvm-svn: 323890
* Fix typo. NFCJonathan Roelofs2018-01-311-1/+1
| | | | llvm-svn: 323864
* [clang-format] Adds space around braces in text protosKrasimir Georgiev2018-01-314-37/+38
| | | | | | | | | | | | | | | | | Summary: This patch modifies the text proto Google style to add spaces around braces. I investigated using something different than Cpp11BracedListStyle, but it turns out it's what we want and also the java and js styles also depend on that. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42685 llvm-svn: 323860
* [CUDA] Detect installation in PATHJonas Hahnfeld2018-01-3114-34/+168
| | | | | | | | | | | | | | | | If the CUDA toolkit is not installed to its default locations in /usr/local/cuda, the user is forced to specify --cuda-path. This is tedious and the driver can be smarter if well-known tools (like ptxas) can already be found in the PATH environment variable. Add option --cuda-path-ignore-env if the user wants to ignore set environment variables. Also use it in the tests to make sure the driver always finds the same CUDA installation, regardless of the user's environment. Differential Revision: https://reviews.llvm.org/D42642 llvm-svn: 323848
* [analyzer] Extend SuppressInlineDefensiveChecksVisitor to all macros, ↵George Karpenkov2018-01-303-59/+120
| | | | | | | | | | | | including non-function-like ones No reason to treat function-like macros differently here. Tracked in rdar://29907377 Differential Revision: https://reviews.llvm.org/D42444 llvm-svn: 323827
* Revert "CodeGen: annotate ObjC ARC functions with ABI constraints"Akira Hatanaka2018-01-302-32/+11
| | | | | | | | This reverts commit r294872. Although this patch is correct, it caused the objc_autoreleaseRValue/objc_retainAutoreleasedReturnValue llvm-svn: 323814
* Revert "[coroutines] Fix application of NRVO to Coroutine "Gro" or return ↵Eric Fiselier2018-01-303-89/+5
| | | | | | | | | object." This reverts commit r323712. It's causing some test failures on certain machines. Not sure why, will investigate. llvm-svn: 323717
* [CUDA] Added partial support for CUDA-9.1Artem Belevich2018-01-308-32/+1872
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang can use CUDA-9.1 now, though new APIs (are not implemented yet. The major change is that headers in CUDA-9.1 went through substantial changes that started in CUDA-9.0 which required substantial changes in the cuda compatibility headers provided by clang. There are two major issues: * CUDA SDK no longer provides declarations for libdevice functions. * A lot of device-side functions have become nvcc's builtins and CUDA headers no longer contain their implementations. This patch changes the way CUDA headers are handled if we compile with CUDA 9.x. Both 9.0 and 9.1 are affected. * Clang provides its own declarations of libdevice functions. * For CUDA-9.x clang now provides implementation of device-side 'standard library' functions using libdevice. This patch should not affect compilation with CUDA-8. There may be some observable differences for CUDA-9.0, though they are not expected to affect functionality. Tested: CUDA test-suite tests for all supported combinations of: CUDA: 7.0,7.5,8.0,9.0,9.1 GPU: sm_20, sm_35, sm_60, sm_70 Differential Revision: https://reviews.llvm.org/D42513 llvm-svn: 323713
* [coroutines] Fix application of NRVO to Coroutine "Gro" or return object.Eric Fiselier2018-01-293-5/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fix NRVO for Gro variable. Previously, we only marked the GRO declaration as an NRVO variable when its QualType and the function return's QualType matched exactly (using operator==). However, this was incorrect for two reasons: 1. We were marking non-class types, such as ints, as being NRVO variables. 2. We failed to handle cases where the canonical types were the same, but the actual `QualType` objects were different. For example, if one was represented by a typedef. (Example: https://godbolt.org/g/3UFgsL) This patch fixes these bugs by marking the Gro variable as supporting NRVO only when `BuildReturnStmt` marks the Gro variable as a coroutine candidate. Reviewers: rsmith, GorNishanov, nicholas Reviewed By: GorNishanov Subscribers: majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D42343 llvm-svn: 323712
* [analyzer] Use stable filenames in analyzer testing infrastructureGeorge Karpenkov2018-01-291-0/+1
| | | | | | | | Makes finding the right file in test results easier. Differential Revision: https://reviews.llvm.org/D42445 llvm-svn: 323697
* [analyzer] [NFC] Remove unused method visitItemsInWorkListGeorge Karpenkov2018-01-292-41/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D42562 llvm-svn: 323696
* [clang-format] Add more tests for ObjC protocol list formatting behaviorBen Hamilton2018-01-291-0/+14
| | | | | | | | | | | | | | | | | | | | | | | Summary: The existing unit tests in FormatTestObjC.cpp didn't fully cover all the cases for protocol confirmance list formatting. This extends the unit tests to more cases of protocol conformance list formatting, especially how the behavior changes when `BinPackParameters` changes from `true` (the default) to `false`. Test Plan: make -j12 FormatTests && \ ./tools/clang/unittests/Format/FormatTests --gtest_filter=FormatTestObjC.\* Reviewers: krasimir, jolesiak, stephanemoore Reviewed By: krasimir Subscribers: benhamilton, klimek, cfe-commits, hokein, Wizard Differential Revision: https://reviews.llvm.org/D42649 llvm-svn: 323684
* [NFC] Fixup comment with function name, actually incorrect name!Erich Keane2018-01-291-3/+2
| | | | llvm-svn: 323679
* [clang-format] Disable some text proto delimiters and functions for google styleKrasimir Georgiev2018-01-291-9/+1
| | | | | | | | | | | | | | | | | | Summary: This disables some of the most commonly used text proto delimiters and functions for google style until we resolve several style options for that style. In particular, wheter there should be a space surrounding braces ``msg { sub { key : value } }`` and the extent of packing of submessages on a same line. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42651 llvm-svn: 323678
* [clang-format] Fix bug where -dump-config failed on ObjC headerBen Hamilton2018-01-294-3/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: `clang-format -dump-config path/to/file.h` never passed anything for the Code parameter to clang::format::getStyle(). This meant the logic to guess Objective-C from the contents of a .h file never worked, because LibFormat didn't have the code to work with. With this fix, we now correctly read in the contents of the file if possible with -dump-config. I had to update the lit config for test/Format/ because the default config ignores .h files. Test Plan: make -j12 check-clang Reviewers: jolesiak, krasimir Reviewed By: jolesiak, krasimir Subscribers: Wizard, klimek, cfe-commits, djasper Differential Revision: https://reviews.llvm.org/D42395 llvm-svn: 323668
* [scan-build] Add an option to skip overriding CC and CXX make varsJonathan Roelofs2018-01-292-5/+21
| | | | | | | | | | | | | | Autoconf and some other systems tend to add essential compilation options to CC (e.g. -std=gnu99). When running such an auto-generated makefile, scan-build does not need to change CC and CXX as they are already set to use ccc-analyzer by a configure script. Implement a new option --keep-cc as was proposed in this discussion: http://lists.llvm.org/pipermail/cfe-dev/2013-September/031832.html Patch by Paul Fertser! llvm-svn: 323665
* [analyzer] Fix -x language argument for C preprocessed sourcesJonathan Roelofs2018-01-291-2/+2
| | | | | | | | | | | | | clang's -x option doesn't accept c-cpp-output as a language (even though 463eb6ab was merged, the driver still doesn't handle that). This bug prevents testing C language projects when ccache is used. Fixes #25851. Investigation and patch by Dave Rigby. llvm-svn: 323664
* [Lexer] Support adding working directory to relative search dir for #include ↵Eric Liu2018-01-294-12/+129
| | | | | | | | | | | | shortening in HeaderSearch. Reviewers: bkramer Subscribers: mgorny, hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D42577 llvm-svn: 323647
* [NFC] fix trivial typos in commentsHiroshi Inoue2018-01-293-4/+4
| | | | | | "to to" -> "to" llvm-svn: 323627
* Change memcpy/memove/memset to have dest and source alignment attributes.Daniel Neilson2018-01-2820-68/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change is step three in the series of changes to remove alignment argument from memcpy/memmove/memset in favour of alignment attributes. Steps: Step 1) Remove alignment parameter and create alignment parameter attributes for memcpy/memmove/memset. ( rL322965, rC322964, rL322963 ) Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing source and dest alignments. ( rL323597 ) Step 3) Update Clang to use the new IRBuilder API. Step 4) Update Polly to use the new IRBuilder API. Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API, and those that use use MemIntrinsicInst::[get|set]Alignment() to use getDestAlignment() and getSourceAlignment() instead. Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the MemIntrinsicInst::[get|set]Alignment() methods. Reference http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html Reviewers: rjmccall Subscribers: jyknight, nemanjai, nhaehnle, javed.absar, sbc100, aheejin, kbarton, fedor.sergeev, cfe-commits Differential Revision: https://reviews.llvm.org/D41677 llvm-svn: 323617
* [git-clang-format] Process CUDA filesJonas Hahnfeld2018-01-281-0/+1
| | | | | | | | | Clang supports compiling CUDA source files for some time, format them by default as well. Differential Revision: https://reviews.llvm.org/D42589 llvm-svn: 323615
* Attempt to make the PS4 build bot happy.Gabor Horvath2018-01-271-2/+2
| | | | llvm-svn: 323590
OpenPOWER on IntegriCloud