summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/DiagnosticGroups.td
Commit message (Collapse)AuthorAgeFilesLines
* [MS] Allow access to ambiguous, inaccessible direct basesReid Kleckner2017-10-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Clang typically warns that in the following class hierarchy, 'A' is inaccessible because there is no series of casts that the user can write to access it unambiguously: struct A { }; struct B : A { }; struct C : A, B { }; MSVC allows the user to convert from C* to A*, though, and we've encountered this issue in the latest Windows SDK headers. This patch allows this conversion when -fms-compatibility is set and adds a warning for it under -Wmicrosoft-inaccessible-base. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39389 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316807 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Add support for flexible array members in Obj-C.Volodymyr Sapsai2017-10-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow Obj-C ivars with incomplete array type but only as the last ivar. Also add a requirement for ivars that contain a flexible array member to be at the end of class too. It is possible to add in a subclass another ivar at the end but we'll emit a warning in this case. Also we'll emit a warning if a variable sized ivar is declared in class extension or in implementation because subclasses won't know they should avoid adding new ivars. In ARC incomplete array objects are treated as __unsafe_unretained so require them to be marked as such. Prohibit synthesizing ivars with flexible array members because order of synthesized ivars is not obvious and tricky to control. Spelling out ivar explicitly gives control to developers and helps to avoid surprises with unexpected ivar ordering. For C and C++ changed diagnostic to tell explicitly a field is not the last one and point to the next field. It is not as useful as in Obj-C but it is an improvement and it is consistent with Obj-C. For C for unions emit more specific err_flexible_array_union instead of generic err_field_incomplete. rdar://problem/21054495 Reviewers: rjmccall, theraven Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38773 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316381 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide a flag group to turn on/off all "binary literals" extension warnings.Richard Smith2017-10-181-1/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316056 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Re-land: Diagnose tautological comparison with type's min/max valuesRoman Lebedev2017-10-151-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | The first attempt, rL315614 was reverted because one libcxx test broke, and i did not know at the time how to deal with it. Summary: Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`), and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the `std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147 Continuation of https://reviews.llvm.org/D37565 Reviewers: rjmccall, rsmith, aaron.ballman Reviewed By: rsmith Subscribers: rtrieu, jroelofs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D38101 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315875 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Sema] Diagnose tautological comparison with type's min/max values"Roman Lebedev2017-10-121-5/+3
| | | | | | | | | | | | | | | | | | | | | This reverts r315614,r315615,r315621,r315622 Breaks http://bb9.pgr.jp/#/builders/20/builds/59 /home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:95:17: error: comparison 'long long' > 9223372036854775807 is always false [-Werror,-Wtautological-constant-compare] if (max_sec > Lim::max()) return false; ~~~~~~~ ^ ~~~~~~~~~~ /home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:13: error: comparison 'long long' < -9223372036854775808 is always false [-Werror,-Wtautological-constant-compare] if (sec < Lim::min() || sec > Lim::max()) return false; ~~~ ^ ~~~~~~~~~~ /home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:33: error: comparison 'long long' > 9223372036854775807 is always false [-Werror,-Wtautological-constant-compare] if (sec < Lim::min() || sec > Lim::max()) return false; ~~~ ^ ~~~~~~~~~~ 3 errors generated. -- I'm not yet sure what is the proper fix. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315631 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Diagnose tautological comparison with type's min/max valuesRoman Lebedev2017-10-121-3/+5
| | | | | | | | | | | | | | | | | | | | | | Summary: Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`), and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the `std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147 Continuation of https://reviews.llvm.org/D37565 Reviewers: rjmccall, rsmith, aaron.ballman Reviewed By: rsmith Subscribers: rtrieu, jroelofs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D38101 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315614 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-221-0/+1
| | | | | | | | | | | | | | | | | | | | The attribute informs the compiler that the annotated pointer parameter of a function cannot escape and enables IRGen to attach attribute 'nocapture' to parameters that are annotated with the attribute. That is the only optimization that currently takes advantage of 'noescape', but there are other optimizations that will be added later that improves IRGen for ObjC blocks. This recommits r313722, which was reverted in r313725 because clang couldn't build compiler-rt. It failed to build because there were function declarations that were missing 'noescape'. That has been fixed in r313929. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32210 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313945 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compareRoman Lebedev2017-09-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recommit. Original commit was reverted because buildbots broke. The error was only reproducible in the build with assertions. The problem was that the diagnostic expected true/false as bool, while it was provided as string "true"/"false". Summary: As requested by Sam McCall: > Enums (not new I guess). Typical case: if (enum < 0 || enum > MAX) > The warning strongly suggests that the enum < 0 check has no effect > (for enums with nonnegative ranges). > Clang doesn't seem to optimize such checks out though, and they seem > likely to catch bugs in some cases. Yes, only if there's UB elsewhere, > but I assume not optimizing out these checks indicates a deliberate > decision to stay somewhat compatible with a technically-incorrect > mental model. > If this is the case, should we move these to a > -Wtautological-compare-enum subcategory? Reviewers: rjmccall, rsmith, aaron.ballman, sammccall, bkramer, djasper Reviewed By: aaron.ballman Subscribers: jroelofs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D37629 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313745 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Add support for attribute 'noescape'."Akira Hatanaka2017-09-201-1/+0
| | | | | | | | | | This reverts commit r313722. It looks like compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc cannot be compiled because some of the functions declared in the file do not match the ones in the SDK headers (which are annotated with 'noescape'). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313725 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-201-0/+1
| | | | | | | | | | | | | | | The attribute informs the compiler that the annotated pointer parameter of a function cannot escape and enables IRGen to attach attribute 'nocapture' to parameters that are annotated with the attribute. That is the only optimization that currently takes advantage of 'noescape', but there are other optimizations that will be added later that improves IRGen for ObjC blocks. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32210 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313722 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Add support for attribute 'noescape'."Akira Hatanaka2017-09-201-1/+0
| | | | | | | | This reverts r313717. I closed the wrong phabricator review. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313721 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-201-0/+1
| | | | | | | | | | | | | | | The attribute informs the compiler that the annotated pointer parameter of a function cannot escape and enables IRGen to attach attribute 'nocapture' to parameters that are annotated with the attribute. That is the only optimization that currently takes advantage of 'noescape', but there are other optimizations that will be added later that improves IRGen for ObjC blocks. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32520 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313720 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema][ObjC] Warn about mismatches in attributes between overriding andAkira Hatanaka2017-09-201-0/+3
| | | | | | | | | | | | | overridden methods when compiling for non-ARC. Previously, clang would error out when compiling for ARC, but didn't print any diagnostics when compiling for non-ARC. This was pointed out in the patch review for attribute noescape: https://reviews.llvm.org/D32210 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313717 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare"Roman Lebedev2017-09-191-2/+0
| | | | | | | | | | | | | | | | This reverts commit r313677. Buildbots fail with assertion failure Failing Tests (7): Clang :: Analysis/null-deref-ps.c Clang :: CodeGen/enum.c Clang :: Sema/compare.c Clang :: Sema/outof-range-constant-compare.c Clang :: Sema/tautological-unsigned-enum-zero-compare.c Clang :: Sema/tautological-unsigned-zero-compare.c Clang :: SemaCXX/compare.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313683 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compareRoman Lebedev2017-09-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As requested by Sam McCall: > Enums (not new I guess). Typical case: if (enum < 0 || enum > MAX) > The warning strongly suggests that the enum < 0 check has no effect > (for enums with nonnegative ranges). > Clang doesn't seem to optimize such checks out though, and they seem > likely to catch bugs in some cases. Yes, only if there's UB elsewhere, > but I assume not optimizing out these checks indicates a deliberate > decision to stay somewhat compatible with a technically-incorrect > mental model. > If this is the case, should we move these to a > -Wtautological-compare-enum subcategory? Reviewers: rjmccall, rsmith, aaron.ballman, sammccall, bkramer, djasper Reviewed By: aaron.ballman Subscribers: jroelofs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D37629 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313677 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach clang to tolerate the 'p = nullptr + n' idiom used by glibcAndrew Kaylor2017-09-191-1/+3
| | | | | | | | Differential Revision: https://reviews.llvm.org/D37042 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313666 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Put tautological comparison of unsigned and zero into it's own flagRoman Lebedev2017-09-081-1/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: As requested by Sam McCall. ``` $ /build/llvm-build-Clang-release/./bin/clang -c /build/clang/test/Sema/outof-range-constant-compare.c /build/clang/test/Sema/outof-range-constant-compare.c:40:11: warning: comparison of unsigned expression < 0 is always false [-Wtautological-unsigned-zero-compare] if (a < 0x0000000000000000UL) // expected-warning {{comparison of unsigned expression < 0 is always false}} ~ ^ ~~~~~~~~~~~~~~~~~~~~ ``` Reviewers: sammccall, bkramer, djasper, rsmith, rjmccall, aaron.ballman Reviewed By: sammccall, aaron.ballman Subscribers: aaron.ballman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D37620 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312792 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename diagnostic groups from CXX1z to CXX17. No functionality change.Richard Smith2017-08-251-10/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311758 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix up the -Wc++XX-compat warnings to properly handle C++2a.Richard Smith2017-08-251-8/+22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311750 91177308-0d34-0410-b5e6-96231b3b80d8
* [mips] Introducing option -mabs=[legacy/2008]Petar Jovanovic2017-08-241-0/+1
| | | | | | | | | | | | | | | | | | In patch r205628 using abs.[ds] instruction is forced, as they should behave in accordance with flags Has2008 and ABS2008. Unfortunately for revisions prior mips32r6 and mips64r6, abs.[ds] is not generating correct result when working with NaNs. To generate a sequence which always produce a correct result but also to allow user more control on how his code is compiled, option -mabs is added where user can choose legacy or 2008. By default legacy mode is used on revisions prior R6. Mips32r6 and mips64r6 use abs2008 mode by default. Patch by Aleksandar Beserminji Differential Revision: https://reviews.llvm.org/D35982 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311669 91177308-0d34-0410-b5e6-96231b3b80d8
* [c++2a] Implement P0409R2 - Allow lambda capture [=,this] (by hamzasood)Faisal Vali2017-08-191-0/+7
| | | | | | | | | | | | | | This patch, by hamzasood, implements P0409R2, and allows [=, this] pre-C++2a as an extension (with appropriate warnings) for consistency. https://reviews.llvm.org/D36572 Thanks Hamza! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311224 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace remaining user-visible mentions of C++1z with C++17.Richard Smith2017-08-131-5/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310804 91177308-0d34-0410-b5e6-96231b3b80d8
* [c++2a] Treat 'concept' and 'requires' as keywords, add compat warning for ↵Richard Smith2017-08-131-0/+2
| | | | | | C++17 and before. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310803 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Assign new flag -Wenum-compare-switch to switch-related parts of ↵Gabor Horvath2017-08-091-0/+2
| | | | | | | | | | | -Wenum-compare Patch by: Reka Nikolett Kovacs Differential Revision: https://reviews.llvm.org/D36526 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310521 91177308-0d34-0410-b5e6-96231b3b80d8
* [Driver] Allow users to silence the warning that is issued when theAkira Hatanaka2017-07-311-0/+3
| | | | | | | | | | deployment target is earlier than iOS 11 and the target is 32-bit. This is a follow-up to r306922. rdar://problem/32230613 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309607 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327 3rd time: Add a warning for missingAlex Lorenz2017-07-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files The second recommit (r309106) was reverted because the "non-default #pragma pack value chages the alignment of struct or union members in the included file" warning proved to be too aggressive for external projects like Chromium (https://bugs.chromium.org/p/chromium/issues/detail?id=749197). This recommit makes the problematic warning a non-default one, and gives it the -Wpragma-pack-suspicious-include warning option. The first recommit (r308441) caused a "non-default #pragma pack value might change the alignment of struct or union members in the included file" warning in LLVM itself. This recommit tweaks the added warning to avoid warnings for #includes that don't have any records that are affected by the non-default alignment. This tweak avoids the previously emitted warning in LLVM. Original message: This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309386 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r309106 "Recommit r308327 2nd time: Add a warning for missing"Hans Wennborg2017-07-261-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning fires on non-suspicious code in Chromium. Reverting until a solution is figured out. > Recommit r308327 2nd time: Add a warning for missing > '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files > > The first recommit (r308441) caused a "non-default #pragma pack value might > change the alignment of struct or union members in the included file" warning > in LLVM itself. This recommit tweaks the added warning to avoid warnings for > #includes that don't have any records that are affected by the non-default > alignment. This tweak avoids the previously emitted warning in LLVM. > > Original message: > > This commit adds a new -Wpragma-pack warning. It warns in the following cases: > > - When a translation unit is missing terminating #pragma pack (pop) directives. > - When entering an included file if the current alignment value as determined > by '#pragma pack' directives is different from the default alignment value. > - When leaving an included file that changed the state of the current alignment > value. > > rdar://10184173 > > Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309186 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327 2nd time: Add a warning for missingAlex Lorenz2017-07-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files The first recommit (r308441) caused a "non-default #pragma pack value might change the alignment of struct or union members in the included file" warning in LLVM itself. This recommit tweaks the added warning to avoid warnings for #includes that don't have any records that are affected by the non-default alignment. This tweak avoids the previously emitted warning in LLVM. Original message: This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309106 91177308-0d34-0410-b5e6-96231b3b80d8
* [ubsan] Null-check pointers in -fsanitize=vptr (PR33881)Vedant Kumar2017-07-251-0/+1
| | | | | | | | | | | | | | | | | | | The instrumentation generated by -fsanitize=vptr does not null check a user pointer before loading from it. This causes crashes in the face of UB member calls (this=nullptr), i.e it's causing user programs to crash only after UBSan is turned on. The fix is to make run-time null checking a prerequisite for enabling -fsanitize=vptr, and to then teach UBSan to reuse these run-time null checks to make -fsanitize=vptr safe. Testing: check-clang, check-ubsan, a stage2 ubsan-enabled build Differential Revision: https://reviews.llvm.org/D35735 https://bugs.llvm.org/show_bug.cgi?id=33881 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309007 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland "[mips] Teach the driver to accept -m(no-)gpopt."Simon Dardis2017-07-201-0/+1
| | | | | | | | | | | | | | | This patch teaches the driver to pass -mgpopt by default to the backend when it is supported, i.e. we are using -mno-abicalls. Reviewers: atanasyan, slthakur Differential Revision: https://reviews.llvm.org/D35548 This version fixes a logic error that generated warnings incorrectly and gets rid of spurious arguments to the backend when -mgpopt is not used. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308619 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Reland "[mips] Teach the driver to accept -m(no-)gpopt.""Simon Dardis2017-07-191-1/+0
| | | | | | | This reverts r308458. Investigating further buildbot breakage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308459 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland "[mips] Teach the driver to accept -m(no-)gpopt."Simon Dardis2017-07-191-0/+1
| | | | | | | | | | | | | | This patch teaches the driver to pass -mgpopt by default to the backend when it is supported, i.e. we are using -mno-abicalls. Reviewers: atanasyan, slthakur Differential Revision: https://reviews.llvm.org/D35548 This version fixes a logic error that generated warnings incorrectly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308458 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r308441 "Recommit r308327: Add a warning for missing '#pragma pack ↵Hans Wennborg2017-07-191-2/+1
| | | | | | | | | | | | | | | | | | | | | (pop)' and suspicious uses of '#pragma pack' in included files" This seems to have broken the sanitizer-x86_64-linux buildbot. Reverting until it's fixed, especially since this landed just before the 5.0 branch. > This commit adds a new -Wpragma-pack warning. It warns in the following cases: > > - When a translation unit is missing terminating #pragma pack (pop) directives. > - When entering an included file if the current alignment value as determined > by '#pragma pack' directives is different from the default alignment value. > - When leaving an included file that changed the state of the current alignment > value. > > rdar://10184173 > > Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308455 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327: Add a warning for missing '#pragma pack (pop)'Alex Lorenz2017-07-191-1/+2
| | | | | | | | | | | | | | | | | | | and suspicious uses of '#pragma pack' in included files This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308441 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[mips] Teach the driver to accept -m(no-)gpopt."Simon Dardis2017-07-191-1/+0
| | | | | | | Revert r308431 and r308432, these caused broke some buildbots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308436 91177308-0d34-0410-b5e6-96231b3b80d8
* [mips] Teach the driver to accept -m(no-)gpopt.Simon Dardis2017-07-191-0/+1
| | | | | | | | | | | | This patch teaches the driver to pass -mgpopt by default to the backend when it is supported, i.e. we are using -mno-abicalls. Reviewers: atanasyan, slthakur Differential Revision: https://reviews.llvm.org/D35548 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308431 91177308-0d34-0410-b5e6-96231b3b80d8
* Add GCC's noexcept-type alias for c++1z-compat-manglingRaphael Isemann2017-07-181-0/+2
| | | | | | | | | | | | | | Summary: GCC has named this `-Wnoexcept-type`, so let's add an alias to stay compatible with the GCC flags. Reviewers: rsmith, dexonsmith Reviewed By: dexonsmith Subscribers: cfe-commits, karies, v.g.vassilev, ahatanak Differential Revision: https://reviews.llvm.org/D34439 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308340 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r308327Alex Lorenz2017-07-181-2/+1
| | | | | | | I forgot to test clang-tools-extra which is now failing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308328 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a warning for missing '#pragma pack (pop)' and suspicious usesAlex Lorenz2017-07-181-1/+2
| | | | | | | | | | | | | | | | | | | of '#pragma pack' in included files This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308327 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Issue diagnostics if a new/delete expression generates a call toAkira Hatanaka2017-06-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | a c++17 aligned allocation/deallocation function that is unavailable in the standard library on Apple platforms. The aligned functions are implemented only in the following versions or later versions of the OSes, so clang issues diagnostics if the deployment target being targeted is older than these: macosx: 10.13 ios: 11.0 tvos: 11.0 watchos: 4.0 The diagnostics are issued whenever the aligned functions are selected except when the selected function has a definition in the same file. If there is a user-defined function available somewhere else, option -Wno-aligned-allocation-unavailable can be used to silence the diagnostics. rdar://problem/32664169 Differential Revision: https://reviews.llvm.org/D34574 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306722 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Add -Wunguarded-availability-newAlex Lorenz2017-06-221-1/+3
| | | | | | | | | | | | | | | | The new compiler warning -Wunguarded-availability-new is a subset of -Wunguarded-availability. It is on by default. It only warns about uses of APIs that have been introduced in macOS >= 10.13, iOS >= 11, watchOS >= 4 and tvOS >= 11. We decided to use this kind of solution as we didn't want to turn on -Wunguarded-availability by default, because we didn't want our users to get warnings about uses of old APIs in their existing projects. rdar://31054725 Differential Revision: https://reviews.llvm.org/D34264 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306033 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a subgroup of c++1z-compat to enable and disable the warning aboutAkira Hatanaka2017-06-201-1/+3
| | | | | | | | | | c++17's non-throwing exception specification in function signature. rdar://problem/32628743 Differential Revision: https://reviews.llvm.org/D34251 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305772 91177308-0d34-0410-b5e6-96231b3b80d8
* Add compatibility alias for -Wno-#warningsDavid Blaikie2017-06-011-0/+1
| | | | | | | GCC uses -Wno-cpp for this, so seems reasonable to add an alias to match. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304456 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland "Warn about unused static file scope function template declarations."Vassil Vassilev2017-05-091-0/+2
| | | | | | | | This patch reinstates r299930, reverted in r299956, as a separate diagnostic option (-Wunused-template). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302518 91177308-0d34-0410-b5e6-96231b3b80d8
* [Profile] Add off-by-default -Wprofile-instr-missing warningVedant Kumar2017-04-271-0/+1
| | | | | | | | | | | | | | | Clang warns that a profile is out-of-date if it can't find a profile record for any function in a TU. This warning became noisy after llvm started allowing dead-stripping of instrumented functions. To fix this, this patch changes the existing profile out-of-date warning (-Wprofile-instr-out-of-date) so that it only complains about mismatched data. Further, it introduces a new, off-by-default warning about missing function data (-Wprofile-instr-missing). Differential Revision: https://reviews.llvm.org/D28867 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301570 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #pragma clang attributeAlex Lorenz2017-04-181-1/+3
| | | | | | | | | | | | | | | | | | This is a recommit of r300539 that was reverted in r300543 due to test failures. The original commit message is displayed below: The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300556 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r300539 - Add #pragma clang attributeAlex Lorenz2017-04-181-3/+1
| | | | | | | | Some tests fail on the Windows buildbots. I will have to investigate more. This commit reverts r300539, r300540 and r300542. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300543 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #pragma clang attributeAlex Lorenz2017-04-181-1/+3
| | | | | | | | | | | | | | | The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300539 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename coroutine warning when unhandled_exception() is missingEric Fiselier2017-04-171-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300513 91177308-0d34-0410-b5e6-96231b3b80d8
* [coroutines] Implement unhandled_exception changes.Eric Fiselier2017-03-231-0/+1
| | | | | | | | | | | | | | | | | | Summary: This patch adopts the recent changes that renamed `set_exception(exception_pointer)` to `unhandled_exception()`. Additionally `unhandled_exception()` is now required, and so an error is emitted when exceptions are enabled but the promise type does not provide the member. When exceptions are disabled a warning is emitted instead of an error, The warning notes that the `unhandled_exception()` function is required when exceptions are enabled. Reviewers: rsmith, GorNishanov, aaron.ballman, majnemer Reviewed By: GorNishanov Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D30859 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298565 91177308-0d34-0410-b5e6-96231b3b80d8