summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [CFG] [analyzer] Add construction context for implicit constructor conversions.Artem Dergachev2018-03-094-5/+108
| | | | | | | | | | | | | Implicit constructor conversions such as A a = B() are represented by surrounding the constructor for B() with an ImplicitCastExpr of CK_ConstructorConversion kind, similarly to how explicit constructor conversions are surrounded by a CXXFunctionalCastExpr. Support this syntax pattern when extracting the construction context for the implicit constructor that performs the conversion. Differential Revision: https://reviews.llvm.org/D44051 llvm-svn: 327096
* [DOXYGEN] Fix doxygen and content issues in mmintrin.hDouglas Yung2018-03-091-9/+11
| | | | | | | | | | - Fix instruction mappings/listings for various intrinsics This patch was made by Craig Flores Differential Revision: https://reviews.llvm.org/D41517 llvm-svn: 327090
* Add a debug info testcase for the trvial_abi attribute.Adrian Prantl2018-03-081-0/+10
| | | | llvm-svn: 327078
* [StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2018-03-084-320/+336
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 327074
* [OPENMP] Emit sizes/init ptrs etc. data for task reductions beforeAlexey Bataev2018-03-083-10/+23
| | | | | | | | | | | using. We may emit the code in wrong order because of incorrect implementation of the runtime functions for task reductions. Threadprivate storages may be initialized after real initialization of the reduction items. Patch fixes this problem. llvm-svn: 327008
* [clang-format] Use NestedBlockIndent as a 0 column in formatted raw stringsKrasimir Georgiev2018-03-082-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This makes the formatter of raw string literals use NestedBlockIndent for determining the 0 column of the content inside. This makes the formatting use less horizonal space and fixes a case where two newlines before and after the raw string prefix were selected instead of a single newline after it: Before: ``` aaaa = ffff( R"pb( key: value)pb"); ``` After: ``` aaaa = ffff(R"pb( key: value)pb"); ``` Reviewers: djasper, sammccall Reviewed By: sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D44141 llvm-svn: 326996
* Propagate DLLAttr to friend re-declarations of member functionsStephan Bergmann2018-03-082-0/+25
| | | | | | | | | | | ...that have already been constructed (e.g., in inner classes) while parsing the class definition. They would otherwise lack any DLLAttr inherited from the class, which are only set here (called from Sema::CheckCompletedClass) after the class definition has been parsed completely. Differential revision: https://reviews.llvm.org/D16632 llvm-svn: 326990
* [CodeGen] Emit lifetime.ends in both EH and non-EH blocksGeorge Burgess IV2018-03-082-9/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this, we'd only emit lifetime.ends for these temps in non-exceptional paths. This potentially made our stack larger than it needed to be for any code that follows an EH cleanup. e.g. in ``` struct Foo { char cs[32]; }; void escape(void *); struct Bar { ~Bar() { char cs[64]; escape(cs); } }; Foo getFoo(); void baz() { Bar b; getFoo(); } ``` baz() would require 96 bytes of stack, since the temporary from getFoo() only had a lifetime.end on the non-exceptional path. This also makes us keep hold of the Value* returned by EmitLifetimeStart, so we don't have to remake it later. llvm-svn: 326988
* [analyzer] Correctly model iteration through "nil" objectsGeorge Karpenkov2018-03-083-39/+66
| | | | | | | | | | | | | | | | | | | | Previously, iteration through nil objects which resulted from objc-messages being set to nil were modeled incorrectly. There are a couple of notes about this patch: In principle, ExprEngineObjC might be left untouched IFF osx.loops checker is enabled. I however think that we should not do something completely incorrect depending on what checkers are left on. We should evaluate and potentially remove altogether the isConsumedExpr performance heuristic, as it seems very fragile. rdar://22205149 Differential Revision: https://reviews.llvm.org/D44178 llvm-svn: 326982
* Fix an unused variable warning; NFCGeorge Burgess IV2018-03-081-1/+1
| | | | llvm-svn: 326980
* [Documentation] Fix Release notes problems introduced in r326889. Add ↵Eugene Zelenko2018-03-081-5/+7
| | | | | | highlighting. llvm-svn: 326979
* Revert "[Sema] Make getCurFunction() return null outside function parsing"Reid Kleckner2018-03-089-114/+100
| | | | | | | | | | This reverts r326965. It seems to have caused repeating test failures in clang/test/Sema/diagnose_if.c on some buildbots. I cannot reproduce the problem, and it's not immediately obvious what the problem is, so let's revert to green. llvm-svn: 326974
* When substituting previously-checked template arguments into a templateRichard Smith2018-03-085-18/+85
| | | | | | | | | | | | | template parameter that is an expanded parameter pack, only substitute into the current slice, not the entire pack. This reduces the checking of N template template arguments for an expanded parameter pack containing N parameters from quadratic time to linear time in the length of the pack. This is important because one (and possibly the only?) general technique for splitting a template parameter pack in linear time depends on doing this. llvm-svn: 326973
* [MS] Pass CVRU qualifiers properly in Itanium manglerReid Kleckner2018-03-082-1/+5
| | | | | | | | | We already have a mangling for the __unaligned qualifier, we just have to call Qualifiers::getFromCVRUMask instead of getFromCVRMask. PR36638 llvm-svn: 326971
* Fix a doc typo; NFCGeorge Burgess IV2018-03-081-1/+1
| | | | llvm-svn: 326968
* [Sema] Make getCurFunction() return null outside function parsingReid Kleckner2018-03-089-100/+114
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Before this patch, Sema pre-allocated a FunctionScopeInfo and kept it in the first, always present element of the FunctionScopes stack. This meant that Sema::getCurFunction would return a pointer to this pre-allocated object when parsing code outside a function body. This is pretty much always a bug, so this patch moves the pre-allocated object into a separate unique_ptr. This should make bugs like PR36536 a lot more obvious. As you can see from this patch, there were a number of places that unconditionally assumed they were always called inside a function. However, there are also many places that null checked the result of getCurFunction(), so I think this is a reasonable direction. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44039 llvm-svn: 326965
* [MS] Accept __unaligned as a qualifier on member function pointersReid Kleckner2018-03-072-1/+9
| | | | | | | | | | We need to treat __unaligned like the other 'cvr' qualifiers when it appears at the end of a function prototype. We weren't doing that in some tentative parsing. Fixes PR36638. llvm-svn: 326962
* Set dso_local on tls init functions.Rafael Espindola2018-03-072-1/+4
| | | | | | | We copy the visibility, so copying the dso_local flag seems the natural thing to do. llvm-svn: 326961
* [ms] Emit vtordisp initializers in a deterministic order.Nico Weber2018-03-071-5/+6
| | | | | | | | | | No effective behavior change, just for cleanliness. Analysis and typing by me, actual patch mostly by Reid. Fixes PR36159. https://reviews.llvm.org/D44223 llvm-svn: 326960
* Avoid including ScopeInfo.h from Sema.hReid Kleckner2018-03-0712-173/+174
| | | | | | | | | | | | | | | | | Summary: This provides no measurable build speedup, but it reinstates an optimization from r112038 that was lost in r179618. It requires moving CapturedScopeInfo::Capture out to clang::sema, which might be too general since we have plenty of other Capture records in BlockDecl and other AST nodes. Reviewers: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44221 llvm-svn: 326957
* [analyzer] [PointerArithChecker] do not warn on indexes into vector typesGeorge Karpenkov2018-03-072-0/+10
| | | | | | | | rdar://35041502 Differential Revision: https://reviews.llvm.org/D44172 llvm-svn: 326952
* [analyzer] Don't crash with assertion failure on structured bindingsGeorge Karpenkov2018-03-072-1/+16
| | | | | | | | | | | | Proper modeling still remains to be done. Note that BindingDecl#getHoldingVar() is almost always null, and this should probably be handled by dealing with DecompositionDecl beforehand. rdar://36852163 Differential Revision: https://reviews.llvm.org/D44183 llvm-svn: 326951
* [OpenMP] Remove implicit data sharing code gen that aims to use device ↵Gheorghe-Teodor Bercea2018-03-075-267/+39
| | | | | | | | | | | | | | | | shared memory Summary: Remove this scheme for now since it will be covered by another more generic scheme using global memory. This code will be worked into an optimization for the generic data sharing scheme. Removing this completely and then adding it via future patches will make all future data sharing patches cleaner. Reviewers: ABataev, carlo.bertolli, caomhin Reviewed By: ABataev Subscribers: jholewinski, guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D43625 llvm-svn: 326948
* CodeGen: Fix address space of indirect function argumentYaxun Liu2018-03-0715-111/+332
| | | | | | | | | | | | | | | | | | | | | The indirect function argument is in alloca address space in LLVM IR. However, during Clang codegen for C++, the address space of indirect function argument should match its address space in the source code, i.e., default addr space, even for indirect argument. This is because destructor of the indirect argument may be called in the caller function, and address of the indirect argument may be taken, in either case the indirect function argument is expected to be in default addr space, not the alloca address space. Therefore, the indirect function argument should be mapped to the temp var casted to default address space. The caller will cast it to alloca addr space when passing it to the callee. In the callee, the argument is also casted to the default address space and used. CallArg is refactored to facilitate this fix. Differential Revision: https://reviews.llvm.org/D34367 llvm-svn: 326946
* [clang-format] Break consecutive string literals in text protosKrasimir Georgiev2018-03-072-1/+8
| | | | | | | | | | | | | | | | Summary: This patch fixes a bug where consecutive string literals in text protos were put on the same line. Reviewers: alexfh Reviewed By: alexfh Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D44204 llvm-svn: 326945
* Correct the alignment for the PS4 targetMatthew Voss2018-03-072-0/+4
| | | | | | https://reviews.llvm.org/D44218 llvm-svn: 326942
* [OpenCL] Remove block invoke function from emitted block literal structYaxun Liu2018-03-076-179/+135
| | | | | | | | | | | | | | | | | | | | | OpenCL runtime tracks the invoke function emitted for any block expression. Due to restrictions on blocks in OpenCL (v2.0 s6.12.5), it is always possible to know the block invoke function when emitting call of block expression or __enqueue_kernel builtin functions. Since __enqueu_kernel already has an argument for the invoke function, it is redundant to have invoke function member in the llvm block literal structure. This patch removes invoke function from the llvm block literal structure. It also removes the bitcast of block invoke function to the generic block literal type which is useless for OpenCL. This will save some space for the kernel argument, and also eliminate some store instructions. Differential Revision: https://reviews.llvm.org/D43783 llvm-svn: 326937
* [analyzer] [NFC] Minor refactoring of NonNullParamCheckerGeorge Karpenkov2018-03-071-68/+65
| | | | | | Differential Revision: https://reviews.llvm.org/D43917 llvm-svn: 326935
* Push a function scope when parsing function bodies without a declarationReid Kleckner2018-03-072-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is PR36536. There are a few ways to reach Sema::ActOnStartOfFunctionDef with a null Decl. Currently, the parser continues on to attempt to parse the statements in the function body without pushing a function scope or declaration context. However, lots of statement parsing logic relies on getCurFunction() returning something reasonable. It turns out that getCurFunction() will never return null today because of an optimization where Sema pre-allocates one FunctionScopeInfo and reuses it when possible. This goes wrong when something inside the function body causes us to push another function scope, such as requiring an implicit definition of a special member function. Reusing the state clears it out, which will lead to bugs. In PR36536, we found that the SwitchStack gets unbalanced, because we push a switch, clear out the stack, and then try to pop a switch that isn't there. As a follow-up, I plan to move the pre-allocated FunctionScopeInfo out of the FunctionScopes stack. This means the FunctionScopes stack will often be empty, and callers of getCurFunction() will need to check for null. Reviewers: thakis Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43980 llvm-svn: 326926
* [OPENMP] Fix lifetime of the loop counters.Alexey Bataev2018-03-073-77/+115
| | | | | | | | We may emit incorrect lifetime info during codegen for loop counters in OpenMP constructs because of automatic scope cleanup when we needed temporarily locations for private loop counters. llvm-svn: 326922
* Add Clang ReleaseNotes that --autocomplete breaks backward compatibilyYuka Takahashi2018-03-071-0/+9
| | | | | | | | | | | | | | Summary: --autocomplete flag now handles all the flags passed to shell, and this implementation breaks backward compatibily before Clang 6.0. Reviewers: teemperor, v.g.vassilev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44191 llvm-svn: 326889
* Remove a placeholderGeorge Burgess IV2018-03-071-1/+1
| | | | | | | ...Running tests in the wrong directory will often make them seem to pass. Oops. :) llvm-svn: 326873
* Reland r326766 (with a slightly modified test)George Burgess IV2018-03-072-1/+21
| | | | | | | | | The original revert was done in r326869, since reverting r326602 broke the test added by this. The new test should be less dependent on r326602. llvm-svn: 326872
* Revert 326766 too, after r326862 the test fails and I don't know how to fix.Nico Weber2018-03-072-17/+1
| | | | llvm-svn: 326869
* [analyzer] Fix the checker for the performance anti-pattern to accept messagesGeorge Karpenkov2018-03-072-11/+45
| | | | | | | | send to ObjC objects. Differential Revision: https://reviews.llvm.org/D44170 llvm-svn: 326868
* [Driver] Enable SafeStack by default on FuchsiaPetr Hosek2018-03-073-5/+16
| | | | | | | | This is already used throughout the entire system, so make it a default. Differential Revision: https://reviews.llvm.org/D44065 llvm-svn: 326867
* [ASTMatcher] Extend hasAnyArgument to ObjCMessageExprGeorge Karpenkov2018-03-073-7/+54
| | | | | | | | | | | | | | | Currently hasArgument works with both ObjC messages and function calls, but not hasAnyArgument. This patch fixes that discrepancy, as it's often more convenient to use hasAnyArgument. On a more general note, it would be great to have a common superclass for objc-call and function call, and a matcher matching that, but that's probably a job for another commit. Differential Revision: https://reviews.llvm.org/D44169 llvm-svn: 326865
* Revert r326602, it caused PR36620.Nico Weber2018-03-0716-503/+150
| | | | llvm-svn: 326862
* [Driver] Automatically disable incompatible default sanitizersPetr Hosek2018-03-071-13/+23
| | | | | | | | | | When a sanitizer incompatible with one of the default sanitizers is explicitly enabled, automatically disable all the conflicting default sanitizers. Differential Revision: https://reviews.llvm.org/D44064 llvm-svn: 326860
* [StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2018-03-074-294/+296
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 326856
* Fix a typo from r326844; NFCGeorge Burgess IV2018-03-061-1/+1
| | | | llvm-svn: 326845
* [CodeGen] Don't emit lifetime.end without lifetime.startGeorge Burgess IV2018-03-062-3/+10
| | | | | | | | EmitLifetimeStart returns a non-null `size` pointer if it actually emits a lifetime.start. Later in this function, we use `tempSize`'s nullness to determine whether or not we should emit a lifetime.end. llvm-svn: 326844
* [FrontEnd] Allow overriding the default C/C++ -std via CMake varsMichal Gorny2018-03-063-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide two new CMake cache variables -- CLANG_DEFAULT_STD_C and CLANG_DEFAULT_STD_CXX -- that can be used to override the default C/ObjC and C++/ObjC++ standards appropriately. They can be set to one of the identifiers from LangStandards.def, or left unset (the default) to respect the current platform default. This option is mostly intended for compiler vendors that may wish to adjust the defaults their compilers are using. For example, Gentoo planned to use it to set clang and gcc to matching standards, so that we could maintain as much compatibility between different compilers as possible. The code relies on explicit identifiers rather than the string aliases for simplicity. This saves us from the necessity of parsing aliases at build-time or adding additional processing at runtime. For the latter case, it also adds trivial value check -- if incorrect value is passed, the code simply fails to compile through referencing an undefined constant. If the variable is used to redefine the default standard, the explicit value overrides the special case for PS4. It is done this way mostly following other kinds of variables where 'platform defaults' are redefined. Differential Revision: https://reviews.llvm.org/D34365 llvm-svn: 326836
* [OPENMP] Fix generation of the unique names for task reductionAlexey Bataev2018-03-063-17/+32
| | | | | | | | | | | variables. If the task has reduction construct and this construct for some variable requires unique threadprivate storage, we may generate different names for variables used in taskgroup task_reduction clause and in task in_reduction clause. Patch fixes this problem. llvm-svn: 326827
* TableGen: Give up on exact fixits for diagnostic groupsNicolai Haehnle2018-03-063-67/+17
| | | | | | | | | | | With recent changes in the TableGen frontend, we no longer have usable location information for anonymous defs. Fixes test breakage caused by r326788. The normal, non-error TableGen output is not affected by this change. llvm-svn: 326822
* [clang-format] Improve detection of ObjC for-in statementsBen Hamilton2018-03-063-3/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, clang-format would detect the following as an Objective-C for-in statement: for (int x = in.value(); ...) {} because the logic only decided a for-loop was definitely *not* an Objective-C for-in loop after it saw a semicolon or a colon. To fix this, I delayed the decision of whether this was a for-in statement until after we found the matching right-paren, at which point we know if we've seen a semicolon or not. Test Plan: New tests added. Ran tests with: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: krasimir, jolesiak Reviewed By: jolesiak Subscribers: djasper, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D43904 llvm-svn: 326815
* [X86] Fix typo in cpuid.h, bit_AVX51SER->bit_AVX512ER.Craig Topper2018-03-061-1/+1
| | | | llvm-svn: 326807
* [clang-format] fix handling of consecutive unary operatorsKrasimir Georgiev2018-03-063-4/+5
| | | | | | | | | | | | | | | | | | | | | | Summary: Code that used to be formatted as `if (! + object) {` is now formatted as `if (!+object) {` (we have a particular object in our codebase where unary `operator+` is overloaded to return the underlying value, which in this case is a `bool`) We still preserve the TypeScript behavior where `!` is a trailing non-null operator. (This is already tested by an existing unit test in `FormatTestJS.cpp`) It doesn't appear like handling of consecutive unary operators are tested in general, so I added another test for completeness Patch contributed by @kevinl! Reviewers: krasimir Reviewed By: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43312 llvm-svn: 326792
* [analyzer] CStringChecker.cpp: Remove the duplicated check about null ↵Henry Wong2018-03-061-21/+0
| | | | | | | | | | | | | | | | dereference on dest-buffer or src-buffer. Summary: `CheckBufferAccess()` calls `CheckNonNull()`, so there are some calls to `CheckNonNull()` that are useless. Reviewers: dcoughlin, NoQ, xazax.hun, cfe-commits, george.karpenkov Reviewed By: NoQ Subscribers: szepet, rnkovacs, MTC, a.sidorin Differential Revision: https://reviews.llvm.org/D44075 llvm-svn: 326782
* [clang-format] Fix documentation for SpaceAfterCStyleCast optionKrasimir Georgiev2018-03-062-3/+51
| | | | | | | | | | | | | | | | Patch contributed by @EricMarti! Summary: I noticed that the example for SpaceAfterCStyleCast does not match its description. I fixed the example after testing it out. Reviewers: rsmith, krasimir Reviewed By: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43731 llvm-svn: 326781
OpenPOWER on IntegriCloud