summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* Factor out repeated code parsing and concatenating header-names fromRichard Smith2019-03-199-205/+129
| | | | | | | | | | | tokens. We now actually form an angled_string_literal token for a header name by concatenation rather than just working out what its contents would be. This substantially simplifies downstream processing and is necessary for C++20 header unit imports. llvm-svn: 356433
* Don't apply the include depth limit until we actually decide to enterRichard Smith2019-03-191-7/+7
| | | | | | | | | the file. NFC unless a skipped #include is found at the final permitted #include level. llvm-svn: 356432
* Minor renaming as suggested in review [NFC]Aaron Puchert2019-03-192-15/+16
| | | | | | See D59455. llvm-svn: 356430
* Thread safety analysis: Add note for unlock kind mismatchAaron Puchert2019-03-185-22/+24
| | | | | | | | | | | | | | | | | | Summary: Similar to D56967, we add the existing diag::note_locked_here to tell the user where we saw the locking that isn't matched correctly. Reviewers: aaron.ballman, delesley Reviewed By: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59455 llvm-svn: 356427
* [MS] Skip vbase construction in abstract class ctorsReid Kleckner2019-03-183-27/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As background, when constructing a complete object, virtual bases are constructed first. If an exception is thrown later in the ctor, those virtual bases are destroyed, so sema marks the relevant constructors and destructors of virtual bases as referenced. If necessary, they are emitted. However, an abstract class can never be used to construct a complete object. In the Itanium C++ ABI, this works out nicely, because we never end up emitting the "complete" constructor variant, only the "base" constructor variant, which can be called by constructors of derived classes. Clang's Sema::MarkBaseAndMemberDestructorsReferenced is aware of this optimization, and it does not mark ctors and dtors of virtual bases referenced when the constructor of an abstract class is emitted. In the Microsoft ABI, there are no complete/base variants, so before this change, the constructor of an abstract class could reference ctors and dtors of a virtual base without marking them referenced. This could lead to unresolved symbol errors at link time, as reported in PR41065. The fix is to implement the same optimization as Sema: If the class is abstract, don't bother initializing its virtual bases. The "is this class the most derived class" check in the constructor will never pass, and the virtual base constructor calls are always dead. Skip them. I think Richard noticed this missed optimization back in 2016 when he was implementing inheriting constructors. I wasn't able to find any bugs or email about it, though. Fixes PR41065 llvm-svn: 356425
* [X86] Add gcc rotate intrinsics to ia32intrin.hCraig Topper2019-03-182-0/+180
| | | | | | | | | | | | | | | | This is another attempt at what Erich Keane tried to do in r355322. This adds rolb, rolw, rold, rolq and their ror equivalent as always_inline wrappers around __builtin_rotate* which will lower to funnel shift intrinsics in IR. Additionally, when _MSC_VER is not defined we will define _rotl, _lrotl, _rotr, _lrotr as macros to one of the always_inline intrinsics mentioned above. Making sure that _lrotl/_lrotr use either 32 or 64 bit based on the size of long. These need to be macros because we have builtins with the same name for MS compatibility, but _MSC_VER isn't always defined when those builtins are enabled. We also define _rotwl and _rotwr as macros aliasing to rolw/rorw just like gcc to complete the set. These don't need to be gated with _MSC_VER because these aren't MS builtins. I've added tests both for non-MS and -ms-extensions with and without _MSC_VER being defined. Differential Revision: https://reviews.llvm.org/D59346 llvm-svn: 356423
* [Sema] Add some compile time _FORTIFY_SOURCE diagnosticsErik Pilkington2019-03-1816-106/+280
| | | | | | | | | | | | | | | | | | | | | | | These diagnose overflowing calls to subset of fortifiable functions. Some functions, like sprintf or strcpy aren't supported right not, but we should probably support these in the future. We previously supported this kind of functionality with -Wbuiltin-memcpy-chk-size, but that diagnostic doesn't work with _FORTIFY implementations that use wrapper functions. Also unlike that diagnostic, we emit these warnings regardless of whether _FORTIFY_SOURCE is actually enabled, which is nice for programs that don't enable the runtime checks. Why not just use diagnose_if, like Bionic does? We can get better diagnostics in the compiler (i.e. mention the sizes), and we have the potential to diagnose sprintf and strcpy which is impossible with diagnose_if (at least, in languages that don't support C++14 constexpr). This approach also saves standard libraries from having to add diagnose_if. rdar://48006655 Differential revision: https://reviews.llvm.org/D58797 llvm-svn: 356397
* [OPENMP] Set scheduling for doacross loops as schedule, 1.Alexey Bataev2019-03-184-4/+22
| | | | | | | The default scheduling for doacross loops is changed from static to static, 1. llvm-svn: 356388
* [AMDGPU] Add the missing clang change of the experimental buffer fat pointerMichael Liao2019-03-183-4/+5
| | | | llvm-svn: 356385
* Add testcase from bug 41079Matt Arsenault2019-03-171-0/+17
| | | | llvm-svn: 356354
* CodeGen: Preserve packed attribute in constStructWithPadding.Peter Collingbourne2019-03-162-1/+7
| | | | | | | | Otherwise the object may have an incorrect size due to tail padding. Differential Revision: https://reviews.llvm.org/D59446 llvm-svn: 356328
* [analyzer] ConditionBRVisitor: Unknown condition evaluation supportCsaba Dabis2019-03-163-11/+22
| | | | | | | | | | | | | | | | | | | | | | Summary: If the constraint information is not changed between two program states the analyzer has not learnt new information and made no report. But it is possible to happen because we have no information at all. The new approach evaluates the condition to determine if that is the case and let the user know we just `Assuming...` some value. Reviewers: NoQ, george.karpenkov Reviewed By: NoQ Subscribers: llvm-commits, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gsd, gerazo Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D57410 llvm-svn: 356323
* [analyzer] ConditionBRVisitor: Remove GDM checkingCsaba Dabis2019-03-165-8/+24
| | | | | | | | | | | | | | | | | | | | Summary: Removed the `GDM` checking what could prevent reports made by this visitor. Now we rely on constraint changes instead. (It reapplies 356318 with a feature from 356319 because build-bot failure.) Reviewers: NoQ, george.karpenkov Reviewed By: NoQ Subscribers: cfe-commits, jdoerfert, gerazo, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D54811 llvm-svn: 356322
* Revert "[analyzer] ConditionBRVisitor: Remove GDM checking"Csaba Dabis2019-03-165-22/+8
| | | | | | This reverts commit f962485adad9d646511fd3240c0408d9554e6784. llvm-svn: 356321
* Revert "[analyzer] ConditionBRVisitor: Unknown condition evaluation support"Csaba Dabis2019-03-163-24/+11
| | | | | | This reverts commit 0fe67a61cd4aec13c7969a179517f1cc06ab05cd. llvm-svn: 356320
* [analyzer] ConditionBRVisitor: Unknown condition evaluation supportCsaba Dabis2019-03-163-11/+24
| | | | | | | | | | | | | | | | Summary: If the constraint information is not changed between two program states the analyzer has not learnt new information and made no report. But it is possible to happen because we have no information at all. The new approach evaluates the condition to determine if that is the case and let the user know we just 'Assuming...' some value. Reviewers: NoQ, george.karpenkov Reviewed By: NoQ Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gsd, gerazo Tags: #clang Differential Revision: https://reviews.llvm.org/D57410 llvm-svn: 356319
* [analyzer] ConditionBRVisitor: Remove GDM checkingCsaba Dabis2019-03-165-8/+22
| | | | | | | | | | | | | | | | Summary: Removed the `GDM` checking what could prevent reports made by this visitor. Now we rely on constraint changes instead. Reviewers: NoQ, george.karpenkov Reviewed By: NoQ Subscribers: jdoerfert, gerazo, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D54811 llvm-svn: 356318
* [WebAssembly] Use rethrow intrinsic in the rethrow blockHeejin Ahn2019-03-165-13/+15
| | | | | | | | | | | | | | | | | | | | | | Summary: Because in wasm we merge all catch clauses into one big catchpad, in case none of the types in catch handlers matches after we test against each of them, we should unwind to the next EH enclosing scope. For this, we should NOT use a call to `__cxa_rethrow` but rather a call to our own rethrow intrinsic, because what we're trying to do here is just to transfer the control flow into the next enclosing EH pad (or the caller). Calls to `__cxa_rethrow` should only be used after a call to `__cxa_begin_catch`. Reviewers: dschuff Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59353 llvm-svn: 356317
* [analyzer] Teach scan-build to find clang when installed in /usr/local/bin/Devin Coughlin2019-03-161-2/+21
| | | | | | | | | | | | | Change scan-build to support the scenario where scan-build is installed in $TOOLCHAIN/usr/local/bin/ but clang itself is installed in $TOOLCHAIN/usr/bin/. This is restricted to when 'xcrun' is present; that is, on the Mac. rdar://problem/48914634 Differential Revision: https://reviews.llvm.org/D59406 llvm-svn: 356308
* hello, clangCsaba Dabis2019-03-151-1/+1
| | | | | | Test commit with head and body. llvm-svn: 356307
* [coroutines][PR40978] Emit error for co_yield within catch blockBrian Gesiak2019-03-156-25/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As reported in https://bugs.llvm.org/show_bug.cgi?id=40978, it's an error to use the `co_yield` or `co_await` keywords outside of a valid "suspension context" as defined by [expr.await]p2 of http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4775.pdf. Whether or not the current scope was in a function-try-block's (https://en.cppreference.com/w/cpp/language/function-try-block) handler could be determined using scope flag `Scope::FnTryCatchScope`. No such flag existed for a simple C++ catch statement, so this commit adds one. Reviewers: GorNishanov, tks2103, rsmith Reviewed By: GorNishanov Subscribers: EricWF, jdoerfert, cfe-commits, lewissbaker Tags: #clang Differential Revision: https://reviews.llvm.org/D59076 llvm-svn: 356296
* [CUDA][Windows] Partial fix for bug 38811 (Step 2 of 3)Evgeny Mankov2019-03-152-11/+11
| | | | | | | | | | | | | | | | | | | | Partial fix for the clang Bug 38811 "Clang fails to compile with CUDA-9.x on Windows". [Synopsis] __sptr is a new Microsoft specific modifier (https://docs.microsoft.com/en-us/cpp/cpp/sptr-uptr?view=vs-2017). [Solution] Replace all `__sptr` occurrences with `__s` (and all `__cptr` with `__c` as well) to eliminate the below clang compilation error on Windows. In file included from C:\GIT\LLVM\trunk\llvm-64-release-vs2017-15.9.5\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:162: C:\GIT\LLVM\trunk\llvm-64-release-vs2017-15.9.5\dist\lib\clang\9.0.0\include\__clang_cuda_device_functions.h:524:33: error: expected expression return __nv_fast_sincosf(__a, __sptr, __cptr); ^ Reviewed by: Artem Belevich Differential Revision: http://reviews.llvm.org/D59423 llvm-svn: 356291
* [HIP-Clang] propagate -mllvm options to opt and llcAaron Enye Shi2019-03-152-0/+45
| | | | | | | | | | Change the HIP Toolchain to pass the OPT_mllvm options into OPT and LLC stages. Added a lit test to verify the command args. Reviewers: yaxunl Differential Revision: https://reviews.llvm.org/D59316 llvm-svn: 356277
* [CUDA][Windows] Partial fix for bug #38811 (Step 1 of 3)Evgeny Mankov2019-03-151-2/+2
| | | | | | | | | | | | | | | Partial fix for the clang Bug https://bugs.llvm.org/show_bug.cgi?id=38811 "Clang fails to compile with CUDA-9.x on Windows". Adding defined(_WIN64) check along with existing #if defined(__LP64__) eliminates the below clang (64-bit) compilation error on Windows. C:/GIT/LLVM/trunk/llvm-64-release-vs2017/dist/lib/clang/9.0.0\include\__clang_cuda_device_functions.h(1609,45): error GEF7559A7: no matching function for call to 'roundf' __DEVICE__ long lroundf(float __a) { return roundf(__a); } Reviewed by: Artem Belevich Differential Revision: http://reviews.llvm.org/D59361 llvm-svn: 356255
* Make getFullyQualifiedName qualify both the pointee and class type for ↵Benjamin Kramer2019-03-152-1/+16
| | | | | | | | | | | member ptr types We already handle pointers and references, member ptrs are just another special case. Fixes PR40732. Differential Revision: https://reviews.llvm.org/D59387 llvm-svn: 356250
* Remove an assert in template pack deduction during nested instantiation.Richard Trieu2019-03-152-18/+37
| | | | llvm-svn: 356231
* Add missing override specifier [NFC]Aaron Puchert2019-03-151-1/+1
| | | | | | | This should fix a -Winconsistent-missing-override warning that is only visible when Z3 is enabled. llvm-svn: 356228
* [analyzer] RetainCount: A function isn't a CFRetain if it takes no arguments.Artem Dergachev2019-03-152-6/+19
| | | | | | | | | | | | | Don't crash when a function has a name that starts with "CF" and ends with "Retain" but takes 0 arguments. In particular, don't try to treat it as if it returns its first argument. These problems are inevitable because the checker is naming-convention-based, but at least we shouldn't crash. Differential Revision: https://reviews.llvm.org/D59123 llvm-svn: 356223
* [analyzer] Support C++17 aggregates with bases without constructors.Artem Dergachev2019-03-152-5/+109
| | | | | | | | | | | | RegionStore now knows how to bind a nonloc::CompoundVal that represents the value of an aggregate initializer when it has its initial segment of sub-values correspond to base classes. Additionally, fixes the crash from pr40022. Differential Revision: https://reviews.llvm.org/D59054 llvm-svn: 356222
* Reland the rest of "Add AIX Target Info"Jason Liu2019-03-147-1/+510
| | | | | | | | | llvm-svn 356197 relanded previously failing test case max_align.c. This commit will reland the rest of llvm-svn 356060 commit. Differential Revision: https://reviews.llvm.org/D59048 llvm-svn: 356208
* [OPENMP]Fix crash for the ordered(n) clause.Alexey Bataev2019-03-143-5/+16
| | | | | | | | If the doacross lop construct is used and the loop counter is declare outside of the loop, the compiler might crash trying to get the address of the loop counter. Patch fixes this problem. llvm-svn: 356198
* Reland part of "Add AIX Target Info"Jason Liu2019-03-141-0/+12
| | | | | | | | | | | This patch reland the test case max_align.c which is failing at Windows and PS4 platform in the previous commit. Differential Revision: https://reviews.llvm.org/D59048 original llvm-svn: 356060 llvm-svn: 356197
* [CodeGen] Consider tied operands when adjusting inline asm operands.Eli Friedman2019-03-142-2/+17
| | | | | | | | | | | | | The constraint "0" in the following asm did not consider the its relationship with "=y" when try to replace the type of the operands. asm ("nop" : "=y"(Mu8_1 ) : "0"(Mu8_0 )); Patch by Xiang Zhang. Differential Revision: https://reviews.llvm.org/D56990 llvm-svn: 356196
* [Sema] Fix a use-after-free of a _Nonnull ParsedAttrErik Pilkington2019-03-142-10/+18
| | | | | | | | | | | | | | We were allocating the implicit attribute in the declarator's attribute pool, but putting into the declaration specifier's ParsedAttributesView. If there are multiple declarators, then we'll use the attribute from the declaration specifier after clearing out the declarators attribute pool. Fix this by allocating the attribute in the declaration specifier's pool. rdar://48529718 Differential revision: https://reviews.llvm.org/D59327 llvm-svn: 356187
* Add PragmaHandler for MSVC pragma execution_character_setReid Kleckner2019-03-145-0/+132
| | | | | | | | | | | | __pragma(execution_character_set(push, "UTF-8")) is used in TraceLoggingProvider.h. This commit implements a no-op handler for compatability, similar to how the flag -fexec_charset is handled. Patch by Matt Gardner! Differential Revision: https://reviews.llvm.org/D58530 llvm-svn: 356185
* [analyzer] Fix an assertation failure for invalid sourcelocation, add a new ↵Kristof Umann2019-03-146-2/+69
| | | | | | | | | | | | | | | | | | | | | | | | debug checker For a rather short code snippet, if debug.ReportStmts (added in this patch) was enabled, a bug reporter visitor crashed: struct h { operator int(); }; int k() { return h(); } Ultimately, this originated from PathDiagnosticLocation::createMemberLoc, as it didn't handle the case where it's MemberExpr typed parameter returned and invalid SourceLocation for MemberExpr::getMemberLoc. The solution was to find any related valid SourceLocaion, and Stmt::getBeginLoc happens to be just that. Differential Revision: https://reviews.llvm.org/D58777 llvm-svn: 356161
* [CodeGen][ObjC] Remove the leading 'l' from symbols for protocolAkira Hatanaka2019-03-1410-22/+37
| | | | | | | | | | | | | metadata and protocol list The leading 'l' tells ld64 to remove the symbol name, which can make debugging difficult. rdar://problem/47256637 Differential Revision: https://reviews.llvm.org/D59234 llvm-svn: 356156
* Fix test after r356148Nico Weber2019-03-141-1/+4
| | | | llvm-svn: 356154
* Remove unused variable to silence compiler warning [NFC]Mikael Holmen2019-03-141-2/+1
| | | | | | The only use of MI was removed in r356142. llvm-svn: 356152
* [ASTImporter] Fix import of NestedNameSpecifierLoc.Balazs Keri2019-03-142-1/+24
| | | | | | | | | | | | | | | | | | | Summary: Import type location in case of TypeSpec and TypeSpecWithTemplate. Without this fix the imported NespedNameSpecifierLoc will have an invalid begin location. Reviewers: a.sidorin, shafik, a_sidorin, martong Reviewed By: a_sidorin Subscribers: rnkovacs, jdoerfert, dkrupp, martong, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D55358 llvm-svn: 356151
* Objective-C++11: Support static_assert() in @interface/@implementation ivar ↵Nico Weber2019-03-146-1/+159
| | | | | | | | | | | | | | | | | | | | | | lists and method declarations This adds support for static_assert() (and _Static_assert()) in @interface/@implementation ivar lists and in @interface method declarations. It was already supported in @implementation blocks outside of the ivar lists. The assert AST nodes are added at file scope, matching where other (non-Objective-C) declarations at @interface / @implementation level go (cf `allTUVariables`). Also add a `__has_feature(objc_c_static_assert)` that's true in C11 (and `__has_extension(objc_c_static_assert)` that's always true) and `__has_feature(objc_cxx_static_assert)` that's true in C++11 modea fter this patch, so it's possible to check if this is supported. Differential Revision: https://reviews.llvm.org/D59223 llvm-svn: 356148
* [analyzer] Fix function macro crashKristof Umann2019-03-143-4/+518
| | | | | | | | Re-commit D57893. Differential Revision: https://reviews.llvm.org/D57893 llvm-svn: 356142
* [X86] Only define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 in 64-bit mode.Craig Topper2019-03-142-3/+7
| | | | | | | | | | | | | | | | | | | Summary: This define should correspond to CMPXCHG16B being available which requires 64-bit mode. I checked and gcc also seems to only define this in 64-bit mode. Reviewers: RKSimon, spatel, efriedma, jyknight, jfb Reviewed By: jfb Subscribers: jfb, cfe-commits, llvm-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59287 llvm-svn: 356118
* Fix invocation of Gold plugin with LTO after r355331Nemanja Ivanovic2019-03-132-1/+11
| | | | | | | | | | The above commit breaks the usage of PGO and LTO when -fprofile-use is supplied without a path. This patch changes the usage of this argument to be inline with its use in addPGOAndCoverageFlags(). Differential revision: https://reviews.llvm.org/D59304 llvm-svn: 356111
* Revert "Add a new attribute, fortify_stdlib"Erik Pilkington2019-03-1311-434/+1
| | | | | | | | | | This reverts commit r353765. After talking with our c stdlib folks, we decided to use the existing pass_object_size attribute to implement _FORTIFY_SOURCE wrappers, like Bionic does (I didn't realize that pass_object_size could be used for this purpose). Sorry for the flip/flop, and thanks to James Y. Knight for pointing this out to me. llvm-svn: 356103
* [clang-format] Propagate inferred language to getLLVMStyle() in ↵Jordan Rupprecht2019-03-132-1/+6
| | | | | | | | getPredefinedStyle() rC355158 added an optional language parameter to getLLVMStyle(), but this parameter was not used in getPredefinedStyle(). Because unit tests directly specify the style, this codepath wasn't tested. Add an additional unit test for getStyle(). llvm-svn: 356099
* [OPENMP]Fix PR37283: Assertion failure on openmp task with by referenceAlexey Bataev2019-03-132-3/+4
| | | | | | | | | | array. If the firstprivate variable is a reference, we may incorrectly classify the kind of the private copy. Use the type of the private copy instead of the original shared variable. llvm-svn: 356098
* [clang-format][NFC] Include TableGen in enum->string mapping used for debuggingJordan Rupprecht2019-03-131-0/+2
| | | | | | Running `clang-format -debug` prints "Unknown" for tablegen files because of this missing mapping, even though it is recognized as a tablegen file. llvm-svn: 356097
* [LibTooling] Add retrieval of extended AST-node source to FixIt libraryYitzhak Mandelbaum2019-03-133-15/+97
| | | | | | | | | | | | | | | | | | | | | Summary: Introduces variants of `getText` and `getSourceRange` that extract the source text of an AST node potentially with a trailing token. Some of the new functions manipulate `CharSourceRange`s, rather than `SourceRange`s, because they document and dynamically enforce their type. So, this revision also updates the corresponding existing FixIt functions to manipulate `CharSourceRange`s. This change is not strictly necessary, but seems like the correct choice, to keep the API self-consistent. This revision is the first in a series intended to improve the abstractions available to users for writing source-to-source transformations. A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling". Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: kimgr, riccibruno, JonasToth, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58556 llvm-svn: 356095
* [OPENMP]Disable ADL in C for user-defined reductions.Alexey Bataev2019-03-132-29/+41
| | | | | | C does not support ADL, disable it for C to prevent compiler crash. llvm-svn: 356089
OpenPOWER on IntegriCloud