view clang/test/Preprocessor/pragma_assume_nonnull.c @ 237:c80f45b162ad llvm-original

add some fix
author kono
date Wed, 09 Nov 2022 17:47:54 +0900
parents c4bab56944e8
children
line wrap: on
line source

// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -E %s | FileCheck %s

// CHECK: #pragma clang assume_nonnull begin
#pragma clang assume_nonnull begin

int bar(int * ip) { return *ip; }

// CHECK: #pragma clang assume_nonnull end
#pragma clang assume_nonnull end

int foo(int * _Nonnull ip) { return *ip; }

int main(void) {
   return bar(0) + foo(0); // expected-warning 2 {{null passed to a callee that requires a non-null argument}}
}