mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
[clang] consistently quote expressions in diagnostics (#134769)
This commit is contained in:
@@ -416,6 +416,17 @@ Description:
|
||||
and the modifier indexes in the substitution are re-numbered accordingly. The
|
||||
substituted text must itself be a valid format string before substitution.
|
||||
|
||||
**"quoted" format**
|
||||
|
||||
Example:
|
||||
``"expression %quoted0 evaluates to 0"``
|
||||
Class:
|
||||
``String``
|
||||
Description:
|
||||
This is a simple formatter which adds quotes around the given string.
|
||||
This is useful when the argument could be a string in some cases, but
|
||||
another class in other cases, and it needs to be quoted consistently.
|
||||
|
||||
.. _internals-producing-diag:
|
||||
|
||||
Producing the Diagnostic
|
||||
|
||||
@@ -314,6 +314,7 @@ Improvements to Clang's diagnostics
|
||||
- Clang now respects the current language mode when printing expressions in
|
||||
diagnostics. This fixes a bunch of `bool` being printed as `_Bool`, and also
|
||||
a bunch of HLSL types being printed as their C++ equivalents.
|
||||
- Clang now consistently quotes expressions in diagnostics.
|
||||
- When printing types for diagnostics, clang now doesn't suppress the scopes of
|
||||
template arguments contained within nested names.
|
||||
- The ``-Wshift-bool`` warning has been added to warn about shifting a boolean. (#GH28334)
|
||||
|
||||
@@ -143,8 +143,8 @@ def note_constexpr_null_subobject : Note<
|
||||
"access array element of|perform pointer arithmetic on|"
|
||||
"access real component of|"
|
||||
"access imaginary component of}0 null pointer">;
|
||||
def note_constexpr_null_callee : Note<
|
||||
"'%0' evaluates to a null function pointer">;
|
||||
def note_constexpr_null_callee
|
||||
: Note<"%0 evaluates to a null function pointer">;
|
||||
def note_constexpr_function_param_value_unknown : Note<
|
||||
"function parameter %0 with unknown value cannot be used in a constant "
|
||||
"expression">;
|
||||
|
||||
@@ -1639,7 +1639,7 @@ def note_omp_ctx_compatible_set_and_selector_for_property
|
||||
"'match(%2={%1(%0)})'">;
|
||||
def warn_omp_ctx_incompatible_score_for_property
|
||||
: Warning<"the context selector '%0' in the context set '%1' cannot have a "
|
||||
"score ('%2'); score ignored">,
|
||||
"score (%quoted2); score ignored">,
|
||||
InGroup<OpenMPClauses>;
|
||||
def warn_omp_more_one_device_type_clause
|
||||
: Warning<"more than one 'device_type' clause is specified">,
|
||||
|
||||
@@ -167,9 +167,10 @@ def err_expr_not_string_literal : Error<"expression is not a string literal">;
|
||||
def ext_predef_outside_function : Warning<
|
||||
"predefined identifier is only valid inside function">,
|
||||
InGroup<DiagGroup<"predefined-identifier-outside-function">>;
|
||||
def ext_init_from_predefined : ExtWarn<
|
||||
"initializing an array from a '%0' predefined identifier is a Microsoft extension">,
|
||||
InGroup<MicrosoftInitFromPredefined>;
|
||||
def ext_init_from_predefined
|
||||
: ExtWarn<"initializing an array from a %0 predefined identifier is a "
|
||||
"Microsoft extension">,
|
||||
InGroup<MicrosoftInitFromPredefined>;
|
||||
def ext_string_literal_from_predefined : ExtWarn<
|
||||
"expansion of predefined identifier '%0' to a string literal is a Microsoft extension">,
|
||||
InGroup<MicrosoftStringLiteralFromPredefined>;
|
||||
@@ -3021,14 +3022,14 @@ def note_substituted_constraint_expr_is_ill_formed : Note<
|
||||
"because substituted constraint expression is ill-formed%0">;
|
||||
def note_constraint_references_error
|
||||
: Note<"constraint depends on a previously diagnosed expression">;
|
||||
def note_atomic_constraint_evaluated_to_false : Note<
|
||||
"%select{and|because}0 '%1' evaluated to false">;
|
||||
def note_concept_specialization_constraint_evaluated_to_false : Note<
|
||||
"%select{and|because}0 '%1' evaluated to false">;
|
||||
def note_atomic_constraint_evaluated_to_false
|
||||
: Note<"%select{and|because}0 %1 evaluated to false">;
|
||||
def note_concept_specialization_constraint_evaluated_to_false
|
||||
: Note<"%select{and|because}0 %1 evaluated to false">;
|
||||
def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
|
||||
"%select{and|because}0 %1 does not satisfy %2">;
|
||||
def note_atomic_constraint_evaluated_to_false_elaborated : Note<
|
||||
"%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
|
||||
def note_atomic_constraint_evaluated_to_false_elaborated
|
||||
: Note<"%select{and|because}0 %1 (%2 %3 %4) evaluated to false">;
|
||||
def note_is_deducible_constraint_evaluated_to_false : Note<
|
||||
"cannot deduce template arguments for %0 from %1">;
|
||||
def err_constrained_virtual_method : Error<
|
||||
@@ -3048,14 +3049,14 @@ def note_expr_requirement_expr_substitution_error : Note<
|
||||
"%select{and|because}0 '%1' would be invalid: %2">;
|
||||
def note_expr_requirement_expr_unknown_substitution_error : Note<
|
||||
"%select{and|because}0 '%1' would be invalid">;
|
||||
def note_expr_requirement_noexcept_not_met : Note<
|
||||
"%select{and|because}0 '%1' may throw an exception">;
|
||||
def note_expr_requirement_noexcept_not_met
|
||||
: Note<"%select{and|because}0 %1 may throw an exception">;
|
||||
def note_expr_requirement_type_requirement_substitution_error : Note<
|
||||
"%select{and|because}0 '%1' would be invalid: %2">;
|
||||
def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
|
||||
"%select{and|because}0 '%1' would be invalid">;
|
||||
def note_expr_requirement_constraints_not_satisfied : Note<
|
||||
"%select{and|because}0 type constraint '%1' was not satisfied:">;
|
||||
def note_expr_requirement_constraints_not_satisfied
|
||||
: Note<"%select{and|because}0 type constraint %1 was not satisfied:">;
|
||||
def note_expr_requirement_constraints_not_satisfied_simple : Note<
|
||||
"%select{and|because}0 %1 does not satisfy %2:">;
|
||||
def note_type_requirement_substitution_error : Note<
|
||||
@@ -4356,9 +4357,9 @@ def note_reference_is_return_value : Note<"%0 returns a reference">;
|
||||
|
||||
def note_pointer_declared_here : Note<
|
||||
"pointer %0 declared here">;
|
||||
def warn_division_sizeof_ptr : Warning<
|
||||
"'%0' will return the size of the pointer, not the array itself">,
|
||||
InGroup<DiagGroup<"sizeof-pointer-div">>;
|
||||
def warn_division_sizeof_ptr
|
||||
: Warning<"%0 will return the size of the pointer, not the array itself">,
|
||||
InGroup<DiagGroup<"sizeof-pointer-div">>;
|
||||
def warn_division_sizeof_array : Warning<
|
||||
"expression does not compute the number of elements in this array; element "
|
||||
"type is %0, not %1">,
|
||||
@@ -5581,8 +5582,9 @@ def note_function_member_spec_matched : Note<
|
||||
def err_template_recursion_depth_exceeded : Error<
|
||||
"recursive template instantiation exceeded maximum depth of %0">,
|
||||
DefaultFatal, NoSFINAE;
|
||||
def err_constraint_depends_on_self : Error<
|
||||
"satisfaction of constraint '%0' depends on itself">, NoSFINAE;
|
||||
def err_constraint_depends_on_self
|
||||
: Error<"satisfaction of constraint %0 depends on itself">,
|
||||
NoSFINAE;
|
||||
def note_template_recursion_depth : Note<
|
||||
"use -ftemplate-depth=N to increase recursive template instantiation depth">;
|
||||
|
||||
@@ -7098,8 +7100,8 @@ def warn_precedence_bitwise_rel : Warning<
|
||||
InGroup<Parentheses>;
|
||||
def note_precedence_bitwise_first : Note<
|
||||
"place parentheses around the %0 expression to evaluate it first">;
|
||||
def note_precedence_silence : Note<
|
||||
"place parentheses around the '%0' expression to silence this warning">;
|
||||
def note_precedence_silence : Note<"place parentheses around the %quoted0 "
|
||||
"expression to silence this warning">;
|
||||
|
||||
def warn_precedence_conditional : Warning<
|
||||
"operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
|
||||
@@ -7117,9 +7119,11 @@ def warn_consecutive_comparison : Warning<
|
||||
def warn_enum_constant_in_bool_context : Warning<
|
||||
"converting the enum constant to a boolean">,
|
||||
InGroup<IntInBoolContext>, DefaultIgnore;
|
||||
def warn_left_shift_in_bool_context : Warning<
|
||||
"converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
|
||||
InGroup<IntInBoolContext>, DefaultIgnore;
|
||||
def warn_left_shift_in_bool_context
|
||||
: Warning<"converting the result of '<<' to a boolean; did you mean to "
|
||||
"compare with '0'?">,
|
||||
InGroup<IntInBoolContext>,
|
||||
DefaultIgnore;
|
||||
def warn_logical_instead_of_bitwise : Warning<
|
||||
"use of logical '%0' with constant operand">,
|
||||
InGroup<DiagGroup<"constant-logical-operand">>;
|
||||
@@ -10331,9 +10335,11 @@ def warn_dangling_pointer_assignment : Warning<
|
||||
"object backing %select{|the pointer }0%1 "
|
||||
"will be destroyed at the end of the full-expression">,
|
||||
InGroup<DanglingAssignment>;
|
||||
def warn_dangling_reference_captured : Warning<
|
||||
"object whose reference is captured by '%0' will be destroyed at the end of "
|
||||
"the full-expression">, InGroup<DanglingCapture>;
|
||||
def warn_dangling_reference_captured
|
||||
: Warning<"object whose reference is captured by %0 will be destroyed at "
|
||||
"the end of "
|
||||
"the full-expression">,
|
||||
InGroup<DanglingCapture>;
|
||||
def warn_dangling_reference_captured_by_unknown : Warning<
|
||||
"object whose reference is captured will be destroyed at the end of "
|
||||
"the full-expression">, InGroup<DanglingCapture>;
|
||||
@@ -13038,15 +13044,15 @@ def note_acc_atomic_too_many_stmts
|
||||
def note_acc_atomic_expected_binop : Note<"expected binary operation on right "
|
||||
"hand side of assignment operator">;
|
||||
def note_acc_atomic_mismatch_operand
|
||||
: Note<"left hand side of assignment operation('%0') must match one side "
|
||||
"of the sub-operation on the right hand side('%1' and '%2')">;
|
||||
: Note<"left hand side of assignment operation(%0) must match one side "
|
||||
"of the sub-operation on the right hand side(%1 and %2)">;
|
||||
def note_acc_atomic_mismatch_compound_operand
|
||||
: Note<"variable %select{|in unary expression|on right hand side of "
|
||||
"assignment|on left hand side of assignment|on left hand side of "
|
||||
"compound assignment|on left hand side of assignment}2('%3') must "
|
||||
"compound assignment|on left hand side of assignment}2(%3) must "
|
||||
"match variable used %select{|in unary expression|on right hand "
|
||||
"side of assignment|<not possible>|on left hand side of compound "
|
||||
"assignment|on left hand side of assignment}0('%1') from the first "
|
||||
"assignment|on left hand side of assignment}0(%1) from the first "
|
||||
"statement">;
|
||||
def err_acc_declare_required_clauses
|
||||
: Error<"no valid clauses specified in OpenACC 'declare' directive">;
|
||||
@@ -13066,9 +13072,9 @@ def err_acc_multiple_references
|
||||
: Error<"variable referenced in '%0' clause of OpenACC 'declare' directive "
|
||||
"was already referenced">;
|
||||
def err_acc_routine_not_func
|
||||
: Error<"OpenACC routine name '%0' does not name a function">;
|
||||
: Error<"OpenACC routine name %0 does not name a function">;
|
||||
def err_acc_routine_overload_set
|
||||
: Error<"OpenACC routine name '%0' names a set of overloads">;
|
||||
: Error<"OpenACC routine name %0 names a set of overloads">;
|
||||
def err_acc_magic_static_in_routine
|
||||
: Error<"function static variables are not permitted in functions to which "
|
||||
"an OpenACC 'routine' directive applies">;
|
||||
|
||||
@@ -512,8 +512,6 @@ void clang::FormatASTNodeDiagnosticArgument(
|
||||
const Expr *E = reinterpret_cast<Expr *>(Val);
|
||||
assert(E && "Received null Expr!");
|
||||
E->printPretty(OS, /*Helper=*/nullptr, Context.getPrintingPolicy());
|
||||
// FIXME: Include quotes when printing expressions.
|
||||
NeedQuotes = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1144,20 +1144,25 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd,
|
||||
|
||||
switch (Kind) {
|
||||
// ---- STRINGS ----
|
||||
case DiagnosticsEngine::ak_std_string: {
|
||||
const std::string &S = getArgStdStr(ArgNo);
|
||||
assert(ModifierLen == 0 && "No modifiers for strings yet");
|
||||
EscapeStringForDiagnostic(S, OutStr);
|
||||
break;
|
||||
}
|
||||
case DiagnosticsEngine::ak_std_string:
|
||||
case DiagnosticsEngine::ak_c_string: {
|
||||
const char *S = getArgCStr(ArgNo);
|
||||
assert(ModifierLen == 0 && "No modifiers for strings yet");
|
||||
|
||||
// Don't crash if get passed a null pointer by accident.
|
||||
if (!S)
|
||||
S = "(null)";
|
||||
StringRef S = [&]() -> StringRef {
|
||||
if (Kind == DiagnosticsEngine::ak_std_string)
|
||||
return getArgStdStr(ArgNo);
|
||||
const char *SZ = getArgCStr(ArgNo);
|
||||
// Don't crash if get passed a null pointer by accident.
|
||||
return SZ ? SZ : "(null)";
|
||||
}();
|
||||
bool Quoted = false;
|
||||
if (ModifierIs(Modifier, ModifierLen, "quoted")) {
|
||||
Quoted = true;
|
||||
OutStr.push_back('\'');
|
||||
} else {
|
||||
assert(ModifierLen == 0 && "unknown modifier for string");
|
||||
}
|
||||
EscapeStringForDiagnostic(S, OutStr);
|
||||
if (Quoted)
|
||||
OutStr.push_back('\'');
|
||||
break;
|
||||
}
|
||||
// ---- INTEGERS ----
|
||||
|
||||
@@ -11685,7 +11685,10 @@ static void DiagnoseIntInBoolContext(Sema &S, Expr *E) {
|
||||
S.Diag(ExprLoc, diag::warn_left_shift_always)
|
||||
<< (Result.Val.getInt() != 0);
|
||||
else if (E->getType()->isSignedIntegerType())
|
||||
S.Diag(ExprLoc, diag::warn_left_shift_in_bool_context) << E;
|
||||
S.Diag(ExprLoc, diag::warn_left_shift_in_bool_context)
|
||||
<< FixItHint::CreateInsertion(E->getBeginLoc(), "(")
|
||||
<< FixItHint::CreateInsertion(S.getLocForEndOfToken(E->getEndLoc()),
|
||||
") != 0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -920,7 +920,7 @@ namespace CompoundLiterals {
|
||||
// null pointer suggests we're doing something odd during constant expression
|
||||
// evaluation: I think it's still taking 'x' as being null from the call to
|
||||
// f3() rather than tracking the assignment happening in the VLA.
|
||||
constexpr int f3(int *x, int (*y)[*(x=(int[]){1,2,3})]) { // both-warning {{object backing the pointer x will be destroyed at the end of the full-expression}}
|
||||
constexpr int f3(int *x, int (*y)[*(x=(int[]){1,2,3})]) { // both-warning {{object backing the pointer 'x' will be destroyed at the end of the full-expression}}
|
||||
return x[0]; // both-note {{read of dereferenced null pointer is not allowed in a constant expression}}
|
||||
}
|
||||
constexpr int h = f3(0,0); // both-error {{constexpr variable 'h' must be initialized by a constant expression}} \
|
||||
|
||||
@@ -32,8 +32,8 @@ void sink(int *);
|
||||
|
||||
int func_return(void) {
|
||||
int *p = f().a; // expected-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
|
||||
p = f().a; // expected-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
|
||||
p = g().a; // expected-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
|
||||
p = f().a; // expected-warning {{object backing the pointer 'p' will be destroyed at the end of the full-expression}}
|
||||
p = g().a; // expected-warning {{object backing the pointer 'p' will be destroyed at the end of the full-expression}}
|
||||
sink(f().a); // Ok
|
||||
return *f().a; // Ok
|
||||
}
|
||||
@@ -41,7 +41,7 @@ int func_return(void) {
|
||||
int ternary(void) {
|
||||
int *p = (1 ? (struct X){ 0 } : f()).a; // expected-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
|
||||
int *r = (1 ? (union U){ 0 } : g()).a; // expected-warning {{temporary whose address is used as value of local variable 'r' will be destroyed at the end of the full-expression}}
|
||||
p = (1 ? (struct X){ 0 } : f()).a; // expected-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
|
||||
p = (1 ? (struct X){ 0 } : f()).a; // expected-warning {{object backing the pointer 'p' will be destroyed at the end of the full-expression}}
|
||||
sink((1 ? (struct X){ 0 } : f()).a); // Ok
|
||||
|
||||
// This intentionally gets one diagnostic in C and two in C++. In C, the
|
||||
@@ -49,10 +49,10 @@ int ternary(void) {
|
||||
// only one branch results in a temporary in C but both branches do in C++.
|
||||
int *q = 1 ? (struct X){ 0 }.a : f().a; // expected-warning {{temporary whose address is used as value of local variable 'q' will be destroyed at the end of the full-expression}} \
|
||||
cpp-warning {{temporary whose address is used as value of local variable 'q' will be destroyed at the end of the full-expression}}
|
||||
q = 1 ? (struct X){ 0 }.a : f().a; // expected-warning {{object backing the pointer q will be destroyed at the end of the full-expression}} \
|
||||
cpp-warning {{object backing the pointer q will be destroyed at the end of the full-expression}}
|
||||
q = 1 ? (struct X){ 0 }.a : g().a; // expected-warning {{object backing the pointer q will be destroyed at the end of the full-expression}} \
|
||||
cpp-warning {{object backing the pointer q will be destroyed at the end of the full-expression}}
|
||||
q = 1 ? (struct X){ 0 }.a : f().a; // expected-warning {{object backing the pointer 'q' will be destroyed at the end of the full-expression}} \
|
||||
cpp-warning {{object backing the pointer 'q' will be destroyed at the end of the full-expression}}
|
||||
q = 1 ? (struct X){ 0 }.a : g().a; // expected-warning {{object backing the pointer 'q' will be destroyed at the end of the full-expression}} \
|
||||
cpp-warning {{object backing the pointer 'q' will be destroyed at the end of the full-expression}}
|
||||
sink(1 ? (struct X){ 0 }.a : f().a); // Ok
|
||||
return *(1 ? (struct X){ 0 }.a : f().a); // Ok
|
||||
}
|
||||
@@ -60,7 +60,7 @@ int ternary(void) {
|
||||
int comma(void) {
|
||||
struct X x;
|
||||
int *p = ((void)0, x).a; // c-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
|
||||
p = ((void)0, x).a; // c-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
|
||||
p = ((void)0, x).a; // c-warning {{object backing the pointer 'p' will be destroyed at the end of the full-expression}}
|
||||
sink(((void)0, x).a); // Ok
|
||||
return *(((void)0, x).a);// Ok
|
||||
}
|
||||
@@ -68,7 +68,7 @@ int comma(void) {
|
||||
int cast(void) {
|
||||
struct X x;
|
||||
int *p = ((struct X)x).a; // expected-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
|
||||
p = ((struct X)x).a; // expected-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
|
||||
p = ((struct X)x).a; // expected-warning {{object backing the pointer 'p' will be destroyed at the end of the full-expression}}
|
||||
sink(((struct X)x).a); // Ok
|
||||
return *(((struct X)x).a); // Ok
|
||||
}
|
||||
@@ -76,7 +76,7 @@ int cast(void) {
|
||||
int assign(void) {
|
||||
struct X x, s;
|
||||
int *p = (x = s).a; // c-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
|
||||
p = (x = s).a; // c-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
|
||||
p = (x = s).a; // c-warning {{object backing the pointer 'p' will be destroyed at the end of the full-expression}}
|
||||
sink((x = s).a); // Ok
|
||||
return *((x = s).a); // Ok
|
||||
}
|
||||
|
||||
@@ -18,19 +18,19 @@ int D = 1;
|
||||
#pragma data_seg(".data")
|
||||
int a = 1;
|
||||
extern const Mutable mutable_custom_section;
|
||||
const Mutable mutable_custom_section; // expected-warning {{`#pragma const_seg` for section ".my_const" will not apply to 'mutable_custom_section' due to the presence of a mutable field}}
|
||||
const Mutable mutable_custom_section; // expected-warning {{`#pragma const_seg` for section '".my_const"' will not apply to 'mutable_custom_section' due to the presence of a mutable field}}
|
||||
extern const Normal normal_custom_section;
|
||||
const Normal normal_custom_section;
|
||||
struct NonTrivialDtor {
|
||||
~NonTrivialDtor();
|
||||
};
|
||||
extern const NonTrivialDtor non_trivial_dtor_custom_section;
|
||||
const NonTrivialDtor non_trivial_dtor_custom_section; // expected-warning {{`#pragma const_seg` for section ".my_const" will not apply to 'non_trivial_dtor_custom_section' due to the presence of a non-trivial destructor}}
|
||||
const NonTrivialDtor non_trivial_dtor_custom_section; // expected-warning {{`#pragma const_seg` for section '".my_const"' will not apply to 'non_trivial_dtor_custom_section' due to the presence of a non-trivial destructor}}
|
||||
struct NonTrivialCtor {
|
||||
NonTrivialCtor();
|
||||
};
|
||||
extern const NonTrivialCtor non_trivial_ctor_custom_section;
|
||||
const NonTrivialCtor non_trivial_ctor_custom_section; // expected-warning {{`#pragma const_seg` for section ".my_const" will not apply to 'non_trivial_ctor_custom_section' due to the presence of a non-trivial constructor}}
|
||||
const NonTrivialCtor non_trivial_ctor_custom_section; // expected-warning {{`#pragma const_seg` for section '".my_const"' will not apply to 'non_trivial_ctor_custom_section' due to the presence of a non-trivial constructor}}
|
||||
#pragma data_seg(push, label, ".data2")
|
||||
extern const int b;
|
||||
const int b = 1;
|
||||
|
||||
7
clang/test/FixIt/fixit-bool.cpp
Normal file
7
clang/test/FixIt/fixit-bool.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
// RUN: %clang_cc1 -fdiagnostics-parseable-fixits -std=c++26 -Wint-in-bool-context %s 2>&1 | FileCheck %s
|
||||
|
||||
int x;
|
||||
bool t1 = x << x;
|
||||
// CHECK-LABEL: 4:13: warning: converting the result of '<<' to a boolean
|
||||
// CHECK: fix-it:"{{.*}}":{4:11-4:11}:"("
|
||||
// CHECK-NEXT: fix-it:"{{.*}}":{4:17-4:17}:") != 0"
|
||||
@@ -3380,8 +3380,8 @@ struct S17 {
|
||||
};
|
||||
#else
|
||||
S17 s17;
|
||||
// expected-error@second.h:* {{'FunctionTemplate::S17' has different definitions in different modules; first difference is definition in module 'SecondModule' found function template 'foo' with 1st template parameter with default argument 1 + 1}}
|
||||
// expected-note@first.h:* {{but in 'FirstModule' found function template 'foo' with 1st template parameter with default argument 2}}
|
||||
// expected-error@second.h:* {{'FunctionTemplate::S17' has different definitions in different modules; first difference is definition in module 'SecondModule' found function template 'foo' with 1st template parameter with default argument '1 + 1'}}
|
||||
// expected-note@first.h:* {{but in 'FirstModule' found function template 'foo' with 1st template parameter with default argument '2'}}
|
||||
#endif
|
||||
|
||||
#if defined(FIRST)
|
||||
|
||||
@@ -34,7 +34,7 @@ int foo(void);
|
||||
#pragma omp declare variant(foo) match(implementation={vendor(score ibm)}) // expected-error {{expected '(' after 'score'}} expected-warning {{expected '':'' after the score expression; '':'' assumed}}
|
||||
#pragma omp declare variant(foo) match(implementation={vendor(score( ibm)}) // expected-error {{use of undeclared identifier 'ibm'}} expected-error {{expected ')'}} expected-warning {{expected '':'' after the score expression; '':'' assumed}} expected-warning {{expected identifier or string literal describing a context property; property skipped}} expected-note {{context property options are: 'amd' 'arm' 'bsc' 'cray' 'fujitsu' 'gnu' 'ibm' 'intel' 'llvm' 'nec' 'nvidia' 'pgi' 'ti' 'unknown'}} expected-note {{to match this '('}}
|
||||
#pragma omp declare variant(foo) match(implementation={vendor(score(2 ibm)}) // expected-error {{expected ')'}} expected-error {{expected ')'}} expected-warning {{expected '':'' after the score expression; '':'' assumed}} expected-warning {{expected identifier or string literal describing a context property; property skipped}} expected-note {{to match this '('}} expected-note {{context property options are: 'amd' 'arm' 'bsc' 'cray' 'fujitsu' 'gnu' 'ibm' 'intel' 'llvm' 'nec' 'nvidia' 'pgi' 'ti' 'unknown'}} expected-note {{to match this '('}}
|
||||
#pragma omp declare variant(foo) match(implementation={vendor(score(foo()) ibm)}) // expected-warning {{expected '':'' after the score expression; '':'' assumed}} expected-warning {{score expressions in the OpenMP context selector need to be constant; foo() is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation={vendor(score(foo()) ibm)}) // expected-warning {{expected '':'' after the score expression; '':'' assumed}} expected-warning {{score expressions in the OpenMP context selector need to be constant; 'foo()' is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation={vendor(score(5): ibm), vendor(llvm)}) // expected-warning {{the context selector 'vendor' was used already in the same 'omp declare variant' directive; selector ignored}} expected-note {{the previous context selector 'vendor' used here}} expected-note {{the ignored selector spans until here}}
|
||||
#pragma omp declare variant(foo) match(implementation={vendor(score(5): ibm), kind(cpu)}) // expected-warning {{the context selector 'kind' is not valid for the context set 'implementation'; selector ignored}} expected-note {{the context selector 'kind' can be nested in the context set 'device'; try 'match(device={kind(property)})'}} expected-note {{the ignored selector spans until here}}
|
||||
#pragma omp declare variant(foo) match(device={xxx}) // expected-warning {{'xxx' is not a valid context selector for the context set 'device'; selector ignored}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} expected-note {{the ignored selector spans until here}}
|
||||
@@ -53,18 +53,18 @@ int foo(void);
|
||||
#pragma omp declare variant(foo) match(target_device={kind}) // expected-warning {{the context selector 'kind' in context set 'target_device' requires a context property defined in parentheses; selector ignored}} expected-note {{the ignored selector spans until here}}
|
||||
#pragma omp declare variant(foo) match(target_device={kind(}) // expected-error {{expected ')'}} expected-warning {{expected identifier or string literal describing a context property; property skipped}} expected-note {{context property options are: 'host' 'nohost' 'cpu' 'gpu' 'fpga' 'any'}} expected-note {{to match this '('}}
|
||||
#pragma omp declare variant(foo) match(target_device={kind()}) // expected-warning {{expected identifier or string literal describing a context property; property skipped}} expected-note {{context property options are: 'host' 'nohost' 'cpu' 'gpu' 'fpga' 'any'}}
|
||||
#pragma omp declare variant(foo) match(target_device={device_num}) // expected-warning {{the context selector 'device_num' in context set 'target_device' requires a context property defined in parentheses; selector ignored}} expected-note {{the ignored selector spans until here}}
|
||||
#pragma omp declare variant(foo) match(target_device={device_num}) // expected-warning {{the context selector 'device_num' in context set 'target_device' requires a context property defined in parentheses; selector ignored}} expected-note {{the ignored selector spans until here}}
|
||||
#pragma omp declare variant(foo) match(target_device={device_num()}) // expected-error {{expected expression}}
|
||||
#pragma omp declare variant(foo) match(target_device={device_num(-1)}) // expected-error {{argument to 'device_num' clause must be a non-negative integer value}}
|
||||
#pragma omp declare variant(foo) match(target_device={device_num(abc)}) // expected-error {{expected expression}} expected-error {{use of undeclared identifier 'abc'}}
|
||||
int bar(void);
|
||||
|
||||
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; foo is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo()) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; foo() is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; 'foo' is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo()) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; 'foo()' is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(<expr>) :llvm)}) // expected-error {{expected expression}} expected-error {{use of undeclared identifier 'expr'}} expected-error {{expected expression}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo)}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; foo is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo())}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; foo() is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo)}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; 'foo' is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo())}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; 'foo()' is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(<expr>)}) // expected-error {{expected expression}} expected-error {{use of undeclared identifier 'expr'}} expected-error {{expected expression}} expected-note {{the ignored selector spans until here}}
|
||||
int score_and_cond_non_const(void);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ T foofoo();
|
||||
#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score ibm)}) // expected-error {{expected '(' after 'score'}} expected-warning {{expected '':'' after the score expression; '':'' assumed}}
|
||||
#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score( ibm)}) // expected-error {{use of undeclared identifier 'ibm'}} expected-error {{expected ')'}} expected-warning {{expected '':'' after the score expression; '':'' assumed}} expected-warning {{expected identifier or string literal describing a context property; property skipped}} expected-note {{context property options are: 'amd' 'arm' 'bsc' 'cray' 'fujitsu' 'gnu' 'ibm' 'intel' 'llvm' 'nec' 'nvidia' 'pgi' 'ti' 'unknown'}} expected-note {{to match this '('}}
|
||||
#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(2 ibm)}) // expected-error {{expected ')'}} expected-error {{expected ')'}} expected-warning {{expected '':'' after the score expression; '':'' assumed}} expected-warning {{expected identifier or string literal describing a context property; property skipped}} expected-note {{to match this '('}} expected-note {{context property options are: 'amd' 'arm' 'bsc' 'cray' 'fujitsu' 'gnu' 'ibm' 'intel' 'llvm' 'nec' 'nvidia' 'pgi' 'ti' 'unknown'}} expected-note {{to match this '('}}
|
||||
#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(foofoo <int>()) ibm)}) // expected-warning {{expected '':'' after the score expression; '':'' assumed}} expected-warning {{score expressions in the OpenMP context selector need to be constant; foofoo<int>() is not and will be ignored}}
|
||||
#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(foofoo <int>()) ibm)}) // expected-warning {{expected '':'' after the score expression; '':'' assumed}} expected-warning {{score expressions in the OpenMP context selector need to be constant; 'foofoo<int>()' is not and will be ignored}}
|
||||
#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(5): ibm), vendor(llvm)}) // expected-warning {{the context selector 'vendor' was used already in the same 'omp declare variant' directive; selector ignored}} expected-note {{the previous context selector 'vendor' used here}} expected-note {{the ignored selector spans until here}}
|
||||
#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(5): ibm), kind(cpu)}) // expected-warning {{the context selector 'kind' is not valid for the context set 'implementation'; selector ignored}} expected-note {{the context selector 'kind' can be nested in the context set 'device'; try 'match(device={kind(property)})'}} expected-note {{the ignored selector spans until here}}
|
||||
#pragma omp declare variant(foofoo <int>) match(device={xxx}) // expected-warning {{'xxx' is not a valid context selector for the context set 'device'; selector ignored}} expected-note {{context selector options are: 'kind' 'arch' 'isa'}} expected-note {{the ignored selector spans until here}}
|
||||
@@ -95,11 +95,11 @@ int bar();
|
||||
template <typename T, int C>
|
||||
T barbar();
|
||||
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; foo is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo()) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; foo() is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; 'foo' is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo()) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; 'foo()' is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(<expr>) :llvm)}) // expected-error {{expected expression}} expected-error {{use of undeclared identifier 'expr'}} expected-error {{expected expression}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo)}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; foo is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo())}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; foo() is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo)}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; 'foo' is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo())}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; 'foo()' is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(<expr>)}) // expected-error {{expected expression}} expected-error {{use of undeclared identifier 'expr'}} expected-error {{expected expression}} expected-note {{the ignored selector spans until here}}
|
||||
int score_and_cond_non_const();
|
||||
|
||||
@@ -112,11 +112,11 @@ int score_and_cond_non_const();
|
||||
template<int C>
|
||||
int score_and_cond_non_const_no_inst();
|
||||
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; foo is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo()) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; foo() is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; 'foo' is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(foo()) :llvm)}) // expected-warning {{score expressions in the OpenMP context selector need to be constant; 'foo()' is not and will be ignored}}
|
||||
#pragma omp declare variant(foo) match(implementation = {vendor(score(<expr>) :llvm)}) // expected-error {{expected expression}} expected-error {{use of undeclared identifier 'expr'}} expected-error {{expected expression}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo)}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; foo is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo())}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; foo() is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo)}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; 'foo' is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(foo())}) // expected-error {{the user condition in the OpenMP context selector needs to be constant; 'foo()' is not}}
|
||||
#pragma omp declare variant(foo) match(user = {condition(<C>)}) // expected-error {{expected expression}} expected-error {{expected expression}} expected-note {{the ignored selector spans until here}}
|
||||
template<int C>
|
||||
int score_and_cond_non_const_inst();
|
||||
|
||||
@@ -111,7 +111,7 @@ template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp parallel for simd linear(ind2:LEN) // expected-warning {{zero linear step (ind2 should probably be const)}}
|
||||
#pragma omp parallel for simd linear(ind2:LEN) // expected-warning {{zero linear step ('ind2' should probably be const)}}
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ int main(int argc, char **argv) {
|
||||
for (i = 0; i < argc; ++i) ++i;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute parallel for simd linear(i: pval) // omp52-error {{use of undeclared identifier 'pval'}}
|
||||
#pragma omp distribute parallel for simd linear(i: pval) // omp52-error {{use of undeclared identifier 'pval'}}
|
||||
for (i = 0; i < argc; ++i) ++i;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
|
||||
@@ -111,7 +111,7 @@ template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp parallel for simd linear(ind2:LEN) // expected-warning {{zero linear step (ind2 should probably be const)}}
|
||||
#pragma omp parallel for simd linear(ind2:LEN) // expected-warning {{zero linear step ('ind2' should probably be const)}}
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp for linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
|
||||
@@ -72,7 +72,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp for simd linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -228,7 +228,7 @@ int main(int argc, char **argv) {
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp for simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#pragma omp for simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#pragma omp for simd linear(i)
|
||||
#endif
|
||||
@@ -236,7 +236,7 @@ int main(int argc, char **argv) {
|
||||
#ifdef OMP52
|
||||
#pragma omp for simd linear(j: step()) // omp52-error 2 {{expected expression}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp for simd linear(j: pval) // omp52-error {{use of undeclared identifier 'pval'}}
|
||||
#pragma omp for simd linear(j: pval) // omp52-error {{use of undeclared identifier 'pval'}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp for simd linear(i: val, step(2 // omp52-error 3 {{expected ')'}} omp52-note 2 {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
|
||||
@@ -481,7 +481,7 @@ void test_linear(void) {
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('x' and other variables in clause should probably be const)}}
|
||||
#pragma omp for simd linear(x, y : 0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
@@ -81,7 +81,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp masked taskloop simd linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -274,13 +274,13 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#ifdef OMP52
|
||||
#pragma omp masked taskloop simd linear(j: ref)
|
||||
#else
|
||||
#else
|
||||
#pragma omp masked taskloop simd linear(ref(j))
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp masked taskloop simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#else
|
||||
#pragma omp masked taskloop simd linear(i)
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
|
||||
@@ -81,7 +81,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp master taskloop simd linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -275,13 +275,13 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#ifdef OMP52
|
||||
#pragma omp master taskloop simd linear(j: ref)
|
||||
#else
|
||||
#else
|
||||
#pragma omp master taskloop simd linear(ref(j)) // omp52-error {{old syntax 'linear-modifier(list)' on 'linear' clause was deprecated, use new syntax 'linear(list: [linear-modifier,] step(step-size))'}}
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp master taskloop simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#else
|
||||
#pragma omp master taskloop simd linear(i)
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
|
||||
@@ -83,7 +83,7 @@ T test_template(T *arr, N num) {
|
||||
template <int LEN>
|
||||
int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp parallel for linear(ind2 : LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
|
||||
@@ -71,7 +71,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp parallel for simd linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
|
||||
@@ -472,7 +472,7 @@ void test_linear(void) {
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('x' and other variables in clause should probably be const)}}
|
||||
#pragma omp parallel for simd linear(x, y : 0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
@@ -81,7 +81,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp parallel masked taskloop simd linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -275,13 +275,13 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#ifdef OMP52
|
||||
#pragma omp parallel masked taskloop simd linear(j: ref)
|
||||
#else
|
||||
#else
|
||||
#pragma omp parallel masked taskloop simd linear(ref(j)) // omp52-error {{old syntax 'linear-modifier(list)' on 'linear' clause was deprecated, use new syntax 'linear(list: [linear-modifier,] step(step-size))'}}
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp parallel masked taskloop simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#pragma omp parallel masked taskloop simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#pragma omp parallel masked taskloop simd linear(i)
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
|
||||
@@ -81,7 +81,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp parallel master taskloop simd linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -275,13 +275,13 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#ifdef OMP52
|
||||
#pragma omp parallel master taskloop simd linear(j: ref)
|
||||
#else
|
||||
#else
|
||||
#pragma omp parallel master taskloop simd linear(ref(j)) // omp52-error {{old syntax 'linear-modifier(list)' on 'linear' clause was deprecated, use new syntax 'linear(list: [linear-modifier,] step(step-size))'}}
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp parallel master taskloop simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#else
|
||||
#pragma omp parallel master taskloop simd linear(i)
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
|
||||
@@ -71,7 +71,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp simd linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -265,13 +265,13 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#ifdef OMP52
|
||||
#pragma omp simd linear(j: ref)
|
||||
#else
|
||||
#else
|
||||
#pragma omp simd linear(ref(j)) // omp52-error {{old syntax 'linear-modifier(list)' on 'linear' clause was deprecated, use new syntax 'linear(list: [linear-modifier,] step(step-size))'}}
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#else
|
||||
#pragma omp simd linear(i)
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
|
||||
@@ -469,7 +469,7 @@ void test_linear(void) {
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('x' and other variables in clause should probably be const)}}
|
||||
#pragma omp simd linear(x, y : 0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
@@ -92,7 +92,7 @@ T test_template(T *arr, N num) {
|
||||
template <int LEN>
|
||||
int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp target parallel for linear(ind2 : LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -291,7 +291,7 @@ int main(int argc, char **argv) {
|
||||
++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp target parallel for linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#else
|
||||
#pragma omp target parallel for linear(i)
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k)
|
||||
|
||||
@@ -94,7 +94,7 @@ T test_template(T *arr, N num) {
|
||||
template <int LEN>
|
||||
int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp target parallel for simd linear(ind2 : LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -293,7 +293,7 @@ int main(int argc, char **argv) {
|
||||
++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp target parallel for simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#else
|
||||
#pragma omp target parallel for simd linear(i)
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k)
|
||||
|
||||
@@ -93,7 +93,7 @@ T test_template(T *arr, N num) {
|
||||
template <int LEN>
|
||||
int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp target simd linear(ind2 : LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -292,7 +292,7 @@ int main(int argc, char **argv) {
|
||||
++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp target simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#else
|
||||
#pragma omp target simd linear(i)
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k)
|
||||
|
||||
@@ -96,7 +96,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-error@+1 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}}
|
||||
#pragma omp target teams distribute parallel for simd linear(ind2:LEN) // expected-warning {{zero linear step (ind2 should probably be const)}}
|
||||
#pragma omp target teams distribute parallel for simd linear(ind2:LEN) // expected-warning {{zero linear step ('ind2' should probably be const)}}
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-error@+1 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}}
|
||||
#pragma omp target teams distribute simd linear(ind2:LEN) // expected-warning {{zero linear step (ind2 should probably be const)}}
|
||||
#pragma omp target teams distribute simd linear(ind2:LEN) // expected-warning {{zero linear step ('ind2' should probably be const)}}
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ int main(int argc, char **argv, char *env[]) {
|
||||
#pragma omp task affinity(iterator(unsigned argc: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected '=' in iterator specifier}} expected-error 2 {{expected expression}} expected-error {{expected ',' or ')' after iterator specifier}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
|
||||
#pragma omp task affinity(iterator(unsigned argc = // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error 2 {{expected expression}} expected-error {{expected ',' or ')' after iterator specifier}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
|
||||
#pragma omp task affinity(iterator(vector argc = 0:2):argc) // expected-error {{expected integral or pointer type as the iterator-type, not 'vector'}} expected-error {{expected expression}}
|
||||
#pragma omp task affinity(iterator(vector *argc = nullptr:nullptr+2:0):argc) // expected-error {{invalid operands to binary expression ('std::nullptr_t' and 'int')}} expected-error {{iterator step expression 0 evaluates to 0}} expected-error {{expected expression}}
|
||||
#pragma omp task affinity(iterator(vector *argc = nullptr:nullptr+2:0):argc) // expected-error {{invalid operands to binary expression ('std::nullptr_t' and 'int')}} expected-error {{iterator step expression '0' evaluates to 0}} expected-error {{expected expression}}
|
||||
#pragma omp task affinity(iterator(vector *argc = 0:vector():argc):argc) // expected-error {{converting 'vector' to incompatible type 'vector *'}} expected-error {{expected expression}}
|
||||
foo();
|
||||
#pragma omp task affinity(iterator(i = 0:10, i = 0:10) : argv[i]) // expected-error {{redefinition of 'i'}} expected-note {{previous definition is here}}
|
||||
|
||||
@@ -78,7 +78,7 @@ int main(int argc, char **argv, char *env[]) {
|
||||
#pragma omp task depend(iterator(unsigned argc: // expected-error {{expected ')'}} omp45-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-note {{to match this '('}} omp50-error {{expected '=' in iterator specifier}} omp50-error 2 {{expected expression}} omp50-error {{expected ',' or ')' after iterator specifier}} omp50-error {{expected ')'}} omp50-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'depobj' in OpenMP clause 'depend'}} omp50-error {{expected ','}} omp50-note {{to match this '('}} omp51-error {{expected '=' in iterator specifier}} omp51-error 2 {{expected expression}} omp51-error {{expected ',' or ')' after iterator specifier}} omp51-error {{expected ')'}} omp51-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset', 'depobj' or 'inoutset' in OpenMP clause 'depend'}} omp51-error {{expected ','}} omp51-note {{to match this '('}}
|
||||
#pragma omp task depend(iterator(unsigned argc = // expected-error {{expected ')'}} omp45-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-note {{to match this '('}} omp50-error 2 {{expected expression}} omp50-error {{expected ',' or ')' after iterator specifier}} omp50-error {{expected ')'}} omp50-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'depobj' in OpenMP clause 'depend'}} omp50-error {{expected ','}} omp50-note {{to match this '('}} omp51-error 2 {{expected expression}} omp51-error {{expected ',' or ')' after iterator specifier}} omp51-error {{expected ')'}} omp51-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset', 'depobj' or 'inoutset' in OpenMP clause 'depend'}} omp51-error {{expected ','}} omp51-note {{to match this '('}}
|
||||
#pragma omp task depend(iterator(vector argc = 0:2):argc) // omp45-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} omp50-error {{expected integral or pointer type as the iterator-type, not 'vector'}} omp50-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'depobj' in OpenMP clause 'depend'}} omp50-error {{expected ','}} omp51-error {{expected integral or pointer type as the iterator-type, not 'vector'}} omp51-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset', 'depobj' or 'inoutset' in OpenMP clause 'depend'}} omp51-error {{expected ','}}
|
||||
#pragma omp task depend(iterator(vector *argc = nullptr:nullptr+2:0), in:argc) // omp45-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} omp50-error {{invalid operands to binary expression ('std::nullptr_t' and 'int')}} omp50-error {{iterator step expression 0 evaluates to 0}} omp51-error {{invalid operands to binary expression ('std::nullptr_t' and 'int')}} omp51-error {{iterator step expression 0 evaluates to 0}}
|
||||
#pragma omp task depend(iterator(vector *argc = nullptr:nullptr+2:0), in:argc) // omp45-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} omp50-error {{invalid operands to binary expression ('std::nullptr_t' and 'int')}} omp50-error {{iterator step expression '0' evaluates to 0}} omp51-error {{invalid operands to binary expression ('std::nullptr_t' and 'int')}} omp51-error {{iterator step expression '0' evaluates to 0}}
|
||||
#pragma omp task depend(iterator(vector *argc = 0:vector():argc), in:argc) // omp45-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} omp50-error {{converting 'vector' to incompatible type 'vector *'}} omp51-error {{converting 'vector' to incompatible type 'vector *'}}
|
||||
foo();
|
||||
#pragma omp task depend(iterator(unsigned argc = 0:10), in : argc) // omp45-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}}
|
||||
|
||||
@@ -81,7 +81,7 @@ template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
// expected-warning@+1 {{zero linear step ('ind2' should probably be const)}}
|
||||
#pragma omp taskloop simd linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
@@ -275,13 +275,13 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#ifdef OMP52
|
||||
#pragma omp taskloop simd linear(j: ref)
|
||||
#else
|
||||
#else
|
||||
#pragma omp taskloop simd linear(ref(j)) // omp52-error {{old syntax 'linear-modifier(list)' on 'linear' clause was deprecated, use new syntax 'linear(list: [linear-modifier,] step(step-size))'}}
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#ifdef OMP52
|
||||
#pragma omp taskloop simd linear(i: step(1), step(2)) // omp52-error {{multiple 'step size' found in linear clause}}
|
||||
#else
|
||||
#else
|
||||
#pragma omp taskloop simd linear(i)
|
||||
#endif
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
|
||||
@@ -100,7 +100,7 @@ template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-error@+2 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}}
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute parallel for simd linear(ind2:LEN) // expected-warning {{zero linear step (ind2 should probably be const)}}
|
||||
#pragma omp teams distribute parallel for simd linear(ind2:LEN) // expected-warning {{zero linear step ('ind2' should probably be const)}}
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-error@+2 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}}
|
||||
#pragma omp target
|
||||
#pragma omp teams distribute simd linear(ind2:LEN) // expected-warning {{zero linear step (ind2 should probably be const)}}
|
||||
#pragma omp teams distribute simd linear(ind2:LEN) // expected-warning {{zero linear step ('ind2' should probably be const)}}
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ void foo1(int A)
|
||||
for(int I=0; I<256; ++I) { bar(I); }
|
||||
|
||||
#ifdef __SIZEOF_INT128__
|
||||
// expected-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was (__int128_t)1311768467294899680ULL << 64}}
|
||||
// expected-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was '(__int128_t)1311768467294899680ULL << 64'}}
|
||||
[[clang::code_align((__int128_t)0x1234567890abcde0ULL << 64)]]
|
||||
for(int I=0; I<256; ++I) { bar(I); }
|
||||
#endif
|
||||
@@ -99,7 +99,7 @@ void foo1(int A)
|
||||
#ifdef __SIZEOF_INT128__
|
||||
// cpp-local-error@+3{{expression is not an integral constant expression}}
|
||||
// cpp-local-note@+2{{left shift of negative value -1311768467294899680}}
|
||||
// c-local-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -(__int128_t)1311768467294899680ULL << 64}}
|
||||
// c-local-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was '-(__int128_t)1311768467294899680ULL << 64'}}
|
||||
[[clang::code_align(-(__int128_t)0x1234567890abcde0ULL << 64)]]
|
||||
for(int I=0; I<256; ++I) { bar(I); }
|
||||
#endif
|
||||
|
||||
@@ -25,8 +25,8 @@ enum num {
|
||||
|
||||
int test(int a, unsigned b, enum num n) {
|
||||
boolean r;
|
||||
r = a << a; // expected-warning {{converting the result of '<<' to a boolean; did you mean '(a << a) != 0'?}}
|
||||
r = MM; // expected-warning {{converting the result of '<<' to a boolean; did you mean '(a << a) != 0'?}}
|
||||
r = a << a; // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
r = MM; // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
r = (1 << 7); // expected-warning {{converting the result of '<<' to a boolean always evaluates to true}}
|
||||
r = 2UL << 2; // expected-warning {{converting the result of '<<' to a boolean always evaluates to true}}
|
||||
r = 0 << a; // expected-warning {{converting the result of '<<' to a boolean always evaluates to false}}
|
||||
@@ -34,23 +34,23 @@ int test(int a, unsigned b, enum num n) {
|
||||
r = 1 << 0; // expected-warning {{converting the result of '<<' to a boolean always evaluates to true}}
|
||||
r = 1 << 2; // expected-warning {{converting the result of '<<' to a boolean always evaluates to true}}
|
||||
r = 1ULL << 2; // expected-warning {{converting the result of '<<' to a boolean always evaluates to true}}
|
||||
r = 2 << b; // expected-warning {{converting the result of '<<' to a boolean; did you mean '(2 << b) != 0'?}}
|
||||
r = 2 << b; // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
r = (unsigned)(2 << b);
|
||||
r = b << 7;
|
||||
r = (1 << a); // expected-warning {{converting the result of '<<' to a boolean; did you mean '(1 << a) != 0'?}}
|
||||
r = TWO << a; // expected-warning {{converting the result of '<<' to a boolean; did you mean '(2 << a) != 0'?}}
|
||||
r = a << 7; // expected-warning {{converting the result of '<<' to a boolean; did you mean '(a << 7) != 0'?}}
|
||||
r = ONE << a; // expected-warning {{converting the result of '<<' to a boolean; did you mean '(1 << a) != 0'?}}
|
||||
if (TWO << a) // expected-warning {{converting the result of '<<' to a boolean; did you mean '(2 << a) != 0'?}}
|
||||
r = (1 << a); // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
r = TWO << a; // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
r = a << 7; // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
r = ONE << a; // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
if (TWO << a) // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
return a;
|
||||
|
||||
a = 1 << 2 ? 0: 1; // expected-warning {{converting the result of '<<' to a boolean always evaluates to true}}
|
||||
a = 1 << a ? 0: 1; // expected-warning {{converting the result of '<<' to a boolean; did you mean '(1 << a) != 0'?}}
|
||||
|
||||
for (a = 0; 1 << a; a++) // expected-warning {{converting the result of '<<' to a boolean; did you mean '(1 << a) != 0'?}}
|
||||
a = 1 << 2 ? 0: 1; // expected-warning {{converting the result of '<<' to a boolean always evaluates to true}}
|
||||
a = 1 << a ? 0: 1; // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
|
||||
for (a = 0; 1 << a; a++) // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
;
|
||||
|
||||
if (a << TWO) // expected-warning {{converting the result of '<<' to a boolean; did you mean '(a << 2) != 0'?}}
|
||||
if (a << TWO) // expected-warning {{converting the result of '<<' to a boolean}}
|
||||
return a;
|
||||
|
||||
if (n || two)
|
||||
|
||||
@@ -121,13 +121,13 @@ MyLongPointerFromConversion global2;
|
||||
|
||||
void initLocalGslPtrWithTempOwner() {
|
||||
MyIntPointer p = MyIntOwner{}; // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}}
|
||||
MyIntPointer pp = p = MyIntOwner{}; // expected-warning {{object backing the pointer p will be}}
|
||||
p = MyIntOwner{}; // expected-warning {{object backing the pointer p }}
|
||||
MyIntPointer pp = p = MyIntOwner{}; // expected-warning {{object backing the pointer 'p' will be}}
|
||||
p = MyIntOwner{}; // expected-warning {{object backing the pointer 'p' }}
|
||||
pp = p; // no warning
|
||||
global = MyIntOwner{}; // expected-warning {{object backing the pointer global }}
|
||||
global = MyIntOwner{}; // expected-warning {{object backing the pointer 'global' }}
|
||||
MyLongPointerFromConversion p2 = MyLongOwnerWithConversion{}; // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}}
|
||||
p2 = MyLongOwnerWithConversion{}; // expected-warning {{object backing the pointer p2 }}
|
||||
global2 = MyLongOwnerWithConversion{}; // expected-warning {{object backing the pointer global2 }}
|
||||
p2 = MyLongOwnerWithConversion{}; // expected-warning {{object backing the pointer 'p2' }}
|
||||
global2 = MyLongOwnerWithConversion{}; // expected-warning {{object backing the pointer 'global2' }}
|
||||
}
|
||||
|
||||
|
||||
@@ -707,7 +707,7 @@ std::string_view test1() {
|
||||
std::string_view t1 = Ref(std::string()); // expected-warning {{object backing}}
|
||||
t1 = Ref(std::string()); // expected-warning {{object backing}}
|
||||
return Ref(std::string()); // expected-warning {{returning address}}
|
||||
|
||||
|
||||
std::string_view t2 = TakeSv(std::string()); // expected-warning {{object backing}}
|
||||
t2 = TakeSv(std::string()); // expected-warning {{object backing}}
|
||||
return TakeSv(std::string()); // expected-warning {{returning address}}
|
||||
@@ -731,15 +731,15 @@ std::string_view test2(Foo<std::string> r1, Foo<std::string_view> r2) {
|
||||
std::string_view t1 = Foo<std::string>().get(); // expected-warning {{object backing}}
|
||||
t1 = Foo<std::string>().get(); // expected-warning {{object backing}}
|
||||
return r1.get(); // expected-warning {{address of stack}}
|
||||
|
||||
|
||||
std::string_view t2 = Foo<std::string_view>().get();
|
||||
t2 = Foo<std::string_view>().get();
|
||||
return r2.get();
|
||||
|
||||
// no warning on no-LB-annotated method.
|
||||
std::string_view t3 = Foo<std::string>().getNoLB();
|
||||
t3 = Foo<std::string>().getNoLB();
|
||||
return r1.getNoLB();
|
||||
std::string_view t3 = Foo<std::string>().getNoLB();
|
||||
t3 = Foo<std::string>().getNoLB();
|
||||
return r1.getNoLB();
|
||||
}
|
||||
|
||||
struct Bar {};
|
||||
@@ -771,7 +771,7 @@ void test4() {
|
||||
// Ideally, we would diagnose the following case, but due to implementation
|
||||
// constraints, we do not.
|
||||
const int& t4 = *MySpan<int>(std::vector<int>{}).begin();
|
||||
|
||||
|
||||
auto it1 = MySpan<int>(v).begin(); // expected-warning {{temporary whose address is use}}
|
||||
auto it2 = ReturnFirstIt(MySpan<int>(v)); // expected-warning {{temporary whose address is used}}
|
||||
}
|
||||
@@ -821,7 +821,7 @@ std::string_view foo(std::string_view sv [[clang::lifetimebound]]);
|
||||
void test1() {
|
||||
std::string_view k1 = S().sv; // OK
|
||||
std::string_view k2 = S().s; // expected-warning {{object backing the pointer will}}
|
||||
|
||||
|
||||
std::string_view k3 = Q().get()->sv; // OK
|
||||
std::string_view k4 = Q().get()->s; // expected-warning {{object backing the pointer will}}
|
||||
|
||||
@@ -863,7 +863,7 @@ struct StatusOr {
|
||||
const char* foo() {
|
||||
StatusOr<std::string> s;
|
||||
return s->data(); // expected-warning {{address of stack memory associated with local variable}}
|
||||
|
||||
|
||||
StatusOr<std::string_view> s2;
|
||||
return s2->data();
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@ void nonMember(
|
||||
const int &x1 [[clang::lifetime_capture_by(s, t)]],
|
||||
S &s,
|
||||
S &t,
|
||||
const int &x2 [[clang::lifetime_capture_by(12345 + 12)]], // expected-error {{'lifetime_capture_by' attribute argument 12345 + 12 is not a known function parameter; must be a function parameter, 'this', 'global' or 'unknown'}}
|
||||
const int &x2 [[clang::lifetime_capture_by(12345 + 12)]], // expected-error {{'lifetime_capture_by' attribute argument '12345 + 12' is not a known function parameter; must be a function parameter, 'this', 'global' or 'unknown'}}
|
||||
const int &x3 [[clang::lifetime_capture_by(abcdefgh)]], // expected-error {{'lifetime_capture_by' attribute argument 'abcdefgh' is not a known function parameter; must be a function parameter, 'this', 'global' or 'unknown'}}
|
||||
const int &x4 [[clang::lifetime_capture_by("abcdefgh")]], // expected-error {{'lifetime_capture_by' attribute argument "abcdefgh" is not a known function parameter; must be a function parameter, 'this', 'global' or 'unknown'}}
|
||||
const int &x4 [[clang::lifetime_capture_by("abcdefgh")]], // expected-error {{'lifetime_capture_by' attribute argument '"abcdefgh"' is not a known function parameter; must be a function parameter, 'this', 'global' or 'unknown'}}
|
||||
const int &x5 [[clang::lifetime_capture_by(this)]], // expected-error {{'lifetime_capture_by' argument references unavailable implicit 'this'}}
|
||||
const int &x6 [[clang::lifetime_capture_by()]], // expected-error {{'lifetime_capture_by' attribute specifies no capturing entity}}
|
||||
const int& x7 [[clang::lifetime_capture_by(u,
|
||||
const int& x7 [[clang::lifetime_capture_by(u,
|
||||
x7)]], // expected-error {{'lifetime_capture_by' argument references itself}}
|
||||
const int &x8 [[clang::lifetime_capture_by(global)]],
|
||||
const int &x9 [[clang::lifetime_capture_by(unknown)]],
|
||||
@@ -35,9 +35,9 @@ void global_param_name(const int& global, // expected-error {{parameter cannot b
|
||||
const int& s [[clang::lifetime_capture_by(global)]]);
|
||||
struct T {
|
||||
void member(
|
||||
const int &x [[clang::lifetime_capture_by(s)]],
|
||||
const int &x [[clang::lifetime_capture_by(s)]],
|
||||
S &s,
|
||||
S &t,
|
||||
S &t,
|
||||
const int &y [[clang::lifetime_capture_by(s)]],
|
||||
const int &z [[clang::lifetime_capture_by(this, x, y)]],
|
||||
const int &u [[clang::lifetime_capture_by(global, unknown, x, s)]])
|
||||
|
||||
@@ -69,10 +69,10 @@ namespace usage_ok {
|
||||
const int& s = crefparam(2); // expected-warning {{temporary bound to local reference 's' will be destroyed at the end of the full-expression}}
|
||||
|
||||
void test_assignment() {
|
||||
p = A().class_member(); // expected-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
|
||||
p = {A().class_member()}; // expected-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
|
||||
q = A(); // expected-warning {{object backing the pointer q will be destroyed at the end of the full-expression}}
|
||||
r = A(1); // expected-warning {{object backing the pointer r will be destroyed at the end of the full-expression}}
|
||||
p = A().class_member(); // expected-warning {{object backing the pointer 'p' will be destroyed at the end of the full-expression}}
|
||||
p = {A().class_member()}; // expected-warning {{object backing the pointer 'p' will be destroyed at the end of the full-expression}}
|
||||
q = A(); // expected-warning {{object backing the pointer 'q' will be destroyed at the end of the full-expression}}
|
||||
r = A(1); // expected-warning {{object backing the pointer 'r' will be destroyed at the end of the full-expression}}
|
||||
}
|
||||
|
||||
struct FieldCheck {
|
||||
@@ -85,7 +85,7 @@ namespace usage_ok {
|
||||
Set c;
|
||||
int * d;
|
||||
};
|
||||
Pair p;
|
||||
Pair p;
|
||||
FieldCheck(const int& a): p(a){}
|
||||
Pair& getR() [[clang::lifetimebound]] { return p; }
|
||||
Pair* getP() [[clang::lifetimebound]] { return &p; }
|
||||
@@ -356,8 +356,8 @@ struct StatusOr {
|
||||
};
|
||||
|
||||
void test(StatusOr<FooView> foo1, StatusOr<NonAnnotatedFooView> foo2) {
|
||||
foo1 = Foo(); // expected-warning {{object backing foo1 will be destroyed at the end}}
|
||||
foo1 = Foo(); // expected-warning {{object backing 'foo1' will be destroyed at the end}}
|
||||
// This warning is triggered by the lifetimebound annotation, regardless of whether the class type is annotated with GSL.
|
||||
foo2 = NonAnnotatedFoo(); // expected-warning {{object backing foo2 will be destroyed at the end}}
|
||||
foo2 = NonAnnotatedFoo(); // expected-warning {{object backing 'foo2' will be destroyed at the end}}
|
||||
}
|
||||
} // namespace GH106372
|
||||
|
||||
@@ -4,8 +4,8 @@ struct NotAPack;
|
||||
template <typename T, auto V, template<typename> typename Tp>
|
||||
void not_pack() {
|
||||
int i = 0;
|
||||
i...[0]; // expected-error {{i does not refer to the name of a parameter pack}}
|
||||
V...[0]; // expected-error {{V does not refer to the name of a parameter pack}}
|
||||
i...[0]; // expected-error {{'i' does not refer to the name of a parameter pack}}
|
||||
V...[0]; // expected-error {{'V' does not refer to the name of a parameter pack}}
|
||||
NotAPack...[0] a; // expected-error{{'NotAPack' does not refer to the name of a parameter pack}}
|
||||
T...[0] b; // expected-error{{'T' does not refer to the name of a parameter pack}}
|
||||
Tp...[0] c; // expected-error{{'Tp' does not refer to the name of a parameter pack}}
|
||||
@@ -42,11 +42,11 @@ int test_types() {
|
||||
|
||||
void test() {
|
||||
params<0>(); // expected-note{{here}} \
|
||||
// expected-error@#error-param-size {{invalid index 0 for pack p of size 0}}
|
||||
// expected-error@#error-param-size {{invalid index 0 for pack 'p' of size 0}}
|
||||
params<1>(0); // expected-note{{here}} \
|
||||
// expected-error@#error-param-size {{invalid index 1 for pack p of size 1}}
|
||||
// expected-error@#error-param-size {{invalid index 1 for pack 'p' of size 1}}
|
||||
params<-1>(0); // expected-note{{here}} \
|
||||
// expected-error@#error-param-size {{invalid index -1 for pack p of size 1}}
|
||||
// expected-error@#error-param-size {{invalid index -1 for pack 'p' of size 1}}
|
||||
|
||||
test_types<-1>(); //expected-note {{in instantiation}} \
|
||||
// expected-error@#error-type-size {{invalid index -1 for pack 'T' of size 0}}
|
||||
@@ -190,7 +190,7 @@ void h() {
|
||||
|
||||
static_assert(__is_same(decltype(g<foo{}, bar{}, baz{}>(sequence<0, 2, 1>())), W<foo{}, baz{}, bar{}>));
|
||||
g<foo{}>(sequence<4>());
|
||||
// expected-error@#nttp-use {{invalid index 4 for pack args of size 1}}
|
||||
// expected-error@#nttp-use {{invalid index 4 for pack 'args' of size 1}}
|
||||
// expected-note-re@-2 {{function template specialization '{{.*}}' requested here}}
|
||||
}
|
||||
}
|
||||
@@ -214,7 +214,7 @@ void f( ) {
|
||||
test(1);
|
||||
test2<1>();
|
||||
test2();
|
||||
// expected-error@#test2-R {{invalid index 0 for pack args of size 0}}
|
||||
// expected-error@#test2-R {{invalid index 0 for pack 'args' of size 0}}
|
||||
// expected-note@#test2-call {{requested here}}
|
||||
// expected-note@-3 {{requested here}}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ using T = int[];
|
||||
|
||||
void f() {
|
||||
int *p = &(int&)(int&&)0; // expected-warning {{temporary whose address is used as value of local variable 'p' will be destroyed at the end of the full-expression}}
|
||||
p = &(int&)(int&&)0; // expected-warning {{object backing the pointer p will be destroyed at the end of the full-expression}}
|
||||
p = &(int&)(int&&)0; // expected-warning {{object backing the pointer 'p' will be destroyed at the end of the full-expression}}
|
||||
|
||||
int *q = (int *const &)T{1, 2, 3}; // expected-warning {{temporary whose address is used as value of local variable 'q' will be destroyed at the end of the full-expression}}
|
||||
q = (int *const &)T{1, 2, 3}; // expected-warning {{object backing the pointer q will be destroyed at the end of the full-expression}}
|
||||
q = (int *const &)T{1, 2, 3}; // expected-warning {{object backing the pointer 'q' will be destroyed at the end of the full-expression}}
|
||||
|
||||
// FIXME: We don't warn here because the 'int*' temporary is not const, but
|
||||
// it also can't have actually changed since it was created, so we could
|
||||
@@ -35,5 +35,5 @@ struct basic_string {
|
||||
} // namespace std
|
||||
void test(const char* a) {
|
||||
// verify we're emitting the `-Wdangling-assignment-gsl` warning.
|
||||
a = std::basic_string().c_str(); // expected-warning {{object backing the pointer a will be destroyed at the end of the full-expression}}
|
||||
a = std::basic_string().c_str(); // expected-warning {{object backing the pointer 'a' will be destroyed at the end of the full-expression}}
|
||||
}
|
||||
|
||||
@@ -32,24 +32,24 @@ void test_asuint_first_arg_const(double D) {
|
||||
const uint A = 0;
|
||||
uint B;
|
||||
asuint(D, A, B);
|
||||
// expected-error@hlsl/hlsl_intrinsics.h:* {{read-only variable is not assignable}}
|
||||
// expected-error@hlsl/hlsl_intrinsics.h:* {{read-only variable is not assignable}}
|
||||
}
|
||||
|
||||
void test_asuint_second_arg_const(double D) {
|
||||
const uint A = 0;
|
||||
uint B;
|
||||
asuint(D, B, A);
|
||||
// expected-error@hlsl/hlsl_intrinsics.h:* {{read-only variable is not assignable}}
|
||||
// expected-error@hlsl/hlsl_intrinsics.h:* {{read-only variable is not assignable}}
|
||||
}
|
||||
|
||||
void test_asuint_imidiate_value(double D) {
|
||||
uint B;
|
||||
asuint(D, B, 1);
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument 1 to out paramemter}}
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument '1' to out paramemter}}
|
||||
}
|
||||
|
||||
void test_asuint_expr(double D) {
|
||||
uint B;
|
||||
asuint(D, B, B + 1);
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument B + 1 to out paramemter}}
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument 'B + 1' to out paramemter}}
|
||||
}
|
||||
|
||||
@@ -61,5 +61,5 @@ int2 test_select_builtin_second_arg_not_vector(bool2 p0, int2 t0, int f0) {
|
||||
|
||||
// if vector last 2 aren't same type (so both are vectors but wrong type)
|
||||
int1 test_select_builtin_diff_types(bool1 p0, int1 t0, float1 f0) {
|
||||
return __builtin_hlsl_select(p0, t0, f0); // expected-error{{second and third arguments to __builtin_hlsl_select must be of scalar or vector type with matching scalar element type: 'vector<int, [...]>' vs 'vector<float, [...]>'}}
|
||||
return __builtin_hlsl_select(p0, t0, f0); // expected-error{{second and third arguments to '__builtin_hlsl_select' must be of scalar or vector type with matching scalar element type: 'vector<int, [...]>' vs 'vector<float, [...]>'}}
|
||||
}
|
||||
|
||||
@@ -2,75 +2,75 @@
|
||||
|
||||
void test_no_second_arg(double D) {
|
||||
__builtin_hlsl_elementwise_splitdouble(D);
|
||||
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
|
||||
// expected-error@-1 {{too few arguments to function call, expected 3, have 1}}
|
||||
}
|
||||
|
||||
void test_no_third_arg(double D) {
|
||||
uint A;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, A);
|
||||
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
|
||||
// expected-error@-1 {{too few arguments to function call, expected 3, have 2}}
|
||||
}
|
||||
|
||||
void test_too_many_arg(double D) {
|
||||
uint A, B, C;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, A, B, C);
|
||||
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
|
||||
// expected-error@-1 {{too many arguments to function call, expected 3, have 4}}
|
||||
}
|
||||
|
||||
void test_first_arg_type_mismatch(bool3 D) {
|
||||
uint3 A, B;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, A, B);
|
||||
// expected-error@-1 {{invalid operand of type 'bool3' (aka 'vector<bool, 3>') where 'double' or a vector of such type is required}}
|
||||
// expected-error@-1 {{invalid operand of type 'bool3' (aka 'vector<bool, 3>') where 'double' or a vector of such type is required}}
|
||||
}
|
||||
|
||||
void test_second_arg_type_mismatch(double D) {
|
||||
bool A;
|
||||
uint B;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, A, B);
|
||||
// expected-error@-1 {{invalid operand of type 'bool' where 'unsigned int' or a vector of such type is required}}
|
||||
// expected-error@-1 {{invalid operand of type 'bool' where 'unsigned int' or a vector of such type is required}}
|
||||
}
|
||||
|
||||
void test_third_arg_type_mismatch(double D) {
|
||||
bool A;
|
||||
uint B;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, B, A);
|
||||
// expected-error@-1 {{invalid operand of type 'bool' where 'unsigned int' or a vector of such type is required}}
|
||||
// expected-error@-1 {{invalid operand of type 'bool' where 'unsigned int' or a vector of such type is required}}
|
||||
}
|
||||
|
||||
void test_const_second_arg(double D) {
|
||||
const uint A = 1;
|
||||
uint B;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, A, B);
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument A to out paramemter}}
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument 'A' to out paramemter}}
|
||||
}
|
||||
|
||||
void test_const_third_arg(double D) {
|
||||
uint A;
|
||||
const uint B = 1;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, A, B);
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument B to out paramemter}}
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument 'B' to out paramemter}}
|
||||
}
|
||||
|
||||
void test_number_second_arg(double D) {
|
||||
uint B;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, (uint)1, B);
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument (uint)1 to out paramemter}}
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument '(uint)1' to out paramemter}}
|
||||
}
|
||||
|
||||
void test_number_third_arg(double D) {
|
||||
uint B;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, B, (uint)1);
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument (uint)1 to out paramemter}}
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument '(uint)1' to out paramemter}}
|
||||
}
|
||||
|
||||
void test_expr_second_arg(double D) {
|
||||
uint B;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, B+1, B);
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument B + 1 to out paramemter}}
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument 'B + 1' to out paramemter}}
|
||||
}
|
||||
|
||||
void test_expr_third_arg(double D) {
|
||||
uint B;
|
||||
__builtin_hlsl_elementwise_splitdouble(D, B, B+1);
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument B + 1 to out paramemter}}
|
||||
// expected-error@-1 {{cannot bind non-lvalue argument 'B + 1' to out paramemter}}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ void InOutVecFn(inout float3) {}
|
||||
void case1() {
|
||||
float f;
|
||||
int i;
|
||||
OutVecFn(f); // expected-error{{illegal scalar extension cast on argument f to out paramemter}}
|
||||
InOutVecFn(f); // expected-error{{illegal scalar extension cast on argument f to inout paramemter}}
|
||||
OutVecFn(f); // expected-error{{illegal scalar extension cast on argument 'f' to out paramemter}}
|
||||
InOutVecFn(f); // expected-error{{illegal scalar extension cast on argument 'f' to inout paramemter}}
|
||||
|
||||
OutVecFn(i); // expected-error{{illegal scalar extension cast on argument i to out paramemter}}
|
||||
InOutVecFn(i); // expected-error{{illegal scalar extension cast on argument i to inout paramemter}}
|
||||
OutVecFn(i); // expected-error{{illegal scalar extension cast on argument 'i' to out paramemter}}
|
||||
InOutVecFn(i); // expected-error{{illegal scalar extension cast on argument 'i' to inout paramemter}}
|
||||
}
|
||||
|
||||
// Case 2: Conversion warnings on argument initialization. Clang generates
|
||||
|
||||
@@ -48,8 +48,8 @@ void callFns() {
|
||||
// Call with literal arguments.
|
||||
implicitFn(1); // Ok.
|
||||
inFn(1); // Ok.
|
||||
inoutFn(1); // expected-error{{cannot bind non-lvalue argument 1 to inout paramemter}}
|
||||
outFn(1); // expected-error{{cannot bind non-lvalue argument 1 to out paramemter}}
|
||||
inoutFn(1); // expected-error{{cannot bind non-lvalue argument '1' to inout paramemter}}
|
||||
outFn(1); // expected-error{{cannot bind non-lvalue argument '1' to out paramemter}}
|
||||
|
||||
// Call with variables.
|
||||
float f;
|
||||
|
||||
@@ -24,21 +24,21 @@ void test(void) {
|
||||
#if (__OPENCL_C_VERSION__ < CL_VERSION_2_0) || (__OPENCL_C_VERSION__ >= CL_VERSION_3_0 && !defined(__opencl_c_generic_address_space))
|
||||
// expected-error@-2{{use of undeclared identifier 'to_global'}}
|
||||
#else
|
||||
// expected-error@-4{{invalid argument x to function: 'to_global', expecting a generic pointer argument}}
|
||||
// expected-error@-4{{invalid argument 'x' to function: 'to_global', expecting a generic pointer argument}}
|
||||
#endif
|
||||
|
||||
glob = to_global(con);
|
||||
#if (__OPENCL_C_VERSION__ < CL_VERSION_2_0) || (__OPENCL_C_VERSION__ >= CL_VERSION_3_0 && !defined(__opencl_c_generic_address_space))
|
||||
// expected-error@-2{{use of undeclared identifier 'to_global'}}
|
||||
#else
|
||||
// expected-error@-4{{invalid argument con to function: 'to_global', expecting a generic pointer argument}}
|
||||
// expected-error@-4{{invalid argument 'con' to function: 'to_global', expecting a generic pointer argument}}
|
||||
#endif
|
||||
|
||||
glob = to_global(con_typedef);
|
||||
#if (__OPENCL_C_VERSION__ < CL_VERSION_2_0) || (__OPENCL_C_VERSION__ >= CL_VERSION_3_0 && !defined(__opencl_c_generic_address_space))
|
||||
// expected-error@-2{{use of undeclared identifier 'to_global'}}
|
||||
#else
|
||||
// expected-error@-4{{invalid argument con_typedef to function: 'to_global', expecting a generic pointer argument}}
|
||||
// expected-error@-4{{invalid argument 'con_typedef' to function: 'to_global', expecting a generic pointer argument}}
|
||||
#endif
|
||||
|
||||
loc = to_global(glob);
|
||||
|
||||
@@ -420,6 +420,7 @@ enum ModifierType {
|
||||
MT_Q,
|
||||
MT_ObjCClass,
|
||||
MT_ObjCInstance,
|
||||
MT_Quoted,
|
||||
};
|
||||
|
||||
static StringRef getModifierName(ModifierType MT) {
|
||||
@@ -447,6 +448,8 @@ static StringRef getModifierName(ModifierType MT) {
|
||||
return "objcclass";
|
||||
case MT_ObjCInstance:
|
||||
return "objcinstance";
|
||||
case MT_Quoted:
|
||||
return "quoted";
|
||||
case MT_Unknown:
|
||||
llvm_unreachable("invalid modifier type");
|
||||
}
|
||||
@@ -1113,6 +1116,7 @@ Piece *DiagnosticTextBuilder::DiagText::parseDiagText(StringRef &Text,
|
||||
.Case("q", MT_Q)
|
||||
.Case("objcclass", MT_ObjCClass)
|
||||
.Case("objcinstance", MT_ObjCInstance)
|
||||
.Case("quoted", MT_Quoted)
|
||||
.Case("", MT_Placeholder)
|
||||
.Default(MT_Unknown);
|
||||
|
||||
@@ -1264,6 +1268,7 @@ Piece *DiagnosticTextBuilder::DiagText::parseDiagText(StringRef &Text,
|
||||
case MT_Placeholder:
|
||||
case MT_ObjCClass:
|
||||
case MT_ObjCInstance:
|
||||
case MT_Quoted:
|
||||
case MT_Ordinal:
|
||||
case MT_Human: {
|
||||
Parsed.push_back(New<PlaceholderPiece>(ModType, parseModifier(Text)));
|
||||
|
||||
Reference in New Issue
Block a user