blob: b1906d3a24940c6339e2b741be105556cf816093 [file] [log] [blame]
Chris Lattnercc67ec12006-11-09 06:54:47 +00001//===--- Sema.h - Semantic Analysis & AST Building --------------*- C++ -*-===//
Chris Lattner7cee11f2006-11-03 06:42:29 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Chris Lattnercc67ec12006-11-09 06:54:47 +000010// This file defines the Sema class, which performs semantic analysis and
11// builds ASTs.
Chris Lattner7cee11f2006-11-03 06:42:29 +000012//
13//===----------------------------------------------------------------------===//
14
Chris Lattnercc67ec12006-11-09 06:54:47 +000015#ifndef LLVM_CLANG_AST_SEMA_H
16#define LLVM_CLANG_AST_SEMA_H
Chris Lattner7cee11f2006-11-03 06:42:29 +000017
18#include "clang/Parse/Action.h"
Chris Lattnere2473062007-05-28 06:28:18 +000019#include "llvm/ADT/DenseMap.h"
Anders Carlsson51873c22007-07-22 07:07:56 +000020#include "llvm/ADT/SmallVector.h"
Chris Lattner7cee11f2006-11-03 06:42:29 +000021#include <vector>
Chris Lattnereaafe1222006-11-10 05:17:58 +000022#include <string>
Chris Lattner7cee11f2006-11-03 06:42:29 +000023
Chris Lattnerfc1c44a2007-08-23 05:46:52 +000024namespace llvm {
25 class APSInt;
26}
27
Chris Lattner7cee11f2006-11-03 06:42:29 +000028namespace clang {
Chris Lattnercb6a3822006-11-10 06:20:45 +000029 class ASTContext;
Chris Lattner7cee11f2006-11-03 06:42:29 +000030 class Preprocessor;
31 class Decl;
Steve Naroff9324db12007-09-13 18:10:37 +000032 class ScopedDecl;
Steve Naroff78403362007-04-02 22:55:05 +000033 class Expr;
Steve Narofff33527a2007-09-02 15:34:30 +000034 class InitListExpr;
Chris Lattnerc5cdf4d2007-01-21 07:42:07 +000035 class VarDecl;
Chris Lattner53621a52007-06-13 20:44:40 +000036 class ParmVarDecl;
Chris Lattner01564d92007-01-27 19:27:06 +000037 class TypedefDecl;
38 class FunctionDecl;
Steve Naroffe5aa9be2007-04-05 22:36:20 +000039 class QualType;
Chris Lattner9cf21c52007-09-04 02:45:27 +000040 struct LangOptions;
41 struct DeclaratorChunk;
Chris Lattner146762e2007-07-20 16:59:19 +000042 class Token;
Steve Naroff35d85152007-05-07 00:24:15 +000043 class IntegerLiteral;
Steve Naroff8eeeb132007-05-08 21:09:37 +000044 class ArrayType;
Chris Lattnere2473062007-05-28 06:28:18 +000045 class LabelStmt;
Anders Carlsson51873c22007-07-22 07:07:56 +000046 class SwitchStmt;
Steve Narofff8fd09e2007-07-27 22:15:19 +000047 class OCUVectorType;
Steve Naroffddf5a1d2007-07-29 16:33:31 +000048 class TypedefDecl;
Fariborz Jahanian343f7092007-09-29 00:54:24 +000049 class ObjcInterfaceDecl;
Fariborz Jahanianfa0667b2007-09-29 17:04:06 +000050 class ObjcProtocolDecl;
Fariborz Jahanianec7b3332007-09-29 17:14:55 +000051 class ObjcImplementationDecl;
Fariborz Jahanian89b8ef92007-10-02 16:38:50 +000052 class ObjcCategoryImplDecl;
53 class ObjcCategoryDecl;
Steve Naroffddf5a1d2007-07-29 16:33:31 +000054
Chris Lattnercc67ec12006-11-09 06:54:47 +000055/// Sema - This implements semantic analysis and AST building for C.
56class Sema : public Action {
Steve Naroff38d31b42007-02-28 01:22:02 +000057 Preprocessor &PP;
58
Chris Lattnercb6a3822006-11-10 06:20:45 +000059 ASTContext &Context;
Chris Lattner7cee11f2006-11-03 06:42:29 +000060
Chris Lattner229ce602006-11-21 01:21:07 +000061 /// CurFunctionDecl - If inside of a function body, this contains a pointer to
62 /// the function decl for the function being parsed.
63 FunctionDecl *CurFunctionDecl;
64
Chris Lattner7cee11f2006-11-03 06:42:29 +000065 /// LastInGroupList - This vector is populated when there are multiple
66 /// declarators in a single decl group (e.g. "int A, B, C"). In this case,
67 /// all but the last decl will be entered into this. This is used by the
68 /// ASTStreamer.
69 std::vector<Decl*> &LastInGroupList;
Chris Lattnere2473062007-05-28 06:28:18 +000070
71 /// LabelMap - This is a mapping from label identifiers to the LabelStmt for
72 /// it (which acts like the label decl in some ways). Forward referenced
73 /// labels have a LabelStmt created for them with a null location & SubStmt.
Chris Lattner23b7eb62007-06-15 23:05:46 +000074 llvm::DenseMap<IdentifierInfo*, LabelStmt*> LabelMap;
Anders Carlsson51873c22007-07-22 07:07:56 +000075
76 llvm::SmallVector<SwitchStmt*, 8> SwitchStack;
Steve Naroffddf5a1d2007-07-29 16:33:31 +000077
78 /// OCUVectorDecls - This is a list all the OCU vector types. This allows
79 /// us to associate a raw vector type with one of the OCU type names.
80 /// This is only necessary for issuing pretty diagnostics.
81 llvm::SmallVector<TypedefDecl*, 24> OCUVectorDecls;
Chris Lattnerb87b1b32007-08-10 20:18:51 +000082
83 // Enum values used by KnownFunctionIDs (see below).
84 enum {
85 id_printf,
86 id_fprintf,
87 id_sprintf,
88 id_snprintf,
Chris Lattnerb87b1b32007-08-10 20:18:51 +000089 id_asprintf,
Ted Kremenekcfc94192007-08-10 21:13:51 +000090 id_vsnprintf,
Chris Lattnerb87b1b32007-08-10 20:18:51 +000091 id_vasprintf,
92 id_vfprintf,
93 id_vsprintf,
94 id_vprintf,
95 id_num_known_functions
96 };
97
98 /// KnownFunctionIDs - This is a list of IdentifierInfo objects to a set
99 /// of known functions used by the semantic analysis to do various
100 /// kinds of checking (e.g. checking format string errors in printf calls).
101 /// This list is populated upon the creation of a Sema object.
102 IdentifierInfo* KnownFunctionIDs[ id_num_known_functions ];
103
Chris Lattner7cee11f2006-11-03 06:42:29 +0000104public:
Steve Naroff2c055d22007-02-28 19:32:13 +0000105 Sema(Preprocessor &pp, ASTContext &ctxt, std::vector<Decl*> &prevInGroup);
Chris Lattner7cee11f2006-11-03 06:42:29 +0000106
Chris Lattnerac18be92006-11-20 06:49:47 +0000107 const LangOptions &getLangOptions() const;
108
Steve Naroff71ce2e02007-05-18 22:53:50 +0000109 /// The primitive diagnostic helpers - always returns true, which simplifies
110 /// error handling (i.e. less code).
Chris Lattnerd6647d32007-05-16 17:56:50 +0000111 bool Diag(SourceLocation Loc, unsigned DiagID);
112 bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg);
113 bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
114 const std::string &Msg2);
Steve Naroff71ce2e02007-05-18 22:53:50 +0000115
116 /// More expressive diagnostic helpers for expressions (say that 6 times:-)
117 bool Diag(SourceLocation Loc, unsigned DiagID, SourceRange R1);
118 bool Diag(SourceLocation Loc, unsigned DiagID,
119 SourceRange R1, SourceRange R2);
120 bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
121 SourceRange R1);
122 bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
123 SourceRange R1, SourceRange R2);
124 bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg1,
125 const std::string &Msg2, SourceRange R1);
126 bool Diag(SourceLocation Loc, unsigned DiagID,
127 const std::string &Msg1, const std::string &Msg2,
128 SourceRange R1, SourceRange R2);
Fariborz Jahanian343f7092007-09-29 00:54:24 +0000129
Chris Lattner57c523f2007-08-31 04:53:24 +0000130 virtual void DeleteExpr(ExprTy *E);
131 virtual void DeleteStmt(StmtTy *S);
132
Chris Lattner7cee11f2006-11-03 06:42:29 +0000133 //===--------------------------------------------------------------------===//
Chris Lattnerf84a79c2006-11-11 22:59:23 +0000134 // Type Analysis / Processing: SemaType.cpp.
135 //
Steve Naroffe5aa9be2007-04-05 22:36:20 +0000136 QualType GetTypeForDeclarator(Declarator &D, Scope *S);
Chris Lattnerf84a79c2006-11-11 22:59:23 +0000137
Steve Naroff30d242c2007-09-15 18:49:24 +0000138 virtual TypeResult ActOnTypeName(Scope *S, Declarator &D);
Chris Lattnerf84a79c2006-11-11 22:59:23 +0000139
Steve Naroff30d242c2007-09-15 18:49:24 +0000140 virtual TypeResult ActOnParamDeclaratorType(Scope *S, Declarator &D);
Steve Naroff26c8ea52007-03-21 21:08:52 +0000141private:
Chris Lattnerf84a79c2006-11-11 22:59:23 +0000142 //===--------------------------------------------------------------------===//
Chris Lattnere168f762006-11-10 05:29:30 +0000143 // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
Chris Lattner7cee11f2006-11-03 06:42:29 +0000144 //
Chris Lattner2ebe4bb2006-11-20 01:29:42 +0000145 virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const;
Steve Naroff30d242c2007-09-15 18:49:24 +0000146 virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
Steve Naroff61091402007-09-12 14:07:44 +0000147 void AddInitializerToDecl(DeclTy *dcl, ExprTy *init);
Chris Lattner776fac82007-06-09 00:53:06 +0000148 virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group);
149
Chris Lattnerc5cdf4d2007-01-21 07:42:07 +0000150 virtual DeclTy *ParseStartOfFunctionDef(Scope *S, Declarator &D);
Chris Lattner229ce602006-11-21 01:21:07 +0000151 virtual DeclTy *ParseFunctionDefBody(DeclTy *Decl, StmtTy *Body);
Chris Lattner7cee11f2006-11-03 06:42:29 +0000152 virtual void PopScope(SourceLocation Loc, Scope *S);
Chris Lattner01564d92007-01-27 19:27:06 +0000153
Chris Lattner200bdc32006-11-19 02:43:37 +0000154 /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with
155 /// no declarator (e.g. "struct foo;") is parsed.
156 virtual DeclTy *ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS);
157
Steve Naroff30d242c2007-09-15 18:49:24 +0000158 virtual DeclTy *ActOnTag(Scope *S, unsigned TagType, TagKind TK,
Chris Lattnerf34c4da2007-01-23 04:08:05 +0000159 SourceLocation KWLoc, IdentifierInfo *Name,
Steve Naroffb3096442007-06-09 03:47:53 +0000160 SourceLocation NameLoc, AttributeList *Attr);
Steve Naroff30d242c2007-09-15 18:49:24 +0000161 virtual DeclTy *ActOnField(Scope *S, DeclTy *TagDecl,SourceLocation DeclStart,
Chris Lattner1300fb92007-01-23 23:42:53 +0000162 Declarator &D, ExprTy *BitfieldWidth);
Steve Naroff2e688fd2007-09-14 23:09:53 +0000163
164 // This is used for both record definitions and ObjC interface declarations.
Fariborz Jahanian343f7092007-09-29 00:54:24 +0000165 virtual void ActOnFields(Scope* S,
166 SourceLocation RecLoc, DeclTy *TagDecl,
Steve Naroff2e688fd2007-09-14 23:09:53 +0000167 DeclTy **Fields, unsigned NumFields,
168 tok::ObjCKeywordKind *visibility = 0);
Steve Naroff30d242c2007-09-15 18:49:24 +0000169 virtual DeclTy *ActOnEnumConstant(Scope *S, DeclTy *EnumDecl,
Chris Lattner4ef40012007-06-11 01:28:17 +0000170 DeclTy *LastEnumConstant,
Chris Lattnerc1915e22007-01-25 07:29:02 +0000171 SourceLocation IdLoc, IdentifierInfo *Id,
172 SourceLocation EqualLoc, ExprTy *Val);
Steve Naroff30d242c2007-09-15 18:49:24 +0000173 virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDecl,
Chris Lattnerc1915e22007-01-25 07:29:02 +0000174 DeclTy **Elements, unsigned NumElements);
Steve Naroff3273c222007-03-14 21:52:03 +0000175private:
Steve Naroff30d242c2007-09-15 18:49:24 +0000176 /// Subroutines of ActOnDeclarator()...
Steve Naroffa23cc792007-09-13 23:52:58 +0000177 TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, ScopedDecl *LastDecl);
Steve Naroff9def2b12007-09-13 21:41:19 +0000178 TypedefDecl *MergeTypeDefDecl(TypedefDecl *New, ScopedDecl *Old);
179 FunctionDecl *MergeFunctionDecl(FunctionDecl *New, ScopedDecl *Old);
180 VarDecl *MergeVarDecl(VarDecl *New, ScopedDecl *Old);
Steve Naroff26c8ea52007-03-21 21:08:52 +0000181 /// AddTopLevelDecl - called after the decl has been fully processed.
182 /// Allows for bookkeeping and post-processing of each declaration.
183 void AddTopLevelDecl(Decl *current, Decl *last);
Steve Naroff6fbf0dc2007-03-16 00:33:25 +0000184
Steve Naroff3273c222007-03-14 21:52:03 +0000185 /// More parsing and symbol table subroutines...
Chris Lattner53621a52007-06-13 20:44:40 +0000186 ParmVarDecl *ParseParamDeclarator(DeclaratorChunk &FI, unsigned ArgNo,
187 Scope *FnBodyScope);
Steve Naroff9324db12007-09-13 18:10:37 +0000188 ScopedDecl *LookupScopedDecl(IdentifierInfo *II, unsigned NSI,
189 SourceLocation IdLoc, Scope *S);
Steve Naroffc6814ea2007-10-02 20:01:56 +0000190 ObjcInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *Id);
Fariborz Jahanianfa0667b2007-09-29 17:04:06 +0000191 ObjcProtocolDecl *getObjCProtocolDecl(Scope *S,
192 IdentifierInfo *Id, SourceLocation IdLoc);
Steve Naroff9324db12007-09-13 18:10:37 +0000193 ScopedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S);
Steve Naroff2f742082007-09-16 16:16:00 +0000194 ScopedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
Steve Naroff3273c222007-03-14 21:52:03 +0000195 Scope *S);
Steve Naroffa8fd9732007-06-11 00:35:03 +0000196 // Decl attributes - this routine is the top level dispatcher.
197 void HandleDeclAttributes(Decl *New, AttributeList *declspec_prefix,
198 AttributeList *declarator_postfix);
199 void HandleDeclAttribute(Decl *New, AttributeList *rawAttr);
200
201 // HandleVectorTypeAttribute - this attribute is only applicable to
202 // integral and float scalars, although arrays, pointers, and function
203 // return values are allowed in conjunction with this construct. Aggregates
204 // with this attribute are invalid, even if they are of the same size as a
205 // corresponding scalar.
206 // The raw attribute should contain precisely 1 argument, the vector size
207 // for the variable, measured in bytes. If curType and rawAttr are well
208 // formed, this routine will return a new vector type.
Steve Naroff4ae0ac62007-07-06 23:09:18 +0000209 QualType HandleVectorTypeAttribute(QualType curType, AttributeList *rawAttr);
Steve Naroffddf5a1d2007-07-29 16:33:31 +0000210 void HandleOCUVectorTypeAttribute(TypedefDecl *d, AttributeList *rawAttr);
Chris Lattner1300fb92007-01-23 23:42:53 +0000211
Fariborz Jahanianec7b3332007-09-29 17:14:55 +0000212 /// CheckProtocolMethodDefs - This routine checks unimpletented methods
213 /// Declared in protocol, and those referenced by it.
214 void CheckProtocolMethodDefs(ObjcProtocolDecl *PDecl,
Fariborz Jahanianadf84f32007-10-02 20:06:01 +0000215 bool& IncompleteImpl,
Fariborz Jahanianec7b3332007-09-29 17:14:55 +0000216 const llvm::DenseMap<void *, char>& InsMap,
217 const llvm::DenseMap<void *, char>& ClsMap);
218
219 /// ImplMethodsVsClassMethods - This is main routine to warn if any method
220 /// remains unimplemented in the @implementation class.
221 void ImplMethodsVsClassMethods(ObjcImplementationDecl* IMPDecl,
222 ObjcInterfaceDecl* IDecl);
223
Fariborz Jahanian89b8ef92007-10-02 16:38:50 +0000224 /// ImplCategoryMethodsVsIntfMethods - Checks that methods declared in the
225 /// category interface is implemented in the category @implementation.
226 void ImplCategoryMethodsVsIntfMethods(ObjcCategoryImplDecl *CatImplDecl,
Fariborz Jahanianadf84f32007-10-02 20:06:01 +0000227 ObjcCategoryDecl *CatClassDecl);
Fariborz Jahanian89b8ef92007-10-02 16:38:50 +0000228
Chris Lattner7cee11f2006-11-03 06:42:29 +0000229 //===--------------------------------------------------------------------===//
Chris Lattnere168f762006-11-10 05:29:30 +0000230 // Statement Parsing Callbacks: SemaStmt.cpp.
Steve Naroff3273c222007-03-14 21:52:03 +0000231public:
Steve Naroff66356bd2007-09-16 14:56:35 +0000232 virtual StmtResult ActOnExprStmt(ExprTy *Expr);
Chris Lattner1ec5f562007-06-27 05:38:08 +0000233
Steve Naroff66356bd2007-09-16 14:56:35 +0000234 virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc);
235 virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
Chris Lattnercac27a52007-08-31 21:49:55 +0000236 StmtTy **Elts, unsigned NumElts,
237 bool isStmtExpr);
Steve Naroff66356bd2007-09-16 14:56:35 +0000238 virtual StmtResult ActOnDeclStmt(DeclTy *Decl);
239 virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprTy *LHSVal,
Chris Lattner6c0ff132006-11-05 00:19:50 +0000240 SourceLocation DotDotDotLoc, ExprTy *RHSVal,
241 SourceLocation ColonLoc, StmtTy *SubStmt);
Steve Naroff66356bd2007-09-16 14:56:35 +0000242 virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
Chris Lattner46eeb222007-07-18 02:28:47 +0000243 SourceLocation ColonLoc, StmtTy *SubStmt,
244 Scope *CurScope);
Steve Naroff66356bd2007-09-16 14:56:35 +0000245 virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
Chris Lattner6c0ff132006-11-05 00:19:50 +0000246 SourceLocation ColonLoc, StmtTy *SubStmt);
Steve Naroff66356bd2007-09-16 14:56:35 +0000247 virtual StmtResult ActOnIfStmt(SourceLocation IfLoc, ExprTy *CondVal,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000248 StmtTy *ThenVal, SourceLocation ElseLoc,
249 StmtTy *ElseVal);
Steve Naroff66356bd2007-09-16 14:56:35 +0000250 virtual StmtResult ActOnStartOfSwitchStmt(ExprTy *Cond);
251 virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtTy *Switch,
Anders Carlsson51873c22007-07-22 07:07:56 +0000252 ExprTy *Body);
Steve Naroff66356bd2007-09-16 14:56:35 +0000253 virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc, ExprTy *Cond,
Chris Lattner85ed8732006-11-04 20:40:44 +0000254 StmtTy *Body);
Steve Naroff66356bd2007-09-16 14:56:35 +0000255 virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtTy *Body,
Chris Lattner85ed8732006-11-04 20:40:44 +0000256 SourceLocation WhileLoc, ExprTy *Cond);
257
Steve Naroff66356bd2007-09-16 14:56:35 +0000258 virtual StmtResult ActOnForStmt(SourceLocation ForLoc,
Chris Lattner71e23ce2006-11-04 20:18:38 +0000259 SourceLocation LParenLoc,
260 StmtTy *First, ExprTy *Second, ExprTy *Third,
261 SourceLocation RParenLoc, StmtTy *Body);
Steve Naroff66356bd2007-09-16 14:56:35 +0000262 virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc,
Chris Lattner16976d32006-11-05 01:46:01 +0000263 SourceLocation LabelLoc,
264 IdentifierInfo *LabelII);
Steve Naroff66356bd2007-09-16 14:56:35 +0000265 virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
Chris Lattner16976d32006-11-05 01:46:01 +0000266 SourceLocation StarLoc,
267 ExprTy *DestExp);
Steve Naroff66356bd2007-09-16 14:56:35 +0000268 virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
Chris Lattnereaafe1222006-11-10 05:17:58 +0000269 Scope *CurScope);
Steve Naroff66356bd2007-09-16 14:56:35 +0000270 virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc, Scope *CurScope);
Chris Lattner71e23ce2006-11-04 20:18:38 +0000271
Steve Naroff66356bd2007-09-16 14:56:35 +0000272 virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000273 ExprTy *RetValExp);
274
275 //===--------------------------------------------------------------------===//
Chris Lattnere168f762006-11-10 05:29:30 +0000276 // Expression Parsing Callbacks: SemaExpr.cpp.
Chris Lattner7cee11f2006-11-03 06:42:29 +0000277
278 // Primary Expressions.
Steve Naroff30d242c2007-09-15 18:49:24 +0000279 virtual ExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
Chris Lattnerac18be92006-11-20 06:49:47 +0000280 IdentifierInfo &II,
281 bool HasTrailingLParen);
Steve Naroff83895f72007-09-16 03:34:24 +0000282 virtual ExprResult ActOnPreDefinedExpr(SourceLocation Loc,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000283 tok::TokenKind Kind);
Steve Naroff83895f72007-09-16 03:34:24 +0000284 virtual ExprResult ActOnNumericConstant(const Token &);
285 virtual ExprResult ActOnCharacterConstant(const Token &);
286 virtual ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000287 ExprTy *Val);
Chris Lattner697e5d62006-11-09 06:32:27 +0000288
Steve Naroff83895f72007-09-16 03:34:24 +0000289 /// ActOnStringLiteral - The specified tokens were lexed as pasted string
Chris Lattner697e5d62006-11-09 06:32:27 +0000290 /// fragments (e.g. "foo" "bar" L"baz").
Steve Naroff83895f72007-09-16 03:34:24 +0000291 virtual ExprResult ActOnStringLiteral(const Token *Toks, unsigned NumToks);
Chris Lattner697e5d62006-11-09 06:32:27 +0000292
Chris Lattner7cee11f2006-11-03 06:42:29 +0000293 // Binary/Unary Operators. 'Tok' is the token for the operator.
Steve Naroff83895f72007-09-16 03:34:24 +0000294 virtual ExprResult ActOnUnaryOp(SourceLocation OpLoc, tok::TokenKind Op,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000295 ExprTy *Input);
296 virtual ExprResult
Steve Naroff83895f72007-09-16 03:34:24 +0000297 ActOnSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000298 SourceLocation LParenLoc, TypeTy *Ty,
299 SourceLocation RParenLoc);
300
Steve Naroff83895f72007-09-16 03:34:24 +0000301 virtual ExprResult ActOnPostfixUnaryOp(SourceLocation OpLoc,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000302 tok::TokenKind Kind, ExprTy *Input);
303
Steve Naroff83895f72007-09-16 03:34:24 +0000304 virtual ExprResult ActOnArraySubscriptExpr(ExprTy *Base, SourceLocation LLoc,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000305 ExprTy *Idx, SourceLocation RLoc);
Steve Naroff83895f72007-09-16 03:34:24 +0000306 virtual ExprResult ActOnMemberReferenceExpr(ExprTy *Base,SourceLocation OpLoc,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000307 tok::TokenKind OpKind,
308 SourceLocation MemberLoc,
309 IdentifierInfo &Member);
310
Steve Naroff83895f72007-09-16 03:34:24 +0000311 /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
Chris Lattner7cee11f2006-11-03 06:42:29 +0000312 /// This provides the location of the left/right parens and a list of comma
313 /// locations.
Steve Naroff83895f72007-09-16 03:34:24 +0000314 virtual ExprResult ActOnCallExpr(ExprTy *Fn, SourceLocation LParenLoc,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000315 ExprTy **Args, unsigned NumArgs,
316 SourceLocation *CommaLocs,
317 SourceLocation RParenLoc);
318
Steve Naroff83895f72007-09-16 03:34:24 +0000319 virtual ExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000320 SourceLocation RParenLoc, ExprTy *Op);
Steve Narofffbd09832007-07-19 01:06:55 +0000321
Steve Naroff83895f72007-09-16 03:34:24 +0000322 virtual ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, TypeTy *Ty,
Steve Narofffbd09832007-07-19 01:06:55 +0000323 SourceLocation RParenLoc, ExprTy *Op);
Chris Lattner7cee11f2006-11-03 06:42:29 +0000324
Steve Naroff83895f72007-09-16 03:34:24 +0000325 virtual ExprResult ActOnInitList(SourceLocation LParenLoc,
Steve Narofffbd09832007-07-19 01:06:55 +0000326 ExprTy **InitList, unsigned NumInit,
327 SourceLocation RParenLoc);
328
Steve Naroff83895f72007-09-16 03:34:24 +0000329 virtual ExprResult ActOnBinOp(SourceLocation TokLoc, tok::TokenKind Kind,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000330 ExprTy *LHS,ExprTy *RHS);
331
Steve Naroff83895f72007-09-16 03:34:24 +0000332 /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
Chris Lattner7cee11f2006-11-03 06:42:29 +0000333 /// in the case of a the GNU conditional expr extension.
Steve Naroff83895f72007-09-16 03:34:24 +0000334 virtual ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
Chris Lattner7cee11f2006-11-03 06:42:29 +0000335 SourceLocation ColonLoc,
336 ExprTy *Cond, ExprTy *LHS, ExprTy *RHS);
Chris Lattner29375652006-12-04 18:06:35 +0000337
Steve Naroff66356bd2007-09-16 14:56:35 +0000338 /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
339 virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc,
Chris Lattnereefa10e2007-05-28 06:56:27 +0000340 IdentifierInfo *LabelII);
341
Steve Naroff66356bd2007-09-16 14:56:35 +0000342 virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt,
Chris Lattner366727f2007-07-24 16:58:17 +0000343 SourceLocation RPLoc); // "({..})"
Chris Lattnerf17bd422007-08-30 17:45:32 +0000344
345 /// __builtin_offsetof(type, a.b[123][456].c)
Steve Naroff66356bd2007-09-16 14:56:35 +0000346 virtual ExprResult ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc,
Chris Lattnerf17bd422007-08-30 17:45:32 +0000347 SourceLocation TypeLoc, TypeTy *Arg1,
348 OffsetOfComponent *CompPtr,
349 unsigned NumComponents,
350 SourceLocation RParenLoc);
351
Steve Naroff78864672007-08-01 22:05:33 +0000352 // __builtin_types_compatible_p(type1, type2)
Steve Naroff66356bd2007-09-16 14:56:35 +0000353 virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
Steve Naroff78864672007-08-01 22:05:33 +0000354 TypeTy *arg1, TypeTy *arg2,
355 SourceLocation RPLoc);
Steve Naroff9efdabc2007-08-03 21:21:27 +0000356
357 // __builtin_choose_expr(constExpr, expr1, expr2)
Steve Naroff66356bd2007-09-16 14:56:35 +0000358 virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
Steve Naroff9efdabc2007-08-03 21:21:27 +0000359 ExprTy *cond, ExprTy *expr1, ExprTy *expr2,
360 SourceLocation RPLoc);
Chris Lattner366727f2007-07-24 16:58:17 +0000361
Steve Naroff66356bd2007-09-16 14:56:35 +0000362 /// ActOnCXXCasts - Parse {dynamic,static,reinterpret,const}_cast's.
363 virtual ExprResult ActOnCXXCasts(SourceLocation OpLoc, tok::TokenKind Kind,
Chris Lattner29375652006-12-04 18:06:35 +0000364 SourceLocation LAngleBracketLoc, TypeTy *Ty,
365 SourceLocation RAngleBracketLoc,
366 SourceLocation LParenLoc, ExprTy *E,
367 SourceLocation RParenLoc);
Bill Wendling4073ed52007-02-13 01:51:42 +0000368
Steve Naroff66356bd2007-09-16 14:56:35 +0000369 /// ActOnCXXBoolLiteral - Parse {true,false} literals.
370 virtual ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
Bill Wendlingbf313b02007-02-13 20:09:46 +0000371 tok::TokenKind Kind);
Anders Carlsson76f4a902007-08-21 17:43:55 +0000372
373 // ParseObjCStringLiteral - Parse Objective-C string literals.
374 virtual ExprResult ParseObjCStringLiteral(ExprTy *string);
Anders Carlssonc5a81eb2007-08-22 15:14:15 +0000375 virtual ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc,
376 SourceLocation LParenLoc,
377 TypeTy *Ty,
378 SourceLocation RParenLoc);
379
Steve Naroff09bf8152007-09-06 21:24:23 +0000380 // Objective-C declarations.
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +0000381 virtual DeclTy *ObjcStartClassInterface(Scope* S,
382 SourceLocation AtInterafceLoc,
Steve Naroff09bf8152007-09-06 21:24:23 +0000383 IdentifierInfo *ClassName, SourceLocation ClassLoc,
384 IdentifierInfo *SuperName, SourceLocation SuperLoc,
385 IdentifierInfo **ProtocolNames, unsigned NumProtocols,
386 AttributeList *AttrList);
387
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +0000388 virtual DeclTy *ObjcStartProtoInterface(Scope* S,
389 SourceLocation AtProtoInterfaceLoc,
Fariborz Jahanian39d641f2007-09-17 21:07:36 +0000390 IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
391 IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs);
392
Fariborz Jahanian343f7092007-09-29 00:54:24 +0000393 virtual DeclTy *ObjcStartCatInterface(Scope* S,
394 SourceLocation AtInterfaceLoc,
Fariborz Jahanian867a7eb2007-09-18 20:26:58 +0000395 IdentifierInfo *ClassName, SourceLocation ClassLoc,
396 IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
397 IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs);
398
Fariborz Jahanianbfe13c52007-09-25 18:38:09 +0000399 virtual DeclTy *ObjcStartClassImplementation(Scope* S,
400 SourceLocation AtClassImplLoc,
401 IdentifierInfo *ClassName, SourceLocation ClassLoc,
402 IdentifierInfo *SuperClassname,
403 SourceLocation SuperClassLoc);
404
Fariborz Jahanian89b8ef92007-10-02 16:38:50 +0000405 virtual DeclTy *ObjcStartCategoryImplementation(Scope* S,
406 SourceLocation AtCatImplLoc,
407 IdentifierInfo *ClassName,
408 SourceLocation ClassLoc,
409 IdentifierInfo *CatName,
410 SourceLocation CatLoc);
411
Steve Naroff09bf8152007-09-06 21:24:23 +0000412 virtual DeclTy *ObjcClassDeclaration(Scope *S, SourceLocation AtClassLoc,
413 IdentifierInfo **IdentList,
414 unsigned NumElts);
Fariborz Jahanian876e27d2007-09-21 15:40:54 +0000415
416 virtual DeclTy *ObjcForwardProtocolDeclaration(Scope *S,
417 SourceLocation AtProtocolLoc,
418 IdentifierInfo **IdentList,
419 unsigned NumElts);
Steve Naroff09bf8152007-09-06 21:24:23 +0000420
Fariborz Jahanian343f7092007-09-29 00:54:24 +0000421 virtual void ObjcAddMethodsToClass(Scope* S, DeclTy *ClassDecl,
Steve Narofff2fb4ad2007-09-11 21:17:26 +0000422 DeclTy **allMethods, unsigned allNum);
Fariborz Jahanian2a4dd312007-09-26 18:27:25 +0000423
424 virtual void ActOnImpleIvarVsClassIvars(DeclTy *ClassDecl,
425 DeclTy **Fields, unsigned NumFields);
426
Fariborz Jahanian0c74e9d2007-09-18 00:25:23 +0000427 virtual DeclTy *ObjcBuildMethodDeclaration(SourceLocation MethodLoc,
Steve Naroff80175062007-09-28 22:22:11 +0000428 tok::TokenKind MethodType, TypeTy *ReturnType, Selector Sel,
Steve Narofff73590d2007-09-27 14:38:14 +0000429 // optional arguments. The number of types/arguments is obtained
430 // from the Sel.getNumArgs().
431 TypeTy **ArgTypes, IdentifierInfo **ArgNames,
432 AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind);
Steve Narofff0f2afc2007-09-17 21:01:15 +0000433
Steve Narofff73590d2007-09-27 14:38:14 +0000434 // ActOnClassMessage - used for both unary and keyword messages.
435 // ArgExprs is optional - if it is present, the number of expressions
436 // is obtained from Sel.getNumArgs().
437 virtual ExprResult ActOnClassMessage(
Steve Naroff80175062007-09-28 22:22:11 +0000438 IdentifierInfo *receivingClassName, Selector Sel,
Steve Naroffc6814ea2007-10-02 20:01:56 +0000439 SourceLocation lbrac, SourceLocation rbrac, ExprTy **ArgExprs);
Steve Narofff73590d2007-09-27 14:38:14 +0000440
441 // ActOnInstanceMessage - used for both unary and keyword messages.
442 // ArgExprs is optional - if it is present, the number of expressions
443 // is obtained from Sel.getNumArgs().
444 virtual ExprResult ActOnInstanceMessage(
Steve Naroff80175062007-09-28 22:22:11 +0000445 ExprTy *receiver, Selector Sel,
Steve Narofff73590d2007-09-27 14:38:14 +0000446 SourceLocation lbrac, SourceLocation rbrac, ExprTy **ArgExprs);
Steve Naroff26c8ea52007-03-21 21:08:52 +0000447private:
Steve Naroff71b59a92007-06-04 22:22:31 +0000448 // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
Steve Naroff31090012007-07-16 21:54:35 +0000449 // functions and arrays to their respective pointers (C99 6.3.2.1).
450 void UsualUnaryConversions(Expr *&expr);
451
452 // DefaultFunctionArrayConversion - converts functions and arrays
453 // to their respective pointers (C99 6.3.2.1).
454 void DefaultFunctionArrayConversion(Expr *&expr);
Steve Naroffb8ea4fb2007-07-13 23:32:42 +0000455
Steve Naroff0b661582007-08-28 23:30:39 +0000456 // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
457 // do not have a prototype. Integer promotions are performed on each
458 // argument, and arguments that have type float are promoted to double.
459 void DefaultArgumentPromotion(Expr *&expr);
460
Steve Naroff71b59a92007-06-04 22:22:31 +0000461 // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
462 // operands and then handles various conversions that are common to binary
463 // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
464 // routine returns the first non-arithmetic type found. The client is
465 // responsible for emitting appropriate error diagnostics.
Steve Naroffbe4c4d12007-08-24 19:07:16 +0000466 QualType UsualArithmeticConversions(Expr *&lExpr, Expr *&rExpr,
467 bool isCompAssign = false);
Steve Naroff98cf3e92007-06-06 18:38:38 +0000468 enum AssignmentCheckResult {
Steve Naroff17f76e02007-05-03 21:03:48 +0000469 Compatible,
470 Incompatible,
471 PointerFromInt,
472 IntFromPointer,
Steve Naroff1f4d7272007-05-11 04:00:31 +0000473 IncompatiblePointer,
474 CompatiblePointerDiscardsQualifiers
Steve Naroff17f76e02007-05-03 21:03:48 +0000475 };
Steve Naroffb8ea4fb2007-07-13 23:32:42 +0000476 // CheckAssignmentConstraints - Perform type checking for assignment,
477 // argument passing, variable initialization, and function return values.
478 // This routine is only used by the following two methods. C99 6.5.16.
Steve Naroff98cf3e92007-06-06 18:38:38 +0000479 AssignmentCheckResult CheckAssignmentConstraints(QualType lhs, QualType rhs);
Steve Naroffb8ea4fb2007-07-13 23:32:42 +0000480
Steve Naroff83895f72007-09-16 03:34:24 +0000481 // CheckSingleAssignmentConstraints - Currently used by ActOnCallExpr,
Steve Naroff66356bd2007-09-16 14:56:35 +0000482 // CheckAssignmentOperands, and ActOnReturnStmt. Prior to type checking,
Steve Naroffb8ea4fb2007-07-13 23:32:42 +0000483 // this routine performs the default function/array converions.
484 AssignmentCheckResult CheckSingleAssignmentConstraints(QualType lhs,
485 Expr *&rExpr);
486 // CheckCompoundAssignmentConstraints - Type check without performing any
487 // conversions. For compound assignments, the "Check...Operands" methods
488 // perform the necessary conversions.
489 AssignmentCheckResult CheckCompoundAssignmentConstraints(QualType lhs,
490 QualType rhs);
491
Steve Naroff98cf3e92007-06-06 18:38:38 +0000492 // Helper function for CheckAssignmentConstraints (C99 6.5.16.1p1)
493 AssignmentCheckResult CheckPointerTypesForAssignment(QualType lhsType,
494 QualType rhsType);
Steve Naroff9eb24652007-05-02 21:58:15 +0000495
Steve Naroff8eeeb132007-05-08 21:09:37 +0000496 /// the following "Check" methods will return a valid/converted QualType
497 /// or a null QualType (indicating an error diagnostic was issued).
498
Steve Naroff83895f72007-09-16 03:34:24 +0000499 /// type checking binary operators (subroutines of ActOnBinOp).
Steve Naroff7a5af782007-07-13 16:58:59 +0000500 inline void InvalidOperands(SourceLocation l, Expr *&lex, Expr *&rex);
501 inline QualType CheckVectorOperands(SourceLocation l, Expr *&lex, Expr *&rex);
Steve Naroff218bc2b2007-05-04 21:54:46 +0000502 inline QualType CheckMultiplyDivideOperands( // C99 6.5.5
Steve Naroffbe4c4d12007-08-24 19:07:16 +0000503 Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false);
Steve Naroff218bc2b2007-05-04 21:54:46 +0000504 inline QualType CheckRemainderOperands( // C99 6.5.5
Steve Naroffbe4c4d12007-08-24 19:07:16 +0000505 Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false);
Steve Naroff218bc2b2007-05-04 21:54:46 +0000506 inline QualType CheckAdditionOperands( // C99 6.5.6
Steve Naroffbe4c4d12007-08-24 19:07:16 +0000507 Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false);
Steve Naroff218bc2b2007-05-04 21:54:46 +0000508 inline QualType CheckSubtractionOperands( // C99 6.5.6
Steve Naroffbe4c4d12007-08-24 19:07:16 +0000509 Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false);
Steve Naroff218bc2b2007-05-04 21:54:46 +0000510 inline QualType CheckShiftOperands( // C99 6.5.7
Steve Naroffbe4c4d12007-08-24 19:07:16 +0000511 Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false);
Chris Lattnerb620c342007-08-26 01:18:55 +0000512 inline QualType CheckCompareOperands( // C99 6.5.8/9
513 Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isRelational);
Steve Naroff218bc2b2007-05-04 21:54:46 +0000514 inline QualType CheckBitwiseOperands( // C99 6.5.[10...12]
Steve Naroffbe4c4d12007-08-24 19:07:16 +0000515 Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false);
Steve Naroff218bc2b2007-05-04 21:54:46 +0000516 inline QualType CheckLogicalOperands( // C99 6.5.[13,14]
Steve Naroff7a5af782007-07-13 16:58:59 +0000517 Expr *&lex, Expr *&rex, SourceLocation OpLoc);
Steve Naroff35d85152007-05-07 00:24:15 +0000518 // CheckAssignmentOperands is used for both simple and compound assignment.
519 // For simple assignment, pass both expressions and a null converted type.
520 // For compound assignment, pass both expressions and the converted type.
521 inline QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
Steve Naroff0c1c7ed2007-08-24 22:33:52 +0000522 Expr *lex, Expr *&rex, SourceLocation OpLoc, QualType convertedType);
Steve Naroff218bc2b2007-05-04 21:54:46 +0000523 inline QualType CheckCommaOperands( // C99 6.5.17
Steve Naroff7a5af782007-07-13 16:58:59 +0000524 Expr *&lex, Expr *&rex, SourceLocation OpLoc);
Steve Narofff8a28c52007-05-15 20:29:32 +0000525 inline QualType CheckConditionalOperands( // C99 6.5.15
Steve Naroff7a5af782007-07-13 16:58:59 +0000526 Expr *&cond, Expr *&lhs, Expr *&rhs, SourceLocation questionLoc);
Steve Naroff95af0132007-03-30 23:47:58 +0000527
Steve Naroff83895f72007-09-16 03:34:24 +0000528 /// type checking unary operators (subroutines of ActOnUnaryOp).
Steve Naroff9358c712007-05-27 23:58:33 +0000529 /// C99 6.5.3.1, 6.5.3.2, 6.5.3.4
Steve Naroff71ce2e02007-05-18 22:53:50 +0000530 QualType CheckIncrementDecrementOperand(Expr *op, SourceLocation OpLoc);
531 QualType CheckAddressOfOperand(Expr *op, SourceLocation OpLoc);
532 QualType CheckIndirectionOperand(Expr *op, SourceLocation OpLoc);
533 QualType CheckSizeOfAlignOfOperand(QualType type, SourceLocation loc,
534 bool isSizeof);
Chris Lattner74ed76b2007-08-24 21:41:10 +0000535 QualType CheckRealImagOperand(Expr *&Op, SourceLocation OpLoc);
Steve Narofff8fd09e2007-07-27 22:15:19 +0000536
537 /// type checking primary expressions.
538 QualType CheckOCUVectorComponent(QualType baseType, SourceLocation OpLoc,
539 IdentifierInfo &Comp, SourceLocation CmpLoc);
540
Steve Naroff2fea1392007-09-02 02:04:30 +0000541 /// type checking declaration initializers (C99 6.7.8)
Steve Naroff77b97002007-09-04 14:36:54 +0000542 bool CheckInitializer(Expr *&simpleInit_or_initList, QualType &declType,
Steve Naroff7d2c5ed2007-09-03 01:24:23 +0000543 bool isStatic);
Steve Naroff77b97002007-09-04 14:36:54 +0000544 bool CheckSingleInitializer(Expr *&simpleInit, QualType declType);
545 bool CheckInitExpr(Expr *expr, InitListExpr *IList, unsigned slot,
546 bool isStatic, QualType ElementType);
Steve Naroffac074b42007-09-04 02:20:04 +0000547 void CheckVariableInitList(QualType DeclType, InitListExpr *IList,
548 QualType ElementType, bool isStatic,
549 int &nInitializers, bool &hadError);
550 void CheckConstantInitList(QualType DeclType, InitListExpr *IList,
551 QualType ElementType, bool isStatic,
552 int &nInitializers, bool &hadError);
553
Chris Lattnerfc1c44a2007-08-23 05:46:52 +0000554 /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
555 /// the specified width and sign. If an overflow occurs, detect it and emit
556 /// the specified diagnostic.
557 void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal,
558 unsigned NewWidth, bool NewSign,
559 SourceLocation Loc, unsigned DiagID);
560
Chris Lattnerb87b1b32007-08-10 20:18:51 +0000561 //===--------------------------------------------------------------------===//
562 // Extra semantic analysis beyond the C type system
563 private:
564
Anders Carlsson98f07902007-08-17 05:31:46 +0000565 bool CheckFunctionCall(Expr *Fn,
Ted Kremeneke68f1aa2007-08-14 17:39:48 +0000566 SourceLocation LParenLoc, SourceLocation RParenLoc,
567 FunctionDecl *FDecl,
Chris Lattnerb87b1b32007-08-10 20:18:51 +0000568 Expr** Args, unsigned NumArgsInCall);
569
Ted Kremeneke68f1aa2007-08-14 17:39:48 +0000570 void CheckPrintfArguments(Expr *Fn,
571 SourceLocation LParenLoc, SourceLocation RParenLoc,
572 bool HasVAListArg, FunctionDecl *FDecl,
Ted Kremenek56c864e2007-08-10 21:21:05 +0000573 unsigned format_idx, Expr** Args,
574 unsigned NumArgsInCall);
Ted Kremenekcff94fa2007-08-17 16:46:58 +0000575
576 void CheckReturnStackAddr(Expr *RetValExp, QualType lhsType,
577 SourceLocation ReturnLoc);
578
Anders Carlsson98f07902007-08-17 05:31:46 +0000579
580 bool CheckBuiltinCFStringArgument(Expr* Arg);
Chris Lattner7cee11f2006-11-03 06:42:29 +0000581};
582
583
584} // end namespace clang
Chris Lattner7cee11f2006-11-03 06:42:29 +0000585
586#endif