1*73ed2153SZijunZhaoCCK // RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify -Wformat-pedantic %s 2*73ed2153SZijunZhaoCCK // RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -fdiagnostics-parseable-fixits -Wformat-pedantic %s 2>&1 | FileCheck %s 30b07b06eSShoaib Meenai 40b07b06eSShoaib Meenai extern "C" int printf(const char * restrict, ...); 50b07b06eSShoaib Meenai 60b07b06eSShoaib Meenai #if __LP64__ 70b07b06eSShoaib Meenai typedef long CFIndex; 80b07b06eSShoaib Meenai typedef long NSInteger; 90b07b06eSShoaib Meenai typedef unsigned long NSUInteger; 100b07b06eSShoaib Meenai #else 110b07b06eSShoaib Meenai typedef int CFIndex; 120b07b06eSShoaib Meenai typedef int NSInteger; 130b07b06eSShoaib Meenai typedef unsigned int NSUInteger; 140b07b06eSShoaib Meenai #endif 150b07b06eSShoaib Meenai 160b07b06eSShoaib Meenai enum class CFIndexEnum : CFIndex { One }; 170b07b06eSShoaib Meenai enum class NSIntegerEnum : NSInteger { Two }; 180b07b06eSShoaib Meenai enum class NSUIntegerEnum : NSUInteger { Three }; 190b07b06eSShoaib Meenai f()200b07b06eSShoaib Meenaivoid f() { 210b07b06eSShoaib Meenai printf("%d", CFIndexEnum::One); // expected-warning{{format specifies type 'int' but the argument has type 'CFIndexEnum'}} 220b07b06eSShoaib Meenai // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%ld" 230b07b06eSShoaib Meenai // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"static_cast<long>(" 240b07b06eSShoaib Meenai // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:32-[[@LINE-3]]:32}:")" 250b07b06eSShoaib Meenai 260b07b06eSShoaib Meenai printf("%d", NSIntegerEnum::Two); // expected-warning{{format specifies type 'int' but the argument has type 'NSIntegerEnum'}} 270b07b06eSShoaib Meenai // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%ld" 280b07b06eSShoaib Meenai // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"static_cast<long>(" 290b07b06eSShoaib Meenai // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:34-[[@LINE-3]]:34}:")" 300b07b06eSShoaib Meenai 310b07b06eSShoaib Meenai printf("%d", NSUIntegerEnum::Three); // expected-warning{{format specifies type 'int' but the argument has type 'NSUIntegerEnum'}} 320b07b06eSShoaib Meenai // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%lu" 330b07b06eSShoaib Meenai // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"static_cast<unsigned long>(" 340b07b06eSShoaib Meenai // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:37-[[@LINE-3]]:37}:")" 350b07b06eSShoaib Meenai } 36