Skip to content

Commit

Permalink
Fix diagnostic message
Browse files Browse the repository at this point in the history
  • Loading branch information
ahatanak committed Jan 24, 2024
1 parent 50068f2 commit 437441a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -8765,7 +8765,8 @@ def err_expected_callable_argument : Error<
def note_building_builtin_dump_struct_call : Note<
"in call to printing function with arguments '(%0)' while dumping struct">;
def err_builtin_verbose_trap_arg : Error<
"argument to __builtin_verbose_trap must be a non-empty string literal">;
"argument to __builtin_verbose_trap must be a pointer to a non-empty constant "
"string">;

def err_atomic_load_store_uses_lib : Error<
"atomic %select{load|store}0 requires runtime support that is not "
Expand Down
6 changes: 3 additions & 3 deletions clang/test/SemaCXX/verbose-trap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ void f(const char * arg) {
__builtin_verbose_trap("hello" "world");
__builtin_verbose_trap(constMsg1);
__builtin_verbose_trap(constMsg2);
__builtin_verbose_trap(""); // expected-error {{argument to __builtin_verbose_trap must be a non-empty string literal}}
__builtin_verbose_trap(""); // expected-error {{argument to __builtin_verbose_trap must be a pointer to a non-empty constant string}}
__builtin_verbose_trap(); // expected-error {{too few arguments}}
__builtin_verbose_trap(0); // expected-error {{argument to __builtin_verbose_trap must be a non-empty string literal}}
__builtin_verbose_trap(0); // expected-error {{argument to __builtin_verbose_trap must be a pointer to a non-empty constant string}}
__builtin_verbose_trap(1); // expected-error {{cannot initialize a parameter of type 'const char *' with}}
__builtin_verbose_trap(arg); // expected-error {{argument to __builtin_verbose_trap must be a non-empty string literal}}
__builtin_verbose_trap(arg); // expected-error {{argument to __builtin_verbose_trap must be a pointer to a non-empty constant string}}
__builtin_verbose_trap(str);
__builtin_verbose_trap(u8"hello");
}
Expand Down

0 comments on commit 437441a

Please sign in to comment.