summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Expose return statement from CallExit program pointGeorge Karpenkov2018-02-023-5/+11
| | | | | | | | | | | | | | | | 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-023-5/+50
| | | | | | Differential Revision: https://reviews.llvm.org/D42774 llvm-svn: 324049
* [analyzer] Fix yet-another-crash in body-farming std::call_onceGeorge Karpenkov2018-02-021-1/+10
| | | | | | | | | | | | | | 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-011-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Don't communicate evaluation failures through memregion hierarchy.Artem Dergachev2018-02-012-45/+42
| | | | | | | | | | | | | | | | | | | | | | | 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-011-0/+10
| | | | | | | | DeclContext rather than injecting it wherever we happen to be. This avoids creating functions whose DeclContext is a struct or similar. llvm-svn: 323998
* Reverting patch rL323952 due to build errors that ISander de Smalen2018-02-0111-179/+71
| | | | | | haven't encountered in local builds. llvm-svn: 323956
* [DebugInfo] Enable debug information for C99 VLA typesSander de Smalen2018-02-0111-71/+179
| | | | | | | | | | | | | | | | | | | | | 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-011-2/+6
| | | | | | | | | | | | | | 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
* PR36181: Teach CodeGen to properly ignore requests to emit dependent entities.Richard Smith2018-02-012-17/+14
| | | | | | | 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-311-3/+4
| | | | | | | | | | | 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-311-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [WebAssembly] Don't pass -ffunction-section/-fdata-sectionsSam Clegg2018-01-311-5/+2
| | | | | | | | | llvm currently forces both of these to true to passing them is redundant. Differential Revision: https://reviews.llvm.org/D37831 llvm-svn: 323897
* Revert "Revert rC322769: [RISCV] Propagate -mabi and -march values to GNU ↵Ana Pazos2018-01-311-0/+12
| | | | | | | | | | | | | | | | 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
* [clang-format] Adds space around braces in text protosKrasimir Georgiev2018-01-311-0/+1
| | | | | | | | | | | | | | | | | 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-311-15/+50
| | | | | | | | | | | | | | | | 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-301-13/+7
| | | | | | | | | | | | 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-301-19/+0
| | | | | | | | 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-301-2/+4
| | | | | | | | | 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-307-31/+1868
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-291-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] [NFC] Remove unused method visitItemsInWorkListGeorge Karpenkov2018-01-291-33/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D42562 llvm-svn: 323696
* [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
* [Lexer] Support adding working directory to relative search dir for #include ↵Eric Liu2018-01-291-11/+22
| | | | | | | | | | | | 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-291-2/+2
| | | | | | "to to" -> "to" llvm-svn: 323627
* Change memcpy/memove/memset to have dest and source alignment attributes.Daniel Neilson2018-01-281-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [ASTImporter] Add support to import some AST nodes:Gabor Horvath2018-01-271-23/+108
| | | | | | | | | | | | | | | | * CXXOperatorCallExpr * SizeOfPackExpr * DependentTemplateSpecializationType * DependentSizedArray * CXXTypeidExpr * Fix importing CXXTemporaryObjectExpr Some of the changes are based on https://github.com/haoNoQ/clang/blob/summary-ipa-draft/lib/AST/ASTImporter.cpp Differential Revision: https://reviews.llvm.org/D42335 llvm-svn: 323589
* [CodeGen] Use the non-virtual alignment when emitting the baseAkira Hatanaka2018-01-271-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | constructor. Previously, clang would emit an over-aligned (16-byte) store to initialize B::x in B's base constructor when compiling the following code: struct A { __attribute__((aligned(16))) double data1; }; struct B : public virtual A { B() : x(123) {} double a; int x; }; struct C : public virtual B {}; void test() { B b; C c; } This was happening because the code in IRGen that does member initialization was using the alignment of a complete object instead of the non-virtual alignment. This commit fixes the bug. rdar://problem/36382481 Differential Revision: https://reviews.llvm.org/D42521 llvm-svn: 323578
* Always allow "#pragma region".Matt Davis2018-01-271-2/+4
| | | | | | | | | | | | | | | | | | | | | Summary: Both MS and PS4 targets are capable of recognizing the existence of: #pragma region, #pragma endregion. Since this pragma is only a hint for certain editors, and has no logic, it seems helpful to permit this pragma in all cases, not just MS compatibility mode. Reviewers: rnk, rsmith, majnemer Reviewed By: majnemer Subscribers: Quuxplusone, probinson, majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D42248 llvm-svn: 323577
* [X86] Add 'rdrnd' feature to silvermont to match recent gcc bug fix.Craig Topper2018-01-261-1/+1
| | | | | | gcc recently fixed this bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83546 llvm-svn: 323552
* [index] Fix crash when indexing a C++14 PCH/module related to ↵Argyrios Kyrtzidis2018-01-262-3/+8
| | | | | | | | | | | | | TemplateTemplateParmDecls of alias templates TemplateTemplateParmDecls of alias templates ended-up serialized as 'file-level decls' which was causing a crash while trying to index a PCH/module file that contained them. Commit makes sure TemplateTemplateParmDecls are not recorded as such kind of decls. Fixes crash of rdar://36608297 Differential Revision: https://reviews.llvm.org/D42588 llvm-svn: 323549
* AST: support protocol conformances on id/class/interfaces in MS ABISaleem Abdulrasool2018-01-261-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | Add support for mangling ObjC protocol conformances in MS ABI as if they are COM interfaces. By diverging from the itanium mangling of `objc_protocol` prefixed names, this approach allows for a semi-reasonable, albeit of questionable sanity, undecoration via existing tooling. There is also the possibility of adding an extension and taking part of the namespace to add the conformance via the `L` and `Z` "modifiers", but the existing tooling would not be able to properly undecorated the symbol even though incidentally `undname` currently produces something legible while wine's implementation is not able to cope with the extension. This allows for the disambiguation of overloads where the parameter differs only in the protocol conformance of the ObjC type, e.g. ``` @protocol P; void f(std::vector<id>); void f(std::vector<id<P>>); ``` which clang would previously fail due to the mangling being identical as the protocol conformance was ignored. llvm-svn: 323547
* [X86] Define __IBT__ when -mibt is specified.Craig Topper2018-01-261-0/+2
| | | | llvm-svn: 323543
* clang-format: [JS] Prevent ASI before [ and (.Martin Probst2018-01-261-3/+5
| | | | | | | | | | | | | | | Summary: JavaScript automatic semicolon insertion can trigger before [ and (, so avoid breaking before them if the previous token is likely to terminate an expression. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D42570 llvm-svn: 323532
* [AST] Use bit packing to reduce sizeof(TypedefNameDecl) from 88 to 80.Benjamin Kramer2018-01-261-3/+1
| | | | | | | | We can stash the cached transparent tag bit in existing pointer padding. Everything coming out of ASTContext is always aligned to a multiple of 8, so we have 8 spare bits. llvm-svn: 323528
* [ASTImporter] avoid warnings: unused var, switch coveredSam McCall2018-01-262-8/+6
| | | | llvm-svn: 323524
* [ASTImporter] Support LambdaExprs and improve template supportAleksei Sidorin2018-01-263-61/+334
| | | | | | | | | | | | | | Also, a number of style and bug fixes was done: * ASTImporterTest: added sanity check for source node * ExternalASTMerger: better lookup for template specializations * ASTImporter: don't add templated declarations into DeclContext * ASTImporter: introduce a helper, ImportTemplateArgumentListInfo getting SourceLocations * ASTImporter: proper set ParmVarDecls for imported FunctionProtoTypeLoc Differential Revision: https://reviews.llvm.org/D42301 llvm-svn: 323519
* [NFC] fix trivial typos in comments and documentsHiroshi Inoue2018-01-262-2/+2
| | | | | | "in in" -> "in", "on on" -> "on" etc. llvm-svn: 323509
* [Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel.Amara Emerson2018-01-261-0/+31
| | | | | | Differential Revision: https://reviews.llvm.org/D42276 llvm-svn: 323485
* AST: inline a single-use variable (NFC)Saleem Abdulrasool2018-01-251-2/+1
| | | | | | Inline the single use variable into the only use. NFC. llvm-svn: 323461
* [clang-cl] Add support for /arch:AVX512F and /arch:AVX512Nico Weber2018-01-251-5/+6
| | | | | | | | | | | | | | | | | | | | | For /arch:AVX512F: clang-cl and cl.exe both defines __AVX512F__ __AVX512CD__. clang-cl also defines __AVX512ER__ __AVX512PF__. 64-bit cl.exe also defines (according to /Bz) _NO_PREFETCHW. For /arch:AVX512: clang-cl and cl.exe both define __AVX512F__ __AVX512CD__ __AVX512BW__ __AVX512DQ__ __AVX512VL__. 64-bit cl.exe also defines _NO_PREFETCHW. So not 100% identical, but pretty close. Also refactor the existing AVX / AVX2 code to not repeat itself in both the 32-bit and 64-bit cases. https://reviews.llvm.org/D42538 llvm-svn: 323433
* clang-cl: Simplify handling of /arch: flag.Nico Weber2018-01-251-27/+5
| | | | | | | | | | | | | | | | | | | r213083 initially implemented /arch: support by mapping it to CPU features. Then r241077 additionally mapped it to CPU, which made the feature flags redundant (if harmless). This change here removes the redundant mapping to feature flags, and rewrites test/Driver/cl-x86-flags.c to be a bit more of an integration test that checks for preprocessor defines like AVX (like documented on MSDN) instead of for driver flags. To keep emitting warn_drv_unused_argument, use getLastArgNoClaim() followed by an explicit claim() if needed. This is in preparation for adding support for /arch:AVX512(F). No intended behavior change. https://reviews.llvm.org/D42497 llvm-svn: 323426
* [CodeGen] Decorate aggregate accesses with TBAA tagsIvan A. Kosarev2018-01-2515-55/+123
| | | | | | Differential Revision: https://reviews.llvm.org/D41539 llvm-svn: 323421
* [clang-format] Fixes indentation of inner text proto messagesKrasimir Georgiev2018-01-251-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Consider the text proto: ``` message { sub { key: value } } ``` Previously the first `{` was TT_Unknown, which caused the inner message to be indented by the continuation width. This didn't happen for: ``` message { sub: { key: value } } ``` This is because the code to mark the first `{` as a TT_DictLiteral was only considering the case where it marches forward and reaches a `:`. This patch updates this by looking not only for `:`, but also for `<` and `{`. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42500 llvm-svn: 323419
* [Driver] Add support for mips32 and scudoSimon Dardis2018-01-251-1/+3
| | | | | | | | | | | r317337 missed that scudo is supported on MIPS32, so permit that option for MIPS32. Reviewers: cryptoad, atanasyan Differential Revision: https://reviews.llvm.org/D42416 llvm-svn: 323412
* FreeBSD needs also execinfo (in sanitizers)Kamil Rytarowski2018-01-241-2/+3
| | | | | | | | | | | | | | | | Summary: As NetBSD, FreeBSD needs execinfo for backtrace's matters. Patch by: David CARLIER. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: emaste, krytarowski, cfe-commits Differential Revision: https://reviews.llvm.org/D42467 llvm-svn: 323387
* [analyzer] Do not attempt to get the pointee of void*Alexander Shaposhnikov2018-01-241-0/+3
| | | | | | | | | | | | Do not attempt to get the pointee of void* while generating a bug report (otherwise it will trigger an assert inside RegionStoreManager::getBinding assert(!T->isVoidType() && "Attempting to dereference a void pointer!")). Test plan: make check-all Differential revision: https://reviews.llvm.org/D42396 llvm-svn: 323382
* [coroutines] Pass coro func args to promise ctorBrian Gesiak2018-01-244-36/+96
| | | | | | | | | | | | | | | | | | | Summary: Use corutine function arguments to initialize a promise type, but only if the promise type defines a constructor that takes those arguments. Otherwise, fall back to the default constructor. Test Plan: check-clang Reviewers: rsmith, GorNishanov, eric_niebler Reviewed By: GorNishanov Subscribers: toby-allsopp, lewissbaker, EricWF, cfe-commits Differential Revision: https://reviews.llvm.org/D41820 llvm-svn: 323381
OpenPOWER on IntegriCloud