summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* ANSIfy. No behavior change.Nico Weber2017-05-053-3/+3
| | | | llvm-svn: 302258
* Warn that the [] spelling of uuid(...) is deprecated.Nico Weber2017-05-052-2/+9
| | | | | | https://reviews.llvm.org/D32879 llvm-svn: 302255
* Add a fix-it for -Wunguarded-availabilityAlex Lorenz2017-05-052-20/+189
| | | | | | | | | | | | | This patch adds a fix-it for the -Wunguarded-availability warning. This fix-it is similar to the Swift one: it suggests that you wrap the statement in an `if (@available)` check. The produced fixits are indented (just like the Swift ones) to make them look nice in Xcode's fix-it preview. rdar://31680358 Differential Revision: https://reviews.llvm.org/D32424 llvm-svn: 302253
* [ObjC] Don't disallow vector parameters/return values in methodsAlex Lorenz2017-05-051-3/+1
| | | | | | | | | | | whose introduced version is lower than the allowed version. We should just rely on the target version as this introduced version can lead to false positives (e.g. deprecated declarations). rdar://31964333 llvm-svn: 302250
* Introduce Wzero-as-null-pointer-constant.Nico Weber2017-05-051-0/+14
| | | | | | | | | Add an opt-in warning that fires when 0 is used as a null pointer. gcc has this warning, and there's some demand for it. https://reviews.llvm.org/D32914 llvm-svn: 302247
* [Tooling] Remove redundant check, NFCiKrasimir Georgiev2017-05-051-6/+2
| | | | | | | | | | | | Summary: The Database check looks redundant. Reviewers: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D32909 llvm-svn: 302236
* Document that Multilib flags must be actual flagsJonathan Roelofs2017-05-051-10/+12
| | | | | | | | This is because -print-multi-lib depends on them being flags for correctness. Fixes a case of this in the arm-android multilib selection logic. llvm-svn: 302207
* Fix whitespace before token-paste of an argument.James Y Knight2017-05-041-12/+18
| | | | | | | | | | | | | | | The whitespace should come from the argument name in the macro expansion, rather than from the token passed to the macro (same as it does when not pasting). Added a new test case for the change in behavior to stringize_space.c. FileCheck'ized macro_paste_commaext.c, tweaked the test case, and added a comment; no behavioral change to this test. Differential Revision: https://reviews.llvm.org/D30427 llvm-svn: 302195
* Fix bugs checking va_start in lambdas and erroneous contextsReid Kleckner2017-05-041-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: First, getCurFunction looks through blocks and lambdas, which is wrong. Inside a lambda, va_start should refer to the lambda call operator prototype. This fixes PR32737. Second, we shouldn't use any of the getCur* methods, because they look through contexts that we don't want to look through (EnumDecl, CapturedStmtDecl). We can use CurContext directly as the calling context. Finally, this code assumed that CallExprs would never appear outside of code contexts (block, function, obj-c method), which is wrong. Struct member initializers are an easy way to create and parse exprs in a non-code context. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D32761 llvm-svn: 302188
* Driver: only inject libstdc++ paths when needed on CrossWindowsSaleem Abdulrasool2017-05-041-1/+1
| | | | | | | | When building with libc++ don't bother with injecting the libstdc++ search paths into the linker search path. This will make it easier to switch between ld and lld. llvm-svn: 302184
* Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in ↵Peter Collingbourne2017-05-041-2/+6
| | | | | | | | the module summary. NFCI." with a fix for the clang backend. llvm-svn: 302176
* clang-format: [JS] exponentiation operatorMartin Probst2017-05-042-0/+12
| | | | | | | | | | | | Summary: While its precedence should be higher than multiplicative, LLVM does not have a level for that, so for the time being just treat it as multiplicative. Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D32864 llvm-svn: 302156
* DiagnosticsEngine should clear DelayedDiagID before reporting theAlex Lorenz2017-05-042-5/+7
| | | | | | | | | | | | | | | | | | | | | delayed diagnostic This fix avoids an infinite recursion that was uncovered in one of our internal tests by r301992. The testcase is the most reduced version of that auto-generated test. This is an improved version of the reverted commit r302037. The previous fix actually managed to expose another subtle bug whereby `fatal_too_many_errors` error was reported twice, with the second report setting the `FatalErrorOccurred` flag. That prevented the notes that followed the diagnostic the caused `fatal_too_many_errors` to be emitted. This commit ensures that notes that follow `fatal_too_many_errors` but that belong to the diagnostic that caused `fatal_too_many_errors` won't be emitted by setting the `FatalErrorOccurred` when emitting `fatal_too_many_errors`. rdar://31962618 llvm-svn: 302151
* Add support of the next Ubuntu (Ubuntu 17.10 - Artful Aardvark)Sylvestre Ledru2017-05-041-0/+1
| | | | llvm-svn: 302143
* Revert "IR: Use pointers instead of GUIDs to represent edges in the module ↵Eric Liu2017-05-041-2/+2
| | | | | | | | summary. NFCI." This reverts commit r302108. llvm-svn: 302141
* [Index] The relation between the declarations in templateAlex Lorenz2017-05-041-3/+1
| | | | | | | | | | specializations that 'override' declarations in the base template should use the 'specializationOf' relation instead of 'specializationOf | overrideOf'. The indexer relations are meant to be orthogonal, so 'specializationOf' is better than the combined relation. llvm-svn: 302136
* [ARM] ACLE Chapter 9 intrinsicsSam Parker2017-05-041-2/+316
| | | | | | | | | | Implemented the remaining integer data processing intrinsics from the ARM ACLE v2.1 spec, such as parallel arithemtic and DSP style multiplications. Differential Revision: https://reviews.llvm.org/D32282 llvm-svn: 302131
* [OpenCL] Add intel_reqd_sub_group_size attribute supportXiuli Pan2017-05-043-22/+50
| | | | | | | | | | | | | | | | Summary: Add intel_reqd_sub_group_size attribute support as intel extension cl_intel_required_subgroup_size from https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt Reviewers: Anastasia, bader, hfinkel, pxli168 Reviewed By: Anastasia, bader, pxli168 Subscribers: cfe-commits, yaxunl Differential Revision: https://reviews.llvm.org/D30805 llvm-svn: 302125
* IR: Use pointers instead of GUIDs to represent edges in the module summary. ↵Peter Collingbourne2017-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | NFCI. When profiling a no-op incremental link of Chromium I found that the functions computeImportForFunction and computeDeadSymbols were consuming roughly 10% of the profile. The goal of this change is to improve the performance of those functions by changing the map lookups that they were previously doing into pointer dereferences. This is achieved by changing the ValueInfo data structure to be a pointer to an element of the global value map owned by ModuleSummaryIndex, and changing reference lists in the GlobalValueSummary to hold ValueInfos instead of GUIDs. This means that a ValueInfo will take a client directly to the summary list for a given GUID. Differential Revision: https://reviews.llvm.org/D32471 llvm-svn: 302108
* Add #pragma clang module begin/end pragmas and generate them when ↵Richard Smith2017-05-047-69/+240
| | | | | | | | | | | | | | preprocessing a module. These pragmas are intended to simulate the effect of entering or leaving a file with an associated module. This is not completely implemented yet: declarations between the pragmas will not be attributed to the correct module, but macro visibility is already functional. Modules named by #pragma clang module begin must already be known to clang (in some module map that's either loaded or on the search path). llvm-svn: 302098
* [IR] Abstract away ArgNo+1 attribute indexing as much as possibleReid Kleckner2017-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Do three things to help with that: - Add AttributeList::FirstArgIndex, which is an enumerator currently set to 1. It allows us to change the indexing scheme with fewer changes. - Add addParamAttr/removeParamAttr. This just shortens addAttribute call sites that would otherwise need to spell out FirstArgIndex. - Remove some attribute-specific getters and setters from Function that take attribute list indices. Most of these were only used from BuildLibCalls, and doesNotAlias was only used to test or set if the return value is malloc-like. I'm happy to split the patch, but I think they are probably easier to review when taken together. This patch should be NFC, but it sets the stage to change the indexing scheme to this, which is more convenient when indexing into an array: 0: func attrs 1: retattrs 2...: arg attrs Reviewers: chandlerc, pete, javed.absar Subscribers: david2050, llvm-commits Differential Revision: https://reviews.llvm.org/D32811 llvm-svn: 302060
* Revert r302037Alex Lorenz2017-05-031-2/+1
| | | | | | | | | The commit caused the following two buildbot failures: Clang :: Misc/error-limit-multiple-notes.cpp Clang :: Misc/error-limit.c llvm-svn: 302046
* DiagnosticsEngine should clear DelayedDiagID before reporting theAlex Lorenz2017-05-031-1/+2
| | | | | | | | | | | | delayed diagnostic This avoids an infinite loop that was uncovered in one of our internal tests by r301992. The testcase is the most reduced version of that auto-generated test. rdar://31962618 llvm-svn: 302037
* [OpenMP] Extended parse for 'always' map modifierCarlo Bertolli2017-05-031-0/+24
| | | | | | | | https://reviews.llvm.org/D32807 This patch allows the map modifier 'always' to be separated by the map type (to, from, tofrom) only by a whitespace, rather than strictly by a comma as in current trunk. llvm-svn: 302031
* Reusing an existing attribute diagnosticOren Ben Simhon2017-05-031-1/+2
| | | | | | | | | In a previous patch, a new generic error diagnostic for inconsistent attributes was added. In this commit I reuse this diagnostic for ns_returns_retained attribute check. Differential Revision: https://reviews.llvm.org/D32697 llvm-svn: 302024
* [analyzer] Fix memory error bug category capitalization.Artem Dergachev2017-05-034-18/+23
| | | | | | | | | | | | It was written as "Memory Error" in most places and as "Memory error" in a few other places, however it is the latter that is more consistent with other categories (such as "Logic error"). rdar://problem/31718115 Differential Revision: https://reviews.llvm.org/D32702 llvm-svn: 302016
* Silences gcc's -Wnarrowing.Daniel Jasper2017-05-031-2/+3
| | | | | | | | | I think this is a false positive in GCC's warning, but nonetheless, we should try to be warning-free. Smaller reproducer (reproduces with GCC 6.3): https://godbolt.org/g/cJuO2z llvm-svn: 302003
* Revert rL301998: "Fix a bug that -isysroot is completely ignored on Unix"Yuka Takahashi2017-05-031-1/+1
| | | | | | | | This reverts commit because it broke sanitizer-x86_64-linux-autoconf bot and clang-ppc64be-linux-multistage bot. llvm-svn: 302000
* Fix a bug that -isysroot is completely ignored on UnixYuka Takahashi2017-05-031-1/+1
| | | | | | | | | | | | -isysroot is the flag which set the system root directory. This bug report https://bugs.llvm.org//show_bug.cgi?id=11503 shows that -isysroot is not handled at all on Unix, so fixed this bug. After this diff, I could get this result https://pastebin.com/TeCmn9mj . Differential Revision: https://reviews.llvm.org/D31495 llvm-svn: 301998
* [sanitizer-coverage] add a deprecation warning to the old sanitizer-coverage ↵Kostya Serebryany2017-05-031-2/+10
| | | | | | flag combinations llvm-svn: 301994
* [modules] Round-trip -Werror flag through explicit module build.Richard Smith2017-05-034-47/+61
| | | | | | | | | | | | | | | The intent for an explicit module build is that the diagnostics produced within the module are those that were configured when the module was built, not those that are enabled within a user of the module. This includes diagnostics that don't actually show up until the module is used (for instance, diagnostics produced during template instantiation and weird cases like -Wpadded). We serialized and restored the diagnostic state for individual warning groups, but previously did not track the state for flags like -Werror and -Weverything, which are implemented as separate bits rather than as part of the diagnostics mapping information. llvm-svn: 301992
* [ODRHash] Add support for array and decayed types, and parameter names and ↵Richard Trieu2017-05-022-0/+161
| | | | | | types. llvm-svn: 301989
* [ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)Vedant Kumar2017-05-021-8/+78
| | | | | | | | | | | | | | | | | | | | | | | | Currently, ubsan emits overflow checks for arithmetic that is known to be safe at compile-time, e.g: 1 + 1 => CheckedAdd(1, 1) This leads to breakage when using the __builtin_prefetch intrinsic. LLVM expects the arguments to @llvm.prefetch to be constant integers, and when ubsan inserts unnecessary checks on the operands to the intrinsic, this contract is broken, leading to verifier failures (see PR32874). Instead of special-casing __builtin_prefetch for ubsan, this patch fixes the underlying problem, i.e that clang currently emits unnecessary overflow checks. Testing: I ran the check-clang and check-ubsan targets with a stage2, ubsan-enabled build of clang. I added a regression test for PR32874, and some extra checking to make sure we don't regress runtime checking for unsafe arithmetic. The existing ubsan-promoted-arithmetic.cpp test also provides coverage for this change. llvm-svn: 301988
* Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of ↵Reid Kleckner2017-05-023-21/+6
| | | | | | | | | | AttributeList" This time, I fixed, built, and tested clang. This reverts r301712. llvm-svn: 301981
* Fix PR32831 (Try Again): 'this' capture while instantiating generic lambda ↵Faisal Vali2017-05-021-14/+39
| | | | | | | | | | | | | | | | | | | | | | | call operator specialization When computing the appropriate cv-qualifiers for the 'this' capture, we have to examine each enclosing lambda - but when using the FunctionScopeInfo stack we have to ensure that the lambda below (outer) is the decl-context of the closure-class of the current lambda. https://bugs.llvm.org/show_bug.cgi?id=32831 This patch was initially committed here: https://reviews.llvm.org/rL301735 Then reverted here: https://reviews.llvm.org/rL301916 The issue with the original patch was a failure to check that the closure type has been created within the LambdaScopeInfo before querying its DeclContext - instead of just assuming it has (silly!). A reduced example such as this highlights the problem: struct X { int data; auto foo() { return [] { return [] -> decltype(data) { return 0; }; }; } }; When 'data' within decltype(data) tries to determine the type of 'this', none of the LambdaScopeInfo's have their closure types created at that point. llvm-svn: 301972
* [Sema] Update function doc; NFCGeorge Burgess IV2017-05-021-1/+1
| | | | llvm-svn: 301970
* Simplify some va_start checking logicReid Kleckner2017-05-021-85/+82
| | | | | | | | | | | | | | | Combine the logic doing the ms_abi/sysv_abi checks into one function so that each check and its logical opposite are near each other. Now we don't need two Sema entry points for MS va_start and regular va_start. Refactor the code that checks if the va_start caller is a function, block, or obj-c method. We do this in three places, and they are all buggy for variadic lambdas (PR32737). After this change, I have one place to apply the functional fix. NFC llvm-svn: 301968
* Revert r301822 (and dependent r301825), which tried to improve theDaniel Jasper2017-05-021-136/+106
| | | | | | | | | | | | | | | | | | | | | | | | handling of constexprs with unknown bounds. This triggers a corner case of the language where it's not yet clear whether this should be an error: struct A { static void *const a[]; static void *const b[]; }; constexpr void *A::a[] = {&b[0]}; constexpr void *A::b[] = {&a[0]}; When discovering the initializer for A::a, the bounds of A::b aren't known yet. It is unclear whether warning about errors should be deferred until the end of the translation unit, possibly resolving errors that can be resolved. In practice, the compiler can know the bounds of all arrays in this example. Credits for reproducers and explanation go to Richard Smith. Richard, please add more info in case my explanation is wrong. llvm-svn: 301963
* Revert r301735 (and subsequent r301786).Daniel Jasper2017-05-021-37/+13
| | | | | | | | | | | | | | | It leads to clang crashing, e.g. on this short code fragment (added to test/SemaCXX/warn-thread-safety-parsing.cpp): class SomeClass { public: void foo() { auto l = [this] { auto l = [] EXCLUSIVE_LOCKS_REQUIRED(mu_) {}; }; } Mutex mu_; }; llvm-svn: 301916
* [analyzer] Detect bad free of function pointersDaniel Marjamaki2017-05-021-1/+44
| | | | | | Differential Revision: https://reviews.llvm.org/D31650 llvm-svn: 301913
* Revert r301785 (and r301787) because they caused PR32864.Nick Lewycky2017-05-021-7/+1
| | | | | | The fix is that ExprEvaluatorBase::VisitInitListExpr should handle transparent exprs instead of exprs with one element. Fixing that uncovers one testcase failure because the AST for "constexpr _Complex float test2 = {1};" is wrong (the _Complex prvalue should not be const-qualified), and a number of test failures in test/OpenMP where the captured stmt contains an InitListExpr that is in syntactic form. llvm-svn: 301891
* Fix initial diagnostic state setup for an explicit module with no diagnostic ↵Richard Smith2017-05-011-4/+14
| | | | | | | | | | | | pragmas. If a file has no diagnostic pragmas, we build its diagnostic state lazily, but in this case we never set up the root state to be the diagnostic state in which the module was originally built, so the diagnostic flags for files in the module with no diagnostic pragmas were incorrectly based on the user of the module rather than the diagnostic state when the module was built. llvm-svn: 301846
* Object: Remove ModuleSummaryIndexObjectFile class.Peter Collingbourne2017-05-011-1/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D32195 llvm-svn: 301832
* Silence unused variable warning. NFC.Benjamin Kramer2017-05-011-1/+1
| | | | llvm-svn: 301825
* Improve handling of arrays of unknown bound in constant expressions.Richard Smith2017-05-011-106/+136
| | | | | | | | | | | | | | Do not spuriously reject constexpr functions that access elements of an array of unknown bound; this may later become valid once the bound is known. Permit array-to-pointer decay on such arrays, but disallow pointer arithmetic (since we do not know whether it will have defined behavior). The standard is not clear on how this should work, but this seems to be a decent answer. Patch by Robert Haberlach! llvm-svn: 301822
* Adapt to LLVM's rename of WeakVH to WeakTrackingVH; NFCSanjoy Das2017-05-015-12/+14
| | | | llvm-svn: 301815
* The -coverage-file flag was removed in r280306, and this piece was missed; NFC.Aaron Ballman2017-05-011-1/+1
| | | | llvm-svn: 301796
* Remove unneeded struct; NFCSanjoy Das2017-05-012-20/+12
| | | | | | | | | | | | | | Summary: Unless I'm missing something, the DeferredGlobal struct's GV field is unused, removing which makes the struct itself trivial. Reviewers: rafael, chandlerc Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D32691 llvm-svn: 301789
* Handle expressions with non-literal types like ignored expressions if we are ↵Nick Lewycky2017-05-011-1/+7
| | | | | | | | supposed to continue evaluating them. Also fix a crash casting a derived nullptr to a virtual base. llvm-svn: 301785
* [X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)Simon Pilgrim2017-04-292-0/+165
| | | | llvm-svn: 301749
OpenPOWER on IntegriCloud