mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-20 12:05:48 -04:00

Rather than sprinkle calls to DiagnoseUnusedExprResult() around in places where we want diagnostics, we now diagnose unused expression statements and full expressions in a more generic way when acting on the final expression statement. This results in more appropriate diagnostics for [[nodiscard]] where we were previously lacking them, such as when the body of a for loop is not a compound statement. This patch fixes PR39837. llvm-svn: 350404
19 lines
559 B
C
19 lines
559 B
C
|
|
#define Outer(action) action
|
|
|
|
void completeParam(int param) {
|
|
;
|
|
Outer(__extension__({ _Pragma("clang diagnostic push") }));
|
|
param;
|
|
}
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:7:1 %s | FileCheck %s
|
|
// CHECK: param : [#int#]param
|
|
|
|
void completeParamPragmaError(int param) {
|
|
Outer(__extension__({ _Pragma(2) })); // expected-error {{_Pragma takes a parenthesized string literal}}
|
|
param; // expected-warning {{expression result unused}}
|
|
}
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -code-completion-at=%s:16:1 %s | FileCheck %s
|