[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / keychainAPI-diagnostic-visitor.m
blob7c9926b1d2439f88a46105335968d59b62506430
1 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=osx.SecKeychainAPI -analyzer-output=text -verify %s
3 // This file is for testing enhanced diagnostics produced by the default SecKeychainAPI checker.
5 typedef unsigned int OSStatus;
6 typedef unsigned int SecKeychainAttributeList;
7 typedef unsigned int SecKeychainItemRef;
8 typedef unsigned int SecItemClass;
9 typedef unsigned int UInt32;
10 enum {
11     noErr                      = 0,
12     GenericError               = 1
14 OSStatus SecKeychainItemCopyContent (
15                                      SecKeychainItemRef itemRef,
16                                      SecItemClass *itemClass,
17                                      SecKeychainAttributeList *attrList,
18                                      UInt32 *length,
19                                      void **outData
20                                      );
22 void DellocWithCFStringCreate4(void) {
23     unsigned int *ptr = 0;
24     OSStatus st = 0;
25     UInt32 length;
26     char *bytes;
27     char *x;
28     st = SecKeychainItemCopyContent(2, ptr, ptr, &length, (void **)&bytes); // expected-note {{Data is allocated here}}
29     x = bytes;
30     if (st == noErr) // expected-note {{Assuming 'st' is equal to noErr}} // expected-note{{Taking true branch}}
31         x = bytes;;
32   
33     length++; // expected-warning {{Allocated data is not released}} // expected-note{{Allocated data is not released}}