summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* As we don't use minor version anymore, let's remove it from the release ↵Sylvestre Ledru2018-04-041-2/+2
| | | | | | notes too llvm-svn: 329161
* Fix typo in ASTStructuralEquivalence.cpp for UnaryTransform types.Eric Fiselier2018-04-041-1/+1
| | | | | | | | | | | | | | Previously UnaryTransformType nodes were comparing the same node for structural equivalence. This was due to a typo where T1 was on both sides of the comparison. This patch corrects that typo. Unfortunately I couldn't find a way to test this change. It seems that currently UnaryTransform nodes are never actually checked for equivalence, only their canonical types are. None the less, this correction seemed appropriate. llvm-svn: 329151
* Split test/Driver/darwin-sdkroot.c into two testsAlex Lorenz2018-04-042-56/+73
| | | | | | | | | | | The test additions in r329110 are Darwin-specific, as they rely on a code path that is reachabled when driver is invoked without -target. Instead of making the old test checks Darwin-specific too, let's simply split it into two files to ensure that the old checks are still platform-agnostic. Thanks Chandler for suggesting this! llvm-svn: 329141
* [ObjC] Use the name specified by objc_runtime_name instead of the classAkira Hatanaka2018-04-032-2/+30
| | | | | | | | | | | | | identifier. This patch fixes a few places in CGObjCMac.cpp where the class identifier was used instead of the name specified by objc_runtime_name. rdar://problem/37910822 Differential Revision: https://reviews.llvm.org/D45101 llvm-svn: 329128
* [CUDA] Check initializers of instantiated template variables.Artem Belevich2018-04-035-52/+85
| | | | | | | | | We were already performing checks on non-template variables, but the checks on templated ones were missing. Differential Revision: https://reviews.llvm.org/D45231 llvm-svn: 329127
* Add the -fsanitize=shadow-call-stack flagVlad Tsyrklevich2018-04-0310-1/+199
| | | | | | | | | | | | | | | | | Summary: Add support for the -fsanitize=shadow-call-stack flag which causes clang to add ShadowCallStack attribute to functions compiled with that flag enabled. Reviewers: pcc, kcc Reviewed By: pcc, kcc Subscribers: cryptoad, cfe-commits, kcc Differential Revision: https://reviews.llvm.org/D44801 llvm-svn: 329122
* [StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2018-04-036-268/+297
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 329115
* Add REQUIRES: darwin-system to test/Driver/darwin-sdkroot.cAlex Lorenz2018-04-031-0/+1
| | | | | | The test from r329110 is for Darwin only llvm-svn: 329113
* [driver][darwin] Do not infer -simulator environment for non-simulator SDKsAlex Lorenz2018-04-032-5/+74
| | | | | | rdar://36369832 llvm-svn: 329110
* [analyzer] Fix diagnostics in callees of interesting callees.Artem Dergachev2018-04-032-9/+308
| | | | | | | | | | | | | | | removeUnneededCalls() is responsible for removing path diagnostic pieces within functions that don't contain "interesting" events. It makes bug reports much tidier. When a stack frame is known to be interesting, the function doesn't descend into it to prune anything within it, even other callees that are totally boring. Fix the function to prune boring callees in interesting stack frames. Differential Revision: https://reviews.llvm.org/D45117 llvm-svn: 329102
* Revert "Set calling convention for CUDA kernel"Artem Belevich2018-04-0313-92/+17
| | | | | | | This reverts r328795 which introduced an issue with referencing __global__ function templates. More details in the original review D44747. llvm-svn: 329099
* Use Clang when referring to the project and clang when referring to the binary.Richard Smith2018-04-031-2/+3
| | | | llvm-svn: 329098
* Restrict a test using named file descriptors to using the system shellDavid Blaikie2018-04-031-0/+1
| | | | llvm-svn: 329097
* [Hexagon] Remove -mhvx-double and the corresponding subtarget featureKrzysztof Parzyszek2018-04-035-51/+9
| | | | | | | Specifying the HVX vector length should be done via the -mhvx-length option. llvm-svn: 329077
* [clang-format/ObjC] Do not detect "[]" as ObjC method expressionBen Hamilton2018-04-032-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The following C++ code was being detected by `guessLanguage()` as Objective-C: #define FOO(...) auto bar = [] __VA_ARGS__; This was because `[] __VA_ARGS__` is not currently detected as a C++ lambda expression (it has no parens or braces), so `TokenAnnotator::parseSquare()` incorrectly treats the opening square as an ObjC method expression. We have two options to fix this: 1. Parse `[] __VA_ARGS__` explicitly as a C++ lambda 2. Make it so `[]` is never parsed as an Objective-C method expression This diff implements option 2, which causes the `[` to be parsed as `TT_ArraySubscriptLSquare` instead of `TT_ObjCMethodExpr`. Note that when I fixed this, it caused one change in formatting behavior, where the following was implicitly relying on the `[` being parsed as `TT_ObjCMethodExpr`: A<int * []> a; becomes: A<int *[]> a; with `Style.PointerAlignment = Middle`. I don't really know what the desired format is for this syntax; the test was added by Janusz Sobczak and integrated by @djasper in https://github.com/llvm-mirror/clang/commit/b511fe9818829d7ece0cc0b2ce1fbe04a1f0739a . I went ahead and changed the test for now. Test Plan: New tests added. Ran tests with: % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Fixes: https://bugs.llvm.org/show_bug.cgi?id=36248 Reviewers: djasper, jolesiak Reviewed By: djasper Subscribers: klimek, cfe-commits, djasper Differential Revision: https://reviews.llvm.org/D45169 llvm-svn: 329070
* [clang-format/ObjC] Do not insert space after opening brace of ObjC dict literalBen Hamilton2018-04-032-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: D44816 attempted to fix a few cases where `clang-format` incorrectly inserted a space before the closing brace of an Objective-C dictionary literal. This revealed there were still a few cases where we inserted a space after the opening brace of an Objective-C dictionary literal. This fixes the formatting to be consistent and adds more tests. Test Plan: New tests added. Confirmed tests failed before diff and passed after diff. Ran tests with: % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, jolesiak, krasimir Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45168 llvm-svn: 329069
* UsersManual.rst: update text for /GX- to match r328708Hans Wennborg2018-04-031-1/+1
| | | | llvm-svn: 329052
* [AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).Eugene Zelenko2018-04-0310-431/+412
| | | | llvm-svn: 329036
* [Driver] Wire up the -f[no-]rtlib-add-rpath flag and testsPetr Hosek2018-04-022-14/+23
| | | | | | | | | | D30700 added the -f[no-]rtlib-add-rpath flag, but that flag was never wired up in the driver and tests were updated to check whether it actually does anything. This patch wires up the flag and updates test. Differential Revision: https://reviews.llvm.org/D45145 llvm-svn: 329032
* CodeGenCXX: support PreserveMostCC in MS ABISaleem Abdulrasool2018-04-023-4/+45
| | | | | | | | Microsoft has reserved 'U' for the PreserveMostCC which is used in the swift runtime. Add support for this. This allows the swift runtime to be built for Windows again. llvm-svn: 329025
* [MS] Emit vftable thunks for functions with incomplete prototypesReid Kleckner2018-04-029-103/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The following class hierarchy requires that we be able to emit a this-adjusting thunk for B::foo in C's vftable: struct Incomplete; struct A { virtual A* foo(Incomplete p) = 0; }; struct B : virtual A { void foo(Incomplete p) override; }; struct C : B { int c; }; This TU is valid, but lacks a definition of 'Incomplete', which makes it hard to build a thunk for the final overrider, B::foo. Before this change, Clang gives up attempting to emit the thunk, because it assumes that if the parameter types are incomplete, it must be emitting the thunk for optimization purposes. This is untrue for the MS ABI, where the implementation of B::foo has no idea what thunks C's vftable may require. Clang needs to emit the thunk without necessarily having access to the complete prototype of foo. This change makes Clang emit a musttail variadic call when it needs such a thunk. I call these "unprototyped" thunks, because they only prototype the "this" parameter, which must always come first in the MS C++ ABI. These thunks work, but they create ugly LLVM IR. If the call to the thunk is devirtualized, it will be a call to a bitcast of a function pointer. Today, LLVM cannot inline through such a call, but I want to address that soon, because we also use this pattern for virtual member pointer thunks. This change also implements an old FIXME in the code about reusing the thunk's computed CGFunctionInfo as much as possible. Now we don't end up computing the thunk's mangled name and arranging it's prototype up to around three times. Fixes PR25641 Reviewers: rjmccall, rsmith, hans Subscribers: Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D45112 llvm-svn: 329009
* Fix some DenseMap use-after-rehash bugs and hoist MethodVFTableLocationReid Kleckner2018-04-026-78/+69
| | | | | | | | | | | | | | This re-lands r328845 with fixes for crbug.com/827810. The initial motiviation was to hoist MethodVFTableLocation to global scope so it could be forward declared. In this patch, I noticed that MicrosoftVTableContext uses some risky patterns. It has methods that return references to data stored in DenseMaps. I've made some of them return by value for trivial structs and I've moved some things into separate allocations. llvm-svn: 329007
* [Attr] [NFC] Revert accidental change from r327405Joel E. Denny2018-04-021-1/+1
| | | | llvm-svn: 329005
* Temporarily revert r328404:Eric Christopher2018-04-022-140/+0
| | | | | | | | | | | | | | commit 519b97132a4c960e8dedbfe4290d86970d92e995 Author: Richard Trieu <rtrieu@google.com> Date: Sat Mar 24 00:52:44 2018 +0000 [ODRHash] Support pointer and reference types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328404 91177308-0d34-0410-b5e6-96231b3b80d8 As it's breaking some tests. I've communicated with Richard offline about testcases. llvm-svn: 329001
* Add -fclang-abi-compat=6 flag for upcoming ABI changes.Richard Smith2018-04-022-0/+9
| | | | llvm-svn: 329000
* Add helper to determine if a field is a zero-length bitfield.Richard Smith2018-04-028-21/+25
| | | | llvm-svn: 328999
* [CUDA] Let device-side shared variables be initialized with undefYaxun Liu2018-04-023-40/+99
| | | | | | | | | | | CUDA shared variable should be initialized with undef. Patch by Greg Rodgers. Revised and lit test added by Yaxun Liu. Differential Revision: https://reviews.llvm.org/D44985 llvm-svn: 328994
* [coroutines] Add __builtin_coro_noop => llvm.coro.noopGor Nishanov2018-04-023-0/+6
| | | | | | | | | | | | | A recent addition to Coroutines TS (https://wg21.link/p0913) adds a pre-defined coroutine noop_coroutine that does nothing. To implement this feature, we implemented an llvm.coro.noop intrinsic that returns a coroutine handle to a coroutine that does nothing when resumed or destroyed. This patch adds a builtin __builtin_coro_noop() that maps to llvm.coro.noop intrinsic. Related llvm change: https://reviews.llvm.org/D45114 llvm-svn: 328993
* Fix unused variable warning introduced at revision 328910.Andrea Di Biagio2018-04-021-2/+1
| | | | llvm-svn: 328968
* [Coroutines] Schedule coro-split before asanBrian Gesiak2018-04-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The docs for the LLVM coroutines intrinsic `@llvm.coro.id` state that "The second argument, if not null, designates a particular alloca instruction to be a coroutine promise." However, if the address sanitizer pass is run before the `@llvm.coro.id` intrinsic is lowered, the `alloca` instruction passed to the intrinsic as its second argument is converted, as per the https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm docs, to an `inttoptr` instruction that accesses the address of the promise. On optimization levels `-O1` and above, the `-asan` pass is run after `-coro-early`, `-coro-split`, and `-coro-elide`, and before `-coro-cleanup`, and so there is no issue. At `-O0`, however, `-asan` is run in between `-coro-early` and `-coro-split`, which causes an assertion to be hit when the `inttoptr` instruction is forcibly cast to an `alloca`. Rearrange the passes such that the coroutine passes are registered before the sanitizer passes. Test Plan: Compile a simple C++ program that uses coroutines in `-O0` with `-fsanitize-address`, and confirm no assertion is hit: `clang++ coro-example.cpp -fcoroutines-ts -g -fsanitize=address -fno-omit-frame-pointer`. Reviewers: GorNishanov, lewissbaker, EricWF Reviewed By: GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43927 llvm-svn: 328951
* [Coroutines] Find custom allocators in class scopeBrian Gesiak2018-04-015-76/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: https://reviews.llvm.org/rL325291 implemented Coroutines TS N4723 section [dcl.fct.def.coroutine]/7, but it performed lookup of allocator functions within both the global and class scope, whereas the specified behavior is to perform lookup for custom allocators within just the class scope. To fix, add parameters to the `Sema::FindAllocationFunctions` function such that it can be used to lookup allocators in global scope, class scope, or both (instead of just being able to look up in just global scope or in both global and class scope). Then, use those parameters from within the coroutine Sema. This incorrect behavior had the unfortunate side-effect of causing the bug https://bugs.llvm.org/show_bug.cgi?id=36578 (or at least the reports of that bug in C++ programs). That bug would occur for any C++ user with a coroutine frame that took a single pointer argument, since it would then find the global placement form `operator new`, described in the C++ standard 18.6.1.3.1. This patch prevents Clang from generating code that triggers the LLVM assert described in that bug report. Test Plan: `check-clang` Reviewers: GorNishanov, eric_niebler, lewissbaker Reviewed By: GorNishanov Subscribers: EricWF, cfe-commits Differential Revision: https://reviews.llvm.org/D44552 llvm-svn: 328949
* Fix a major swiftcall ABI bug with trivial C++ class types.John McCall2018-04-012-16/+14
| | | | | | | | | | | | | | | | | | | | | | The problem with the previous logic was that there might not be any explicit copy/move constructor declarations, e.g. if the type is trivial and we've never type-checked a copy of it. Relying on Sema's computation seems much more reliable. Also, I believe Richard's recommendation is exactly the rule we use now on the Itanium ABI, modulo the trivial_abi attribute (which this change of course fixes our handling of in Swift). This does mean that we have a less portable rule for deciding indirectness for swiftcall. I would prefer it if we just applied the Itanium rule universally under swiftcall, but in the meantime, I need to fix this bug. This only arises when defining functions with class-type arguments in C++, as we do in the Swift runtime. It doesn't affect normal Swift operation because we don't import code as C++. llvm-svn: 328942
* Add missing include to ContinuousRangeMap.hEric Fiselier2018-04-011-0/+1
| | | | llvm-svn: 328924
* Add missing include to Visibility.hEric Fiselier2018-04-011-0/+1
| | | | llvm-svn: 328923
* Revert r328845, it caused crbug.com/827810.Nico Weber2018-03-316-62/+70
| | | | llvm-svn: 328922
* [analyzer] Unroll the loop when it has a unsigned counter.Henry Wong2018-03-312-7/+32
| | | | | | | | | | | | | | | | | Summary: The original implementation in the `LoopUnrolling.cpp` didn't consider the case where the counter is unsigned. This case is only handled in `simpleCondition()`, but this is not enough, we also need to deal with the unsinged counter with the counter initialization. Since `IntegerLiteral` is `signed`, there is a `ImplicitCastExpr<IntegralCast>` in `unsigned counter = IntergerLiteral`. This patch add the `ignoringParenImpCasts()` in the `IntegerLiteral` matcher. Reviewers: szepet, a.sidorin, NoQ, george.karpenkov Reviewed By: szepet, george.karpenkov Subscribers: xazax.hun, rnkovacs, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D45086 llvm-svn: 328919
* [analyzer] Hopefully fix the ARM buildbot.George Karpenkov2018-03-312-10/+9
| | | | llvm-svn: 328913
* [analyzer] Fix assertion crash in CStringCheckerGeorge Karpenkov2018-03-312-5/+19
| | | | | | | | | | An offset might be unknown. rdar://39054939 Differential Revision: https://reviews.llvm.org/D45115 llvm-svn: 328912
* [analyzer] Cache offset computation for MemRegionGeorge Karpenkov2018-03-312-31/+37
| | | | | | | | | | | | | Achieves almost a 200% speedup on the example where the performance of visitors was problematic. Performance on sqlite3 is unaffected. rdar://38818362 Differential Revision: https://reviews.llvm.org/D45113 llvm-svn: 328911
* [analyzer] Fix liveness calculation for C++17 structured bindingsGeorge Karpenkov2018-03-313-27/+189
| | | | | | | | | | | | | C++ structured bindings for non-tuple-types are defined in a peculiar way, where the resulting declaration is not a VarDecl, but a BindingDecl. That means a lot of existing machinery stops working. rdar://36912381 Differential Revision: https://reviews.llvm.org/D44956 llvm-svn: 328910
* [ASTImporter] Add test helper FixturePeter Szecsi2018-03-302-6/+761
| | | | | | | | | | | | | | | | | | Add a helper test Fixture, so we can add tests which can check internal attributes of AST nodes like getPreviousDecl(), isVirtual(), etc. This enables us to check if a redeclaration chain is correctly built during import, if the virtual flag is preserved during import, etc. We cannot check such attributes with the existing testImport. Also, this fixture makes it possible to import from several "From" contexts. We also added several test cases here, some of them are disabled. We plan to pass the disabled tests in other patches. Patch by Gabor Marton! Differential Revision: https://reviews.llvm.org/D43967 llvm-svn: 328906
* [analyzer] Fix test triple in missing-bind-temporary.cpp.Artem Dergachev2018-03-301-2/+2
| | | | | | | | | Otherwise the default triple for x86-windows-msvc2015 auto-inserts __attribute__((thiscall)) to some calls. Fixes the respective buildbot. llvm-svn: 328903
* [analyzer] Track null or undef values through pointer arithmetic.Artem Dergachev2018-03-303-11/+63
| | | | | | | | | | | | | | | | | | Pointer arithmetic on null or undefined pointers results in null or undefined pointers. This is obvious for undefined pointers; for null pointers it follows from our incorrect-but-somehow-working approach that declares that 0 (Loc) doesn't necessarily represent a pointer of numeric address value 0, but instead it represents any pointer that will cause a valid "null pointer dereference" issue when dereferenced. For now we've been seeing through pointer arithmetic at the original dereference expression, i.e. in bugreporter::getDerefExpr(), but not during further investigation of the value's origins in bugreporter::trackNullOrUndefValue(). The patch fixes it. Differential Revision: https://reviews.llvm.org/D45071 llvm-svn: 328896
* [CFG] [analyzer] Work around a disappearing CXXBindTemporaryExpr.Artem Dergachev2018-03-304-13/+147
| | | | | | | | | | | | | Sometimes template instantiation causes CXXBindTemporaryExpr to be missing in its usual spot. In CFG, temporary destructors work by relying on CXXBindTemporaryExprs, so they won't work in this case. Avoid the crash and notify the clients that we've encountered an unsupported AST by failing to provide the ill-formed construction context for the temporary. Differential Revision: https://reviews.llvm.org/D44955 llvm-svn: 328895
* [CFG] [analyzer] Avoid modeling C++17 constructors that aren't fully supported.Artem Dergachev2018-03-305-8/+92
| | | | | | | | | | | | | | Not enough work has been done so far to ensure correctness of construction contexts in the CFG when C++17 copy elision is in effect, so for now we should drop construction contexts in the CFG and in the analyzer when they seem different from what we support anyway. This includes initializations with conditional operators and return values across multiple stack frames. Differential Revision: https://reviews.llvm.org/D44854 llvm-svn: 328893
* Remove unused CHECK lines leftover from r306928.Eli Friedman2018-03-301-4/+0
| | | | | | | The RUN lines were removed, but the corresponding CHECK lines never went away. llvm-svn: 328891
* [OPENMP] Added emission of offloading data sections for declare targetAlexey Bataev2018-03-3039-534/+772
| | | | | | | | | | variables. Added emission of the offloading data sections for the variables within declare target regions + fixes emission of the declare target variables marked as declare target not within the declare target region. llvm-svn: 328888
* [clang-format] Ensure wrapped ObjC selectors with 1 arg obey ↵Ben Hamilton2018-03-302-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IndentWrappedFunctionNames Summary: In D43121, @Typz introduced logic to avoid indenting 2-or-more argument ObjC selectors too far to the right if the first component of the selector was longer than the others. This had a small side effect of causing wrapped ObjC selectors with exactly 1 argument to not obey IndentWrappedFunctionNames: ``` - (aaaaaaaaaa) aaaaaaaaaa; ``` This diff fixes the issue by ensuring we align wrapped 1-argument ObjC selectors correctly: ``` - (aaaaaaaaaa) aaaaaaaaaa; ``` Test Plan: New tests added. Test failed before change, passed after change. Ran tests with: % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, klimek, Typz, jolesiak Reviewed By: djasper, jolesiak Subscribers: cfe-commits, Typz Differential Revision: https://reviews.llvm.org/D44994 llvm-svn: 328871
* [analyzer] Remove the unused method declaration in `ValistChecker.cpp`.Henry Wong2018-03-301-1/+0
| | | | | | | | | | | | | | Summary: `getVariableNameFromRegion()` seems useless. Reviewers: xazax.hun, george.karpenkov Reviewed By: xazax.hun Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D45081 llvm-svn: 328860
* [Modules] Improve fixit for framework private module mapsBruno Cardoso Lopes2018-03-302-7/+12
| | | | | | | | | The wrong source range was being provided in some case, fix that to get a better fixit. rdar://problem/38520199 llvm-svn: 328857
OpenPOWER on IntegriCloud