summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [attributes][analyzer] Add annotations for handles.Gabor Horvath2019-12-208-0/+164
| | | | | | | These annotations will be used in an upcomming static analyzer check that finds handle leaks, use after releases, and double releases. Differential Revision: https://reviews.llvm.org/D70469
* Apply the alignment specifier attribute to anonymous unions and structs.Kamlesh Kumar2019-12-202-0/+10
|
* [NFC][Driver] Add dummy compiler-rt sanitizer dylibs for Darwin.Dan Liew2019-12-2031-0/+0
| | | | | | | This adds dummy files to the test resource directory used by the Clang driver tests. rdar://problem/58118584
* [objc_direct] Tigthen checks for direct methodsPierre Habouzit2019-12-206-36/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the name of a direct method must be agreed upon by the caller and the implementation, certain bad practices that one can get away with when using dynamism are fatal with direct methods. To avoid really weird and unscruttable linker error, tighten the front-end error reporting. Rule 1: Direct methods can only have at most one declaration in an @interface container. Any redeclaration is strictly forbidden. Today some amount of redeclaration is tolerated between the main interface and categories for dynamic methods, but we can't have that. Rule 2: Direct method implementations can only be declared in a matching @interface container: when implemented in the primary @implementation then the declaration must be in the primary @interface or an extension, and when implemented in a category, the declaration must be in the @interface for the same category. Also fix another issue with ObjCMethod::getCanonicalDecl(): when an implementation lives in the primary @interface, then its canonical declaration can be in any extension, even when it's not an accessor. Add Sema tests to cover the new errors, and CG tests to beef up testing around function names for categories and extensions. Radar-Id: <rdar://problem/58054563> Differential Revision: https://reviews.llvm.org/D71694
* [clang-format] C# formatting a class with inheritance followed by an ↵mydeveloperday2019-12-202-1/+22
| | | | | | | | | | | | | | | | | | | attribute specifier assume its a braces initializer Summary: https://bugs.llvm.org/show_bug.cgi?id=44340 The rule that prevents `... {} [[....]]` being treated as a braced initializer for C++ causes problems for C# with attributes, causing it to be incorrectly classified and then messing up the subsequent formatting. (see bug for details of formatting) Reviewers: mitchell-stellar, klimek, sammccall Reviewed By: mitchell-stellar Subscribers: cfe-commits Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D71769
* [OPENMP]Remove unused OPENMP_MATCH_KIND, NFC.Alexey Bataev2019-12-201-8/+0
|
* Parenthesized a logical expression.Dmitri Gribenko2019-12-201-1/+1
| | | | This change fixes a warning on the ppc64be buildbot.
* Use isa instead of dyn_castDmitri Gribenko2019-12-201-1/+1
|
* [clang][Tooling] Prefer -x over -std when interpolatingKadir Cetinkaya2019-12-202-1/+6
| | | | | | | | | | | | | | | | | | | Summary: Currently interpolation logic prefers -std over -x. But the latter is a more strong signal, so this patch inverts the order and only makes use of -std if -x didn't exist. Fixes https://github.com/clangd/clangd/issues/185 Thanks @sammccall for tracking this down! Reviewers: sammccall Subscribers: ilya-biryukov, usaxena95, cfe-commits, sammccall Tags: #clang Differential Revision: https://reviews.llvm.org/D71727
* [clang] Fix the canonicalization of paths in -fdiagnostics-absolute-pathsKarl-Johan Karlsson2019-12-204-19/+55
| | | | | | | | | | | | | | | | In the current implementation of clang the canonicalization of paths in diagnostic messages (when using -fdiagnostics-absolute-paths) only works if the symbolic link is in the directory part of the filename, not if the file itself is a symbolic link to another file. This patch adds support to canonicalize the complete path including the file. Reviewers: rsmith, hans, rnk, ikudrin Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D70527
* CWG2352: Allow qualification conversions during reference binding.Richard Smith2019-12-1910-153/+250
| | | | | | | | | | | | | | | The language wording change forgot to update overload resolution to rank implicit conversion sequences based on qualification conversions in reference bindings. The anticipated resolution for that oversight is implemented here -- we order candidates based on qualification conversion, not only on top-level cv-qualifiers. For OpenCL/C++, this allows reference binding between pointers with differing (nested) address spaces. This makes the behavior of reference binding consistent with that of implicit pointer conversions, as is the purpose of this change, but that pre-existing behavior for pointer conversions is itself probably not correct. In any case, it's now consistently the same behavior and implemented in only one place.
* Fix crash on init-capture packs where the type of the initializer is ↵Richard Smith2019-12-194-3/+15
| | | | non-dependent.
* [analyzer] Add a syntactic security check for ObjC NSCoder API.Artem Dergachev2019-12-195-1/+129
| | | | | | | Method '-[NSCoder decodeValueOfObjCType:at:]' is not only deprecated but also a security hazard, hence a loud check. Differential Revision: https://reviews.llvm.org/D71728
* ConstrainedFP: use API compatible with opaque pointers.Tim Northover2019-12-191-6/+6
| | | | | | This just updates an IRBuilder interface to take Functions instead of Values so the type can be derived, and fixes some callsites in Clang to call the updated API.
* Implement latest C++ feature test macro recommendations.Richard Smith2019-12-193-15/+34
| | | | | | | | We don't yet advertise init capture packs, because I found some bugs while testing it. We reject-valid and then crash on both of these: template<int ...a> auto x = [...y = a] {}; template<int ...a> auto x = [y = a...] {};
* [X86] Mark various pointer arguments in builtins as constWarren Ristow2019-12-1913-147/+151
| | | | | | | | | | | Enabling `-Wcast-qual` identified many casts in various system headers that were dropping the `const` qualifier. Fixing those missing qualifiers pointed out that a few of the definitions of the builtins did not properly identify their arguments as `const` pointers. This commit fixes those builtin definitions, and the system header files so that they no longer drop the qualifier. Differential Revision: https://reviews.llvm.org/D71718
* [ASTImporter][LLDB] Modifying ImportDeclContext(...) to ensure that we ↵shafik2019-12-191-1/+28
| | | | | | | | | | complete each FieldDecl of a RecordDecl when we are importing the definiton This fix was motivated by a crashes in expression parsing during code generation in which we had a RecordDecl that had incomplete FieldDecl. During code generation when computing the layout for the RecordDecl we crash because we have several incomplete FieldDecl. This fixes the issue by assuring that during ImportDefinition(...) for a RecordDecl we also import the definitions for each FieldDecl. Differential Revision: https://reviews.llvm.org/D71378
* [Clang FE, SystemZ] Recognize -mrecord-mcount CL option.Jonas Paulsson2019-12-196-0/+44
| | | | | | | | | | Recognize -mrecord-mcount from the command line and add a function attribute "mrecord-mcount" when passed. Only valid on SystemZ (when used with -mfentry). Review: Ulrich Weigand https://reviews.llvm.org/D71627
* Re-land "Add an -fno-temp-file flag for compilation"Hans Wennborg2019-12-197-3/+14
| | | | | | | | This time making sure to initialize FrontendOptions::UseTemporary. Patch by Zachary Henkel! Differential revision: https://reviews.llvm.org/D70615
* [clang] Fix compilation with GCC < 8 for MinGWMartin Storsjö2019-12-191-3/+3
| | | | | | | | | | | | | GCC 7 and earlier, when targeting MinGW, seems to have a bug in layout/size of bitfield structs if they contain a nested enum, making the size of the struct 8 bytes, while we have a static assert requiring it to be 4 bytes or less. While this clearly is a GCC bug, the workaround (moving the enum out of the bitfield) also is very nonintrusive and matches other existing enums there. Differential Revision: https://reviews.llvm.org/D71650
* [analysis] Re-discard type sugar when casting values retrieved from the Store.Artem Dergachev2019-12-182-3/+21
| | | | Canonicalization was accidentally omitted in 6d3f43ec.
* [clang] Remove -Wexperimental-float-control.Jordan Rupprecht2019-12-183-15/+0
| | | | | | | | | | | | | | Summary: Per D62731, the behavior of clang with `-frounding-math` is no worse than when the rounding flag was completely ignored, so remove this unnecessary warning. Reviewers: mibintc, chandlerc, echristo, rjmccall, kpn, erichkeane, rsmith, andrew.w.kaylor Reviewed By: mibintc Subscribers: merge_guards_bot, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71671
* [Remarks][Driver] Place temporary remark files next to temporary object filesFrancis Visoiu Mistrih2019-12-183-20/+53
| | | | | | | | | | | On Darwin, when used for generating a linked binary from a source file (through an intermediate object file), the driver will invoke `cc1` to generate a temporary object file. The temporary remark file will now be emitted next to the object file, which will then be picked up by `dsymutil` and emitted in the .dSYM bundle. This is available for all formats except YAML since by default, YAML doesn't need a section and the remark file will be lost.
* [Docs] Fix indentation in remarks sectionFrancis Visoiu Mistrih2019-12-181-19/+19
|
* [WebAssembly] Add avgr_u intrinsics and require nuw in patternsThomas Lively2019-12-183-0/+25
| | | | | | | | | | | | | | | | | | Summary: The vector pattern `(a + b + 1) / 2` was previously selected to an avgr_u instruction regardless of nuw flags, but this is incorrect in the case where either addition may have an unsigned wrap. This CL changes the existing pattern to require both adds to have nuw flags and adds builtin functions and intrinsics for the avgr_u instructions because the corrected pattern is not representable in C. Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D71648
* Revert concepts changes from D41910Vedant Kumar2019-12-1818-1021/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These changes caused LibcxxVariantDataFormatterTestCase in lldb to fail with an assert: Assertion failed: (Idx < size() && "Out-of-bounds Bit access."), function operator[], file /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/ADT/SmallBitVector.h, line 452. In: 7 clang-10 0x00000001094b79d9 isAtLeastAsSpecializedAs(clang::Sema&, clang::SourceLocation, clang::FunctionTemplateDecl*, clang::FunctionTemplateDecl*, clang::TemplatePartialOrderingContext, unsigned int) + 1865 8 clang-10 0x00000001094b7111 clang::Sema::getMoreSpecializedTemplate(clang::FunctionTemplateDecl*, clang::FunctionTemplateDecl*, clang::SourceLocation, clang::TemplatePartialOrderingContext, unsigned int, unsigned int) + 97 9 clang-10 0x000000010939bf88 clang::isBetterOverloadCandidate(clang::Sema&, clang::OverloadCandidate const&, clang::OverloadCandidate const&, clang::SourceLocation, clang::OverloadCandidateSet::CandidateSetKind) + 1128 Revert "[Concepts] Fix incorrect move out of temporary in D41910" This reverts commit 11d5fa6e87e3584f72056ecc2b17f88c58323dde. Revert "[Concepts] Fix crash in D41910" This reverts commit 12038be20ee6a903cdbd3fddce65535ef683e31d. Revert "[Concepts] Constrained partial specializations and function overloads." This reverts commit fc0731b98a67c793862288f8ae334322666214dc.
* Add method to ignore invisible AST nodesStephen Kelly2019-12-188-1/+425
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70613
* Trim trailing whitespaceStephen Kelly2019-12-181-2/+2
|
* Output names in the AST in testsStephen Kelly2019-12-181-3/+13
|
* [Remarks][Driver] Run dsymutil when remarks are enabledFrancis Visoiu Mistrih2019-12-182-2/+16
| | | | | | | | | When clang is invoked with a source file without -c or -S, it creates a cc1 job, a linker job and if debug info is requested, a dsymutil job. In case of remarks, we should also create a dsymutil job to avoid losing the remarks that will be generated in a tempdir that gets removed. Differential Revision: https://reviews.llvm.org/D71675
* [Remarks][Driver][NFC] Make shouldEmitRemarks more available in the DriverFrancis Visoiu Mistrih2019-12-183-25/+28
| | | | Move the function to Driver.h so that it can be re-used in other places.
* [analyzer] Teach MismatchedDealloc about initWithBytesNoCopy with deallocator.Artem Dergachev2019-12-183-2/+29
| | | | | | | | MallocChecker warns when memory is passed into -[NSData initWithBytesNoCopy] but isn't allocated by malloc(), because it will be deallocated by free(). However, initWithBytesNoCopy has an overload that takes an arbitrary block for deallocating the object. If such overload is used, it is no longer necessary to make sure that the memory is allocated by malloc().
* Refactor CompareReferenceRelationship and its callers in preparation forRichard Smith2019-12-188-167/+161
| | | | | | | | | | | | | | implementing the resolution of CWG2352. No functionality change, except that we now convert the referent of a reference binding to the underlying type of the reference in more cases; we used to happen to preserve the type sugar from the referent if the only type change was in the cv-qualifiers. This exposed a bug in how we generate code for trivial assignment operators: if the type sugar (particularly the may_alias attribute) got lost during reference binding, we'd use the "wrong" TBAA information for the load during the assignment.
* Use hasOffsetApplied to initialize member HasOffsetAppliedAkira Hatanaka2019-12-181-1/+1
| | | | | This is NFC since none of the constructor calls in trunk pass hasOffsetApplied=true.
* Move TypeSourceInfo to Type.hReid Kleckner2019-12-184-33/+35
| | | | | | | | | | | | | | | TypeSourceInfo is a thin wrapper around TypeLocs. Notionally, the best place for it to live would be TypeLoc.h, but Decl.h requires it to be complete, so it needs to be lower in the dependency graph. Type.h seems like the next best place. By itself, this change has no impact on build time, because it doesn't remove a single dependency edge from a .cpp file to a .h file, but it is an incremental step towards making the AST headers less interdependent. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D71427
* Change triple in test case to not include triples the test shouldn'tAmy Huang2019-12-181-2/+2
| | | | | pass. This is fixes changes from a85f5efd9597d0036f5c347b362cb873bdf51f16.
* [analyzer] NonnullGlobalConstants: Add support for kCFNull.Artem Dergachev2019-12-182-2/+12
| | | | It's a singleton in CoreFoundation that always contains a non-null CFNullRef.
* [Concepts] Fix incorrect move out of temporary in D41910Saar Raz2019-12-181-2/+2
| | | | Moves out of temporaries caused warnings that failed builds.
* [NFC] Update FIXME for one VFS testAdrian McCarthy2019-12-181-1/+1
| | | | | | The VFS/subframework-symlink.m test is still XFAIL on Windows, but for a different reason than those fixed in PR43272, so I've updated the PR number.
* Fix more VFS tests on WindowsAdrian McCarthy2019-12-183-9/+0
| | | | | | | | | | | | Since VFS paths can be in either Posix or Windows style, we have to use a more flexible definition of "absolute" path. The key here is that FileSystem::makeAbsolute is now virtual, and the RedirectingFileSystem override checks for either concept of absolute before trying to make the path absolute by combining it with the current directory. Differential Revision: https://reviews.llvm.org/D70701
* [Concepts] Fix crash in D41910Saar Raz2019-12-181-1/+1
| | | | Differential Revision: https://reviews.llvm.org/D41910
* [Clang FE, SystemZ] Don't add "true" value for the "mnop-mcount" attribute.Jonas Paulsson2019-12-182-3/+3
| | | | | | | | Let the "mnop-mcount" function attribute simply be present or non-present. Update SystemZ backend as well to use hasFnAttribute() instead. Review: Ulrich Weigand https://reviews.llvm.org/D71669
* [Concepts] Constrained partial specializations and function overloads.Saar Raz2019-12-1818-102/+1021
| | | | | | Added support for constraint satisfaction checking and partial ordering of constraints in constrained partial specialization and function template overloads. Phabricator: D41910
* Add support for the MS qualifiers __ptr32, __ptr64, __sptr, __uptr.Amy Huang2019-12-1821-53/+340
| | | | | | | | | | | | | | | | | | | | Summary: This adds parsing of the qualifiers __ptr32, __ptr64, __sptr, and __uptr and lowers them to the corresponding address space pointer for 32-bit and 64-bit pointers. (32/64-bit pointers added in https://reviews.llvm.org/D69639) A large part of this patch is making these pointers ignore the address space when doing things like overloading and casting. https://bugs.llvm.org/show_bug.cgi?id=42359 Reviewers: rnk, rsmith Subscribers: jholewinski, jvesely, nhaehnle, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71039
* Revert "Add an -fno-temp-file flag for compilation"Mitch Phillips2019-12-187-13/+2
| | | | | | | This reverts commit d129aa1d5369781deff6c6b854cb612e160d3fb2. This broke the MSan buildbots. More information available in the original PR: https://reviews.llvm.org/D70615
* [clang] [cmake] Fix gen_ast_dump_json_test.py binary dirMichał Górny2019-12-181-1/+2
| | | | | | | | Use correct directory to put gen_ast_dump_json_test.py instead of LLVM_BINARY_DIR. This fixes attempting to write to /usr when building clang standalone. Differential Revision: https://reviews.llvm.org/D71615
* Add an -fno-temp-file flag for compilationHans Wennborg2019-12-187-2/+13
| | | | | | | | | | | | Our build system does not handle randomly named files created during the build well. We'd prefer to write compilation output directly without creating a temporary file. Function parameters already existed to control this behavior but were not exposed all the way out to the command line. Patch by Zachary Henkel! Differential revision: https://reviews.llvm.org/D70615
* [Syntax] Use a hash table to search for tokens by their locationIlya Biryukov2019-12-182-9/+50
| | | | | | | | This is both more efficient and avoids corner cases in `SourceManager::isBeforeInTranslationUnit`. The change is trivial and clearly a performance improvement on the hot path of building the syntax tree, so sending without review.
* [Syntax] Uppercase the first letter of the test name. NFCIlya Biryukov2019-12-181-1/+1
| | | | To match naming style of other tests.
* [Syntax] Allow to mutate syntax treesIlya Biryukov2019-12-1813-20/+572
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds facilities to mutate the syntax trees and produce corresponding text replacements. The public interface of the syntax library now includes facilities to: 1. perform type-safe modifications of syntax trees, 2. compute textual replacements to apply the modifications, 3. create syntax trees not backed by the source code. For each of the three, we only add a few example transformations in this patch to illustrate the idea, support for more kinds of nodes and transformations will be done in follow-up patches. The high-level mutation operations are implemented on top of operations that allow to arbitrarily change the trees. They are considered to be implementation details and are not available to the users of the library. Reviewers: sammccall, gribozavr2 Reviewed By: gribozavr2 Subscribers: merge_guards_bot, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64573
OpenPOWER on IntegriCloud