summaryrefslogtreecommitdiffstats
path: root/clang/include
Commit message (Collapse)AuthorAgeFilesLines
...
* [Syntax] Add nodes for most common statementsIlya Biryukov2019-11-061-10/+236
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Most of the statements mirror the ones provided by clang AST. Major differences are: - expressions are wrapped into 'ExpressionStatement' instead of being a subclass of statement, - semicolons are always consumed by the leaf expressions (return, expression satement, etc), - some clang statements are not handled yet, we wrap those into an UnknownStatement class, which is not present in clang. We also define an 'Expression' and 'UnknownExpression' classes in order to produce 'ExpressionStatement' where needed. The actual implementation of expressions is not yet ready, it will follow later. Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63835
* [ARM,MVE] Add intrinsics for gather/scatter load/stores.Simon Tatham2019-11-062-18/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds two new families of intrinsics, both of which are memory accesses taking a vector of locations to load from / store to. The vldrq_gather_base / vstrq_scatter_base intrinsics take a vector of base addresses, and an immediate offset to be added consistently to each one. vldrq_gather_offset / vstrq_scatter_offset take a scalar base address, and a vector of offsets to add to it. The 'shifted_offset' variants also multiply each offset by the element size type, so that the vector is effectively of array indices. At the IR level, these operations are represented by a single set of four IR intrinsics: {gather,scatter} × {base,offset}. The other details (signed/unsigned, shift, and memory element size as opposed to vector element size) are all specified by IR intrinsic polymorphism and immediate operands, because that made the selection job easier than making a huge family of similarly named intrinsics. I considered using the standard IR representations such as llvm.masked.gather, but they're not a good fit. In order to use llvm.masked.gather to represent a gather_offset load with element size smaller than a pointer, you'd have to expand the <8 x i16> vector of offsets into an <8 x i16*> vector of pointers, which would be split up during legalization, so you'd spend most of your time undoing the mess it had made. Also, ISel support for llvm.masked.gather would be easy enough in a trivial way (you can expand it into a gather-base load with a zero immediate offset), but instruction-selecting lots of fiddly idioms back into all the _other_ MVE load instructions would be much more work. So I think dedicated IR intrinsics are the more sensible approach, at least for the moment. On the clang tablegen side, I've added two new features to the Tablegen source accepted by MveEmitter: a 'CopyKind' type node for defining a type that varies with the parameter type (it lets you ask for an unsigned integer type of the same width as the parameter), and an 'unsignedflag' value node for passing an immediate IR operand which is 0 for a signed integer type or 1 for an unsigned one. That lets me write each kind of intrinsic just once and get all its subtypes and immediate arguments generated automatically. Also I've tweaked the handling of pointer-typed values in the code generation part of MveEmitter: they're generated as Address rather than Value (i.e. including an alignment) so that they can be given to the ordinary IR load and store operations, but I'd omitted the code to convert them back to Value when they're going to be used as an argument to an IR intrinsic. On the MC side, I've enhanced MVEVectorVTInfo so that it can tell you not only the full assembly-language suffix for a given vector type (like 's32' or 'u16') but also the numeric-only one used by store instructions (just '32' or '16'). Reviewers: dmgreen Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69791
* [ARM,MVE] Integer-type nitpicks in MVE intrinsics.Simon Tatham2019-11-062-5/+13
| | | | | | | | | | | | | | | | | | | | | A few integer types in the ACLE definitions of MVE intrinsics are given as 'int' or 'unsigned' instead of <stdint.h> fixed-size types like uint32_t. Usually these are the ones where the size isn't that important, such as immediate offsets in loads (which have a range limited by the instruction encoding) or the carry flag in vadcq which can only be 0 or 1 anyway. With this change, <arm_mve.h> follows that exact type naming, so that the function prototypes look identical to the ones in ACLE, instead of replacing int and unsigned with int32_t and uint32_t. Reviewers: dmgreen Subscribers: kristof.beyls, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69790
* [ARM MVE] Remove accidental 64-bit vst2/vld2 intrinsics.Simon Tatham2019-11-061-1/+1
| | | | | | | | | | | | | | | ACLE defines no such intrinsic as vst2q_u64, and the MVE instruction set has no corresponding instruction. But I had accidentally added them to the fledgling <arm_mve.h> anyway, and if you used them, you'd get a compiler crash. Reviewers: dmgreen Subscribers: kristof.beyls, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69788
* [OPENMP50]Simplify processing of context selector scores.Alexey Bataev2019-11-051-6/+0
| | | | | | If the context selector score was not specified, its value must be set to 0. Simplify the processing of unspecified scores + save memory in attribute representation.
* [Clang FE] Recognize -mnop-mcount CL option (SystemZ only).Jonas Paulsson2019-11-053-0/+5
| | | | | | | | | | | | | | Recognize -mnop-mcount from the command line and add a function attribute "mnop-mcount"="true" when passed. When this option is used, a nop is added instead of a call to fentry. This is used when building the Linux Kernel. If this option is passed for any other target than SystemZ, an error is generated. Review: Ulrich Weigand https://reviews.llvm.org/D67763
* [OPENMP50]Support for imperfectly nested loops.Alexey Bataev2019-11-041-21/+13
| | | | Added support for imperfectly nested loops introduced in OpenMP 5.0.
* clang/Modules: Bring back optimization lost in 31e14f41a21fDuncan P. N. Exon Smith2019-11-041-2/+5
| | | | | | 31e14f41a21f9016050a20f07d5da03db2e8c13e accidentally dropped caching of failed module loads. This brings it back by making ModuleMap::getCachedModuleLoad return an Optional.
* [X86] Add support for -mvzeroupper and -mno-vzeroupper to match gccCraig Topper2019-11-041-0/+2
| | | | | | | | | | | | | | | | | -mvzeroupper will force the vzeroupper insertion pass to run on CPUs that normally wouldn't. -mno-vzeroupper disables it on CPUs where it normally runs. To support this with the default feature handling in clang, we need a vzeroupper feature flag in X86.td. Since this flag has the opposite polarity of the fast-partial-ymm-or-zmm-write we used to use to disable the pass, we now need to add this new flag to every CPU except KNL/KNM and BTVER2 to keep identical behavior. Remove -fast-partial-ymm-or-zmm-write which is no longer used. Differential Revision: https://reviews.llvm.org/D69786
* Recommit "[CodeView] Add option to disable inline line tables."Amy Huang2019-11-042-0/+5
| | | | | | | | | | | | This reverts commit 004ed2b0d1b86d424643ffc88fce20ad8bab6804. Original commit hash 6d03890384517919a3ba7fe4c35535425f278f89 Summary: This adds a clang option to disable inline line tables. When it is used, the inliner uses the call site as the location of the inlined function instead of marking it as an inline location with the function location. https://reviews.llvm.org/D67723
* [Diagnostics] Improve some error messages related to bad use of dynamic_castDávid Bolvanský2019-11-041-3/+3
|
* SanitizerMask::bitPosToMask - fix operator precedence warnings. NFCI.Simon Pilgrim2019-11-041-4/+5
| | | | Fix static analyzer operator precedence warnings with suitable bracketing. Pull out the mask generation code so clang-format doesn't make such a mess of it.
* [hwasan] Remove lazy thread-initialisationDavid Spickett2019-11-041-1/+7
| | | | | | | | | | | | | | | | | | | | | This was an experiment made possible by a non-standard feature of the Android dynamic loader. It required introducing a flag to tell the compiler which ABI was being targeted. This flag is no longer needed, since the generated code now works for both ABI's. We leave that flag untouched for backwards compatibility. This also means that if we need to distinguish between targeted ABI's again we can do that without disturbing any existing workflows. We leave a comment in the source code and mention in the help text to explain this for any confused person reading the code in the future. Patch by Matthew Malcomson Differential Revision: https://reviews.llvm.org/D69574
* clang/Modules: Sink CompilerInstance::KnownModules into ModuleMapDuncan P. N. Exon Smith2019-11-032-5/+16
| | | | | | | | | | | | Avoid use-after-frees when FrontendAction::BeginSourceFile is called twice on the same CompilerInstance by sinking CompilerInstance::KnownModules into ModuleMap. On the way, rename the map to CachedModuleLoads. I considered (but rejected) merging this with ModuleMap::Modules, since that only has top-level modules and this map includes submodules. This is an alternative to https://reviews.llvm.org/D58497. Thanks to nemanjai for the detailed analysis of the problem!
* Drop spurious self-include [NFC]Aaron Puchert2019-11-031-1/+0
| | | | This was introduced in D61357, probably by accident.
* DebugInfo: Accept -gdwarf even in clang-clDavid Blaikie2019-11-011-1/+1
| | | | Fixes regression introduced by llvmorg-10-init-8908-g098d901bd1b
* DebugInfo: Let -gdwarf use the toolchain default DWARF version, instead of ↵David Blaikie2019-11-011-4/+4
| | | | hardcoded/aliased to -gdwarf-4
* [WebAssembly] Add experimental SIMD dot product instructionThomas Lively2019-11-011-0/+2
| | | | | | | | | | | | | | | | | | | Summary: This instruction is not merged to the spec proposal, but we need it to be implemented in the toolchain to experiment with it. It is available only on an opt-in basis through a clang builtin. Defined in https://github.com/WebAssembly/simd/pull/127. Depends on D69696. Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69697
* [libTooling] Add Stencil constructor.Yitzhak Mandelbaum2019-11-011-0/+7
| | | | | | | | | | | | | | | | Summary: Adds a constructor that takes a vector with which to initialize the `Parts` field and a corresponding free function that forwards to the constructor. These definitions are needed to assist in transitioning away from `Stencil` as a class to defining it as a type alias. Reviewers: ilya-biryukov Subscribers: cfe-commits, gribozavr Tags: #clang Differential Revision: https://reviews.llvm.org/D69632
* [WebAssembly] SIMD integer min and max instructionsThomas Lively2019-10-311-0/+15
| | | | | | | | | | | | | | | | | | | | | | Summary: Introduces a clang builtins and LLVM intrinsics representing integer min/max instructions. These instructions have not been merged to the SIMD spec proposal yet, so they are currently opt-in only via builtins and not produced by general pattern matching. If these instructions are accepted into the spec proposal the builtins and intrinsics will be replaced with normal pattern matching. Defined in https://github.com/WebAssembly/simd/pull/27. Reviewers: aheejin Reviewed By: aheejin Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69696
* [clang][ScanDeps] Fix issue with multiple commands with the same input.Michael Spencer2019-10-311-6/+4
| | | | | | | | | | | | | | | | | | | Previously, given a CompilationDatabase with two commands for the same source file we would report that file twice with the union of the dependencies for each command both times. This was due to the way `ClangTool` runs actions given an input source file (see the comment in `DependencyScanningTool.cpp`). This commit adds a `SingleCommandCompilationDatabase` that is created with each `CompileCommand` in the original CDB, which is then used for each `ClangTool` invocation. This gives us a single run of `DependencyScanningAction` per `CompileCommand`. I looked at using `AllTUsToolExecutor` which is a parallel tool executor, but I'm not sure it's suitable for `clang-scan-deps` as it does a lot more sharing of state than `AllTUsToolExecutor` expects. Differential Revision: https://reviews.llvm.org/D69643
* [cfi] Add flag to always generate .debug_frameDavid Candler2019-10-312-0/+6
| | | | | | | | | This adds a flag to LLVM and clang to always generate a .debug_frame section, even if other debug information is not being generated. In situations where .eh_frame would normally be emitted, both .debug_frame and .eh_frame will be used. Differential Revision: https://reviews.llvm.org/D67216
* [Diagnostics] Warn for std::is_constant_evaluated in constexpr modeDávid Bolvanský2019-10-311-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: constexpr int fn1() { if constexpr (std::is_constant_evaluated()) // condition is always true! return 0; else return 1; } constexpr int fn2() { if (std::is_constant_evaluated()) return 0; else return 1; } Solves PR42977 Reviewers: rsmith, aaron.ballman Reviewed By: rsmith Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69518
* Revert "[CodeView] Add option to disable inline line tables."Amy Huang2019-10-302-5/+0
| | | | | | because it breaks compiler-rt tests. This reverts commit 6d03890384517919a3ba7fe4c35535425f278f89.
* [CodeView] Add option to disable inline line tables.Amy Huang2019-10-302-0/+5
| | | | | | | | | | | | | | | | | Summary: This adds a clang option to disable inline line tables. When it is used, the inliner uses the call site as the location of the inlined function instead of marking it as an inline location with the function location. See https://bugs.llvm.org/show_bug.cgi?id=42344 Reviewers: rnk Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D67723
* [clang][clang-scan-deps] Add support for extracting full module dependencies.Michael Spencer2019-10-304-3/+118
| | | | | | | | | | | This is a recommit of d8a4ef0e685c with the nondeterminism fixed. This adds experimental support for extracting a Clang module dependency graph from a compilation database. The output format is experimental and will change. It is currently a concatenation of JSON outputs for each compilation. Future patches will change this to deduplicate modules between compilations. Differential Revision: https://reviews.llvm.org/D69420
* Revert "[clang][clang-scan-deps] Add support for extracting full module ↵Michael Spencer2019-10-304-118/+3
| | | | | | | | dependencies." This reverts commit d8a4ef0e685cec1fc73d4953b48220b649d05b40. This commit broke some of the bots. I believe it's due to nondeterminism. Will fix and recommit.
* [clang][clang-scan-deps] Add support for extracting full module dependencies.Michael Spencer2019-10-304-3/+118
| | | | | | | | | This adds experimental support for extracting a Clang module dependency graph from a compilation database. The output format is experimental and will change. It is currently a concatenation of JSON outputs for each compilation. Future patches will change this to deduplicate modules between compilations. Differential Revision: https://reviews.llvm.org/D69420
* Fix readability-identifier-naming to prevent variables becoming keywords.Daniel2019-10-301-0/+2
| | | | | Do not provide a fix-it when clang-tidy encounters a name that would become a keyword.
* Updating the documentation for the _Noreturn attribute; NFC.Aaron Ballman2019-10-301-1/+3
|
* [OPENMP50]Add support for parallel master taskloop simd directive.Alexey Bataev2019-10-308-3/+117
| | | | Added full support for parallel master taskloop simd directive.
* [clang][driver] Add basic --driver-mode=flang support for fortranPeter Waller2019-10-303-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new Flang mode. When in Flang mode, the driver will invoke flang for fortran inputs instead of falling back to the GCC toolchain as it would otherwise do. The behaviour of other driver modes are left unmodified to preserve backwards compatibility. It is intended that a soon to be implemented binary in the flang project will import libclangDriver and run the clang driver in the new flang mode. Please note that since the binary invoked by the driver is under development, there will no doubt be further tweaks necessary in future commits. * Initial support is added for basic driver phases * -E, -fsyntax-only, -emit-llvm -S, -emit-llvm, -S, (none specified) * -### tests are added for all of the above * This is more than is supported by f18 so far, which will emit errors for those options which are unimplemented. * A test is added that ensures that clang gives a reasonable error message if flang is not available in the path (without -###). * Test that the driver accepts multiple inputs in --driver-mode=flang. * Test that a combination of C and Fortran inputs run both clang and flang in --driver-mode=flang. * clang/test/Driver/fortran.f95 is fixed to use the correct fortran comment character. Differential revision: https://reviews.llvm.org/D63607
* Suppress useless GCC "bitfield is too small to hold all values of enum ↵Richard Smith2019-10-291-1/+1
| | | | class" warning.
* Replace std::function in PrintingPolicy with a callbacks object.Richard Smith2019-10-291-7/+14
| | | | | This makes PrintingPolicy significantly more lightweight and provides groundwork for more printing customization hooks.
* Accept __is_same_as as a GCC-compatibility synonym for the proper trait name ↵Richard Smith2019-10-291-0/+2
| | | | __is_same.
* isBuiltinFunc() uses StringRef instead of const char*Guillaume Chatelet2019-10-291-1/+1
| | | | | | | | | | | | Summary: This prevents a bug when passing nullptr, StringRef ctor would call strlen(nullptr). Reviewers: vlad.tsyrklevich Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69569
* [clang] Add no_builtin attributeGuillaume Chatelet2019-10-294-0/+57
| | | | | | | | | | | | | | | | Summary: This is a follow up on https://reviews.llvm.org/D61634 This patch is simpler and only adds the no_builtin attribute. Reviewers: tejohnson, courbet, theraven, t.p.northover, jdoerfert Subscribers: mgrang, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68028 This is a re-submit after it got reverted in https://reviews.llvm.org/rGbd8791610948 since the breakage doesn't seem to come from this patch.
* [NFC] Fix some indentation disturbed in D67368Reid Kleckner2019-10-281-64/+64
|
* [Builtins] Teach Clang about memccpyDávid Bolvanský2019-10-281-0/+1
| | | | | | | | | | | | | | Summary: Hopefully, -fno-builtin-memccpy will work now. Required for https://reviews.llvm.org/D67986. Reviewers: aaron.ballman, rsmith Reviewed By: aaron.ballman Subscribers: RKSimon, kristina, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68377
* Revert "[clang] Add no_builtin attribute"Vlad Tsyrklevich2019-10-284-57/+0
| | | | | This reverts commit bd87916109483d33455cbf20da2309197b983cdd. It was causing ASan/MSan failures on the sanitizer buildbots.
* Revert "[Concepts] Constraint Enforcement & Diagnostics"Vlad Tsyrklevich2019-10-285-227/+18
| | | | | This reverts commit ffa214ef22892d75340dc6720271863901dc2c90, it was causing ASAN test failures on sanitizer-x86_64-linux-bootstrap.
* [clang] Add no_builtin attributeGuillaume Chatelet2019-10-284-0/+57
| | | | | | | | | | | | | | Summary: This is a follow up on https://reviews.llvm.org/D61634 This patch is simpler and only adds the no_builtin attribute. Reviewers: tejohnson, courbet, theraven, t.p.northover, jdoerfert Subscribers: mgrang, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68028
* Add Windows Control Flow Guard checks (/guard:cf).Andrew Paverd2019-10-283-2/+5
| | | | | | | | | | | | | | | | | | | Summary: A new function pass (Transforms/CFGuard/CFGuard.cpp) inserts CFGuard checks on indirect function calls, using either the check mechanism (X86, ARM, AArch64) or or the dispatch mechanism (X86-64). The check mechanism requires a new calling convention for the supported targets. The dispatch mechanism adds the target as an operand bundle, which is processed by SelectionDAG. Another pass (CodeGen/CFGuardLongjmp.cpp) identifies and emits valid longjmp targets, as required by /guard:cf. This feature is enabled using the `cfguard` CC1 option. Reviewers: thakis, rnk, theraven, pcc Subscribers: ychen, hans, metalcanine, dmajor, tomrittervg, alex, mehdi_amini, mgorny, javed.absar, kristof.beyls, hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65761
* [ARM][AArch64] Implement __cls, __clsl and __clsll intrinsics from ACLEvhscampos2019-10-282-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Writing support for three ACLE functions: unsigned int __cls(uint32_t x) unsigned int __clsl(unsigned long x) unsigned int __clsll(uint64_t x) CLS stands for "Count number of leading sign bits". In AArch64, these two intrinsics can be translated into the 'cls' instruction directly. In AArch32, on the other hand, this functionality is achieved by implementing it in terms of clz (count number of leading zeros). Reviewers: compnerd Reviewed By: compnerd Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69250
* [clangd] Do not insert parentheses when completing a using declarationIlya Biryukov2019-10-283-6/+16
| | | | | | | | | | | | | | | | | | Summary: Would be nice to also fix this in clang, but that looks like more work if we want to preserve signatures in informative chunks. Fixes https://github.com/clangd/clangd/issues/118 Reviewers: kadircet Reviewed By: kadircet Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69382
* [c++20] Enforce rule that a union-like class or class with referenceRichard Smith2019-10-272-0/+16
| | | | members cannot have defaulted comparisons.
* [NFC] Add a tablegen node for the root of the AST node hierarchies.John McCall2019-10-254-392/+384
| | | | | This is useful for the property databases we want to add for abstract serialization, since root classes can have interesting properties.
* [clang][DependencyScanning] 80-col.Michael Spencer2019-10-251-3/+6
|
* [clang-format] [NFC] update the documentation in Format.h to allow ↵paulhoad2019-10-252-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | dump_format_style.py to get a little closer to being correct. Summary: Running dump_format_style.py on the tip of the trunk causes ClangFormatStyleOptions.rst to have changes, which I think ideally it shouldn't. Some recent commits have meant Format.h and ClangFormatStyleOptions.rst have become out of sync such that dump_format_style.py either couldn't be run or generated incorrect .rst files. It's also important to remember to edit the IncludeStyles from Tooling. Make a couple of changes {D6833} {D64695} which came from recent clang-format commits that missed this step. There are still a couple of other changes from commit {D67541} {D68296} which also need to be looked at, but I'd like to park these first two changes first. The authors of these original commits I've included in the reviewers, I'm happy to work on the changes, just really need to know which is the ground truth of the changes you want to keep (whats in the Format.h) or what is in the ClangFormatStyleOptions.rst Reviewers: klimek, mitchell-stellar, owenpan, jvoung, Manikishan, sammccall Reviewed By: mitchell-stellar Subscribers: cfe-commits Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D69404
* [clang][ThinLTO] Promote cc1 -fthin_link_bitcode to driver ↵Yuanfang Chen2019-10-242-2/+3
| | | | | | | | | | | | | | | | | -fthinlto_link_bitcode Summary: A necessary step to let build system caching work for its output. Reviewers: tejohnson, steven_wu Reviewed by: tejohnson Subscribers: mehdi_amini, inglorion, dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69406
OpenPOWER on IntegriCloud