Commit 5eb0ba0f authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Merging r291963:

------------------------------------------------------------------------
r291963 | ericwf | 2017-01-13 14:11:40 -0800 (Fri, 13 Jan 2017) | 9 lines

[clang] Emit `diagnose_if` warnings from system headers

Summary: In order for libc++ to meaningfully use `diagnose_if` warnings they need to be emitted from system headers by default. This patch changes the `diagnose_if` warning diagnostic to be shown in system headers.

Reviewers: george.burgess.iv, rsmith, aaron.ballman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28703
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@293783 91177308-0d34-0410-b5e6-96231b3b80d8
parent dff88e09
......@@ -3373,7 +3373,8 @@ def note_ovl_candidate_has_pass_object_size_params: Note<
"candidate address cannot be taken because parameter %0 has "
"pass_object_size attribute">;
def err_diagnose_if_succeeded : Error<"%0">;
def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>;
def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
ShowInSystemHeader;
def note_ovl_candidate_disabled_by_function_cond_attr : Note<
"candidate disabled: %0">;
def note_ovl_candidate_disabled_by_extension : Note<
......
#pragma GCC system_header
inline int system_header_func(int x)
__attribute__((diagnose_if(x == x, "system header warning", "warning"))) // expected-note {{from 'diagnose_if' attribute}}
{
return 0;
}
void test_system_header() {
system_header_func(0); // expected-warning {{system header warning}}
}
......@@ -150,3 +150,6 @@ void alwaysWarnWithArg(int a) _diagnose_if(1 || a, "alwaysWarn", "warning"); //
void runAlwaysWarnWithArg(int a) {
alwaysWarnWithArg(a); // expected-warning{{alwaysWarn}}
}
// Test that diagnose_if warnings generated in system headers are not ignored.
#include "Inputs/diagnose-if-warn-system-header.h"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment