summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* [Coverage] Use the new getInstrProfSectionName API (NFC)Vedant Kumar2017-04-151-1/+3
| | | | llvm-svn: 300382
* Modules: Do not serialize #pragma pack stateDuncan P. N. Exon Smith2017-04-156-59/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The modules side of r299226, which serializes #pragma pack state, doesn't work well. The main purpose was to make -include and -include-pch match semantics (the PCH side). We also started serializing #pragma pack in PCMs, in the hopes of making modules and non-modules builds more consistent. But consider: $ cat a.h $ cat b.h #pragma pack(push, 2) $ cat module.modulemap module M { module a { header "a.h" } module b { header "b.h" } } $ cat t.cpp #include "a.h" #pragma pack(show) As of r299226, the #pragma pack(show) gives "2", even though we've only included "a.h". - With -fmodules-local-submodule-visibility, this is clearly wrong. We should get the default state (8 on x86_64). - Without -fmodules-local-submodule-visibility, this kind of matches how other things work (as if include-the-whole-module), but it's still really terrible, and it doesn't actually make modules and non-modules builds more consistent. This commit disables the serialization for modules, essentially a partial revert of r299226. Going forward: 1. Having this #pragma pack stuff escape is terrible design (or, more often, a horrible bug). We should prioritize adding warnings (maybe -Werror by default?). 2. If we eventually reintroduce this for modules, it should only apply to -fmodules-local-submodule-visibility, and it should be tracked on a per-submodule basis. llvm-svn: 300380
* [ubsan] Don't check alignment if the alignment is 1Vedant Kumar2017-04-143-4/+20
| | | | | | | | | | | | | | If a pointer is 1-byte aligned, there's no use in checking its alignment. Somewhat surprisingly, ubsan can spend a significant amount of time doing just that! This loosely depends on D30283. Testing: check-clang, check-ubsan, and a stage2 ubsan build. Differential Revision: https://reviews.llvm.org/D30285 llvm-svn: 300371
* [ubsan] Reduce alignment checking of C++ object pointersVedant Kumar2017-04-148-206/+277
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch teaches ubsan to insert an alignment check for the 'this' pointer at the start of each method/lambda. This allows clang to emit significantly fewer alignment checks overall, because if 'this' is aligned, so are its fields. This is essentially the same thing r295515 does, but for the alignment check instead of the null check. One difference is that we keep the alignment checks on member expressions where the base is a DeclRefExpr. There's an opportunity to diagnose unaligned accesses in this situation (as pointed out by Eli, see PR32630). Testing: check-clang, check-ubsan, and a stage2 ubsan build. Along with the patch from D30285, this roughly halves the amount of alignment checks we emit when compiling X86FastISel.cpp. Here are the numbers from patched/unpatched clangs based on r298160. ------------------------------------------ | Setup | # of alignment checks | ------------------------------------------ | unpatched, -O0 | 24326 | | patched, -O0 | 12717 | (-47.7%) ------------------------------------------ Differential Revision: https://reviews.llvm.org/D30283 llvm-svn: 300370
* Removing a redundant, but harmless, %s; NFC.Aaron Ballman2017-04-141-1/+1
| | | | llvm-svn: 300347
* [ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt ↵Kuba Mracek2017-04-144-14/+13
| | | | | | | | | | [take 2] CodeGenFunction::EmitObjCForCollectionStmt currently emits lifetime markers for the loop variable in an inconsistent way: lifetime.start is emitted before the loop is entered, but lifetime.end is emitted inside the loop. AddressSanitizer uses these markers to track out-of-scope accesses to local variables, and we get false positives in Obj-C foreach loops (in the 2nd iteration of the loop). This patch keeps the loop variable alive for the whole loop by extending ForScope and registering the cleanup function inside EmitAutoVarAlloca. Differential Revision: https://reviews.llvm.org/D32029 llvm-svn: 300340
* Make Gentoo GNU GCC Config override whitespace tolerantErich Keane2017-04-141-0/+1
| | | | | | | | | | | The config-*triple* file handling isn't tolerant of leading/trailing whitespace, making it not terribly obvious when a single extraneous tab/space/etc will cause the override to be ignored. This patch simply trims the lines to ensure that it is tolerant of whitespace. llvm-svn: 300328
* [X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (clang)Simon Pilgrim2017-04-147-9/+6
| | | | | | | | | | MOVNTDQA non-temporal aligned vector loads can be correctly represented using generic builtin loads, allowing us to remove the existing x86 intrinsics. LLVM companion patch: D31767. Differential Revision: https://reviews.llvm.org/D31766 llvm-svn: 300326
* PR32280: Do not crash on nested initializers.Vassil Vassilev2017-04-142-8/+27
| | | | | | Patch by Yuka Takahashi (D31591)! llvm-svn: 300313
* [AMDGPU][GFX9] Set +fp32-denormals for >=gfx900 unless -cl-denorms-are-zero ↵Konstantin Zhuravlyov2017-04-142-3/+19
| | | | | | | | is set Differential Revision: https://reviews.llvm.org/D31482 llvm-svn: 300306
* Fix use after free errorXinliang David Li2017-04-141-1/+1
| | | | llvm-svn: 300304
* clang/test/CoverageMapping/unused_names.c: Relax an expression for targeting ↵NAKAMURA Takumi2017-04-141-1/+1
| | | | | | PECOFF. llvm-svn: 300303
* Remove unused function /nfcXinliang David Li2017-04-141-4/+0
| | | | llvm-svn: 300301
* [docs] UBSan: Mention that print_stacktrace=1 is unsupported on DarwinVedant Kumar2017-04-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Printing out stack traces along with UBSan diagnostics is unsupported on Darwin. That's because it isn't possible to use the fast unwinder or the slow unwinder. Apparently, it's inappropriate to use the fast unwinder for UBSan issues. I'm not exactly sure why (see the comment in ubsan_diag.cc). Forcing use of the fast unwinder produces decent results, AFAICT. Darwin also does not appear to have a slow unwinder suitable for use with the sanitizers. Apparently that's because of PR20800 [1][2]. But that bug has been fixed. I'm not sure if there is anything preventing use of the slow unwinder now. Currently, passing UBSAN_OPTIONS=print_stacktrace=1 does nothing on Darwin. This isn't good, but it might be a while before we can fix the situation, so we should at least document it. [1] https://github.com/google/sanitizers/issues/137 "We can't use the slow unwinder on OSX now, because Clang produces incorrect unwind info for the ASan runtime functions on OSX (http://llvm.org/PR20800)." [2] https://bugs.llvm.org/show_bug.cgi?id=20800 Bug 20800 - Invalid compact unwind info generated for a function without frame pointers on OSX llvm-svn: 300295
* Revert r300287.Kuba Mracek2017-04-143-6/+9
| | | | llvm-svn: 300290
* [ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmtKuba Mracek2017-04-143-9/+6
| | | | | | | | CodeGenFunction::EmitObjCForCollectionStmt currently emits lifetime markers for the loop variable in an inconsistent way: lifetime.start is emitted before the loop is entered, but lifetime.end is emitted inside the loop. AddressSanitizer uses these markers to track out-of-scope accesses to local variables, and we get false positives in Obj-C foreach loops (in the 2nd iteration of the loop). The markers of the loop variable need to be either both inside the loop (so that we poison and unpoison the variable in each iteration), or both outside. This patch implements the "both inside" approach. Differential Revision: https://reviews.llvm.org/D32029 llvm-svn: 300287
* Fix PR31934: forming refs to functions with enable_if attrs.George Burgess IV2017-04-132-0/+40
| | | | llvm-svn: 300283
* [Profile] PE binary coverage bug fixXinliang David Li2017-04-131-1/+1
| | | | | | | | PR/32584 Differential Revision: https://reviews.llvm.org/D32023 llvm-svn: 300279
* [IR] Make getParamAttributes take argument numbers, not ArgNo+1Reid Kleckner2017-04-131-1/+1
| | | | | | | | | | | | Add hasParamAttribute() and use it instead of hasAttribute(ArgNo+1, Kind) everywhere. The fact that the AttributeList index for an argument is ArgNo+1 should be a hidden implementation detail. NFC llvm-svn: 300272
* [docs] Regenerate diagnostics reference.Richard Smith2017-04-131-2/+119
| | | | llvm-svn: 300271
* [docs] Fix a couple of typos in command line flag help text and regenerate ↵Richard Smith2017-04-132-15/+61
| | | | | | documentation. llvm-svn: 300270
* Add test for anonymous struct containing an implicitly private data member.Richard Smith2017-04-131-0/+3
| | | | | | Patch by Jacob Young! llvm-svn: 300266
* Diagnose attempt to take address of bitfield members in anonymous structs.Richard Smith2017-04-133-2/+10
| | | | | | | | Patch by Jacob Young! Differential Revision: https://reviews.llvm.org/D27263 llvm-svn: 300264
* PR32185: Revert r291512 and add a testcase for PR32185.Richard Smith2017-04-136-49/+83
| | | | | | | | | | | | | | | This reverts an attempt to check that types match when matching a dependently-typed non-type template parameter. (This comes up when matching the parameters of a template template parameter against the parameters of a template template argument.) The matching rules here are murky at best. Our behavior after this revert is definitely wrong for certain C++17 features (for 'auto' template parameter types within the parameter list of a template template argument in particular), but our behavior before this revert is wrong for some pre-existing testcases, so reverting to our prior behavior seems like our best option. llvm-svn: 300262
* [CMake] Support building Fuchsia toolchain on DarwinPetr Hosek2017-04-132-0/+10
| | | | | | | | | This is already supported on Linux but on Darwin it requires some extra flags. Differential Revision: https://reviews.llvm.org/D30958 llvm-svn: 300257
* clang-format-vs licence.txt: drop svn:executableHans Wennborg2017-04-131-0/+0
| | | | | | Not sure how it ended up with that property in the first place. llvm-svn: 300245
* Follow-up to r300225: update ClangFormat.csproj tooHans Wennborg2017-04-131-1/+1
| | | | llvm-svn: 300231
* Follow-up to r300225: update ClangFormat.sln to VS2017Hans Wennborg2017-04-131-2/+2
| | | | | | This got lost in the previous patch somehow. llvm-svn: 300226
* Warning-free clang-format plugin install for VS 15.0Hans Wennborg2017-04-133-81/+24
| | | | | | | | | | | | | | | | | | | | With the new release of VS, it's required that all plugins migrate to the new VSIX manifest format. The new format is backwards compatible with all versions newer that Visual Studio 2012, so this migration effectively drops support for older versions of the IDE. It's also required that these new extensions are built with Visual Studio 2017, so unfortunately it was necessary to migrate the project and solution. Also removed COM references to EnvDTE and Microsoft.VisualStudio.TextManager.Interop from the csproj, as they seem to both be unnecessary and would trigger build warnings because of changes to GAC. Patch by Hugo Puhlmann! Differential Revision: https://reviews.llvm.org/D31740 llvm-svn: 300225
* clang-format-vs: Use a separate license.txt copyHans Wennborg2017-04-133-7/+40
| | | | | | | The regular file used to display very poorly in the VSIX installer due to long lines, wrapping etc. llvm-svn: 300223
* Use the clang-cl recognized spelling of --target=Reid Kleckner2017-04-131-3/+3
| | | | | | This fixes a warning. The test was passing without this change. llvm-svn: 300214
* Re-land "[clang-cl] Make all sanitizer flags available in clang-cl"Reid Kleckner2017-04-132-24/+41
| | | | | | | | | | Adding RUN lines with %clang_cl was causing these tests to fail on Mac because absolute paths there tend to start with "/User/", which is recognized as the "/U" flag. Re-lands r300122 llvm-svn: 300209
* [analyzer] Enforce super-region classes for various memory regions.Artem Dergachev2017-04-138-93/+124
| | | | | | | | | | | | We now check the type of the super-region pointer for most SubRegion classes in compile time; some checks are run-time though. This is an API-breaking change (we now require explicit casts to specific region sub-classes), but in practice very few checkers are affected. Differential Revision: https://reviews.llvm.org/D26838 llvm-svn: 300189
* [analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.Artem Dergachev2017-04-136-119/+230
| | | | | | | | | | | | | | Clean up vtable anchors (remove anchors for regions that have regular out-of-line virtual methods, add anchors for regions that don't have those). Fix private/public methods (all constructors should now be private for leaf classes, protected for abstract classes). No functional change intended, only extra sanity checks and cleanups. Differential Revision: https://reviews.llvm.org/D26837 llvm-svn: 300187
* Revert "[clang-cl] Make all sanitizer flags available in clang-cl"Akira Hatanaka2017-04-132-41/+24
| | | | | | | | | | This reverts commit 47979b20b475664013d19382fc6875b5b9f3ed9d. This was causing a couple of bots to fail. http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/30152 llvm-svn: 300181
* [analyzer] Simplify values in binary operations a bit more aggressively.Artem Dergachev2017-04-133-5/+96
| | | | | | | | | | | | | | | | | SValBuilder tries to constant-fold symbols in the left-hand side of the symbolic expression whenever it fails to evaluate the expression directly. However, it only constant-folds them when they are atomic expressions, not when they are complicated expressions themselves. This patch adds recursive constant-folding to the left-hand side subexpression (there's a lack of symmetry because we're trying to have symbols on the left and constants on the right). As an example, we'd now be able to handle operations similar to "$x + 1 < $y", when $x is constrained to a constant. rdar://problem/31354676 Differential Revision: https://reviews.llvm.org/D31886 llvm-svn: 300178
* [IR] Take func, ret, and arg attrs separately in AttributeList::getReid Kleckner2017-04-131-12/+8
| | | | | | | | | | | | | This seems like a much more natural API, based on Derek Schuff's comments on r300015. It further hides the implementation detail of AttributeList that function attributes come last and appear at index ~0U, which is easy for the user to screw up. git diff says it saves code as well: 97 insertions(+), 137 deletions(-) This also makes it easier to change the implementation, which I want to do next. llvm-svn: 300153
* Fix broken test. We can't assume that 2MB of args is enough to require a ↵Richard Smith2017-04-131-3/+4
| | | | | | | | | response file. This test has apparently been broken for years, but we never noticed before because it's a long test and long tests approximately never get run. llvm-svn: 300151
* ExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]NAKAMURA Takumi2017-04-131-0/+1
| | | | llvm-svn: 300145
* Update to match LLVM r300135.Richard Smith2017-04-122-3/+2
| | | | | | Remove "REQUIRES: long_tests" from test/Driver/response-file.c since it is now about 10x faster. (We can add that back if it's still too slow for some buildbot.) llvm-svn: 300136
* [clang-cl] Make all sanitizer flags available in clang-clReid Kleckner2017-04-122-24/+41
| | | | | | | | | | | | | | | Summary: Use a tablegen let {} block so that new sanitizer flags are available by default in all driver modes. This should cut down on time wasted with bugs like http://crbug.com/710928. Reviewers: vitalybuka, hans Subscribers: kcc, llvm-commits Differential Revision: https://reviews.llvm.org/D31988 llvm-svn: 300122
* [Sema] Add __is_aggregate type-traitEric Fiselier2017-04-129-7/+138
| | | | | | | | | | | | | | | | Summary: [LWG 2911](http://cplusplus.github.io/LWG/lwg-defects.html#2911) adds `std::is_aggregate` to the library, which requires a new builtin trait. This patch implements `__is_aggregate`. Reviewers: rsmith, majnemer, aaron.ballman Reviewed By: aaron.ballman Subscribers: STL_MSFT, cfe-commits Differential Revision: https://reviews.llvm.org/D31513 llvm-svn: 300116
* [analyzer] Add a check for IvarRegion in getExtraInvalidatedValuesAlexander Shaposhnikov2017-04-122-5/+23
| | | | | | | | | | | | This diff adds a defensive check in getExtraInvalidatedValues for the case when there are no regions for the ivar associated with a property. Corresponding test case added. Test plan: make check-clang make check-clang-analysis llvm-svn: 300114
* [modules] Delay calling DeclMustBeEmitted until it's safe.Vassil Vassilev2017-04-123-31/+47
| | | | | | | | | | | | | This patch implements the suggestion in D29753 that calling DeclMustBeEmitted in the middle of deserialization should be avoided and that the actual check should be deferred until it's safe to do so. This patch fixes a crash when accessing the invalid redecl chains while trying to evaluate the value of a const VarDecl that contains a function call. Patch by Raphael Isemann (D30793)! llvm-svn: 300110
* [Driver] Add compiler option to generate a reproducerBruno Cardoso Lopes2017-04-127-13/+52
| | | | | | | | | | | | | | | | | | | | | One way to currently test the reproducers is to setup "FORCE_CLANG_DIAGNOSTICS_CRASH=1" before invoking clang. This simulates a crash and produces the same contents needed by the reproducers. The reproducers are specially useful when triaging Modules issues, not only on crashes, but also for reproducing misleading warnings, errors, etc. Add a '-gen-reproducer' driver option to clang (or any similar name) and give users a flag option. Note that clang already has a -fno-crash-diagnostics, which disables the crash reproducers. I've decided not to propose "-fcrash-diagnostics" since it doesn't convey the ideia of reproduction despite a crash. rdar://problem/24114619 Differential Revision: https://reviews.llvm.org/D27604 llvm-svn: 300109
* [Modules] Enable local submodule visibility for ObjC/CBruno Cardoso Lopes2017-04-122-6/+8
| | | | | | | | | | Remove the restriction where this is only valid with C++ rdar://problem/29055656 Differential Revision: https://reviews.llvm.org/D31781 llvm-svn: 300108
* Modular Codegen: Include testing for inline asm as well as some commentary ↵David Blaikie2017-04-122-0/+16
| | | | | | on the implementaiton choice. llvm-svn: 300106
* Fix up test to handle the now split -fmodules-codegen and ↵David Blaikie2017-04-121-2/+2
| | | | | | -fmodules-debuginfo flags llvm-svn: 300105
* Modular Codegen: Separate flags for function and debug info supportDavid Blaikie2017-04-1211-14/+53
| | | | | | | | | | This allows using and testing these two features separately. (noteably, debug info is, so far as I know, always a win (basically). But function modular codegen is currently a loss for highly optimized code - where most of the linkonce_odr definitions are optimized away, so providing weak_odr definitions is only overhead) llvm-svn: 300104
* Revert r300001 "Revert r298824 & r298816, recommit r298742 & r298754"Hans Wennborg2017-04-124-385/+111
| | | | | | It caused PR32640. llvm-svn: 300074
OpenPOWER on IntegriCloud