summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Drop the logic for collapsing the state if it's same as in preds.Artem Dergachev2019-10-181-10/+1
| | | | | | | | | | One of the first attempts to reduce the size of the exploded graph dumps was to skip the state dump as long as the state is the same as in all of the predecessor nodes. With all the new facilities in place (node joining, diff dumps), this feature doesn't do much, and when it does, it's more harmful than useful. Let's remove it. llvm-svn: 375280
* [analyzer] Fix hidden node traversal in exploded graph dumps.Artem Dergachev2019-10-181-11/+5
| | | | | | | | | The joined nodes now actually have the same state. That was intended from the start but the original implementation turned out to be buggy. Differential Revision: https://reviews.llvm.org/D69150 llvm-svn: 375278
* [Format] Add format check for throwing negative numbersBrian Gesiak2019-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The code `throw -1;` is currently formatted by clang-format as `throw - 1;`. This diff adds a fix for this edge case and a test to check for this in the future. For context, I am looking into a related bug in the clang-formatting of coroutine keywords: `co_yield -1;` is also reformatted in this manner as `co_yield - 1;`. A later diff will add these changes and tests for the `co_yield` and `co_return` keywords. Patch by Jonathan Thomas (jonathoma)! Reviewers: modocache, sammccall, Quuxplusone Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D69144 llvm-svn: 375258
* [OPENMP50]Add support for master taskloop simd.Alexey Bataev2019-10-1815-13/+212
| | | | | | Added trsing/semantics/codegen for combined construct master taskloop simd. llvm-svn: 375255
* [clang-format] fix regression recognizing casts in Obj-C callsKrasimir Georgiev2019-10-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: r373922 added checks for a few tokens that, following an `)` make it unlikely that the `)` is the closing paren of a cast expression. The specific check for `tok::l_square` there introduced a regression for casts of Obj-C calls, like: ``` (cast)[func arg] ``` From the tests added in r373922, I believe the `tok::l_square` case is added to capture the case where a non-cast `)` is directly followed by an attribute specifier, like: ``` int f(int x) [[noreturn]]; ``` I've specialized the code to look for such attribute specifier instead of `tok::l_square` in general. Also, I added a regression test and moved the test cases added in r373922 to an already existing place documenting other instances of historically misidentified casts. Reviewers: MyDeveloperDay Reviewed By: MyDeveloperDay Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69164 llvm-svn: 375247
* [tooling] Relax an assert when multiple GPU targets are specified.Michael Liao2019-10-181-1/+1
| | | | llvm-svn: 375245
* [ThinLTOCodeGenerator] Add support for index-based WPDEugene Leviant2019-10-181-7/+1
| | | | | | | | | This is clang part of the patch. It adds -flto-unit flag for thin LTO builds on Mac and PS4 Differential revision: https://reviews.llvm.org/D68950 llvm-svn: 375224
* [WebAssembly] -pthread implies -target-feature +sign-extThomas Lively2019-10-181-1/+8
| | | | | | | | | | | | | | | | | Summary: The sign extension proposal was motivated by a desire to not have separate sign-extending atomic operations, so it is meant to be enabled when threads are used. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69075 llvm-svn: 375199
* [analyzer] Assign truly stable identifiers to exploded nodes.Artem Dergachev2019-10-173-21/+14
| | | | | | | | | | | ExplodedGraph nodes will now have a numeric identifier stored in them which will keep track of the order in which the nodes were created and it will be fully deterministic both accross runs and across machines. This is extremely useful for debugging as it allows reliably setting conditional breakpoints by node IDs. llvm-svn: 375186
* [analyzer] Display cast kinds in program point dumps.Artem Dergachev2019-10-171-1/+5
| | | | | | | Because cast expressions have their own hierarchy, it's extremely useful to have some information about what kind of casts are we dealing with. llvm-svn: 375185
* [OPENMP]Dow not emit warnings for uninitialized loop counters.Alexey Bataev2019-10-171-1/+2
| | | | | | | In OpenMP constructs all counters are initialized and we should not emit warnings about uninitialized privatized loop control variables. llvm-svn: 375167
* [OPENMP]Improve use of the global tid parameter.Alexey Bataev2019-10-171-9/+14
| | | | | | | | If we can determined, that the global tid parameter can be used in the function, better to use it rather than calling __kmpc_global_thread_num function. llvm-svn: 375134
* [ObjC] Diagnose implicit type coercion from ObjC 'Class' to objectJames Y Knight2019-10-172-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pointer types. For example, in Objective-C mode, the initialization of 'x' in: ``` @implementation MyType + (void)someClassMethod { MyType *x = self; } @end ``` is correctly diagnosed with an incompatible-pointer-types warning, but in Objective-C++ mode, it is not diagnosed at all -- even though incompatible pointer conversions generally become an error in C++. This patch fixes that oversight, allowing implicit conversions involving Class only to/from unqualified-id, and between qualified and unqualified Class, where the protocols are compatible. Note that this does change some behaviors in Objective-C, as well, as shown by the modified tests. Of particular note is that assignment from from 'Class<MyProtocol>' to 'id<MyProtocol>' now warns. (Despite appearances, those are not compatible types. 'Class<MyProtocol>' is not expected to have instance methods defined by 'MyProtocol', while 'id<MyProtocol>' is.) Differential Revision: https://reviews.llvm.org/D67983 llvm-svn: 375125
* [OPENMP]Fix thread id passed to outlined region in sequential parallelAlexey Bataev2019-10-171-5/+3
| | | | | | | | | regions. The real global thread id must be passed to the outlined region instead of the zero thread id. llvm-svn: 375119
* [OpenCL] Preserve addrspace in CGClass (PR43145)Sven van Haastregt2019-10-171-2/+5
| | | | | | | | | | PR43145 revealed two places where Clang was attempting to create a bitcast without considering the address space of class types during C++ class code generation. Differential Revision: https://reviews.llvm.org/D68403 llvm-svn: 375118
* Include leading attributes in DeclStmt's SourceRangeStephan Bergmann2019-10-171-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D68581 llvm-svn: 375104
* SemaExprCXX - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-171-3/+3
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 375101
* SemaDeclObjC - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-171-3/+3
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 375097
* Reland: Dead Virtual Function EliminationOliver Stannard2019-10-176-45/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove dead virtual functions from vtables with replaceNonMetadataUsesWith, so that CGProfile metadata gets cleaned up correctly. Original commit message: Currently, it is hard for the compiler to remove unused C++ virtual functions, because they are all referenced from vtables, which are referenced by constructors. This means that if the constructor is called from any live code, then we keep every virtual function in the final link, even if there are no call sites which can use it. This patch allows unused virtual functions to be removed during LTO (and regular compilation in limited circumstances) by using type metadata to match virtual function call sites to the vtable slots they might load from. This information can then be used in the global dead code elimination pass instead of the references from vtables to virtual functions, to more accurately determine which functions are reachable. To make this transformation safe, I have changed clang's code-generation to always load virtual function pointers using the llvm.type.checked.load intrinsic, instead of regular load instructions. I originally tried writing this using clang's existing code-generation, which uses the llvm.type.test and llvm.assume intrinsics after doing a normal load. However, it is possible for optimisations to obscure the relationship between the GEP, load and llvm.type.test, causing GlobalDCE to fail to find virtual function call sites. The existing linkage and visibility types don't accurately describe the scope in which a virtual call could be made which uses a given vtable. This is wider than the visibility of the type itself, because a virtual function call could be made using a more-visible base class. I've added a new !vcall_visibility metadata type to represent this, described in TypeMetadata.rst. The internalization pass and libLTO have been updated to change this metadata when linking is performed. This doesn't currently work with ThinLTO, because it needs to see every call to llvm.type.checked.load in the linkage unit. It might be possible to extend this optimisation to be able to use the ThinLTO summary, as was done for devirtualization, but until then that combination is rejected in the clang driver. To test this, I've written a fuzzer which generates random C++ programs with complex class inheritance graphs, and virtual functions called through object and function pointers of different types. The programs are spread across multiple translation units and DSOs to test the different visibility restrictions. I've also tried doing bootstrap builds of LLVM to test this. This isn't ideal, because only classes in anonymous namespaces can be optimised with -fvisibility=default, and some parts of LLVM (plugins and bugpoint) do not work correctly with -fvisibility=hidden. However, there are only 12 test failures when building with -fvisibility=hidden (and an unmodified compiler), and this change does not cause any new failures for either value of -fvisibility. On the 7 C++ sub-benchmarks of SPEC2006, this gives a geomean code-size reduction of ~6%, over a baseline compiled with "-O2 -flto -fvisibility=hidden -fwhole-program-vtables". The best cases are reductions of ~14% in 450.soplex and 483.xalancbmk, and there are no code size increases. I've also run this on a set of 8 mbed-os examples compiled for Armv7M, which show a geomean size reduction of ~3%, again with no size increases. I had hoped that this would have no effect on performance, which would allow it to awlays be enabled (when using -fwhole-program-vtables). However, the changes in clang to use the llvm.type.checked.load intrinsic are causing ~1% performance regression in the C++ parts of SPEC2006. It should be possible to recover some of this perf loss by teaching optimisations about the llvm.type.checked.load intrinsic, which would make it worth turning this on by default (though it's still dependent on -fwhole-program-vtables). Differential revision: https://reviews.llvm.org/D63932 llvm-svn: 375094
* Revert "Include sanitize blacklist and other extra deps as part of scan-deps ↵Kousik Kumar2019-10-171-2/+0
| | | | | | | | | | | | | | | | | | output" This test is failing on Windows bots, revert for now (will check the right fix and retry the patch). Summary: This reverts commit 962ca076e51c25a7a08f4e0d329c65328a635bdb. Reviewers: Bigcheese, jkorous, arphaman Subscribers: dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69079 llvm-svn: 375079
* Include sanitize blacklist and other extra deps as part of scan-deps outputKousik Kumar2019-10-171-0/+2
| | | | | | | | | | | | | | | | | Summary: Clang's -M mode includes these extra dependencies in its output and clang-scan-deps should have equivalent behavior, so adding these extradeps to output just like how its being done for ".d" file generation mode. Reviewers: arphaman, dexonsmith, Bigcheese, jkorous Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69017 llvm-svn: 375074
* Revert Tag CFI-generated data structures with "#pragma clang section" ↵Dmitry Mikulin2019-10-174-49/+5
| | | | | | | | attributes. This reverts r375022 (git commit e2692b3bc0327606748b6d291b9009d2c845ced5) llvm-svn: 375069
* [Concepts] ConceptSpecializationExprs manglingSaar Raz2019-10-172-4/+15
| | | | | | | | | Implement mangling for CSEs to match regular template-ids. Reviewed as part of D41569 <https://reviews.llvm.org/D41569>. Re-commit fixing failing test. llvm-svn: 375063
* Replace platform-dependent `stat` with `llvm::sys::fs::status`. NFC intended.Volodymyr Sapsai2019-10-161-8/+7
| | | | | | | | | | | | Reviewers: bruno, sammccall Reviewed By: sammccall Subscribers: jkorous, dexonsmith, arphaman, ributzka, cfe-commits Differential Revision: https://reviews.llvm.org/D69011 llvm-svn: 375031
* [OPENMP]Allow priority clause in combined task-based directives.Alexey Bataev2019-10-165-14/+21
| | | | | | | The expression of the priority clause must be captured in the combined task-based directives, like 'parallel master taskloop' directive. llvm-svn: 375026
* Tag CFI-generated data structures with "#pragma clang section" attributes.Dmitry Mikulin2019-10-164-5/+49
| | | | | | Differential Revision: https://reviews.llvm.org/D68808 llvm-svn: 375022
* [OPENMP]Use different addresses for zeroed thread_id/bound_id.Alexey Bataev2019-10-162-19/+26
| | | | | | | | When the parallel region is called directly in the sequential region, the zeroed tid/bound id are used. But they must point to the different memory locations as the parameters are marked as noalias. llvm-svn: 375017
* [DWARF5] Added support for DW_AT_noreturn attribute to be emitted forAdrian Prantl2019-10-161-0/+2
| | | | | | | | | | C++ class member functions. Patch by Sourabh Singh Tomar! Differential Revision: https://reviews.llvm.org/D68697 llvm-svn: 375012
* [Driver,ARM] Make -mfloat-abi=soft turn off MVE.Simon Tatham2019-10-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since `-mfloat-abi=soft` is taken to mean turning off all uses of the FP registers, it should turn off the MVE vector instructions as well as NEON and scalar FP. But it wasn't doing so. So the options `-march=armv8.1-m.main+mve.fp+fp.dp -mfloat-abi=soft` would cause the underlying LLVM to //not// support MVE (because it knows the real target feature relationships and turned off MVE when the `fpregs` feature was removed), but the clang layer still thought it //was// supported, and would misleadingly define the feature macro `__ARM_FEATURE_MVE`. The ARM driver code already has a long list of feature names to turn off when `-mfloat-abi=soft` is selected. The fix is to add the missing entries `mve` and `mve.fp` to that list. Reviewers: dmgreen Subscribers: kristof.beyls, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69025 llvm-svn: 375001
* RewriteModernObjC - silence static analyzer getAs<> null dereference ↵Simon Pilgrim2019-10-161-5/+4
| | | | | | | | warnings. NFCI. The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 374991
* CGDebugInfo - silence static analyzer dyn_cast<> null dereference warnings. ↵Simon Pilgrim2019-10-161-4/+5
| | | | | | | | NFCI. The static analyzer is warning about potential null dereferences, but in these cases we should be able to use cast<> directly and if not assert will fire for us. llvm-svn: 374989
* CGExprConstant - silence static analyzer getAs<> null dereference warning. NFCI.Simon Pilgrim2019-10-161-2/+2
| | | | | | The static analyzer is warning about a potential null dereference, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 374988
* CGBuiltin - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-161-5/+4
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 374987
* Revert 374967 "[Concepts] ConceptSpecializationExprs mangling"Nico Weber2019-10-162-15/+4
| | | | | | | | | | | | | | | This reverts commit 5e34ad109ced8dbdea9500ee28180315b2aeba3d. The mangling test fails on Windows: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15944 It also fails on ppc64le: http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/21092 Also revert follow-up 374971 "Fix failing mangle-concept.cpp test." (it did not help on Win/ppc64le). llvm-svn: 374985
* [Concepts] ConceptSpecializationExprs manglingSaar Raz2019-10-162-4/+15
| | | | | | | Implement mangling for CSEs to match regular template-ids. Reviewed as part of D41569. llvm-svn: 374967
* [libTooling] Put all Transformer declarations in a single namespace.Yitzhak Mandelbaum2019-10-164-59/+63
| | | | | | | | | | | | | | | | Summary: This revision introduces a new namespace, `clang::transformer`, to hold the declarations for the Transformer library. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68876 llvm-svn: 374962
* PR43674: fix incorrect constant evaluation of 'switch' where no caseRichard Smith2019-10-151-1/+1
| | | | | | label corresponds to the condition. llvm-svn: 374954
* [OPENMP]Allow final clause in combined task-based directives.Alexey Bataev2019-10-155-4/+31
| | | | | | | The condition of the final clause must be captured in the combined task-based directives, like 'parallel master taskloop' directive. llvm-svn: 374942
* [Concept] Associated Constraints InfrastructureSaar Raz2019-10-159-86/+106
| | | | | | | Add code to correctly calculate the associated constraints of a template (no enforcement yet). D41284 on Phabricator. llvm-svn: 374938
* [Clang][OpenMP Offload] Move offload registration code to the wrapperSergey Dmitriev2019-10-154-218/+10
| | | | | | | | | | The final list of OpenMP offload targets becomes known only at the link time and since offload registration code depends on the targets list it makes sense to delay offload registration code generation to the link time instead of adding it to the host part of every fat object. This patch moves offload registration code generation from clang to the offload wrapper tool. This is the last part of the OpenMP linker script elimination patch https://reviews.llvm.org/D64943 Differential Revision: https://reviews.llvm.org/D68746 llvm-svn: 374937
* Added support for "#pragma clang section relro=<name>"Dmitry Mikulin2019-10-155-1/+16
| | | | | | Differential Revision: https://reviews.llvm.org/D68806 llvm-svn: 374934
* Reland [Driver] Fix -working-directory issuesJan Korous2019-10-152-33/+24
| | | | | | | | Don't change the default VFS in Driver, update tests & reland. This reverts commit 999f8a7416f8edc54ef92e715fd23c532bcc74d4. llvm-svn: 374926
* Add more information to JSON AST dumping of source locations.Aaron Ballman2019-10-151-0/+24
| | | | | | This adds information about the offset within the source file to the given source location as well as information about the include file a location is from. These pieces of information allow for more efficient post-processing of JSON AST dumps. llvm-svn: 374921
* CFI: wrong type passed to llvm.type.test with multiple inheritance ↵Dmitry Mikulin2019-10-151-1/+1
| | | | | | | | devirtualization. Differential Revision: https://reviews.llvm.org/D67985 llvm-svn: 374909
* [Concepts] Remove unused and illegal Sema includes from ExprCXX.cppSaar Raz2019-10-151-4/+1
| | | | | | Fixing accidental includes introduced in 374903 llvm-svn: 374907
* [Concepts] Concept Specialization ExpressionsSaar Raz2019-10-1519-33/+425
| | | | | | | | | | Part of C++20 Concepts implementation effort. Added Concept Specialization Expressions that are created when a concept is refe$ D41217 on Phabricator. (recommit after fixing failing Parser test on windows) llvm-svn: 374903
* Revert 374882 "[Concepts] Concept Specialization Expressions"Nico Weber2019-10-1519-422/+33
| | | | | | | | | | This reverts commit ec87b003823d63f3342cf648f55a134c1522e612. The test fails on Windows, see e.g. http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/11533/steps/stage%201%20check/logs/stdio Also revert follow-up r374893. llvm-svn: 374899
* Reapply: [Modules][PCH] Hash input files contentBruno Cardoso Lopes2019-10-155-23/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When files often get touched during builds, the mtime based validation leads to different problems in implicit modules builds, even when the content doesn't actually change: - Modules only: module invalidation due to out of date files. Usually causing rebuild traffic. - Modules + PCH: build failures because clang cannot rebuild a module if it comes from building a PCH. - PCH: build failures because clang cannot rebuild a PCH in case one of the input headers has different mtime. This patch proposes hashing the content of input files (headers and module maps), which is performed during serialization time. When looking at input files for validation, clang only computes the hash in case there's a mtime mismatch. I've tested a couple of different hash algorithms availble in LLVM in face of building modules+pch for `#import <Cocoa/Cocoa.h>`: - `hash_code`: performace diff within the noise, total module cache increased by 0.07%. - `SHA1`: 5% slowdown. Haven't done real size measurements, but it'd be BLOCK_ID+20 bytes per input file, instead of BLOCK_ID+8 bytes from `hash_code`. - `MD5`: 3% slowdown. Like above, but BLOCK_ID+16 bytes per input file. Given the numbers above, the patch uses `hash_code`. The patch also improves invalidation error msgs to point out which type of problem the user is facing: "mtime", "size" or "content". rdar://problem/29320105 Reviewers: dexonsmith, arphaman, rsmith, aprantl Subscribers: jkorous, cfe-commits, ributzka Tags: #clang Differential Revision: https://reviews.llvm.org/D67249 > llvm-svn: 374841 llvm-svn: 374895
* [AST] Remove unused Sema includes to fix a cyclic dependency from Sema to ASTBenjamin Kramer2019-10-151-4/+1
| | | | llvm-svn: 374893
* [Alignment] Migrate Attribute::getWith(Stack)AlignmentGuillaume Chatelet2019-10-151-2/+2
| | | | | | | | | | | | | | | | | | | Summary: This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet, jdoerfert Reviewed By: courbet Subscribers: arsenm, jvesely, nhaehnle, hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D68792 llvm-svn: 374884
OpenPOWER on IntegriCloud