CocoaConventions.h revision 686775deca8b8685eb90801495880e3abdd844c2
1//===- CocoaConventions.h - Special handling of Cocoa conventions -*- C++ -*--// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file implements cocoa naming convention analysis. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef LLVM_CLANG_ANALYSIS_DS_COCOA 15#define LLVM_CLANG_ANALYSIS_DS_COCOA 16 17#include "llvm/ADT/StringRef.h" 18#include "clang/AST/Type.h" 19 20namespace clang { 21 22class ObjCMethodDecl; 23 24namespace ento { 25namespace cocoa { 26 27 enum NamingConvention { NoConvention, CreateRule, InitRule }; 28 29 NamingConvention deriveNamingConvention(Selector S, const ObjCMethodDecl *MD); 30 31 static inline bool followsFundamentalRule(Selector S, 32 const ObjCMethodDecl *MD) { 33 return deriveNamingConvention(S, MD) == CreateRule; 34 } 35 36 bool isRefType(QualType RetTy, StringRef Prefix, 37 StringRef Name = StringRef()); 38 39 bool isCocoaObjectRef(QualType T); 40 41} 42 43namespace coreFoundation { 44 bool isCFObjectRef(QualType T); 45 46 bool followsCreateRule(StringRef functionName); 47} 48 49}} // end: "clang:ento" 50 51#endif 52