summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [NFC] Fix typos in Clangd and ClangKirill Bobyrev2019-12-167-42/+41
| | | | | | Reviewed by: Jim Differential Revision: https://reviews.llvm.org/D71455
* Mark the major papers for C++20 consistent comparisons as "done", andRichard Smith2019-12-153-2/+6
| | | | start publishing the corresponding feature-test macro.
* [c++20] Compute exception specifications for defaulted comparisons.Richard Smith2019-12-156-68/+360
| | | | | | | | This requires us to essentially fully form the body of the defaulted comparison, but from an unevaluated context. Naively this would require generating the function definition twice; instead, we ensure that the function body is implicitly defined before performing the check, and walk the actual body where possible.
* Properly compute whether statement expressions can throw, rather thanRichard Smith2019-12-155-62/+339
| | | | | | | | | conservatively assuming they always can. Also fix cases where we would not consider the computation of a VLA type when determining whether an expression can throw. We don't yet properly determine whether a VLA can throw, but no longer incorrectly claim it can never throw.
* Resolve exception specifications after marking the correspondingRichard Smith2019-12-153-30/+50
| | | | | | | | function as referenced, not before. No functionality change intended. This is groundwork for computing the exception specification of a defaulted comparison, for which we'd like to use the implicit body where possible.
* [AST] Use a reference in a range-based forMark de Wever2019-12-151-2/+2
| | | | | | | | This avoids unneeded copies when using a range-based for loops. This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D71526
* [clang] Improve LLVM-style RTTI support in ExternalASTSource/ExternalSemaSourceRaphael Isemann2019-12-156-12/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We currently have some very basic LLVM-style RTTI support in the ExternalASTSource class hierarchy based on the `SemaSource` bool( to discriminate it form the ExternalSemaSource). As ExternalASTSource is supposed to be subclassed we should have extendable LLVM-style RTTI in this class hierarchy to make life easier for projects building on top of Clang. Most notably the current RTTI implementation forces LLDB to implement RTTI for its own ExternalASTSource class (ClangExternalASTSourceCommon) by keeping a global set of ExternalASTSources that are known to be ClangExternalASTSourceCommon. Projects using Clang currently have to dosimilar workarounds to get RTTI support for their subclasses. This patch turns this into full-fledged LLVM-style RTTI based on a static `ID` variable similar to other LLVM class hierarchies. Also removes the friend declaration from ExternalASTSource to its child class that was only used to grant access to the `SemaSource` member. Reviewers: aprantl, dblaikie, rjmccall Reviewed By: aprantl Subscribers: riccibruno, labath, lhames, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71397
* [analyzer] Add support for namespaces to GenericTaintCheckerBorsik Gabor2019-12-153-58/+290
| | | | | | | | | | | | | This patch introduces the namespaces for the configured functions and also enables the use of the member functions. I added an optional Scope field for every configured function. Functions without Scope match for every function regardless of the namespace. Functions with Scope will match if the full name of the function starts with the Scope. Multiple functions can exist with the same name. Differential Revision: https://reviews.llvm.org/D70878
* [cxx_status] Fix paper number for "Concept auto" paper.Richard Smith2019-12-141-1/+1
|
* [perf-training] Make training data location configurableShoaib Meenai2019-12-145-5/+11
| | | | | | | We may wish to keep the PGO training data outside the repository. Add a CMake variable to allow referencing an external lit testsuite. Differential Revision: https://reviews.llvm.org/D71507
* [clang] Fix modules build after addition of TypeBitCodes.defRaphael Isemann2019-12-141-1/+9
| | | | | | | | | In revision 139006ceb641f038a2b19cac1174316e57004ed6 the Serialization folder got its first def file 'TypeBitCodes.def'. This broke the modules build as this .def file was not textually included but implicitly converted into a module due to our umbrella directive. This patch fixes this by explicitly marking the .def file as textual.
* Move ASTRecordWriter into its own header; NFC.John McCall2019-12-145-297/+322
| | | | | | | | | | Similar motivations to the movement of ASTRecordReader: AbstractBasicWriter.h already has quite a few dependencies, and it's going to get pretty large as we generate more and more into it. Meanwhile, most clients don't depend on this detail of the implementation and shouldn't need to be recompiled. I've also made OMPClauseWriter private, like it belongs.
* Move ASTRecordReader into its own header; NFC.John McCall2019-12-146-365/+387
| | | | | | | | | | | | | AbstractBasicReader.h has quite a few dependencies already, and that's only likely to increase. Meanwhile, ASTRecordReader is really an implementation detail of the ASTReader that is only used in a small number of places. I've kept it in a public header for the use of projects like Swift that might want to plug in to Clang's serialization framework. I've also moved OMPClauseReader into an implementation file, although it can't be made private because of friendship.
* MSVC build fix: forget some unneeded and incorrect friends.John McCall2019-12-142-3/+0
| | | | | | | | On MSVC, friend declarations are (incorrectly) visible even if not otherwise declared, which causes them to interfere with lookup. ASTTypeWriter is actually in an anonymous namespace and cannot be ASTWriter's friend. The others simply don't need to be anymore.
* Abstract serialization: TableGen the (de)serialization code for Types.John McCall2019-12-1413-1424/+1754
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic technical design here is that we have three levels of readers and writers: - At the lowest level, there's a `Basic{Reader,Writer}` that knows how to emit the basic structures of the AST. CRTP allows this to be metaprogrammed so that the client only needs to support a handful of primitive types (e.g. `uint64_t` and `IdentifierInfo*`) and more complicated "inline" structures such as `DeclarationName` can just be emitted in terms of those primitives. In Clang's binary-serialization code, these are `ASTRecord{Reader,Writer}`. For now, a large number of basic structures are still emitted explicitly by code on those classes rather than by either TableGen or CRTP metaprogramming, but I expect to move more of these over. - In the middle, there's a `Property{Reader,Writer}` which is responsible for processing the properties of a larger object. The object-level reader/writer asks the property-level reader/writer to project out a particular property, yielding a basic reader/writer which will be used to read/write the property's value, like so: ``` propertyWriter.find("count").writeUInt32(node->getCount()); ``` Clang's binary-serialization code ignores this level (it uses the basic reader/writer as the property reader/writer and has the projection methods just return `*this`) and simply relies on the roperties being read/written in a stable order. - At the highest level, there's an object reader/writer (e.g. `Type{Reader,Writer}` which emits a logical object with properties. Think of this as writing something like a JSON dictionary literal. I haven't introduced support for bitcode abbreviations yet --- it turns out that there aren't any operative abbreviations for types besides the QualType one --- but I do have some ideas of how they should work. At any rate, they'll be necessary in order to handle statements. I'm sorry for not disentangling the patches that added basic and type reader/writers; I made some effort to, but I ran out of energy after disentangling a number of other patches from the work. Negligible impact on module size, time to build a set of about 20 fairly large modules, or time to read a few declarations out of them.
* Abstract serialization: TableGen "basic" reader/writer CRTPJohn McCall2019-12-1411-5/+1059
| | | | classes that serialize basic values
* Standardize the reader methods in ASTReader; NFC.John McCall2019-12-145-1260/+1028
| | | | | | | | | | | | | | | | | | | | | | | | | | There are three significant changes here: - Most of the methods to read various embedded structures (`APInt`, `NestedNameSpecifier`, `DeclarationName`, etc.) have been moved from `ASTReader` to `ASTRecordReader`. This cleans up quite a bit of code which was passing around `(F, Record, Idx)` arguments everywhere or doing explicit indexing, and it nicely parallels how it works on the writer side. It also sets us up to then move most of these methods into the `BasicReader`s that I'm introducing as part of abstract serialization. As part of this, several of the top-level reader methods (e.g. `readTypeRecord`) have been converted to use `ASTRecordReader` internally, which is a nice readability improvement. - I've standardized most of these method names on `readFoo` rather than `ReadFoo` (used in some of the helper structures) or `GetFoo` (used for some specific types for no apparent reason). - I've changed a few of these methods to return their result instead of reading into an argument passed by reference. This is partly for general consistency and partly because it will make the metaprogramming easier with abstract serialization.
* Extract the TypeClass <-> TypeCode map into a .def file; NFC.John McCall2019-12-142-142/+67
|
* Enable better node-hierarchy metaprogramming; NFC.John McCall2019-12-143-41/+63
|
* Extract out WrappedRecord as a convenience base class; NFC.John McCall2019-12-141-21/+30
|
* Add a function to get the ExceptionSpecInfo of a function type; NFC.John McCall2019-12-141-11/+18
|
* Introduce some types and functions to make it easier to work withJohn McCall2019-12-145-77/+307
| | | | | | | | | | | | the tblgen AST node hierarchies. Not totally NFC because both of the emitters now emit in a different order. The type-nodes emitter now visits nodes in hierarchy order, which means we could use range checks in classof if we had any types that would benefit from that; currently we do not. The AST-nodes emitter now uses a multimap keyed by the name of the record; previously it was using `Record*`, which of couse isn't stable across processes and may have led to non-reproducible builds in some circumstances.
* [NFC] Correct accidental use of tabs.John McCall2019-12-141-99/+99
|
* [NFC] Rename ClangASTEmitters.h -> ASTTableGen.hJohn McCall2019-12-145-7/+7
|
* [clang] Move CLANG_BOOTSTRAP_CMAKE_ARGS above PASSTHROUGH_VARIABLESXin-Xin Wang2019-12-131-1/+1
| | | | | | | | | | | I want to pass some CMake cache files in CLANG_BOOTSTRAP_CMAKE_ARGS as `-C <cache file>.cmake` arguments. I want to be able to use the values of the bootstrap passthrough variables in the cache files, so the cache file arguments need to be after passthrough variables. This should be safe because the values of passthrough variables are all constants and can't refer to values in CLANG_BOOTSTRAP_CMAKE_ARGS. Differential Revision: https://reviews.llvm.org/D71428
* [Driver] Default to -momit-leaf-frame-pointer for AArch64Fangrui Song2019-12-133-5/+7
| | | | | | | | | | | | | | | | | This matches https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html > -momit-leaf-frame-pointer > -mno-omit-leaf-frame-pointer > > Omit or keep the frame pointer in leaf functions. The former behavior is the default. -mno-omit-leaf-frame-pointer is currently a no-op because TargetOptions::DisableFramePointerElim is only considered for non-leaf functions. Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D71167
* PR44268: Fix crash if __builtin_object_size is applied to a heapRichard Smith2019-12-132-2/+8
| | | | allocation.
* [c++20] Improve phrasing of diagnostic for missing #include <compare>.Richard Smith2019-12-135-10/+40
|
* [analyzer] CStringChecker: Fix a crash on unknown value passed to strlcat.Artem Dergachev2019-12-132-7/+12
| | | | | | Checkers should always account for unknown values. Also use a slightly more high-level API that naturally avoids the problem.
* [OpenMP][Docs] Claim loop tiling.Michael Kruse2019-12-131-0/+2
|
* [Driver] Use .init_array for all gcc installations and simplify Generic_ELF ↵Fangrui Song2019-12-135-18/+19
| | | | | | | | | | | | | | | | | -fno-use-init-array rules D39317 made clang use .init_array when no gcc installations is found. This change changes all gcc installations to use .init_array . GCC 4.7 by default stopped providing .ctors/.dtors compatible crt files, and stopped emitting .ctors for __attribute__((constructor)). .init_array should always work. FreeBSD rules are moved to FreeBSD.cpp to make Generic_ELF rules clean. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D71434
* [OPENMP]Fix skipping of functions body.Alexey Bataev2019-12-136-10/+59
| | | | | | When parsing the code with OpenMP and the function's body must be skipped, need to skip also OpenMP annotation tokens. Otherwise the counters for braces/parens are unbalanced and parsing fails.
* Call objc_retainBlock before passing a block as a variadic argumentAkira Hatanaka2019-12-133-0/+19
| | | | | | | | | Copy the block to the heap before passing it to the callee in case the block escapes in the callee. rdar://problem/55683462 Differential Revision: https://reviews.llvm.org/D71431
* Correct gcc vector splat conversion from float to int-vectorErich Keane2019-12-132-0/+17
| | | | | | | | | | | | | | | | | | | | | | | In looking into some other code, I came across this issue where a float converted to a gcc integer vector via a splat causes it to miss the float-to-integral cast, which causes some REALLY strange codegen bugs. The AST looked like: `-ImplicitCastExpr <col:13> 'gcc_int_2':'__attribute__((__vector_size__(2 * sizeof(int)))) int' <VectorSplat> `-ImplicitCastExpr <col:13> 'float' <LValueToRValue> `-DeclRefExpr <col:13> 'float' lvalue ParmVar 0x556f16a5dc90 'f' 'float' Despite the type of the VectorSplat cast as printed, it ended up becoming a vector of float, which caused non-matching instructions. For example, IntVector + a float constant resulted in: add <2 x i32> %8, <2 x float> <float 3.000000e+00, float 3.000000e+00> This patch corrects the conversion so that the float is first converted to an integral, THEN splatted.
* [profile] Fix a crash when -fprofile-remapping-file= triggers an errorFangrui Song2019-12-132-0/+8
| | | | | | Reviewed By: wmi Differential Revision: https://reviews.llvm.org/D71485
* [ARM][MVE][Intrinsics] All vqdmulhq/vqrdmulhq tests should be for signed ↵Mark Murray2019-12-132-18/+18
| | | | | | numbers. Fix broken tests. I can't yet explain how they worked locally pre-commit.
* [ARM][MVE][Intrinsics] remove extraneous intrinsics. (Reapply)Mark Murray2019-12-132-23/+31
| | | | | | | | | | | | | | | | | | Summary: I overstepped my reach and generated too many intrinsics; these never made it into the tests. Remove these extras. Some needed to be signed-olny, and there were some possible but unrequired _x variants that needed an extra argument to IntrinsicMX to allow [de-]selection at compile-time. Reviewers: simon_tatham Subscribers: kristof.beyls, dmgreen, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71466
* Revert "[ARM][MVE][Intrinsics] remove extraneous intrinsics."Dmitri Gribenko2019-12-132-29/+21
| | | | | | | This reverts commit 0eb0992739189dba0d86af33722bc27260a9b555. The code does not compile: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/20462
* [Tooling/Syntax] Helpers to find spelled tokens touching a location.Sam McCall2019-12-131-1/+0
| | | | | | | | | | | | Summary: Useful when positions are used to target nodes, with before/after ambiguity. Reviewers: ilya-biryukov, kbobyrev Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71356
* [ARM][MVE][Intrinsics] remove extraneous intrinsics.Mark Murray2019-12-132-21/+29
| | | | | | | | | | | | | | | | | | Summary: I overstepped my reach and generated too many intrinsics; these never made it into the tests. Remove these extras. Some needed to be signed-olny, and there were some possible but unrequired _x variants that needed an extra argument to IntrinsicMX to allow [de-]selection at compile-time. Reviewers: simon_tatham Subscribers: kristof.beyls, dmgreen, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71466
* Reland [DataLayout] Fix occurrences that size and range of pointers are ↵Nicola Zaghen2019-12-131-2/+2
| | | | | | | | | | | | | | assumed to be the same. GEP index size can be specified in the DataLayout, introduced in D42123. However, there were still places in which getIndexSizeInBits was used interchangeably with getPointerSizeInBits. This notably caused issues with Instcombine's visitPtrToInt; but the unit tests was incorrect, so this remained undiscovered. This fixes the buildbot failures. Differential Revision: https://reviews.llvm.org/D68328 Patch by Joseph Faulls!
* [ARM][MVE] Add vector reduction intrinsics with two vector operandsMikhail Maltsev2019-12-135-0/+2440
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds intrinsics for the following MVE instructions: * VABAV * VMLADAV, VMLSDAV * VMLALDAV, VMLSLDAV * VRMLALDAVH, VRMLSLDAVH Each of the above 4 groups has a corresponding new LLVM IR intrinsic, since the instructions cannot be easily represented using general-purpose IR operations. Reviewers: simon_tatham, ostannard, dmgreen, MarkMurrayARM Reviewed By: MarkMurrayARM Subscribers: merge_guards_bot, kristof.beyls, hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D71062
* [ARM][MVE] Add intrinsics for more immediate shifts.Simon Tatham2019-12-132-0/+956
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This fills in the remaining shift operations that take a single vector input and an immediate shift count: the `vqshl`, `vqshlu`, `vrshr` and `vshll[bt]` families. `vshll[bt]` (which shifts each input lane left into a double-width output lane) is the most interesting one. There are separate MC instruction ids for shifting by exactly the input lane width and shifting by less than that, because the instruction encoding is so completely different for the lane-width special case. So I had to write two sets of patterns to match based on the immediate shift count, which involved adding a ComplexPattern matcher to avoid the general-case pattern accidentally matching the special case too. For that family I've made sure to add an llc codegen test for both versions of each instruction. I'm experimenting with a new strategy for parametrising the isel patterns for all these instructions: adding extra fields to the relevant `Instruction` subclass itself, which are ignored by the Tablegen backends that generate the MC data, but can be retrieved from each instance of that instruction subclass when it's passed as a template parameter to the multiclass that generates its isel patterns. A nice effect of that is that I can fill in those informational fields using `let` blocks, rather than having to type them out once per instruction at `defm` time. (As a result, quite a lot of existing instruction `def`s are reindented by this patch, so it's clearer to read with whitespace changes ignored.) Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard Reviewed By: MarkMurrayARM Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D71458
* [Sema] Improve diagnostic about addr spaces for overload candidatesAnastasia Stulova2019-12-1311-60/+109
| | | | | | | | | | Allow sending address spaces into diagnostics to simplify and improve error reporting. Improved wording of diagnostics for address spaces in overloading. Tags: #clang Differential Revision: https://reviews.llvm.org/D71111
* [ARM][MVE][Intrinsics] Add *_x() variants of my *_m() intrinsics.Mark Murray2019-12-1320-98/+1437
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Better use of multiclass is used, and this helped find some existing bugs in the predicated VMULL* intrinsics, which are now fixed. The refactored VMULL[TB]Q_(INT|POLY)_M() intrinsics were discovered to have an argument ("inactive") with incorrect type, and this required a fix that is included in this whole patch. The argument "inactive" should have been the same width (per vector element) as the return type of the intrinsic, but was not in the case where the return type was double the element width of the input types. To assist in testing the multiclassing , and to thwart further gremlins, the unit tests are improved in scope. The *.ll tests are all generated by a small bit of throw-away scripting from the corresponding *.c tests, and as such the diffs are large and nasty. Look at the file rather than the diff. Reviewers: dmgreen, miyuki, ostannard, simon_tatham Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D71421
* Correct inf typoAndrew Gaul2019-12-132-2/+2
| | | | | | | | | | | | Reviewers: krasimir Reviewed By: krasimir Subscribers: Jim, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57732
* Remove extra character I added to test my changes that I forgot to delete ↵Douglas Yung2019-12-121-1/+1
| | | | before submitting.
* Fix test to work correctly on 32-bit platforms.Douglas Yung2019-12-121-1/+2
|
* Update line number after previous patch added an additional unsupportedEric Christopher2019-12-121-4/+4
| | | | and comment lines.
* [clang] [test] Disable the test exhausting stack on NetBSDMichał Górny2019-12-121-0/+3
| | | | | | | Disable the instantiation-depth-default.cpp test on NetBSD since it requires more stack space than we have by default on NetBSD. Differential Revision: https://reviews.llvm.org/D71419
OpenPOWER on IntegriCloud