summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang] Update isDerivedFrom to support Objective-C classes 🔍Stephane Moore2019-08-121-1/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change updates `isDerivedFrom` to support Objective-C classes by converting it to a polymorphic matcher. Notes: The matching behavior for Objective-C classes is modeled to match the behavior of `isDerivedFrom` with C++ classes. To that effect, `isDerivedFrom` matches aliased types of derived Objective-C classes, including compatibility aliases. To achieve this, the AST visitor has been updated to map compatibility aliases to their underlying Objective-C class. `isSameOrDerivedFrom` also provides similar behaviors for C++ and Objective-C classes. The behavior that `cxxRecordDecl(isSameOrDerivedFrom("X"))` does not match `class Y {}; typedef Y X;` is mirrored for Objective-C in that `objcInterfaceDecl(isSameOrDerivedFrom("X"))` does not match either `@interface Y @end typedef Y X;` or `@interface Y @end @compatibility_alias X Y;`. Test Notes: Ran clang unit tests. Reviewers: aaron.ballman, jordan_rose, rjmccall, klimek, alexfh, gribozavr Reviewed By: aaron.ballman, gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60543 llvm-svn: 368632
* [Sema] Check __builtin_bit_cast operand for completeness before ↵Erik Pilkington2019-08-121-3/+4
| | | | | | | | | materializing it. This shouldn't be observable, but it doesn't make sense to materialize an incomplete type. llvm-svn: 368610
* [Sema] Require a complete type for __builtin_bit_cast operandsErik Pilkington2019-08-121-0/+8
| | | | | | Fixes llvm.org/PR42936 llvm-svn: 368600
* [ASTDump] Add is_anonymous to VisitCXXRecordDeclShafik Yaghmour2019-08-121-0/+1
| | | | | | | | | Summary: Adding is_anonymous the ASTDump for CXXRecordDecl. This turned out to be useful when debugging some problems with how LLDB creates ASTs from DWARF. Differential Revision: https://reviews.llvm.org/D66028 llvm-svn: 368591
* Fix multiple lifetime warning messages for range based for loopGabor Horvath2019-08-121-2/+5
| | | | llvm-svn: 368588
* [OpenCL] Ignore parentheses for sampler initializationSven van Haastregt2019-08-121-1/+1
| | | | | | | | | | | | The sampler handling logic in SemaInit.cpp would inadvertently treat parentheses around sampler arguments as an implicit cast, leading to an unreachable "can't implicitly cast lvalue to rvalue with this cast kind". Fix by ignoring parentheses once we are in the sampler initializer case. Differential Revision: https://reviews.llvm.org/D66080 llvm-svn: 368561
* [OpenCL] Fix lang mode predefined macros for C++ mode.Anastasia Stulova2019-08-123-126/+119
| | | | | | | | | | | | | In C++ mode we should only avoid adding __OPENCL_C_VERSION__, all other predefined macros about the language mode are still valid. This change also fixes the language version check in the headers accordingly. Differential Revision: https://reviews.llvm.org/D65941 llvm-svn: 368552
* [ASTImporter] Fix for import of friend class template with definition.Balazs Keri2019-08-121-4/+6
| | | | | | | | | | | | | | | | | | | | | | Summary: If there is a friend class template "prototype" (forward declaration) and later a definition for it in the existing code, this existing definition may be not found by ASTImporter because it is not linked to the prototype (under the friend AST node). The problem is fixed by looping over all found matching decls instead of break after the first found one. Reviewers: martong, a.sidorin, shafik, a_sidorin Reviewed By: a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65269 llvm-svn: 368551
* [CrossTU] Fix problem with CrossTU AST load limit and progress messages.Balazs Keri2019-08-121-32/+26
| | | | | | | | | | | | | | | | | | | Summary: Number of loaded ASTs is to be incremented only if the AST was really loaded but not if it was returned from cache. At the same place the message about a loaded AST is displayed. Reviewers: martong, gamesh411 Reviewed By: martong Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66054 llvm-svn: 368545
* [X86] Support -march=tigerlakePengfei Wang2019-08-121-0/+10
| | | | | | | | | | | | Support -march=tigerlake for x86. Compare with Icelake Client, It include 4 more new features ,they are avx512vp2intersect, movdiri, movdir64b, shstk. Patch by Xiang Zhang (xiangzhangllvm) Differential Revision: https://reviews.llvm.org/D65840 llvm-svn: 368543
* [clang-format] Expand AllowShortBlocksOnASingleLine for WebKitOwen Pan2019-08-113-8/+20
| | | | | | | | See PR40840 Differential Revision: https://reviews.llvm.org/D66059 llvm-svn: 368539
* Properly detect temporary gsl::Owners through reference initialization chains.Gabor Horvath2019-08-111-1/+2
| | | | llvm-svn: 368534
* Properly handle reference initialization when detecting gsl::Pointer ↵Gabor Horvath2019-08-111-5/+9
| | | | | | initialization chains llvm-svn: 368528
* [clang] Fixed x86 cpuid NSC signatureRaphael Isemann2019-08-101-2/+2
| | | | | | | | | | | | | | | | | | Summary: The signature "Geode by NSC" for NSC vendor is wrong. In lib/Headers/cpuid.h, signature_NSC_edx and signature_NSC_ecx constants are inverted (cpuid signature order is ebx # edx # ecx). Reviewers: teemperor, rsmith, craig.topper Reviewed By: teemperor, craig.topper Subscribers: craig.topper, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65978 llvm-svn: 368510
* [clang-format] Add SpaceInEmptyBlock option for WebKitOwen Pan2019-08-102-1/+4
| | | | | | | | See PR40840 Differential Revision: https://reviews.llvm.org/D65925 llvm-svn: 368507
* Fix a false positive warning when initializing members with gsl::Owners.Gabor Horvath2019-08-101-0/+5
| | | | llvm-svn: 368501
* Attempt to reapply "Even more warnings utilizing gsl::Owner/gsl::Pointer ↵Gabor Horvath2019-08-091-9/+29
| | | | | | annotations" llvm-svn: 368499
* cfi-icall: Allow the jump table to be optionally made non-canonical.Peter Collingbourne2019-08-095-14/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default behavior of Clang's indirect function call checker will replace the address of each CFI-checked function in the output file's symbol table with the address of a jump table entry which will pass CFI checks. We refer to this as making the jump table `canonical`. This property allows code that was not compiled with ``-fsanitize=cfi-icall`` to take a CFI-valid address of a function, but it comes with a couple of caveats that are especially relevant for users of cross-DSO CFI: - There is a performance and code size overhead associated with each exported function, because each such function must have an associated jump table entry, which must be emitted even in the common case where the function is never address-taken anywhere in the program, and must be used even for direct calls between DSOs, in addition to the PLT overhead. - There is no good way to take a CFI-valid address of a function written in assembly or a language not supported by Clang. The reason is that the code generator would need to insert a jump table in order to form a CFI-valid address for assembly functions, but there is no way in general for the code generator to determine the language of the function. This may be possible with LTO in the intra-DSO case, but in the cross-DSO case the only information available is the function declaration. One possible solution is to add a C wrapper for each assembly function, but these wrappers can present a significant maintenance burden for heavy users of assembly in addition to adding runtime overhead. For these reasons, we provide the option of making the jump table non-canonical with the flag ``-fno-sanitize-cfi-canonical-jump-tables``. When the jump table is made non-canonical, symbol table entries point directly to the function body. Any instances of a function's address being taken in C will be replaced with a jump table address. This scheme does have its own caveats, however. It does end up breaking function address equality more aggressively than the default behavior, especially in cross-DSO mode which normally preserves function address equality entirely. Furthermore, it is occasionally necessary for code not compiled with ``-fsanitize=cfi-icall`` to take a function address that is valid for CFI. For example, this is necessary when a function's address is taken by assembly code and then called by CFI-checking C code. The ``__attribute__((cfi_jump_table_canonical))`` attribute may be used to make the jump table entry of a specific function canonical so that the external code will end up taking a address for the function that will pass CFI checks. Fixes PR41972. Differential Revision: https://reviews.llvm.org/D65629 llvm-svn: 368495
* [OpenMP] Add support for close map modifier in ClangGheorghe-Teodor Bercea2019-08-091-2/+8
| | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support for the close map modifier in Clang. This ensures that the new map type is marked and passed to the OpenMP runtime appropriately. Additional regression tests have been merged from patch D55892 (author @saghir). Reviewers: ABataev, caomhin, jdoerfert, kkwli0 Reviewed By: ABataev Subscribers: kkwli0, Hahnfeld, saghir, guansong, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65341 llvm-svn: 368491
* Don't diagnose errors when a file matches an include componentReid Kleckner2019-08-091-1/+2
| | | | | | | | | This regressed in r368322, and was reported as PR42948 and on the mailing list. The fix is to ignore the specific error code for this case. The problem doesn't seem to reproduce on Windows, where a different error code is used instead. llvm-svn: 368475
* CodeGen: ensure 8-byte aligned String Swift CF ABISaleem Abdulrasool2019-08-091-1/+4
| | | | | | | | | CFStrings should be 8-byte aligned when built for the Swift CF runtime ABI as the atomic CF info field must be properly aligned. This is a problem on 32-bit platforms which would give the structure 4-byte alignment rather than 8-byte alignment. llvm-svn: 368471
* Revert Even more warnings utilizing gsl::Owner/gsl::Pointer annotationsGabor Horvath2019-08-091-29/+9
| | | | | | This reverts r368454 (git commit 7c3c8ba8daf40534e09f6fe8701b723e25e4e2dc) llvm-svn: 368463
* Revert Fix a build bot failure and multiple warnings instances for range ↵Gabor Horvath2019-08-091-6/+3
| | | | | | | | base for loops This reverts r368459 (git commit 2bf522aea62e4fb653cacb68072167d25149099e) llvm-svn: 368462
* Fix a build bot failure and multiple warnings instances for range base for loopsGabor Horvath2019-08-091-3/+6
| | | | llvm-svn: 368459
* Even more warnings utilizing gsl::Owner/gsl::Pointer annotationsGabor Horvath2019-08-091-9/+29
| | | | | | Differential Revision: https://reviews.llvm.org/D65127 llvm-svn: 368454
* More warnings regarding gsl::Pointer and gsl::Owner attributesGabor Horvath2019-08-091-4/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D65120 llvm-svn: 368446
* Add SVE opaque built-in typesRichard Sandiford2019-08-0919-6/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the SVE built-in types defined by the Procedure Call Standard for the Arm Architecture: https://developer.arm.com/docs/100986/0000 It handles the types in all relevant places that deal with built-in types. At the moment, some of these places bail out with an error, including: (1) trying to generate LLVM IR for the types (2) trying to generate debug info for the types (3) trying to mangle the types using the Microsoft C++ ABI (4) trying to @encode the types in Objective C (1) and (2) are fixed by follow-on patches but (unlike this patch) they deal mostly with target-specific LLVM details, so seemed like a logically separate change. There is currently no spec for (3) and (4), so reporting an error seems like the correct behaviour for now. The intention is that the types will become sizeless types: http://lists.llvm.org/pipermail/cfe-dev/2019-June/062523.html The main purpose of the sizeless type extension is to diagnose impossible or dangerous uses of the types, such as any that would require sizeof to have a meaningful defined value. Until then, the patch sets the alignments of the types to the values specified in the link above. It also sets the sizes of the types to zero, which is chosen to be consistently wrong and shouldn't affect correctly-written code (i.e. code that would compile even with the sizeless type extension). The patch adds the common subset of functionality needed to test the sizeless type extension on the one hand and to provide SVE intrinsic functions on the other. After this patch, the two pieces of work are essentially independent. The patch is based on one by Graham Hunter: https://reviews.llvm.org/D59245 Differential Revision: https://reviews.llvm.org/D62960 llvm-svn: 368413
* [clang][NFC] Consolidating usage of "FinalPhase" in Driver::BuildActions.Puyan Lotfi2019-08-091-83/+100
| | | | | | | | | | | | | | I am working to remove this concept of the "FinalPhase" in the clang driver, but it is used in a lot of different places to do argument handling for different combinations of phase pipelines and arguments. I am trying to consolidate most of the uses of "FinalPhase" into its own separate scope. Eventually, in a subsequent patch I will move all of this stuff to a separate function, and have more of the complication phase list construction setup into types::getComplicationPhases. Differential Revision: https://reviews.llvm.org/D65969 llvm-svn: 368393
* [PowerPC] [Clang] Port SSE3, SSSE3 and SSE4 intrinsics to PowerPCQiu Chaofan2019-08-094-0/+733
| | | | | | | | | | | | | | | Port existing headers which include x86 intrinsics implementation to PowerPC platform (using Altivec), along with tests. Also, tests about including these intrinsic headers are combined. The headers are mainly developed by Steven Munroe, with contributions from Paul Clarke, Bill Schmidt, Jinsong Ji and Zixuan Wu. Reviewed By: Jinsong Ji Differential Revision: https://reviews.llvm.org/D65630 llvm-svn: 368392
* [analyzer] CastValueChecker: Model castAs(), getAs()Csaba Dabis2019-08-091-91/+161
| | | | | | | | | | Summary: Thanks to Kristóf Umann for the great idea! Reviewed By: NoQ Differential Revision: https://reviews.llvm.org/D65889 llvm-svn: 368383
* [analyzer] ConditionBRVisitor: Fix HTML PathDiagnosticPopUpPiecesCsaba Dabis2019-08-092-19/+41
| | | | | | | | | | | | | | | | Summary: A condition could be a multi-line expression where we create the highlight in separated chunks. PathDiagnosticPopUpPiece is not made for that purpose, it cannot be added to multiple lines because we have only one ending part which contains all the notes. So that it cannot have multiple endings and therefore this patch narrows down the ranges of the highlight to the given interesting variable of the condition. It prevents HTML-breaking injections. Reviewed By: NoQ Differential Revision: https://reviews.llvm.org/D65663 llvm-svn: 368382
* [clang-scan-deps] Add minimizer support for C++20 modules.Michael J. Spencer2019-08-091-1/+70
| | | | | | This only adds support to the minimizer, it doesn't actually capture the dependencies yet. llvm-svn: 368381
* Fix up fd limit diagnosis codeReid Kleckner2019-08-081-2/+3
| | | | | | | | | | | Apparently Windows returns the "invalid argument" error code when the path contains invalid characters such as '<'. The test/Preprocessor/include-likely-typo.c test does this, so it was failing after r368322. Also, the diagnostic requires two arguments, so add the filename. llvm-svn: 368348
* [clang] Add no-warn support for WaBrian Cain2019-08-083-0/+4
| | | | llvm-svn: 368328
* Recommit Devirtualize destructor of final class.Hiroshi Yamauchi2019-08-081-3/+27
| | | | | | | Original patch commited as r364100, reverted as r364359, recommitted as r365509, reverted as r365850. llvm-svn: 368323
* clang: Diag running out of file handles while looking for filesNico Weber2019-08-081-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | clang would only print "file not found" when it's unable to find a header file. If the reason for that is a file handle leak, that's not a very useful error message. For errors that aren't in a small whitelist ("file not found", "file is directory"), print an error with the strerror() output. This changes behavior in corner cases: If clang was out of file handles while looking in one -I dir but then suddenly wasn't when looking in the next -I dir, and both directories contained a file with the desired name, previously we'd silently return the file from the second directory. For this reason, it's important to ignore "is a directory" for this new diag: if a file foo/foo exists and -I -Ifoo are passed, an include of "foo" should successfully open file "foo" in directory "foo/" instead of complaining that "./foo" is a directory. No test since we mostly hit this when there's a handle leak somewhere, and currently there isn't one. I manually tested this with the repro steps in comment 2 on the bug below. Fixes PR42524. Differential Revision: https://reviews.llvm.org/D65956 llvm-svn: 368322
* [OPENMP]Add support for analysis of linear variables and step.Alexey Bataev2019-08-084-6/+38
| | | | | | | | | | | | | | | | | Summary: Added support for basic analysis of the linear variables and linear step expression. Linear loop iteration variables must be excluded from this analysis, only non-loop iteration variables must be analyzed. Reviewers: NoQ Subscribers: guansong, cfe-commits, caomhin, kkwli0 Tags: #clang Differential Revision: https://reviews.llvm.org/D65461 llvm-svn: 368295
* [ARM] Set default alignment to 64bitsDiogo N. Sampaio2019-08-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The maximum alignment used by ARM arch is 64bits, not 128. This could cause overaligned memory access for 128 bit neon vector that have unpredictable behaviour. This fixes: https://bugs.llvm.org/show_bug.cgi?id=42668 Reviewers: ostannard, dmgreen, srhines, danalbert, pirama, peter.smith Reviewed By: pirama, peter.smith Subscribers: phosek, thegameg, thakis, llvm-commits, carwil, peter.smith, javed.absar, kristof.beyls, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65000 llvm-svn: 368288
* [clang-format] fix crash involving invalid preprocessor lineKrasimir Georgiev2019-08-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This (invalid) fragment is crashing clang-format: ``` #if 1 int x; #elif int y; #endif ``` The reason being that the parser expects a token after `#elif`, and the subsequent parsing of the next line does not check if `CurrentToken` is null. Reviewers: gribozavr Reviewed By: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65940 llvm-svn: 368280
* [Extract] Fixed SemicolonExtractionPolicy for SwitchStmt and SwitchCaseShaurya Gupta2019-08-081-1/+4
| | | | | | | | | | | | Reviewers: arphaman, sammccall Subscribers: dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65883 llvm-svn: 368267
* [Driver] Move LIBRARY_PATH before user inputsFangrui Song2019-08-081-6/+5
| | | | | | | | | | | | | | | | Fixes PR16786 Currently, library paths specified by LIBRARY_PATH are placed after inputs: `inputs LIBRARY_PATH stdlib` In gcc, the order is: `LIBRARY_PATH inputs stdlib` if not cross compiling. (On Darwin targets, isCrossCompiling() always returns false.) This patch changes the behavior to match gcc. Reviewed By: hfinkel Differential Revision: https://reviews.llvm.org/D65880 llvm-svn: 368245
* Inline diagnostic text into .td file. NFC.Richard Trieu2019-08-081-9/+19
| | | | llvm-svn: 368244
* Update fix-it hints for std::move warnings.Richard Trieu2019-08-081-24/+27
| | | | | | | | | | | Fix -Wpessimizing-move and -Wredundant-move when warning on initializer lists. The new fix-it hints for removing the std::move call will now also suggest removing the braces for the initializer list so that the resulting code will still be compilable. This fixes PR42832 llvm-svn: 368237
* [Tooling] Expose ExecutorConcurrency option.Diego Astiazaran2019-08-071-1/+1
| | | | | | | | D65628 requires a flag to specify the number of threads for a clang-doc step. It would be good to use ExecutorConcurrency after exposing it instead of creating a new one that has the same purpose. Differential Revision: https://reviews.llvm.org/D65833 llvm-svn: 368196
* Remove LLVM mutexes from clang in favor of std::mutexBenjamin Kramer2019-08-072-6/+4
| | | | | | | None of those need to be recursive mutexes. No functionality change intended. llvm-svn: 368173
* [OPENMP]Set default version to OpenMP 4.5.Alexey Bataev2019-08-072-7/+7
| | | | | | | Since clang fully supports OpenMP 4.5, set the default version to 4.5 instead of 3.1. llvm-svn: 368172
* [OPENMP]Add standard macro value _OPENMP for OpenMP 5.0.Alexey Bataev2019-08-071-0/+3
| | | | | | | | | According to the OpenMP standard, compiler must define _OPENMP macro, which has value in format yyyymm, where yyyy is the year of the standard and mm is the month of the standard. For OpenMP 5.0 this value must be set to 201811. llvm-svn: 368170
* [ASTImporter] Do not import FunctionTemplateDecl in record twice.Balazs Keri2019-08-071-2/+12
| | | | | | | | | | | | | | | | | | | | | Summary: For functions there is a check to not duplicate the declaration if it is in a record (class). For function templates there was no similar check, if a template (in the same class) was imported multiple times the FunctionTemplateDecl was created multiple times with the same templated FunctionDecl. This can result in problems with the declaration chain. Reviewers: martong, a.sidorin, shafik, a_sidorin Reviewed By: a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65203 llvm-svn: 368163
* Replace non-recursive sys::Mutex users with std::mutexBenjamin Kramer2019-08-071-5/+5
| | | | | | | Also remove a use of sys::MutexImpl, that's just evil. No functionality change intended. llvm-svn: 368157
* [clang] Fix mismatched args constructing AddressSpaceAttr.Anton Bikineev2019-08-071-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D65589 llvm-svn: 368152
OpenPOWER on IntegriCloud