summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-format] Fixed edge-case with SpacesInSquareBrackets with trailing ↵Mitchell Balan2019-11-142-3/+8
| | | | | | | | | | | | | | | | | | | bare "&" lambda capture. Summary: Lambda captures allow for a lone `&` capture, so `&]` needs to be properly handled. `int foo = [& ]() {}` is fixed to give `int foo = [ & ]() {}` Reviewers: MyDeveloperDay Reviewed by: MyDeveloperDay Subscribers: cfe-commits Tags: #clang, #clang-format Differential Revision: https://reviews.llvm.org/D70249
* [OPENMP]Add assignment operator in UDR test, NFC.Alexey Bataev2019-11-141-0/+1
| | | | | | Add assignment operator in the test to check that even if the operator was declare explicitly, the constructor is called in the user-defined reduction initializer anyway.
* [AMDGPU][HIP] Change default DWARF version to 4Scott Linder2019-11-144-3/+12
| | | | | | | | | | | | | Summary: Tooling around DWARF 5 is still not mature enough for this to be a sane default, and the AMDGPU and HIP toolchains should agree on a single default. Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, aprantl, dstuttard, tpr, t-tye, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70191
* Improve VFS compatibility on WindowsAdrian McCarthy2019-11-1415-46/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Keys in a virtual file system can be in Posix or Windows form or even a combination of the two. Many VFS tests (and a few Clang tests) were XFAILed on Windows because of false negatives when comparing paths. First, we default CaseSenstive to false on Windows. This allows drive letters like "D:" to match "d:". Windows filesystems are, by default, case insensitive, so this makes sense even beyond the drive letter. Second, we allow slashes to match backslashes when they're used as the root component of a path. Both of these changes are limited to RedirectingFileSystems, so there's little chance of affecting other path handling. These changes allow eleven of the VFS tests to pass on Windows as well as three other Clang tests, so they have re-enabled. This solves the majority of PR43272. Additional VFS test failures will be fixed in separate patches. Differential Revision: https://reviews.llvm.org/D69958
* [Analyzer][NFC] Separate white-box tests for iterator modelling from ↵Adam Balogh2019-11-146-1040/+2434
| | | | | | | | | | | iterator checker tests The recently committed debug.IteratorDebugging checker enables standalone white-box testing of the modelling of containers and iterators. For the three checkers based on iterator modelling only simple tests are needed. Differential Revision: https://reviews.llvm.org/D70123
* Modernize llvm::Error handling in ExternalASTMergerRaphael Isemann2019-11-141-3/+1
|
* [clang][IFS][test] Reverting driver-test.c to what it was prior to e782192d5e6Puyan Lotfi2019-11-141-7/+6
| | | | | | My mistake. Changes I had in this test were for code changes that are not landed yet. I am reverting driver-test.c back to what it was originally.
* [clang][IFS][test] Removing -shared, fixing triple: driver-test.c/windows.cpp.Puyan Lotfi2019-11-142-3/+3
| | | | | | | Removing -shared as it is not used on a lot of targets in order to green failing bots with this change. Also, tiding up the windows.cpp test as the triple compile out can look slightly different that what you specified on a windows bot.
* [clang][IFS][test][NFC] Tightening up clang-ifs tests to use -cc1 more often.Puyan Lotfi2019-11-1422-87/+75
| | | | | | | Unless the test is explicitly testing a driver feature if clang interface stubs I have changed the tests to use %clang_cc1. This should make some changes I plan to make to the driver job pipeline cause fewer test changes and breakages.
* [WebAssembly] -fwasm-exceptions enables reference-typesHeejin Ahn2019-11-133-3/+19
| | | | | | | | | | | | | | | Summary: This adds `-mreference-types` and `-mno-reference-types` flags to clang and make `-fwasm-exceptions` enables reference types feature in clang and the backend. Reviewers: tlively Subscribers: dschuff, sbc100, jgravelle-google, sunfish, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69832
* Move CodeGenFileType enum to Support/CodeGen.hReid Kleckner2019-11-131-5/+5
| | | | | | | Avoids the need to include TargetMachine.h from various places just for an enum. Various other enums live here, such as the optimization level, TLS model, etc. Data suggests that this change probably doesn't matter, but it seems nice to have anyway.
* [X86] Don't treat mxcsr as a register name when parsing MS inline assembly.Craig Topper2019-11-131-1/+9
| | | | | No instruction takes mxcsr as a an operand so we should always treat it as an identifier name.
* Revert "[RISCV] Use compiler-rt if no GCC installation detected"Richard Smith2019-11-138-45/+19
| | | | | | | This change causes test failures for builds configured with -DCLANG_DEFAULT_RTLIB=compiler-rt. This reverts commit 3289352e6bb9d2949c678c625478024bf2a5fbfb.
* [clang-format] refactor the use of the SMDiagnostics in replacement warningsmydeveloperday2019-11-131-40/+9
| | | | | | | | | | | | | | | | | Summary: Review comments in {D69854} recommended a simpler approach of creating the SMDiagnostics to remove much of the complexity. (thanks @thakis) @vlad.tsyrklevich I've rebuilt on both Windows and Linux (running Linux with Address and Undefined sanitizers) over the clang code base Reviewers: thakis, klimek, mitchell-stellar, vlad.tsyrklevich Reviewed By: thakis Subscribers: cfe-commits, thakis, vlad.tsyrklevich Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D69921
* [BPF] fix clang test failure for bpf-attr-preserve-access-index-4.cYonghong Song2019-11-131-3/+3
| | | | | | | Depending on different cmake configures, clang may generate different IR name for slot variables. Let us use the regex instead of hard coding the name. I did the same for other bpf-attr-preserve-access-index tests with such an approach, but somehow did not do for this one.
* [RISCV] Use compiler-rt if no GCC installation detectedEdward Jones2019-11-138-19/+45
| | | | | | | | If a GCC installation is not detected, then this attempts to use compiler-rt and the compiler-rt crtbegin/crtend implementations as a fallback. Differential Revision: https://reviews.llvm.org/D68407
* [BPF] add missing attribute in pragma-attribute-supported-attributes-list.testYonghong Song2019-11-131-0/+1
| | | | | Add the newly supported BPF specific __attribute__((preserve_access_index) in the pragma-attribute-supported-attributes-list.test.
* [BPF] Add preserve_access_index attribute for record definitionYonghong Song2019-11-1313-8/+412
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a resubmission for the previous reverted commit 943436040121 with the same subject. This commit fixed the segfault issue and addressed additional review comments. This patch introduced a new bpf specific attribute which can be added to struct or union definition. For example, struct s { ... } __attribute__((preserve_access_index)); union u { ... } __attribute__((preserve_access_index)); The goal is to simplify user codes for cases where preserve access index happens for certain struct/union, so user does not need to use clang __builtin_preserve_access_index for every members. The attribute has no effect if -g is not specified. When the attribute is specified and -g is specified, any member access defined by that structure or union, including array subscript access and inner records, will be preserved through __builtin_preserve_{array,struct,union}_access_index() IR intrinsics, which will enable relocation generation in bpf backend. The following is an example to illustrate the usage: -bash-4.4$ cat t.c #define __reloc__ __attribute__((preserve_access_index)) struct s1 { int c; } __reloc__; struct s2 { union { struct s1 b[3]; }; } __reloc__; struct s3 { struct s2 a; } __reloc__; int test(struct s3 *arg) { return arg->a.b[2].c; } -bash-4.4$ clang -target bpf -g -S -O2 t.c A relocation with access string "0:0:0:0:2:0" will be generated representing access offset of arg->a.b[2].c. forward declaration with attribute is also handled properly such that the attribute is copied and populated in real record definition. Differential Revision: https://reviews.llvm.org/D69759
* [clang][Tooling] Filter flags that generate output in SyntaxOnlyAdjusterKadir Cetinkaya2019-11-132-2/+48
| | | | | | | | | | | | | | | | | | Summary: Flags that generate output could result in failures when creating syntax only actions. This patch introduces initial logic for filtering out those. The first such flag is "save-temps", which saves intermediate files(bitcode, assembly, etc.) into a specified directory. Fixes https://github.com/clangd/clangd/issues/191 Reviewers: hokein Subscribers: ilya-biryukov, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70173
* [ARM,MVE] Add intrinsics for contiguous load/stores.Simon Tatham2019-11-135-27/+1595
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the ACLE intrinsics for all the MVE load and store instructions not already handled by D69791. These ones don't need new IR intrinsics, because they can be implemented in terms of standard LLVM IR constructions. Some of the load and store instructions access less than 128 bits of memory, sign/zero extending each value to a wider vector lane on load or truncating it on store. These are represented in IR by a load of a shorter vector followed by a zext/sext, and conversely, a trunc followed by a short store. Existing ISel patterns already recognize those combinations and turn them into the right MVE instructions. The predicated forms of all these instructions are represented in the same way, except that the ordinary load/store operation is replaced with the existing intrinsics @llvm.masked.{load,store}. These are currently only code-generated as predicated MVE load/store instructions if you give LLVM the `-enable-arm-maskedldst` option; so I've done that in the LLVM codegen test. When we make that the default, that option can be removed. In the Tablegen backend, I've had to add a handful of extra support features: * We need to be able to make clang::Address objects out of a pointer and an alignment (previously we only needed these when the user passed us an existing one). * We can now specify vector types that aren't 128 bits wide (for use in those intermediate values in IR), the parametrized type system can make one starting from two existing vector types (using the lane count of one and the element type of the other). * I've added support for code generation of pointer casts, and for specifying LLVM types as operands to IRBuilder operations (for zext and sext, though I think they'll come in useful again). * Now not all IR construction operations need to be specified as Builder.CreateFoo; some don't involve a Builder at all, and one passes it as a parameter to a tiny static helper function in CGBuiltin.cpp. Reviewers: ostannard, MarkMurrayARM, dmgreen Subscribers: kristof.beyls, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D70088
* [OpenCL] Add remaining vector data builtin functionsSven van Haastregt2019-11-131-1/+51
| | | | | | | Add the remaining half (fp16) vector data load and store builtin functions from the OpenCL C specification. Patch by Pierre Gondois and Sven van Haastregt.
* Add 8548 CPU definition and attributesJustin Hibbits2019-11-126-15/+44
| | | | | | | | 8548 CPU is GCC's name for the e500v2, so accept this in clang. The e500v2 doesn't support lwsync, so define __NO_LWSYNC__ for this as well, as GCC does. Differential Revision: https://reviews.llvm.org/D67787
* Don't assume that the clang binary's resolved name includes the stringRichard Smith2019-11-121-1/+1
| | | | | | 'clang'. This is not true in practice in some content-addressed file systems.
* [Sema] Add MacroQualified case for FunctionTypeUnwrapperLeonard Chan2019-11-122-1/+12
| | | | | | | | | | | | | | | | | | This is a fix for PR43315. An assertion error is hit for this minimal example: ``` //clang -cc1 -triple x86_64-- -S tstVMStructRC-min.cpp int (a b)(); // Assertion `Chunk.Kind == DeclaratorChunk::Function' failed. ``` This is because we do not cover the case in the FunctionTypeUnwrapper where it receives a MacroQualifiedType. We have not run into this earlier because this is a unique case where the __attribute__ contains both __cdecl__ and __regparm__ (in that order), and we are compiling for x86_64. Changing the architecture or the order of __cdecl__ and __regparm__ does not raise the assertion. Differential Revision: https://reviews.llvm.org/D67992
* Add -Wtautological-compare to -WallWeverything2019-11-125-0/+99
| | | | | | | | Some warnings in -Wtautological-compare subgroups are DefaultIgnore. Adding this group to -Wmost, which is part of -Wall, will aid in their discoverability. Differential Revision: https://reviews.llvm.org/D69292
* Allow additional file suffixes/extensions considered as source in main ↵mydeveloperday2019-11-1210-7/+127
| | | | | | | | | | | | | | | | | | | | | include grouping Summary: By additional regex match, grouping of main include can be enabled in files that are not normally considered as a C/C++ source code. For example, this might be useful in templated code, where template implementations are being held in *Impl.hpp files. On the occassion, 'assume-filename' option description was reworded as it was misleading. It has nothing to do with `style=file` option and it does not influence sourced style filename. Reviewers: rsmith, ioeric, krasimir, sylvestre.ledru, MyDeveloperDay Reviewed By: MyDeveloperDay Subscribers: MyDeveloperDay, cfe-commits Patch by: furdyna Tags: #clang Differential Revision: https://reviews.llvm.org/D67750
* [Analyzer] Use a reference in a range-based forMark de Wever2019-11-122-12/+12
| | | | | | | | | Let the checkers use a reference instead of a copy in a range-based for loop. This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D70047
* [OpenMP] Use an explicit copy in a range-based forMark de Wever2019-11-121-7/+7
| | | | | | | | | | The std::pair<const clang::ValueDecl *, llvm::ArrayRef<clang::OMPClauseMappableExprCommon::MappableComponent>> type will be copied in a range-based for loop. Make the copy explicit to avoid the -Wrange-loop-analysis warning. This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D70046
* [AST] Use an explicit copy in a range-based forMark de Wever2019-11-128-8/+8
| | | | | | | | | The AssociationIteratorTy type will be copied in a range-based for loop. Make the copy explicit to avoid the -Wrange-loop-analysis warning. This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D70045
* [OPENMP]Use copy constructors instead of assignment operators in declareAlexey Bataev2019-11-125-22/+48
| | | | | | | reduction initializers. Better to use copy constructor at the initialization of the declare reduction construct rather than assignment operator.
* clang/Modules: Error if ReadASTBlock does not find the main moduleDuncan P. N. Exon Smith2019-11-123-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | If ReadASTBlock does not find its top-level submodule, there's something wrong the with the PCM. Error in that case, to avoid hitting problems further from the source. Note that the Swift compiler sometimes hits a case in CompilerInstance::loadModule where the top-level submodule mysteriously does not have Module::IsFromModuleFile set. That will emit a confusing warn_missing_submodule, which was never intended for the main module. The recent audit of error-handling in ReadAST may have rooted out the real problem. If not, this commit will help to clarify the real problem, and replace a confusing warning with an error pointing at the malformed PCM file. We're specifically sniffing out whether the top-level submodule was found/processed, in case there is a malformed module file that is missing it. If there is an error encountered during ReadSubmoduleBlock the return status should already propagate through. It would be nice to detect other missing submodules around here to catch other instances of warn_missing_submodule closer to the source, but that's left as a future exercise. https://reviews.llvm.org/D70063
* AArch64: add arm64_32 support to Clang.Tim Northover2019-11-1224-30/+372
|
* [clang-format] [PR36294] AlwaysBreakAfterReturnType works incorrectly for ↵mydeveloperday2019-11-122-7/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | some operator functions Summary: https://bugs.llvm.org/show_bug.cgi?id=36294 Addressing bug related to returning after return type not being honoured for some operator types. ``` $ bin/clang-format --style="{BasedOnStyle: llvm, AlwaysBreakAfterReturnType: TopLevelDefinitions}" /tmp/foo.cpp class Foo { public: bool operator!() const; bool operator<(Foo const &) const; bool operator*() const; bool operator->() const; bool operator+() const; bool operator-() const; bool f() const; }; bool Foo::operator!() const { return true; } bool Foo::operator<(Foo const &) const { return true; } bool Foo::operator*() const { return true; } bool Foo::operator->() const { return true; } bool Foo::operator+() const { return true; } bool Foo::operator-() const { return true; } bool Foo::f() const { return true; } ``` Reviewers: mitchell-stellar, klimek, owenpan, sammccall, rianquinn Reviewed By: sammccall Subscribers: merge_guards_bot, cfe-commits Tags: #clang-format, #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D69573
* clang/Modules: Clean up modules on error in ReadASTDuncan P. N. Exon Smith2019-11-111-14/+18
| | | | | | | | ReadASTBlock and ReadASTExtensions can both return failures. Be consistent and remove all the just-loaded modules, just like when ReadASTCore returns failures. https://reviews.llvm.org/D70055
* clang/Modules: Add missing diagnostics for malformed AST filesDuncan P. N. Exon Smith2019-11-111-2/+6
| | | | | | | These were found via an audit. In the case of `ParseLineTable` this is actually dead code, since parsing the line table always succeeds, but it's prudent to be defensive since it's possible an assertion there could be converted to a `true` return in the future.
* clang/Modules: Split loop in ReadAST between failable and notDuncan P. N. Exon Smith2019-11-111-1/+7
| | | | | | | | | | | | | Split a loop in ReadAST that visits the just-loaded module chain, between an initial loop that reads further from the ASTs (and can fail) and a second loop that does some preloading (and cannot fail). This makes it less likely for a reading failure to affect the AST. This is not fixing a known bug and the behaviour change may not be observable, it's just part of an audit to look at all of the error handling in the ASTReader. https://reviews.llvm.org/D70056
* clang/Modules: Use range-based for in ASTReader::ReadAST, NFCDuncan P. N. Exon Smith2019-11-111-11/+7
|
* clang/Modules: Delay err_module_file_conflict if a diagnostic is in flightDuncan P. N. Exon Smith2019-11-114-14/+19
| | | | | | | As part of an audit of whether all errors are being reported from the ASTReader, delay err_module_file_conflict if a diagnostic is already in flight when it is hit. This required plumbing an extra argument through the delayed diagnostic mechanics in DiagnosticsEngine.
* clang-format: fix a typo introduced by the previous changeSylvestre Ledru2019-11-111-1/+1
|
* [OPENMP50]Generalize handling of context matching/scoring.Alexey Bataev2019-11-1110-168/+335
| | | | | | | | | | | | | | Summary: Untie context matching/scoring from the attribute for declare variant directive to simplify future uses in other context-dependent directives. Reviewers: jdoerfert Subscribers: guansong, kkwli0, caomhin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69952
* [OPENMP50]Add support for nested atomic and simd constructs inAlexey Bataev2019-11-113-169/+180
| | | | | | | | simd-based directives. According to OpenMP 5.0 standard, ordered simd, atomic and simd directives are allowed as nested directives in the simd-based directives.
* [libTooling] Further simplify `Stencil` type and introduce `MatchComputation`.Yitzhak Mandelbaum2019-11-117-106/+105
| | | | | | | | | | | | | | | | | | | | Summary: This revision introduces a new interface `MatchComputation` which generalizes the `Stencil` interface and replaces the `std::function` interface of `MatchConsumer`. With this revision, `Stencil` (as an abstraction) becomes just one collection of implementations of `MatchComputation<std::string>`. Correspondingly, we remove the `Stencil` class entirely in favor of a simple type alias, deprecate `MatchConsumer` and change all functions that accepted `MatchConsumer<std::string>` to use `MatchComputation<std::string>` instead. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69802
* [Format] Fix clang-format.el unit tests after commit f349cc37cc485fd5fSam McCall2019-11-111-1/+3
| | | | | | Also add a comment that test is not automatically run, and how to run it. Patch by Philipp Stephani!
* clang-format: [JS] test declared fields.Martin Probst2019-11-111-0/+7
| | | | | | | | | | | | | | | | | | | | Summary: TypeScript now supports declaring fields: class Foo { declare field: string; } clang-format happens to already format this fine, so this change just adds a regression test. Reviewers: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69972
* clang-format: [JS] support null operators.Martin Probst2019-11-113-0/+24
| | | | | | | | | | | | | | | | | | | Summary: JavaScript / TypeScript is adding two new operators: the null propagating operator `?.` and the nullish coalescing operator `??`. const x = foo ?? 'default'; const z = foo?.bar?.baz; This change adds support to lex and format both. Reviewers: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69971
* Revert cdcf58e5af0 "[RISCV] enable LTO support, pass some options to linker."Hans Wennborg2019-11-116-154/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This started passing target-features on the linker line, not just for RISCV but for all targets, leading to error messages in Chromium Android build: '+soft-float-abi' is not a recognized feature for this target (ignoring feature) '+soft-float-abi' is not a recognized feature for this target (ignoring feature) See Phabricator review for details. Reverting until this can be fixed properly. > Summary: > 1. enable LTO need to pass target feature and abi to LTO code generation > RISCV backend need the target feature to decide which extension used in > code generation. > 2. move getTargetFeatures to CommonArgs.h and add ForLTOPlugin flag > 3. add general tools::getTargetABI in CommonArgs.h because different target uses different > way to get the target ABI. > > Patch by Kuan Hsu Chen (khchen) > > Reviewers: lenary, lewis-revill, asb, MaskRay > > Reviewed By: lenary > > Subscribers: hiraditya, dschuff, aheejin, fedor.sergeev, mehdi_amini, inglorion, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, cfe-commits > > Tags: #clang > > Differential Revision: https://reviews.llvm.org/D67409
* clang/Modules: Remove unused parameter from ModuleManager::removeModulesDuncan P. N. Exon Smith2019-11-103-12/+3
| | | | | | The other paremeters appear to be sufficient to determine which modules have just been loaded and need to be removed, so stop collecting and sending in that set explicitly.
* [Driver] Remove unused variable. NFC.Benjamin Kramer2019-11-101-1/+0
|
* Fix variable ‘LookedUpGetterSetter’ set but not used warning. NFCI.Simon Pilgrim2019-11-091-2/+0
|
* Fixed dia fileDávid Bolvanský2019-11-092-1/+1
|
OpenPOWER on IntegriCloud