| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | //===--- Sema.h - Semantic Analysis & AST Building --------------*- C++ -*-===// | 
|  | 2 | // | 
|  | 3 | //                     The LLVM Compiler Infrastructure | 
|  | 4 | // | 
| Chris Lattner | 0bc735f | 2007-12-29 19:59:25 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source | 
|  | 6 | // License. See LICENSE.TXT for details. | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 7 | // | 
|  | 8 | //===----------------------------------------------------------------------===// | 
|  | 9 | // | 
|  | 10 | // This file defines the Sema class, which performs semantic analysis and | 
|  | 11 | // builds ASTs. | 
|  | 12 | // | 
|  | 13 | //===----------------------------------------------------------------------===// | 
|  | 14 |  | 
|  | 15 | #ifndef LLVM_CLANG_AST_SEMA_H | 
|  | 16 | #define LLVM_CLANG_AST_SEMA_H | 
|  | 17 |  | 
| Chris Lattner | 7f925cc | 2008-04-11 07:00:53 +0000 | [diff] [blame] | 18 | #include "IdentifierResolver.h" | 
| Argyrios Kyrtzidis | 0795232 | 2008-07-01 10:37:29 +0000 | [diff] [blame] | 19 | #include "CXXFieldCollector.h" | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 20 | #include "SemaOverload.h" | 
| Douglas Gregor | e0762c9 | 2009-06-19 23:52:42 +0000 | [diff] [blame] | 21 | #include "clang/AST/Attr.h" | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 22 | #include "clang/AST/DeclBase.h" | 
| Douglas Gregor | e0762c9 | 2009-06-19 23:52:42 +0000 | [diff] [blame] | 23 | #include "clang/AST/Decl.h" | 
| Douglas Gregor | f0aaf7a | 2009-04-24 21:10:55 +0000 | [diff] [blame] | 24 | #include "clang/AST/DeclObjC.h" | 
| Anders Carlsson | 1c5976e | 2009-06-05 03:43:12 +0000 | [diff] [blame] | 25 | #include "clang/AST/DeclTemplate.h" | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 26 | #include "clang/Parse/Action.h" | 
| Chris Lattner | 500d329 | 2009-01-29 05:15:15 +0000 | [diff] [blame] | 27 | #include "clang/Sema/SemaDiagnostic.h" | 
| Anders Carlsson | c1fcb77 | 2007-07-22 07:07:56 +0000 | [diff] [blame] | 28 | #include "llvm/ADT/SmallVector.h" | 
| Fariborz Jahanian | 85ff264 | 2007-10-05 18:00:57 +0000 | [diff] [blame] | 29 | #include "llvm/ADT/DenseSet.h" | 
| Chris Lattner | f387668 | 2007-10-07 01:13:46 +0000 | [diff] [blame] | 30 | #include "llvm/ADT/SmallPtrSet.h" | 
| Argyrios Kyrtzidis | 0795232 | 2008-07-01 10:37:29 +0000 | [diff] [blame] | 31 | #include "llvm/ADT/OwningPtr.h" | 
| Douglas Gregor | b33fe2f | 2009-06-30 17:20:14 +0000 | [diff] [blame] | 32 | #include <deque> | 
| Douglas Gregor | ac7610d | 2009-06-22 20:57:11 +0000 | [diff] [blame] | 33 | #include <list> | 
| Douglas Gregor | 4dc6b1c | 2009-01-16 00:38:09 +0000 | [diff] [blame] | 34 | #include <string> | 
| Douglas Gregor | 94b1dd2 | 2008-10-24 04:54:22 +0000 | [diff] [blame] | 35 | #include <vector> | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 36 |  | 
| Chris Lattner | f4021e7 | 2007-08-23 05:46:52 +0000 | [diff] [blame] | 37 | namespace llvm { | 
|  | 38 | class APSInt; | 
|  | 39 | } | 
|  | 40 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 41 | namespace clang { | 
|  | 42 | class ASTContext; | 
| Chris Lattner | 2ae34ed | 2008-02-06 00:46:58 +0000 | [diff] [blame] | 43 | class ASTConsumer; | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 44 | class Preprocessor; | 
|  | 45 | class Decl; | 
| Chris Lattner | b048c98 | 2008-04-06 04:47:34 +0000 | [diff] [blame] | 46 | class DeclContext; | 
| Daniel Dunbar | 12bc692 | 2008-08-11 03:27:53 +0000 | [diff] [blame] | 47 | class DeclSpec; | 
| Douglas Gregor | f0aaf7a | 2009-04-24 21:10:55 +0000 | [diff] [blame] | 48 | class ExternalSemaSource; | 
| Steve Naroff | e8043c3 | 2008-04-01 23:04:06 +0000 | [diff] [blame] | 49 | class NamedDecl; | 
| Sebastian Redl | 798d119 | 2008-12-13 16:23:55 +0000 | [diff] [blame] | 50 | class Stmt; | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 51 | class Expr; | 
| Steve Naroff | 6f9f307 | 2007-09-02 15:34:30 +0000 | [diff] [blame] | 52 | class InitListExpr; | 
| Douglas Gregor | 05c13a3 | 2009-01-22 00:58:24 +0000 | [diff] [blame] | 53 | class DesignatedInitExpr; | 
| Chris Lattner | 925e60d | 2007-12-28 05:29:59 +0000 | [diff] [blame] | 54 | class CallExpr; | 
| Douglas Gregor | 1a49af9 | 2009-01-06 05:10:23 +0000 | [diff] [blame] | 55 | class DeclRefExpr; | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 56 | class VarDecl; | 
|  | 57 | class ParmVarDecl; | 
|  | 58 | class TypedefDecl; | 
|  | 59 | class FunctionDecl; | 
|  | 60 | class QualType; | 
| Sebastian Redl | 43af76e | 2009-03-07 12:16:37 +0000 | [diff] [blame] | 61 | class LangOptions; | 
| Chris Lattner | d217773 | 2007-07-20 16:59:19 +0000 | [diff] [blame] | 62 | class Token; | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 63 | class IntegerLiteral; | 
| Steve Naroff | a49e1fa | 2008-01-22 00:55:40 +0000 | [diff] [blame] | 64 | class StringLiteral; | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 65 | class ArrayType; | 
|  | 66 | class LabelStmt; | 
| Anders Carlsson | c1fcb77 | 2007-07-22 07:07:56 +0000 | [diff] [blame] | 67 | class SwitchStmt; | 
| Sebastian Redl | 13e8854 | 2009-04-27 21:33:24 +0000 | [diff] [blame] | 68 | class CXXTryStmt; | 
| Nate Begeman | 213541a | 2008-04-18 23:10:10 +0000 | [diff] [blame] | 69 | class ExtVectorType; | 
| Steve Naroff | bea0b34 | 2007-07-29 16:33:31 +0000 | [diff] [blame] | 70 | class TypedefDecl; | 
| Douglas Gregor | aaba5e3 | 2009-02-04 19:02:06 +0000 | [diff] [blame] | 71 | class TemplateDecl; | 
| Douglas Gregor | 3e00bad | 2009-02-17 01:05:43 +0000 | [diff] [blame] | 72 | class TemplateArgument; | 
| Douglas Gregor | 7e06390 | 2009-05-11 23:53:27 +0000 | [diff] [blame] | 73 | class TemplateArgumentList; | 
| Douglas Gregor | ddc29e1 | 2009-02-06 22:42:48 +0000 | [diff] [blame] | 74 | class TemplateParameterList; | 
| Douglas Gregor | c15cb38 | 2009-02-09 23:23:08 +0000 | [diff] [blame] | 75 | class TemplateTemplateParmDecl; | 
| Douglas Gregor | c8ab256 | 2009-05-31 09:31:02 +0000 | [diff] [blame] | 76 | class ClassTemplatePartialSpecializationDecl; | 
| Douglas Gregor | 88b7094 | 2009-02-25 22:02:03 +0000 | [diff] [blame] | 77 | class ClassTemplateDecl; | 
| Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 78 | class ObjCInterfaceDecl; | 
| Steve Naroff | e8043c3 | 2008-04-01 23:04:06 +0000 | [diff] [blame] | 79 | class ObjCCompatibleAliasDecl; | 
| Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 80 | class ObjCProtocolDecl; | 
| Chris Lattner | cddc888 | 2009-03-01 00:56:52 +0000 | [diff] [blame] | 81 | class ObjCImplDecl; | 
| Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 82 | class ObjCImplementationDecl; | 
|  | 83 | class ObjCCategoryImplDecl; | 
|  | 84 | class ObjCCategoryDecl; | 
|  | 85 | class ObjCIvarDecl; | 
|  | 86 | class ObjCMethodDecl; | 
| Fariborz Jahanian | 02edb98 | 2008-05-01 00:03:38 +0000 | [diff] [blame] | 87 | class ObjCPropertyDecl; | 
| Steve Naroff | 0701bbb | 2009-01-08 17:28:14 +0000 | [diff] [blame] | 88 | class ObjCContainerDecl; | 
| Sebastian Redl | 4994d2d | 2009-07-04 11:39:00 +0000 | [diff] [blame] | 89 | class FunctionProtoType; | 
| Douglas Gregor | 94b1dd2 | 2008-10-24 04:54:22 +0000 | [diff] [blame] | 90 | class BasePaths; | 
| Sebastian Redl | 43af76e | 2009-03-07 12:16:37 +0000 | [diff] [blame] | 91 | struct MemberLookupCriteria; | 
| Anders Carlsson | ff6b3d6 | 2009-05-30 21:05:25 +0000 | [diff] [blame] | 92 | class CXXTemporary; | 
| Steve Naroff | bea0b34 | 2007-07-29 16:33:31 +0000 | [diff] [blame] | 93 |  | 
| Chris Lattner | ea29a3a | 2009-04-18 20:01:55 +0000 | [diff] [blame] | 94 | /// BlockSemaInfo - When a block is being parsed, this contains information | 
|  | 95 | /// about the block.  It is pointed to from Sema::CurBlock. | 
|  | 96 | struct BlockSemaInfo { | 
|  | 97 | llvm::SmallVector<ParmVarDecl*, 8> Params; | 
|  | 98 | bool hasPrototype; | 
|  | 99 | bool isVariadic; | 
|  | 100 | bool hasBlockDeclRefExprs; | 
|  | 101 |  | 
|  | 102 | BlockDecl *TheDecl; | 
|  | 103 |  | 
|  | 104 | /// TheScope - This is the scope for the block itself, which contains | 
|  | 105 | /// arguments etc. | 
|  | 106 | Scope *TheScope; | 
|  | 107 |  | 
|  | 108 | /// ReturnType - This will get set to block result type, by looking at | 
|  | 109 | /// return types, if any, in the block body. | 
| Fariborz Jahanian | 7d5c74e | 2009-06-19 23:37:08 +0000 | [diff] [blame] | 110 | QualType ReturnType; | 
| Chris Lattner | ea29a3a | 2009-04-18 20:01:55 +0000 | [diff] [blame] | 111 |  | 
|  | 112 | /// LabelMap - This is a mapping from label identifiers to the LabelStmt for | 
|  | 113 | /// it (which acts like the label decl in some ways).  Forward referenced | 
|  | 114 | /// labels have a LabelStmt created for them with a null location & SubStmt. | 
|  | 115 | llvm::DenseMap<IdentifierInfo*, LabelStmt*> LabelMap; | 
|  | 116 |  | 
| Chris Lattner | bcfce66 | 2009-04-18 20:10:59 +0000 | [diff] [blame] | 117 | /// SwitchStack - This is the current set of active switch statements in the | 
|  | 118 | /// block. | 
|  | 119 | llvm::SmallVector<SwitchStmt*, 8> SwitchStack; | 
|  | 120 |  | 
| Chris Lattner | 17a7830 | 2009-04-19 05:28:12 +0000 | [diff] [blame] | 121 | /// SavedFunctionNeedsScopeChecking - This is the value of | 
|  | 122 | /// CurFunctionNeedsScopeChecking at the point when the block started. | 
|  | 123 | bool SavedFunctionNeedsScopeChecking; | 
|  | 124 |  | 
| Chris Lattner | ea29a3a | 2009-04-18 20:01:55 +0000 | [diff] [blame] | 125 | /// PrevBlockInfo - If this is nested inside another block, this points | 
|  | 126 | /// to the outer block. | 
|  | 127 | BlockSemaInfo *PrevBlockInfo; | 
|  | 128 | }; | 
|  | 129 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 130 | /// Sema - This implements semantic analysis and AST building for C. | 
|  | 131 | class Sema : public Action { | 
| Chris Lattner | f50adff | 2009-02-17 00:58:30 +0000 | [diff] [blame] | 132 | Sema(const Sema&);           // DO NOT IMPLEMENT | 
|  | 133 | void operator=(const Sema&); // DO NOT IMPLEMENT | 
| Chris Lattner | 0b2f4da | 2008-06-29 00:28:59 +0000 | [diff] [blame] | 134 | public: | 
| Chris Lattner | 53ebff3 | 2009-01-22 19:21:44 +0000 | [diff] [blame] | 135 | const LangOptions &LangOpts; | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 136 | Preprocessor &PP; | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 137 | ASTContext &Context; | 
| Chris Lattner | 2ae34ed | 2008-02-06 00:46:58 +0000 | [diff] [blame] | 138 | ASTConsumer &Consumer; | 
| Chris Lattner | 3cfa928 | 2008-11-22 08:28:49 +0000 | [diff] [blame] | 139 | Diagnostic &Diags; | 
|  | 140 | SourceManager &SourceMgr; | 
| Steve Naroff | 0330071 | 2007-11-12 13:56:41 +0000 | [diff] [blame] | 141 |  | 
| Douglas Gregor | f0aaf7a | 2009-04-24 21:10:55 +0000 | [diff] [blame] | 142 | /// \brief Source of additional semantic information. | 
|  | 143 | ExternalSemaSource *ExternalSource; | 
|  | 144 |  | 
| Argyrios Kyrtzidis | 53d0ea5 | 2008-06-28 06:07:14 +0000 | [diff] [blame] | 145 | /// CurContext - This is the current declaration context of parsing. | 
| Chris Lattner | b048c98 | 2008-04-06 04:47:34 +0000 | [diff] [blame] | 146 | DeclContext *CurContext; | 
| Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 147 |  | 
| Argyrios Kyrtzidis | ef6e647 | 2008-11-08 17:17:31 +0000 | [diff] [blame] | 148 | /// PreDeclaratorDC - Keeps the declaration context before switching to the | 
|  | 149 | /// context of a declarator's nested-name-specifier. | 
|  | 150 | DeclContext *PreDeclaratorDC; | 
|  | 151 |  | 
| Steve Naroff | 4eb206b | 2008-09-03 18:15:37 +0000 | [diff] [blame] | 152 | /// CurBlock - If inside of a block definition, this contains a pointer to | 
|  | 153 | /// the active block object that represents it. | 
|  | 154 | BlockSemaInfo *CurBlock; | 
|  | 155 |  | 
| Daniel Dunbar | 4cde927 | 2008-10-14 05:35:18 +0000 | [diff] [blame] | 156 | /// PackContext - Manages the stack for #pragma pack. An alignment | 
|  | 157 | /// of 0 indicates default alignment. | 
| Chris Lattner | 574aa40 | 2009-02-17 01:09:29 +0000 | [diff] [blame] | 158 | void *PackContext; // Really a "PragmaPackStack*" | 
| Daniel Dunbar | 4cde927 | 2008-10-14 05:35:18 +0000 | [diff] [blame] | 159 |  | 
| Chris Lattner | ea29a3a | 2009-04-18 20:01:55 +0000 | [diff] [blame] | 160 | /// FunctionLabelMap - This is a mapping from label identifiers to the | 
|  | 161 | /// LabelStmt for it (which acts like the label decl in some ways).  Forward | 
|  | 162 | /// referenced labels have a LabelStmt created for them with a null location & | 
|  | 163 | /// SubStmt. | 
|  | 164 | /// | 
|  | 165 | /// Note that this should always be accessed through getLabelMap() in order | 
|  | 166 | /// to handle blocks properly. | 
|  | 167 | llvm::DenseMap<IdentifierInfo*, LabelStmt*> FunctionLabelMap; | 
| Steve Naroff | caaacec | 2009-03-13 15:38:40 +0000 | [diff] [blame] | 168 |  | 
| Chris Lattner | bcfce66 | 2009-04-18 20:10:59 +0000 | [diff] [blame] | 169 | /// FunctionSwitchStack - This is the current set of active switch statements | 
|  | 170 | /// in the top level function.  Clients should always use getSwitchStack() to | 
|  | 171 | /// handle the case when they are in a block. | 
|  | 172 | llvm::SmallVector<SwitchStmt*, 8> FunctionSwitchStack; | 
| Anders Carlsson | 165a0a0 | 2009-05-17 18:41:29 +0000 | [diff] [blame] | 173 |  | 
|  | 174 | /// ExprTemporaries - This is the stack of temporaries that are created by | 
|  | 175 | /// the current full expression. | 
| Anders Carlsson | ff6b3d6 | 2009-05-30 21:05:25 +0000 | [diff] [blame] | 176 | llvm::SmallVector<CXXTemporary*, 8> ExprTemporaries; | 
| Anders Carlsson | 165a0a0 | 2009-05-17 18:41:29 +0000 | [diff] [blame] | 177 |  | 
| Chris Lattner | 38c5ebd | 2009-04-19 05:21:20 +0000 | [diff] [blame] | 178 | /// CurFunctionNeedsScopeChecking - This is set to true when a function or | 
|  | 179 | /// ObjC method body contains a VLA or an ObjC try block, which introduce | 
|  | 180 | /// scopes that need to be checked for goto conditions.  If a function does | 
|  | 181 | /// not contain this, then it need not have the jump checker run on it. | 
|  | 182 | bool CurFunctionNeedsScopeChecking; | 
|  | 183 |  | 
| Nate Begeman | 213541a | 2008-04-18 23:10:10 +0000 | [diff] [blame] | 184 | /// ExtVectorDecls - This is a list all the extended vector types. This allows | 
|  | 185 | /// us to associate a raw vector type with one of the ext_vector type names. | 
| Steve Naroff | bea0b34 | 2007-07-29 16:33:31 +0000 | [diff] [blame] | 186 | /// This is only necessary for issuing pretty diagnostics. | 
| Nate Begeman | 213541a | 2008-04-18 23:10:10 +0000 | [diff] [blame] | 187 | llvm::SmallVector<TypedefDecl*, 24> ExtVectorDecls; | 
| Steve Naroff | e84a864 | 2008-09-28 14:55:53 +0000 | [diff] [blame] | 188 |  | 
| Argyrios Kyrtzidis | 0795232 | 2008-07-01 10:37:29 +0000 | [diff] [blame] | 189 | /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes. | 
|  | 190 | llvm::OwningPtr<CXXFieldCollector> FieldCollector; | 
|  | 191 |  | 
| Anders Carlsson | 4681ebd | 2009-03-22 20:18:17 +0000 | [diff] [blame] | 192 | typedef llvm::SmallPtrSet<const CXXRecordDecl*, 8> RecordDeclSetTy; | 
|  | 193 |  | 
|  | 194 | /// PureVirtualClassDiagSet - a set of class declarations which we have | 
|  | 195 | /// emitted a list of pure virtual functions. Used to prevent emitting the | 
|  | 196 | /// same list more than once. | 
|  | 197 | llvm::OwningPtr<RecordDeclSetTy> PureVirtualClassDiagSet; | 
|  | 198 |  | 
| Douglas Gregor | 6393519 | 2009-03-02 00:19:53 +0000 | [diff] [blame] | 199 | /// \brief A mapping from external names to the most recent | 
|  | 200 | /// locally-scoped external declaration with that name. | 
|  | 201 | /// | 
|  | 202 | /// This map contains external declarations introduced in local | 
|  | 203 | /// scoped, e.g., | 
|  | 204 | /// | 
|  | 205 | /// \code | 
|  | 206 | /// void f() { | 
|  | 207 | ///   void foo(int, int); | 
|  | 208 | /// } | 
|  | 209 | /// \endcode | 
|  | 210 | /// | 
|  | 211 | /// Here, the name "foo" will be associated with the declaration on | 
|  | 212 | /// "foo" within f. This name is not visible outside of | 
|  | 213 | /// "f". However, we still find it in two cases: | 
|  | 214 | /// | 
|  | 215 | ///   - If we are declaring another external with the name "foo", we | 
|  | 216 | ///     can find "foo" as a previous declaration, so that the types | 
|  | 217 | ///     of this external declaration can be checked for | 
|  | 218 | ///     compatibility. | 
|  | 219 | /// | 
|  | 220 | ///   - If we would implicitly declare "foo" (e.g., due to a call to | 
|  | 221 | ///     "foo" in C when no prototype or definition is visible), then | 
|  | 222 | ///     we find this declaration of "foo" and complain that it is | 
|  | 223 | ///     not visible. | 
|  | 224 | llvm::DenseMap<DeclarationName, NamedDecl *> LocallyScopedExternalDecls; | 
|  | 225 |  | 
| Douglas Gregor | b6c8c8b | 2009-04-21 17:11:58 +0000 | [diff] [blame] | 226 | /// \brief The set of tentative declarations seen so far in this | 
|  | 227 | /// translation unit for which no definition has been seen. | 
|  | 228 | /// | 
|  | 229 | /// The tentative declarations are indexed by the name of the | 
|  | 230 | /// declaration, and only the most recent tentative declaration for | 
|  | 231 | /// a given variable will be recorded here. | 
|  | 232 | llvm::DenseMap<DeclarationName, VarDecl *> TentativeDefinitions; | 
|  | 233 |  | 
| Ryan Flynn | e25ff83 | 2009-07-30 03:15:39 +0000 | [diff] [blame] | 234 | /// WeakUndeclaredIdentifiers - Identifiers contained in | 
|  | 235 | /// #pragma weak before declared. rare. may alias another | 
|  | 236 | /// identifier, declared or undeclared | 
|  | 237 | class WeakInfo { | 
|  | 238 | IdentifierInfo *alias;  // alias (optional) | 
|  | 239 | SourceLocation loc;     // for diagnostics | 
|  | 240 | bool used;              // identifier later declared? | 
|  | 241 | public: | 
|  | 242 | WeakInfo() | 
|  | 243 | : alias(0), loc(SourceLocation()), used(false) {} | 
|  | 244 | WeakInfo(IdentifierInfo *Alias, SourceLocation Loc) | 
|  | 245 | : alias(Alias), loc(Loc), used(false) {} | 
|  | 246 | inline IdentifierInfo * getAlias() const { return alias; } | 
|  | 247 | inline SourceLocation getLocation() const { return loc; } | 
|  | 248 | void setUsed(bool Used=true) { used = Used; } | 
|  | 249 | inline bool getUsed() { return used; } | 
|  | 250 | bool operator==(WeakInfo RHS) const { | 
|  | 251 | return alias == RHS.getAlias() && loc == RHS.getLocation(); | 
|  | 252 | } | 
|  | 253 | bool operator!=(WeakInfo RHS) const { return !(*this == RHS); } | 
|  | 254 | }; | 
|  | 255 | llvm::DenseMap<IdentifierInfo*,WeakInfo> WeakUndeclaredIdentifiers; | 
|  | 256 |  | 
| Ryan Flynn | 7b1fdbd | 2009-07-31 02:52:19 +0000 | [diff] [blame] | 257 | /// WeakTopLevelDecl - Translation-unit scoped declarations generated by | 
|  | 258 | /// #pragma weak during processing of other Decls. | 
|  | 259 | /// I couldn't figure out a clean way to generate these in-line, so | 
|  | 260 | /// we store them here and handle separately -- which is a hack. | 
|  | 261 | /// It would be best to refactor this. | 
|  | 262 | llvm::SmallVector<Decl*,2> WeakTopLevelDecl; | 
|  | 263 |  | 
| Chris Lattner | 7f925cc | 2008-04-11 07:00:53 +0000 | [diff] [blame] | 264 | IdentifierResolver IdResolver; | 
|  | 265 |  | 
| Steve Naroff | e440eb8 | 2007-10-10 17:32:04 +0000 | [diff] [blame] | 266 | /// Translation Unit Scope - useful to Objective-C actions that need | 
|  | 267 | /// to lookup file scope declarations in the "ordinary" C decl namespace. | 
|  | 268 | /// For example, user-defined classes, built-in "id" type, etc. | 
| Steve Naroff | b216c88 | 2007-10-09 22:01:59 +0000 | [diff] [blame] | 269 | Scope *TUScope; | 
| Sebastian Redl | c42e118 | 2008-11-11 11:37:55 +0000 | [diff] [blame] | 270 |  | 
|  | 271 | /// The C++ "std" namespace, where the standard library resides. Cached here | 
|  | 272 | /// by GetStdNamespace | 
|  | 273 | NamespaceDecl *StdNamespace; | 
| Sebastian Redl | b5a57a6 | 2008-12-03 20:26:15 +0000 | [diff] [blame] | 274 |  | 
|  | 275 | /// A flag to remember whether the implicit forms of operator new and delete | 
|  | 276 | /// have been declared. | 
|  | 277 | bool GlobalNewDeleteDeclared; | 
| Douglas Gregor | f807fe0 | 2009-04-14 16:27:31 +0000 | [diff] [blame] | 278 |  | 
| Douglas Gregor | ac7610d | 2009-06-22 20:57:11 +0000 | [diff] [blame] | 279 | /// The current expression evaluation context. | 
|  | 280 | ExpressionEvaluationContext ExprEvalContext; | 
|  | 281 |  | 
|  | 282 | typedef std::vector<std::pair<SourceLocation, Decl *> > | 
|  | 283 | PotentiallyReferencedDecls; | 
|  | 284 |  | 
|  | 285 | /// A stack of declarations, each element of which is a set of declarations | 
|  | 286 | /// that will be marked as referenced if the corresponding potentially | 
|  | 287 | /// potentially evaluated expression is potentially evaluated. Each element | 
|  | 288 | /// in the stack corresponds to a PotentiallyPotentiallyEvaluated expression | 
|  | 289 | /// evaluation context. | 
|  | 290 | std::list<PotentiallyReferencedDecls> PotentiallyReferencedDeclStack; | 
| Douglas Gregor | e0762c9 | 2009-06-19 23:52:42 +0000 | [diff] [blame] | 291 |  | 
| Douglas Gregor | f807fe0 | 2009-04-14 16:27:31 +0000 | [diff] [blame] | 292 | /// \brief Whether the code handled by Sema should be considered a | 
|  | 293 | /// complete translation unit or not. | 
|  | 294 | /// | 
|  | 295 | /// When true (which is generally the case), Sema will perform | 
|  | 296 | /// end-of-translation-unit semantic tasks (such as creating | 
|  | 297 | /// initializers for tentative definitions in C) once parsing has | 
|  | 298 | /// completed. This flag will be false when building PCH files, | 
|  | 299 | /// since a PCH file is by definition not a complete translation | 
|  | 300 | /// unit. | 
|  | 301 | bool CompleteTranslationUnit; | 
|  | 302 |  | 
| Douglas Gregor | bb26041 | 2009-06-14 08:02:22 +0000 | [diff] [blame] | 303 | /// \brief The number of SFINAE diagnostics that have been trapped. | 
|  | 304 | unsigned NumSFINAEErrors; | 
|  | 305 |  | 
| Douglas Gregor | f0aaf7a | 2009-04-24 21:10:55 +0000 | [diff] [blame] | 306 | typedef llvm::DenseMap<Selector, ObjCMethodList> MethodPool; | 
|  | 307 |  | 
| Steve Naroff | 58ff9e8 | 2007-10-14 00:58:41 +0000 | [diff] [blame] | 308 | /// Instance/Factory Method Pools - allows efficient lookup when typechecking | 
|  | 309 | /// messages to "id". We need to maintain a list, since selectors can have | 
|  | 310 | /// differing signatures across classes. In Cocoa, this happens to be | 
|  | 311 | /// extremely uncommon (only 1% of selectors are "overloaded"). | 
| Douglas Gregor | f0aaf7a | 2009-04-24 21:10:55 +0000 | [diff] [blame] | 312 | MethodPool InstanceMethodPool; | 
|  | 313 | MethodPool FactoryMethodPool; | 
| Steve Naroff | 6b9dfd4 | 2009-03-04 15:11:40 +0000 | [diff] [blame] | 314 |  | 
| Douglas Gregor | f0aaf7a | 2009-04-24 21:10:55 +0000 | [diff] [blame] | 315 | MethodPool::iterator ReadMethodPool(Selector Sel, bool isInstance); | 
|  | 316 |  | 
| Steve Naroff | 6b9dfd4 | 2009-03-04 15:11:40 +0000 | [diff] [blame] | 317 | /// Private Helper predicate to check for 'self'. | 
|  | 318 | bool isSelfExpr(Expr *RExpr); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 319 | public: | 
| Douglas Gregor | f807fe0 | 2009-04-14 16:27:31 +0000 | [diff] [blame] | 320 | Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, | 
|  | 321 | bool CompleteTranslationUnit = true); | 
| Chris Lattner | 574aa40 | 2009-02-17 01:09:29 +0000 | [diff] [blame] | 322 | ~Sema() { | 
|  | 323 | if (PackContext) FreePackedContext(); | 
|  | 324 | } | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 325 |  | 
| Chris Lattner | 53ebff3 | 2009-01-22 19:21:44 +0000 | [diff] [blame] | 326 | const LangOptions &getLangOptions() const { return LangOpts; } | 
| Chris Lattner | 3cfa928 | 2008-11-22 08:28:49 +0000 | [diff] [blame] | 327 | Diagnostic &getDiagnostics() const { return Diags; } | 
|  | 328 | SourceManager &getSourceManager() const { return SourceMgr; } | 
|  | 329 |  | 
| Douglas Gregor | 25a88bb | 2009-03-20 22:48:49 +0000 | [diff] [blame] | 330 | /// \brief Helper class that creates diagnostics with optional | 
|  | 331 | /// template instantiation stacks. | 
|  | 332 | /// | 
|  | 333 | /// This class provides a wrapper around the basic DiagnosticBuilder | 
|  | 334 | /// class that emits diagnostics. SemaDiagnosticBuilder is | 
|  | 335 | /// responsible for emitting the diagnostic (as DiagnosticBuilder | 
|  | 336 | /// does) and, if the diagnostic comes from inside a template | 
|  | 337 | /// instantiation, printing the template instantiation stack as | 
|  | 338 | /// well. | 
|  | 339 | class SemaDiagnosticBuilder : public DiagnosticBuilder { | 
|  | 340 | Sema &SemaRef; | 
|  | 341 | unsigned DiagID; | 
|  | 342 |  | 
|  | 343 | public: | 
|  | 344 | SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID) | 
|  | 345 | : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) { } | 
|  | 346 |  | 
| Douglas Gregor | 5e9f35c | 2009-06-14 07:33:30 +0000 | [diff] [blame] | 347 | explicit SemaDiagnosticBuilder(Sema &SemaRef) | 
|  | 348 | : DiagnosticBuilder(DiagnosticBuilder::Suppress), SemaRef(SemaRef) { } | 
|  | 349 |  | 
| Douglas Gregor | 25a88bb | 2009-03-20 22:48:49 +0000 | [diff] [blame] | 350 | ~SemaDiagnosticBuilder(); | 
|  | 351 | }; | 
|  | 352 |  | 
|  | 353 | /// \brief Emit a diagnostic. | 
|  | 354 | SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) { | 
| Douglas Gregor | 5e9f35c | 2009-06-14 07:33:30 +0000 | [diff] [blame] | 355 | if (isSFINAEContext() && Diagnostic::isBuiltinSFINAEDiag(DiagID)) { | 
|  | 356 | // If we encountered an error during template argument | 
|  | 357 | // deduction, and that error is one of the SFINAE errors, | 
| Douglas Gregor | bb26041 | 2009-06-14 08:02:22 +0000 | [diff] [blame] | 358 | // suppress the diagnostic. | 
| Douglas Gregor | 8439fac | 2009-06-15 16:52:15 +0000 | [diff] [blame] | 359 | ++NumSFINAEErrors; | 
|  | 360 | return SemaDiagnosticBuilder(*this); | 
| Douglas Gregor | 5e9f35c | 2009-06-14 07:33:30 +0000 | [diff] [blame] | 361 | } | 
|  | 362 |  | 
| Douglas Gregor | ee1828a | 2009-03-10 18:03:33 +0000 | [diff] [blame] | 363 | DiagnosticBuilder DB = Diags.Report(FullSourceLoc(Loc, SourceMgr), DiagID); | 
| Douglas Gregor | 25a88bb | 2009-03-20 22:48:49 +0000 | [diff] [blame] | 364 | return SemaDiagnosticBuilder(DB, *this, DiagID); | 
| Chris Lattner | 3cfa928 | 2008-11-22 08:28:49 +0000 | [diff] [blame] | 365 | } | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 366 |  | 
| Chris Lattner | 394a3fd | 2007-08-31 04:53:24 +0000 | [diff] [blame] | 367 | virtual void DeleteExpr(ExprTy *E); | 
|  | 368 | virtual void DeleteStmt(StmtTy *S); | 
|  | 369 |  | 
| Sebastian Redl | 798d119 | 2008-12-13 16:23:55 +0000 | [diff] [blame] | 370 | OwningExprResult Owned(Expr* E) { return OwningExprResult(*this, E); } | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 371 | OwningExprResult Owned(ExprResult R) { | 
| Douglas Gregor | 5ac8aff | 2009-01-26 22:44:13 +0000 | [diff] [blame] | 372 | if (R.isInvalid()) | 
| Steve Naroff | 872b9ac | 2009-01-21 22:32:33 +0000 | [diff] [blame] | 373 | return ExprError(); | 
| Douglas Gregor | 5ac8aff | 2009-01-26 22:44:13 +0000 | [diff] [blame] | 374 | return OwningExprResult(*this, R.get()); | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 375 | } | 
| Sebastian Redl | 798d119 | 2008-12-13 16:23:55 +0000 | [diff] [blame] | 376 | OwningStmtResult Owned(Stmt* S) { return OwningStmtResult(*this, S); } | 
|  | 377 |  | 
| Chris Lattner | 9299f3f | 2008-08-23 03:19:52 +0000 | [diff] [blame] | 378 | virtual void ActOnEndOfTranslationUnit(); | 
| Sebastian Redl | b8a6aca | 2009-01-19 22:31:54 +0000 | [diff] [blame] | 379 |  | 
| Chris Lattner | ea29a3a | 2009-04-18 20:01:55 +0000 | [diff] [blame] | 380 | /// getLabelMap() - Return the current label map.  If we're in a block, we | 
|  | 381 | /// return it. | 
|  | 382 | llvm::DenseMap<IdentifierInfo*, LabelStmt*> &getLabelMap() { | 
|  | 383 | return CurBlock ? CurBlock->LabelMap : FunctionLabelMap; | 
|  | 384 | } | 
|  | 385 |  | 
| Chris Lattner | bcfce66 | 2009-04-18 20:10:59 +0000 | [diff] [blame] | 386 | /// getSwitchStack - This is returns the switch stack for the current block or | 
|  | 387 | /// function. | 
|  | 388 | llvm::SmallVector<SwitchStmt*,8> &getSwitchStack() { | 
|  | 389 | return CurBlock ? CurBlock->SwitchStack : FunctionSwitchStack; | 
|  | 390 | } | 
| Ryan Flynn | 7b1fdbd | 2009-07-31 02:52:19 +0000 | [diff] [blame] | 391 |  | 
|  | 392 | /// WeakTopLevelDeclDecls - access to #pragma weak-generated Decls | 
|  | 393 | llvm::SmallVector<Decl*,2> &WeakTopLevelDecls() { return WeakTopLevelDecl; } | 
| Chris Lattner | bcfce66 | 2009-04-18 20:10:59 +0000 | [diff] [blame] | 394 |  | 
| Douglas Gregor | 2e22253 | 2009-07-02 17:08:52 +0000 | [diff] [blame] | 395 | virtual void ActOnComment(SourceRange Comment); | 
|  | 396 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 397 | //===--------------------------------------------------------------------===// | 
|  | 398 | // Type Analysis / Processing: SemaType.cpp. | 
|  | 399 | // | 
| Douglas Gregor | 2dc0e64 | 2009-03-23 23:06:20 +0000 | [diff] [blame] | 400 | QualType adjustParameterType(QualType T); | 
| Chris Lattner | eaaebc7 | 2009-04-25 08:06:05 +0000 | [diff] [blame] | 401 | QualType ConvertDeclSpecToType(const DeclSpec &DS, SourceLocation DeclLoc, | 
|  | 402 | bool &IsInvalid); | 
| Chris Lattner | c9b346d | 2008-06-29 00:50:08 +0000 | [diff] [blame] | 403 | void ProcessTypeAttributeList(QualType &Result, const AttributeList *AL); | 
| Douglas Gregor | cd281c3 | 2009-02-28 00:25:32 +0000 | [diff] [blame] | 404 | QualType BuildPointerType(QualType T, unsigned Quals, | 
|  | 405 | SourceLocation Loc, DeclarationName Entity); | 
| Sebastian Redl | 7c80bd6 | 2009-03-16 23:22:08 +0000 | [diff] [blame] | 406 | QualType BuildReferenceType(QualType T, bool LValueRef, unsigned Quals, | 
| Douglas Gregor | cd281c3 | 2009-02-28 00:25:32 +0000 | [diff] [blame] | 407 | SourceLocation Loc, DeclarationName Entity); | 
|  | 408 | QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, | 
|  | 409 | Expr *ArraySize, unsigned Quals, | 
| Douglas Gregor | 7e7eb3d | 2009-07-06 15:59:29 +0000 | [diff] [blame] | 410 | SourceRange Brackets, DeclarationName Entity); | 
| Douglas Gregor | 9cdda0c | 2009-06-17 21:51:59 +0000 | [diff] [blame] | 411 | QualType BuildExtVectorType(QualType T, ExprArg ArraySize, | 
|  | 412 | SourceLocation AttrLoc); | 
| Douglas Gregor | 724651c | 2009-02-28 01:04:19 +0000 | [diff] [blame] | 413 | QualType BuildFunctionType(QualType T, | 
|  | 414 | QualType *ParamTypes, unsigned NumParamTypes, | 
|  | 415 | bool Variadic, unsigned Quals, | 
|  | 416 | SourceLocation Loc, DeclarationName Entity); | 
| Douglas Gregor | 949bf69 | 2009-06-09 22:17:39 +0000 | [diff] [blame] | 417 | QualType BuildMemberPointerType(QualType T, QualType Class, | 
|  | 418 | unsigned Quals, SourceLocation Loc, | 
|  | 419 | DeclarationName Entity); | 
| Anders Carlsson | 9a917e4 | 2009-06-12 22:56:54 +0000 | [diff] [blame] | 420 | QualType BuildBlockPointerType(QualType T, unsigned Quals, | 
|  | 421 | SourceLocation Loc, DeclarationName Entity); | 
| Douglas Gregor | 402abb5 | 2009-05-28 23:31:59 +0000 | [diff] [blame] | 422 | QualType GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip = 0, | 
|  | 423 | TagDecl **OwnedDecl = 0); | 
| Douglas Gregor | 10bd368 | 2008-11-17 22:58:34 +0000 | [diff] [blame] | 424 | DeclarationName GetNameForDeclarator(Declarator &D); | 
| Sebastian Redl | ef65f06 | 2009-05-29 18:02:33 +0000 | [diff] [blame] | 425 | bool CheckSpecifiedExceptionType(QualType T, const SourceRange &Range); | 
| Sebastian Redl | 6a7330c | 2009-05-29 15:01:05 +0000 | [diff] [blame] | 426 | bool CheckDistantExceptionSpec(QualType T); | 
| Sebastian Redl | 4994d2d | 2009-07-04 11:39:00 +0000 | [diff] [blame] | 427 | bool CheckEquivalentExceptionSpec( | 
|  | 428 | const FunctionProtoType *Old, SourceLocation OldLoc, | 
|  | 429 | const FunctionProtoType *New, SourceLocation NewLoc); | 
| Sebastian Redl | 23c7d06 | 2009-07-07 20:29:57 +0000 | [diff] [blame] | 430 | bool CheckExceptionSpecSubset(unsigned DiagID, unsigned NoteID, | 
|  | 431 | const FunctionProtoType *Superset, SourceLocation SuperLoc, | 
|  | 432 | const FunctionProtoType *Subset, SourceLocation SubLoc); | 
| Douglas Gregor | 10bd368 | 2008-11-17 22:58:34 +0000 | [diff] [blame] | 433 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 434 | QualType ObjCGetTypeForMethodDefinition(DeclPtrTy D); | 
| Fariborz Jahanian | 306d68f | 2007-11-08 23:49:49 +0000 | [diff] [blame] | 435 |  | 
| Douglas Gregor | 5737326 | 2008-10-22 14:17:15 +0000 | [diff] [blame] | 436 | bool UnwrapSimilarPointerTypes(QualType& T1, QualType& T2); | 
|  | 437 |  | 
| Sebastian Redl | cee63fb | 2008-12-02 14:43:59 +0000 | [diff] [blame] | 438 | virtual TypeResult ActOnTypeName(Scope *S, Declarator &D); | 
| Sebastian Redl | 37d6de3 | 2008-11-08 13:00:26 +0000 | [diff] [blame] | 439 |  | 
| Douglas Gregor | 86447ec | 2009-03-09 16:13:40 +0000 | [diff] [blame] | 440 | bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned diag, | 
| Douglas Gregor | 4ec339f | 2009-01-19 19:26:10 +0000 | [diff] [blame] | 441 | SourceRange Range1 = SourceRange(), | 
|  | 442 | SourceRange Range2 = SourceRange(), | 
|  | 443 | QualType PrintType = QualType()); | 
|  | 444 |  | 
| Douglas Gregor | e625893 | 2009-03-19 00:39:20 +0000 | [diff] [blame] | 445 | QualType getQualifiedNameType(const CXXScopeSpec &SS, QualType T); | 
|  | 446 |  | 
| Anders Carlsson | af017e6 | 2009-06-29 22:58:55 +0000 | [diff] [blame] | 447 | QualType BuildTypeofExprType(Expr *E); | 
|  | 448 | QualType BuildDecltypeType(Expr *E); | 
|  | 449 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 450 | //===--------------------------------------------------------------------===// | 
|  | 451 | // Symbol table / Decl tracking callbacks: SemaDecl.cpp. | 
|  | 452 | // | 
| Chris Lattner | 21ff9c9 | 2009-03-05 01:25:28 +0000 | [diff] [blame] | 453 |  | 
|  | 454 | /// getDeclName - Return a pretty name for the specified decl if possible, or | 
|  | 455 | /// an empty string if not.  This is used for pretty crash reporting. | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 456 | virtual std::string getDeclName(DeclPtrTy D); | 
| Chris Lattner | 21ff9c9 | 2009-03-05 01:25:28 +0000 | [diff] [blame] | 457 |  | 
| Chris Lattner | 682bf92 | 2009-03-29 16:50:03 +0000 | [diff] [blame] | 458 | DeclGroupPtrTy ConvertDeclToDeclGroup(DeclPtrTy Ptr); | 
|  | 459 |  | 
| Douglas Gregor | 1a51b4a | 2009-02-09 15:09:02 +0000 | [diff] [blame] | 460 | virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, | 
| Douglas Gregor | b696ea3 | 2009-02-04 17:00:24 +0000 | [diff] [blame] | 461 | Scope *S, const CXXScopeSpec *SS); | 
| Chris Lattner | 4c97d76 | 2009-04-12 21:49:30 +0000 | [diff] [blame] | 462 | virtual DeclSpec::TST isTagName(IdentifierInfo &II, Scope *S); | 
|  | 463 |  | 
| Chris Lattner | 682bf92 | 2009-03-29 16:50:03 +0000 | [diff] [blame] | 464 | virtual DeclPtrTy ActOnDeclarator(Scope *S, Declarator &D) { | 
| Douglas Gregor | e542c86 | 2009-06-23 23:11:28 +0000 | [diff] [blame] | 465 | return HandleDeclarator(S, D, MultiTemplateParamsArg(*this), false); | 
| Douglas Gregor | 584049d | 2008-12-15 23:53:10 +0000 | [diff] [blame] | 466 | } | 
| Douglas Gregor | e542c86 | 2009-06-23 23:11:28 +0000 | [diff] [blame] | 467 |  | 
|  | 468 | DeclPtrTy HandleDeclarator(Scope *S, Declarator &D, | 
|  | 469 | MultiTemplateParamsArg TemplateParameterLists, | 
|  | 470 | bool IsFunctionDefinition); | 
| Douglas Gregor | 6393519 | 2009-03-02 00:19:53 +0000 | [diff] [blame] | 471 | void RegisterLocallyScopedExternCDecl(NamedDecl *ND, NamedDecl *PrevDecl, | 
|  | 472 | Scope *S); | 
| Eli Friedman | 85a5319 | 2009-04-07 19:37:57 +0000 | [diff] [blame] | 473 | void DiagnoseFunctionSpecifiers(Declarator& D); | 
| Douglas Gregor | 4afa39d | 2009-01-20 01:17:11 +0000 | [diff] [blame] | 474 | NamedDecl* ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, | 
| Chris Lattner | eaaebc7 | 2009-04-25 08:06:05 +0000 | [diff] [blame] | 475 | QualType R, Decl* PrevDecl, | 
| Douglas Gregor | cda9c67 | 2009-02-16 17:45:42 +0000 | [diff] [blame] | 476 | bool &Redeclaration); | 
| Douglas Gregor | 4afa39d | 2009-01-20 01:17:11 +0000 | [diff] [blame] | 477 | NamedDecl* ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC, | 
| Chris Lattner | eaaebc7 | 2009-04-25 08:06:05 +0000 | [diff] [blame] | 478 | QualType R, NamedDecl* PrevDecl, | 
| Douglas Gregor | dfe3f2d | 2009-07-22 17:18:37 +0000 | [diff] [blame] | 479 | MultiTemplateParamsArg TemplateParamLists, | 
| Douglas Gregor | cda9c67 | 2009-02-16 17:45:42 +0000 | [diff] [blame] | 480 | bool &Redeclaration); | 
| Chris Lattner | eaaebc7 | 2009-04-25 08:06:05 +0000 | [diff] [blame] | 481 | void CheckVariableDeclaration(VarDecl *NewVD, NamedDecl *PrevDecl, | 
| Douglas Gregor | 3d7a12a | 2009-03-25 23:32:15 +0000 | [diff] [blame] | 482 | bool &Redeclaration); | 
| Douglas Gregor | 4afa39d | 2009-01-20 01:17:11 +0000 | [diff] [blame] | 483 | NamedDecl* ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, | 
| Chris Lattner | 682bf92 | 2009-03-29 16:50:03 +0000 | [diff] [blame] | 484 | QualType R, NamedDecl* PrevDecl, | 
| Douglas Gregor | e542c86 | 2009-06-23 23:11:28 +0000 | [diff] [blame] | 485 | MultiTemplateParamsArg TemplateParamLists, | 
| Douglas Gregor | 04495c8 | 2009-02-24 01:23:02 +0000 | [diff] [blame] | 486 | bool IsFunctionDefinition, | 
| Chris Lattner | eaaebc7 | 2009-04-25 08:06:05 +0000 | [diff] [blame] | 487 | bool &Redeclaration); | 
|  | 488 | void CheckFunctionDeclaration(FunctionDecl *NewFD, NamedDecl *&PrevDecl, | 
| Douglas Gregor | 2dc0e64 | 2009-03-23 23:06:20 +0000 | [diff] [blame] | 489 | bool &Redeclaration, | 
|  | 490 | bool &OverloadableAttrRequired); | 
| John McCall | 8c4859a | 2009-07-24 03:03:21 +0000 | [diff] [blame] | 491 | void CheckMain(FunctionDecl *FD); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 492 | virtual DeclPtrTy ActOnParamDeclarator(Scope *S, Declarator &D); | 
|  | 493 | virtual void ActOnParamDefaultArgument(DeclPtrTy param, | 
| Chris Lattner | 0442108 | 2008-04-08 04:40:51 +0000 | [diff] [blame] | 494 | SourceLocation EqualLoc, | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 495 | ExprArg defarg); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 496 | virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param, | 
| Anders Carlsson | 5e300d1 | 2009-06-12 16:51:40 +0000 | [diff] [blame] | 497 | SourceLocation EqualLoc, | 
|  | 498 | SourceLocation ArgLoc); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 499 | virtual void ActOnParamDefaultArgumentError(DeclPtrTy param); | 
| Anders Carlsson | 5e300d1 | 2009-06-12 16:51:40 +0000 | [diff] [blame] | 500 |  | 
|  | 501 | // Contains the locations of the beginning of unparsed default | 
|  | 502 | // argument locations. | 
|  | 503 | llvm::DenseMap<ParmVarDecl *,SourceLocation> UnparsedDefaultArgLocs; | 
|  | 504 |  | 
| Anders Carlsson | f5dcd38 | 2009-05-30 21:37:25 +0000 | [diff] [blame] | 505 | virtual void AddInitializerToDecl(DeclPtrTy dcl, FullExprArg init); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 506 | void AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit); | 
| Anders Carlsson | 6a75cd9 | 2009-07-11 00:34:39 +0000 | [diff] [blame] | 507 | void ActOnUninitializedDecl(DeclPtrTy dcl, bool TypeContainsUndeducedAuto); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 508 | virtual void SetDeclDeleted(DeclPtrTy dcl, SourceLocation DelLoc); | 
| Eli Friedman | c1dc653 | 2009-05-29 01:49:24 +0000 | [diff] [blame] | 509 | virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, | 
|  | 510 | DeclPtrTy *Group, | 
| Chris Lattner | 682bf92 | 2009-03-29 16:50:03 +0000 | [diff] [blame] | 511 | unsigned NumDecls); | 
| Douglas Gregor | a3a8351 | 2009-04-01 23:51:29 +0000 | [diff] [blame] | 512 | virtual void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, | 
|  | 513 | SourceLocation LocAfterDecls); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 514 | virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *S, Declarator &D); | 
|  | 515 | virtual DeclPtrTy ActOnStartOfFunctionDef(Scope *S, DeclPtrTy D); | 
|  | 516 | virtual void ActOnStartOfObjCMethodDef(Scope *S, DeclPtrTy D); | 
| Sebastian Redl | b8a6aca | 2009-01-19 22:31:54 +0000 | [diff] [blame] | 517 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 518 | virtual DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body); | 
| Douglas Gregor | e2c31ff | 2009-05-15 17:59:04 +0000 | [diff] [blame] | 519 | DeclPtrTy ActOnFinishFunctionBody(DeclPtrTy Decl, StmtArg Body, | 
|  | 520 | bool IsInstantiation); | 
| Douglas Gregor | e0762c9 | 2009-06-19 23:52:42 +0000 | [diff] [blame] | 521 |  | 
|  | 522 | /// \brief Diagnose any unused parameters in the given sequence of | 
|  | 523 | /// ParmVarDecl pointers. | 
|  | 524 | template<typename InputIterator> | 
|  | 525 | void DiagnoseUnusedParameters(InputIterator Param, InputIterator ParamEnd) { | 
|  | 526 | for (; Param != ParamEnd; ++Param) { | 
|  | 527 | if (!(*Param)->isUsed() && (*Param)->getDeclName() && | 
| Argyrios Kyrtzidis | 40b598e | 2009-06-30 02:34:44 +0000 | [diff] [blame] | 528 | !(*Param)->template hasAttr<UnusedAttr>()) | 
| Douglas Gregor | e0762c9 | 2009-06-19 23:52:42 +0000 | [diff] [blame] | 529 | Diag((*Param)->getLocation(), diag::warn_unused_parameter) | 
|  | 530 | << (*Param)->getDeclName(); | 
|  | 531 | } | 
|  | 532 | } | 
|  | 533 |  | 
| Chris Lattner | 5af280c | 2009-04-19 04:46:21 +0000 | [diff] [blame] | 534 | void DiagnoseInvalidJumps(Stmt *Body); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 535 | virtual DeclPtrTy ActOnFileScopeAsmDecl(SourceLocation Loc, ExprArg expr); | 
| Anders Carlsson | dfab6cb | 2008-02-08 00:33:21 +0000 | [diff] [blame] | 536 |  | 
| Steve Naroff | b216c88 | 2007-10-09 22:01:59 +0000 | [diff] [blame] | 537 | /// Scope actions. | 
|  | 538 | virtual void ActOnPopScope(SourceLocation Loc, Scope *S); | 
|  | 539 | virtual void ActOnTranslationUnitScope(SourceLocation Loc, Scope *S); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 540 |  | 
|  | 541 | /// ParsedFreeStandingDeclSpec - This method is invoked when a declspec with | 
|  | 542 | /// no declarator (e.g. "struct foo;") is parsed. | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 543 | virtual DeclPtrTy ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 544 |  | 
| Douglas Gregor | bcbffc4 | 2009-01-07 00:43:41 +0000 | [diff] [blame] | 545 | bool InjectAnonymousStructOrUnionMembers(Scope *S, DeclContext *Owner, | 
|  | 546 | RecordDecl *AnonRecord); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 547 | virtual DeclPtrTy BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, | 
|  | 548 | RecordDecl *Record); | 
| Douglas Gregor | bcbffc4 | 2009-01-07 00:43:41 +0000 | [diff] [blame] | 549 |  | 
| Douglas Gregor | 501c5ce | 2009-05-14 16:41:31 +0000 | [diff] [blame] | 550 | bool isAcceptableTagRedeclaration(const TagDecl *Previous, | 
|  | 551 | TagDecl::TagKind NewTag, | 
|  | 552 | SourceLocation NewTagLoc, | 
|  | 553 | const IdentifierInfo &Name); | 
| Douglas Gregor | ed4ec8f | 2009-05-03 17:18:57 +0000 | [diff] [blame] | 554 |  | 
| John McCall | 0f434ec | 2009-07-31 02:45:11 +0000 | [diff] [blame] | 555 | virtual DeclPtrTy ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 556 | SourceLocation KWLoc, const CXXScopeSpec &SS, | 
|  | 557 | IdentifierInfo *Name, SourceLocation NameLoc, | 
| Douglas Gregor | 402abb5 | 2009-05-28 23:31:59 +0000 | [diff] [blame] | 558 | AttributeList *Attr, AccessSpecifier AS, | 
| Douglas Gregor | 7cdbc58 | 2009-07-22 23:48:44 +0000 | [diff] [blame] | 559 | MultiTemplateParamsArg TemplateParameterLists, | 
| Douglas Gregor | 402abb5 | 2009-05-28 23:31:59 +0000 | [diff] [blame] | 560 | bool &OwnedDecl); | 
| Ted Kremenek | 4b7c983 | 2008-09-05 17:16:31 +0000 | [diff] [blame] | 561 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 562 | virtual void ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart, | 
| Chris Lattner | 06f5485 | 2008-08-23 02:00:52 +0000 | [diff] [blame] | 563 | IdentifierInfo *ClassName, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 564 | llvm::SmallVectorImpl<DeclPtrTy> &Decls); | 
|  | 565 | virtual DeclPtrTy ActOnField(Scope *S, DeclPtrTy TagD, | 
|  | 566 | SourceLocation DeclStart, | 
|  | 567 | Declarator &D, ExprTy *BitfieldWidth); | 
| Chris Lattner | 2479366 | 2009-03-05 22:45:59 +0000 | [diff] [blame] | 568 |  | 
|  | 569 | FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, | 
| Douglas Gregor | 4dd55f5 | 2009-03-11 20:50:30 +0000 | [diff] [blame] | 570 | Declarator &D, Expr *BitfieldWidth, | 
|  | 571 | AccessSpecifier AS); | 
| Chris Lattner | 2479366 | 2009-03-05 22:45:59 +0000 | [diff] [blame] | 572 |  | 
| Douglas Gregor | 3cf538d | 2009-03-11 18:59:21 +0000 | [diff] [blame] | 573 | FieldDecl *CheckFieldDecl(DeclarationName Name, QualType T, | 
|  | 574 | RecordDecl *Record, SourceLocation Loc, | 
|  | 575 | bool Mutable, Expr *BitfieldWidth, | 
| Steve Naroff | ea218b8 | 2009-07-14 14:58:18 +0000 | [diff] [blame] | 576 | SourceLocation TSSL, | 
| Douglas Gregor | 4dd55f5 | 2009-03-11 20:50:30 +0000 | [diff] [blame] | 577 | AccessSpecifier AS, NamedDecl *PrevDecl, | 
| Douglas Gregor | 3cf538d | 2009-03-11 18:59:21 +0000 | [diff] [blame] | 578 | Declarator *D = 0); | 
| Douglas Gregor | 1f2023a | 2009-07-22 18:25:24 +0000 | [diff] [blame] | 579 |  | 
|  | 580 | enum CXXSpecialMember { | 
|  | 581 | CXXDefaultConstructor = 0, | 
|  | 582 | CXXCopyConstructor = 1, | 
|  | 583 | CXXCopyAssignment = 2, | 
|  | 584 | CXXDestructor = 3 | 
|  | 585 | }; | 
|  | 586 | void DiagnoseNontrivial(const RecordType* Record, CXXSpecialMember mem); | 
| Fariborz Jahanian | 1d78cc4 | 2008-04-10 23:32:45 +0000 | [diff] [blame] | 587 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 588 | virtual DeclPtrTy ActOnIvar(Scope *S, SourceLocation DeclStart, | 
| Fariborz Jahanian | 496b5a8 | 2009-06-05 18:16:35 +0000 | [diff] [blame] | 589 | DeclPtrTy IntfDecl, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 590 | Declarator &D, ExprTy *BitfieldWidth, | 
|  | 591 | tok::ObjCKeywordKind visibility); | 
| Fariborz Jahanian | 1d78cc4 | 2008-04-10 23:32:45 +0000 | [diff] [blame] | 592 |  | 
| Steve Naroff | f13271f | 2007-09-14 23:09:53 +0000 | [diff] [blame] | 593 | // This is used for both record definitions and ObjC interface declarations. | 
| Fariborz Jahanian | 9d048ff | 2007-09-29 00:54:24 +0000 | [diff] [blame] | 594 | virtual void ActOnFields(Scope* S, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 595 | SourceLocation RecLoc, DeclPtrTy TagDecl, | 
|  | 596 | DeclPtrTy *Fields, unsigned NumFields, | 
| Daniel Dunbar | 1bfe1c2 | 2008-10-03 02:03:53 +0000 | [diff] [blame] | 597 | SourceLocation LBrac, SourceLocation RBrac, | 
|  | 598 | AttributeList *AttrList); | 
| Douglas Gregor | 72de667 | 2009-01-08 20:45:30 +0000 | [diff] [blame] | 599 |  | 
|  | 600 | /// ActOnTagStartDefinition - Invoked when we have entered the | 
|  | 601 | /// scope of a tag's definition (e.g., for an enumeration, class, | 
|  | 602 | /// struct, or union). | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 603 | virtual void ActOnTagStartDefinition(Scope *S, DeclPtrTy TagDecl); | 
| Douglas Gregor | 72de667 | 2009-01-08 20:45:30 +0000 | [diff] [blame] | 604 |  | 
|  | 605 | /// ActOnTagFinishDefinition - Invoked once we have finished parsing | 
|  | 606 | /// the definition of a tag (enumeration, class, struct, or union). | 
| Argyrios Kyrtzidis | 07a5b28 | 2009-07-14 03:17:52 +0000 | [diff] [blame] | 607 | virtual void ActOnTagFinishDefinition(Scope *S, DeclPtrTy TagDecl, | 
|  | 608 | SourceLocation RBraceLoc); | 
| Douglas Gregor | 72de667 | 2009-01-08 20:45:30 +0000 | [diff] [blame] | 609 |  | 
| Douglas Gregor | 879fd49 | 2009-03-17 19:05:46 +0000 | [diff] [blame] | 610 | EnumConstantDecl *CheckEnumConstant(EnumDecl *Enum, | 
|  | 611 | EnumConstantDecl *LastEnumConst, | 
|  | 612 | SourceLocation IdLoc, | 
|  | 613 | IdentifierInfo *Id, | 
|  | 614 | ExprArg val); | 
|  | 615 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 616 | virtual DeclPtrTy ActOnEnumConstant(Scope *S, DeclPtrTy EnumDecl, | 
|  | 617 | DeclPtrTy LastEnumConstant, | 
|  | 618 | SourceLocation IdLoc, IdentifierInfo *Id, | 
|  | 619 | SourceLocation EqualLoc, ExprTy *Val); | 
| Mike Stump | c6e35aa | 2009-05-16 07:06:02 +0000 | [diff] [blame] | 620 | virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, | 
|  | 621 | SourceLocation RBraceLoc, DeclPtrTy EnumDecl, | 
| Edward O'Callaghan | fee1381 | 2009-08-08 14:36:57 +0000 | [diff] [blame^] | 622 | DeclPtrTy *Elements, unsigned NumElements, | 
|  | 623 | Scope *S, AttributeList *Attr); | 
| Sebastian Redl | 37d6de3 | 2008-11-08 13:00:26 +0000 | [diff] [blame] | 624 |  | 
| Argyrios Kyrtzidis | ef6e647 | 2008-11-08 17:17:31 +0000 | [diff] [blame] | 625 | DeclContext *getContainingDC(DeclContext *DC); | 
| Argyrios Kyrtzidis | 0795232 | 2008-07-01 10:37:29 +0000 | [diff] [blame] | 626 |  | 
| Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 627 | /// Set the current declaration context until it gets popped. | 
| Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 628 | void PushDeclContext(Scope *S, DeclContext *DC); | 
| Chris Lattner | b048c98 | 2008-04-06 04:47:34 +0000 | [diff] [blame] | 629 | void PopDeclContext(); | 
| Argyrios Kyrtzidis | 53d0ea5 | 2008-06-28 06:07:14 +0000 | [diff] [blame] | 630 |  | 
| Argyrios Kyrtzidis | 1d17553 | 2009-06-17 23:15:40 +0000 | [diff] [blame] | 631 | /// EnterDeclaratorContext - Used when we must lookup names in the context | 
|  | 632 | /// of a declarator's nested name specifier. | 
|  | 633 | void EnterDeclaratorContext(Scope *S, DeclContext *DC); | 
|  | 634 | void ExitDeclaratorContext(Scope *S); | 
|  | 635 |  | 
|  | 636 |  | 
| Chris Lattner | 371f258 | 2008-12-04 23:50:19 +0000 | [diff] [blame] | 637 | /// getCurFunctionDecl - If inside of a function body, this returns a pointer | 
|  | 638 | /// to the function decl for the function being parsed.  If we're currently | 
|  | 639 | /// in a 'block', this returns the containing context. | 
|  | 640 | FunctionDecl *getCurFunctionDecl(); | 
|  | 641 |  | 
|  | 642 | /// getCurMethodDecl - If inside of a method body, this returns a pointer to | 
|  | 643 | /// the method decl for the method being parsed.  If we're currently | 
|  | 644 | /// in a 'block', this returns the containing context. | 
| Daniel Dunbar | c4a1dea | 2008-08-11 05:35:13 +0000 | [diff] [blame] | 645 | ObjCMethodDecl *getCurMethodDecl(); | 
| Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 646 |  | 
| Chris Lattner | 371f258 | 2008-12-04 23:50:19 +0000 | [diff] [blame] | 647 | /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method | 
|  | 648 | /// or C function we're in, otherwise return null.  If we're currently | 
|  | 649 | /// in a 'block', this returns the containing context. | 
|  | 650 | NamedDecl *getCurFunctionOrMethodDecl(); | 
|  | 651 |  | 
| Argyrios Kyrtzidis | 87f3ff0 | 2008-04-12 00:47:19 +0000 | [diff] [blame] | 652 | /// Add this decl to the scope shadowed decl chains. | 
|  | 653 | void PushOnScopeChains(NamedDecl *D, Scope *S); | 
|  | 654 |  | 
| Argyrios Kyrtzidis | 15a12d0 | 2008-09-09 21:18:04 +0000 | [diff] [blame] | 655 | /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true | 
|  | 656 | /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns | 
|  | 657 | /// true if 'D' belongs to the given declaration context. | 
|  | 658 | bool isDeclInScope(Decl *D, DeclContext *Ctx, Scope *S = 0) { | 
| Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 659 | return IdResolver.isDeclInScope(D, Ctx, Context, S); | 
| Argyrios Kyrtzidis | 15a12d0 | 2008-09-09 21:18:04 +0000 | [diff] [blame] | 660 | } | 
|  | 661 |  | 
| Eli Friedman | 8f17b66 | 2009-02-28 05:41:13 +0000 | [diff] [blame] | 662 |  | 
| Chris Lattner | f1d705c | 2008-02-21 01:07:18 +0000 | [diff] [blame] | 663 | /// Subroutines of ActOnDeclarator(). | 
| Chris Lattner | 682bf92 | 2009-03-29 16:50:03 +0000 | [diff] [blame] | 664 | TypedefDecl *ParseTypedefDecl(Scope *S, Declarator &D, QualType T); | 
| Chris Lattner | eaaebc7 | 2009-04-25 08:06:05 +0000 | [diff] [blame] | 665 | void MergeTypeDefDecl(TypedefDecl *New, Decl *Old); | 
| Douglas Gregor | cda9c67 | 2009-02-16 17:45:42 +0000 | [diff] [blame] | 666 | bool MergeFunctionDecl(FunctionDecl *New, Decl *Old); | 
| Douglas Gregor | 04495c8 | 2009-02-24 01:23:02 +0000 | [diff] [blame] | 667 | bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old); | 
| Chris Lattner | eaaebc7 | 2009-04-25 08:06:05 +0000 | [diff] [blame] | 668 | void MergeVarDecl(VarDecl *New, Decl *Old); | 
| Douglas Gregor | cda9c67 | 2009-02-16 17:45:42 +0000 | [diff] [blame] | 669 | bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old); | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 670 |  | 
|  | 671 | /// C++ Overloading. | 
|  | 672 | bool IsOverload(FunctionDecl *New, Decl* OldD, | 
|  | 673 | OverloadedFunctionDecl::function_iterator &MatchedDecl); | 
| Douglas Gregor | 225c41e | 2008-11-03 19:09:14 +0000 | [diff] [blame] | 674 | ImplicitConversionSequence | 
|  | 675 | TryImplicitConversion(Expr* From, QualType ToType, | 
| Douglas Gregor | 09f41cf | 2009-01-14 15:45:31 +0000 | [diff] [blame] | 676 | bool SuppressUserConversions = false, | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 677 | bool AllowExplicit = false, | 
|  | 678 | bool ForceRValue = false); | 
| Douglas Gregor | 60d62c2 | 2008-10-31 16:23:19 +0000 | [diff] [blame] | 679 | bool IsStandardConversion(Expr *From, QualType ToType, | 
|  | 680 | StandardConversionSequence& SCS); | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 681 | bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType); | 
|  | 682 | bool IsFloatingPointPromotion(QualType FromType, QualType ToType); | 
| Douglas Gregor | 5cdf821 | 2009-02-12 00:15:05 +0000 | [diff] [blame] | 683 | bool IsComplexPromotion(QualType FromType, QualType ToType); | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 684 | bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType, | 
| Douglas Gregor | 45920e8 | 2008-12-19 17:40:08 +0000 | [diff] [blame] | 685 | QualType& ConvertedType, bool &IncompatibleObjC); | 
| Douglas Gregor | c788751 | 2008-12-19 19:13:09 +0000 | [diff] [blame] | 686 | bool isObjCPointerConversion(QualType FromType, QualType ToType, | 
|  | 687 | QualType& ConvertedType, bool &IncompatibleObjC); | 
| Douglas Gregor | 94b1dd2 | 2008-10-24 04:54:22 +0000 | [diff] [blame] | 688 | bool CheckPointerConversion(Expr *From, QualType ToType); | 
| Sebastian Redl | 4433aaf | 2009-01-25 19:43:20 +0000 | [diff] [blame] | 689 | bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType, | 
|  | 690 | QualType &ConvertedType); | 
|  | 691 | bool CheckMemberPointerConversion(Expr *From, QualType ToType); | 
| Douglas Gregor | 98cd599 | 2008-10-21 23:43:52 +0000 | [diff] [blame] | 692 | bool IsQualificationConversion(QualType FromType, QualType ToType); | 
| Douglas Gregor | 60d62c2 | 2008-10-31 16:23:19 +0000 | [diff] [blame] | 693 | bool IsUserDefinedConversion(Expr *From, QualType ToType, | 
| Douglas Gregor | 09f41cf | 2009-01-14 15:45:31 +0000 | [diff] [blame] | 694 | UserDefinedConversionSequence& User, | 
| Douglas Gregor | 734d986 | 2009-01-30 23:27:23 +0000 | [diff] [blame] | 695 | bool AllowConversionFunctions, | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 696 | bool AllowExplicit, bool ForceRValue); | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 697 |  | 
|  | 698 | ImplicitConversionSequence::CompareKind | 
|  | 699 | CompareImplicitConversionSequences(const ImplicitConversionSequence& ICS1, | 
|  | 700 | const ImplicitConversionSequence& ICS2); | 
|  | 701 |  | 
|  | 702 | ImplicitConversionSequence::CompareKind | 
|  | 703 | CompareStandardConversionSequences(const StandardConversionSequence& SCS1, | 
|  | 704 | const StandardConversionSequence& SCS2); | 
|  | 705 |  | 
| Douglas Gregor | 5737326 | 2008-10-22 14:17:15 +0000 | [diff] [blame] | 706 | ImplicitConversionSequence::CompareKind | 
|  | 707 | CompareQualificationConversions(const StandardConversionSequence& SCS1, | 
|  | 708 | const StandardConversionSequence& SCS2); | 
|  | 709 |  | 
| Douglas Gregor | bc0805a | 2008-10-23 00:40:37 +0000 | [diff] [blame] | 710 | ImplicitConversionSequence::CompareKind | 
|  | 711 | CompareDerivedToBaseConversions(const StandardConversionSequence& SCS1, | 
|  | 712 | const StandardConversionSequence& SCS2); | 
|  | 713 |  | 
| Douglas Gregor | 225c41e | 2008-11-03 19:09:14 +0000 | [diff] [blame] | 714 | ImplicitConversionSequence | 
|  | 715 | TryCopyInitialization(Expr* From, QualType ToType, | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 716 | bool SuppressUserConversions = false, | 
|  | 717 | bool ForceRValue = false); | 
| Douglas Gregor | 27c8dc0 | 2008-10-29 00:13:59 +0000 | [diff] [blame] | 718 | bool PerformCopyInitialization(Expr *&From, QualType ToType, | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 719 | const char *Flavor, bool Elidable = false); | 
| Douglas Gregor | 27c8dc0 | 2008-10-29 00:13:59 +0000 | [diff] [blame] | 720 |  | 
| Douglas Gregor | 96176b3 | 2008-11-18 23:14:02 +0000 | [diff] [blame] | 721 | ImplicitConversionSequence | 
|  | 722 | TryObjectArgumentInitialization(Expr *From, CXXMethodDecl *Method); | 
|  | 723 | bool PerformObjectArgumentInitialization(Expr *&From, CXXMethodDecl *Method); | 
|  | 724 |  | 
| Douglas Gregor | 09f41cf | 2009-01-14 15:45:31 +0000 | [diff] [blame] | 725 | ImplicitConversionSequence TryContextuallyConvertToBool(Expr *From); | 
|  | 726 | bool PerformContextuallyConvertToBool(Expr *&From); | 
| Fariborz Jahanian | 98a541e | 2009-07-29 18:40:24 +0000 | [diff] [blame] | 727 |  | 
| Fariborz Jahanian | f3e53d3 | 2009-07-29 19:40:11 +0000 | [diff] [blame] | 728 | bool PerformObjectMemberConversion(Expr *&From, NamedDecl *Member); | 
| Douglas Gregor | 09f41cf | 2009-01-14 15:45:31 +0000 | [diff] [blame] | 729 |  | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 730 | /// OverloadingResult - Capture the result of performing overload | 
|  | 731 | /// resolution. | 
|  | 732 | enum OverloadingResult { | 
|  | 733 | OR_Success,             ///< Overload resolution succeeded. | 
|  | 734 | OR_No_Viable_Function,  ///< No viable function found. | 
| Douglas Gregor | 48f3bb9 | 2009-02-18 21:56:37 +0000 | [diff] [blame] | 735 | OR_Ambiguous,           ///< Ambiguous candidates found. | 
|  | 736 | OR_Deleted              ///< Overload resoltuion refers to a deleted function. | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 737 | }; | 
|  | 738 |  | 
| John McCall | 6ff0785 | 2009-08-07 22:18:02 +0000 | [diff] [blame] | 739 | // Members have to be NamespaceDecl* or TranslationUnitDecl*. | 
|  | 740 | // TODO: make this is a typesafe union. | 
|  | 741 | typedef llvm::SmallPtrSet<DeclContext   *, 16> AssociatedNamespaceSet; | 
|  | 742 |  | 
| Douglas Gregor | 364e021 | 2009-06-27 21:05:07 +0000 | [diff] [blame] | 743 | typedef llvm::SmallPtrSet<AnyFunctionDecl, 16> FunctionSet; | 
| Douglas Gregor | 063daf6 | 2009-03-13 18:40:31 +0000 | [diff] [blame] | 744 | typedef llvm::SmallPtrSet<CXXRecordDecl *, 16> AssociatedClassSet; | 
|  | 745 |  | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 746 | void AddOverloadCandidate(FunctionDecl *Function, | 
|  | 747 | Expr **Args, unsigned NumArgs, | 
| Douglas Gregor | 225c41e | 2008-11-03 19:09:14 +0000 | [diff] [blame] | 748 | OverloadCandidateSet& CandidateSet, | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 749 | bool SuppressUserConversions = false, | 
|  | 750 | bool ForceRValue = false); | 
| Douglas Gregor | 063daf6 | 2009-03-13 18:40:31 +0000 | [diff] [blame] | 751 | void AddFunctionCandidates(const FunctionSet &Functions, | 
|  | 752 | Expr **Args, unsigned NumArgs, | 
|  | 753 | OverloadCandidateSet& CandidateSet, | 
|  | 754 | bool SuppressUserConversions = false); | 
| Douglas Gregor | 96176b3 | 2008-11-18 23:14:02 +0000 | [diff] [blame] | 755 | void AddMethodCandidate(CXXMethodDecl *Method, | 
|  | 756 | Expr *Object, Expr **Args, unsigned NumArgs, | 
|  | 757 | OverloadCandidateSet& CandidateSet, | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 758 | bool SuppressUserConversions = false, | 
|  | 759 | bool ForceRValue = false); | 
| Douglas Gregor | e53060f | 2009-06-25 22:08:12 +0000 | [diff] [blame] | 760 | void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, | 
| Douglas Gregor | 6db8ed4 | 2009-06-30 23:57:56 +0000 | [diff] [blame] | 761 | bool HasExplicitTemplateArgs, | 
|  | 762 | const TemplateArgument *ExplicitTemplateArgs, | 
|  | 763 | unsigned NumExplicitTemplateArgs, | 
| Douglas Gregor | e53060f | 2009-06-25 22:08:12 +0000 | [diff] [blame] | 764 | Expr **Args, unsigned NumArgs, | 
|  | 765 | OverloadCandidateSet& CandidateSet, | 
|  | 766 | bool SuppressUserConversions = false, | 
|  | 767 | bool ForceRValue = false); | 
| Douglas Gregor | f1991ea | 2008-11-07 22:36:19 +0000 | [diff] [blame] | 768 | void AddConversionCandidate(CXXConversionDecl *Conversion, | 
|  | 769 | Expr *From, QualType ToType, | 
|  | 770 | OverloadCandidateSet& CandidateSet); | 
| Douglas Gregor | 106c6eb | 2008-11-19 22:57:39 +0000 | [diff] [blame] | 771 | void AddSurrogateCandidate(CXXConversionDecl *Conversion, | 
| Douglas Gregor | 72564e7 | 2009-02-26 23:50:07 +0000 | [diff] [blame] | 772 | const FunctionProtoType *Proto, | 
| Douglas Gregor | 106c6eb | 2008-11-19 22:57:39 +0000 | [diff] [blame] | 773 | Expr *Object, Expr **Args, unsigned NumArgs, | 
|  | 774 | OverloadCandidateSet& CandidateSet); | 
| Douglas Gregor | 063daf6 | 2009-03-13 18:40:31 +0000 | [diff] [blame] | 775 | void AddOperatorCandidates(OverloadedOperatorKind Op, Scope *S, | 
| Douglas Gregor | f680a0f | 2009-02-04 16:44:47 +0000 | [diff] [blame] | 776 | SourceLocation OpLoc, | 
| Douglas Gregor | 96176b3 | 2008-11-18 23:14:02 +0000 | [diff] [blame] | 777 | Expr **Args, unsigned NumArgs, | 
| Douglas Gregor | f680a0f | 2009-02-04 16:44:47 +0000 | [diff] [blame] | 778 | OverloadCandidateSet& CandidateSet, | 
|  | 779 | SourceRange OpRange = SourceRange()); | 
| Douglas Gregor | 063daf6 | 2009-03-13 18:40:31 +0000 | [diff] [blame] | 780 | void AddMemberOperatorCandidates(OverloadedOperatorKind Op, | 
|  | 781 | SourceLocation OpLoc, | 
|  | 782 | Expr **Args, unsigned NumArgs, | 
|  | 783 | OverloadCandidateSet& CandidateSet, | 
|  | 784 | SourceRange OpRange = SourceRange()); | 
| Douglas Gregor | eb8f306 | 2008-11-12 17:17:38 +0000 | [diff] [blame] | 785 | void AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys, | 
|  | 786 | Expr **Args, unsigned NumArgs, | 
| Douglas Gregor | 88b4bf2 | 2009-01-13 00:52:54 +0000 | [diff] [blame] | 787 | OverloadCandidateSet& CandidateSet, | 
| Douglas Gregor | 09f41cf | 2009-01-14 15:45:31 +0000 | [diff] [blame] | 788 | bool IsAssignmentOperator = false, | 
|  | 789 | unsigned NumContextualBoolArguments = 0); | 
| Douglas Gregor | 7425373 | 2008-11-19 15:42:04 +0000 | [diff] [blame] | 790 | void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, | 
|  | 791 | Expr **Args, unsigned NumArgs, | 
|  | 792 | OverloadCandidateSet& CandidateSet); | 
| Douglas Gregor | fa04764 | 2009-02-04 00:32:51 +0000 | [diff] [blame] | 793 | void AddArgumentDependentLookupCandidates(DeclarationName Name, | 
|  | 794 | Expr **Args, unsigned NumArgs, | 
|  | 795 | OverloadCandidateSet& CandidateSet); | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 796 | bool isBetterOverloadCandidate(const OverloadCandidate& Cand1, | 
|  | 797 | const OverloadCandidate& Cand2); | 
|  | 798 | OverloadingResult BestViableFunction(OverloadCandidateSet& CandidateSet, | 
| Douglas Gregor | e0762c9 | 2009-06-19 23:52:42 +0000 | [diff] [blame] | 799 | SourceLocation Loc, | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 800 | OverloadCandidateSet::iterator& Best); | 
|  | 801 | void PrintOverloadCandidates(OverloadCandidateSet& CandidateSet, | 
|  | 802 | bool OnlyViable); | 
|  | 803 |  | 
| Douglas Gregor | 904eed3 | 2008-11-10 20:40:00 +0000 | [diff] [blame] | 804 | FunctionDecl *ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType, | 
|  | 805 | bool Complain); | 
|  | 806 | void FixOverloadedFunctionReference(Expr *E, FunctionDecl *Fn); | 
|  | 807 |  | 
| Douglas Gregor | 1733001 | 2009-02-04 15:01:18 +0000 | [diff] [blame] | 808 | FunctionDecl *ResolveOverloadedCallFn(Expr *Fn, NamedDecl *Callee, | 
|  | 809 | DeclarationName UnqualifiedName, | 
| Douglas Gregor | 6db8ed4 | 2009-06-30 23:57:56 +0000 | [diff] [blame] | 810 | bool HasExplicitTemplateArgs, | 
|  | 811 | const TemplateArgument *ExplicitTemplateArgs, | 
|  | 812 | unsigned NumExplicitTemplateArgs, | 
| Douglas Gregor | 0a39668 | 2008-11-26 06:01:48 +0000 | [diff] [blame] | 813 | SourceLocation LParenLoc, | 
|  | 814 | Expr **Args, unsigned NumArgs, | 
|  | 815 | SourceLocation *CommaLocs, | 
| Douglas Gregor | fa04764 | 2009-02-04 00:32:51 +0000 | [diff] [blame] | 816 | SourceLocation RParenLoc, | 
| Douglas Gregor | 1733001 | 2009-02-04 15:01:18 +0000 | [diff] [blame] | 817 | bool &ArgumentDependentLookup); | 
| Douglas Gregor | 063daf6 | 2009-03-13 18:40:31 +0000 | [diff] [blame] | 818 |  | 
| Douglas Gregor | bc736fc | 2009-03-13 23:49:33 +0000 | [diff] [blame] | 819 | OwningExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, | 
|  | 820 | unsigned Opc, | 
|  | 821 | FunctionSet &Functions, | 
|  | 822 | ExprArg input); | 
|  | 823 |  | 
| Douglas Gregor | 063daf6 | 2009-03-13 18:40:31 +0000 | [diff] [blame] | 824 | OwningExprResult CreateOverloadedBinOp(SourceLocation OpLoc, | 
|  | 825 | unsigned Opc, | 
|  | 826 | FunctionSet &Functions, | 
|  | 827 | Expr *LHS, Expr *RHS); | 
|  | 828 |  | 
| Douglas Gregor | 88a3514 | 2008-12-22 05:46:06 +0000 | [diff] [blame] | 829 | ExprResult | 
|  | 830 | BuildCallToMemberFunction(Scope *S, Expr *MemExpr, | 
|  | 831 | SourceLocation LParenLoc, Expr **Args, | 
|  | 832 | unsigned NumArgs, SourceLocation *CommaLocs, | 
|  | 833 | SourceLocation RParenLoc); | 
| Douglas Gregor | f9eb905 | 2008-11-19 21:05:33 +0000 | [diff] [blame] | 834 | ExprResult | 
| Douglas Gregor | 5c37de7 | 2008-12-06 00:22:45 +0000 | [diff] [blame] | 835 | BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, | 
| Douglas Gregor | f9eb905 | 2008-11-19 21:05:33 +0000 | [diff] [blame] | 836 | Expr **Args, unsigned NumArgs, | 
|  | 837 | SourceLocation *CommaLocs, | 
|  | 838 | SourceLocation RParenLoc); | 
| Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 839 |  | 
| Douglas Gregor | fe85ced | 2009-08-06 03:17:00 +0000 | [diff] [blame] | 840 | OwningExprResult BuildOverloadedArrowExpr(Scope *S, ExprArg Base, | 
|  | 841 | SourceLocation OpLoc); | 
| Douglas Gregor | 09f41cf | 2009-01-14 15:45:31 +0000 | [diff] [blame] | 842 |  | 
| Mike Stump | 5692586 | 2009-07-28 22:04:01 +0000 | [diff] [blame] | 843 | /// Helpers for dealing with blocks and functions. | 
| Mike Stump | b1682c5 | 2009-07-22 23:56:57 +0000 | [diff] [blame] | 844 | void CheckFallThroughForFunctionDef(Decl *D, Stmt *Body); | 
| Mike Stump | 5692586 | 2009-07-28 22:04:01 +0000 | [diff] [blame] | 845 | void CheckFallThroughForBlock(QualType BlockTy, Stmt *Body); | 
| Chris Lattner | 0442108 | 2008-04-08 04:40:51 +0000 | [diff] [blame] | 846 | bool CheckParmsForFunctionDef(FunctionDecl *FD); | 
| Chris Lattner | 0442108 | 2008-04-08 04:40:51 +0000 | [diff] [blame] | 847 | void CheckCXXDefaultArguments(FunctionDecl *FD); | 
| Douglas Gregor | 6d6eb57 | 2008-05-07 04:49:29 +0000 | [diff] [blame] | 848 | void CheckExtraCXXDefaultArguments(Declarator &D); | 
| Mike Stump | b1682c5 | 2009-07-22 23:56:57 +0000 | [diff] [blame] | 849 | enum ControlFlowKind { NeverFallThrough = 0, MaybeFallThrough = 1, | 
|  | 850 | AlwaysFallThrough = 2 }; | 
|  | 851 | ControlFlowKind CheckFallThrough(Stmt *); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 852 |  | 
| Douglas Gregor | 1a0d31a | 2009-01-12 18:45:55 +0000 | [diff] [blame] | 853 | Scope *getNonFieldDeclScope(Scope *S); | 
|  | 854 |  | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 855 | /// \name Name lookup | 
|  | 856 | /// | 
|  | 857 | /// These routines provide name lookup that is used during semantic | 
|  | 858 | /// analysis to resolve the various kinds of names (identifiers, | 
|  | 859 | /// overloaded operator names, constructor names, etc.) into zero or | 
|  | 860 | /// more declarations within a particular scope. The major entry | 
|  | 861 | /// points are LookupName, which performs unqualified name lookup, | 
|  | 862 | /// and LookupQualifiedName, which performs qualified name lookup. | 
|  | 863 | /// | 
|  | 864 | /// All name lookup is performed based on some specific criteria, | 
|  | 865 | /// which specify what names will be visible to name lookup and how | 
|  | 866 | /// far name lookup should work. These criteria are important both | 
|  | 867 | /// for capturing language semantics (certain lookups will ignore | 
|  | 868 | /// certain names, for example) and for performance, since name | 
|  | 869 | /// lookup is often a bottleneck in the compilation of C++. Name | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 870 | /// lookup criteria is specified via the LookupCriteria enumeration. | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 871 | /// | 
|  | 872 | /// The results of name lookup can vary based on the kind of name | 
|  | 873 | /// lookup performed, the current language, and the translation | 
|  | 874 | /// unit. In C, for example, name lookup will either return nothing | 
|  | 875 | /// (no entity found) or a single declaration. In C++, name lookup | 
|  | 876 | /// can additionally refer to a set of overloaded functions or | 
|  | 877 | /// result in an ambiguity. All of the possible results of name | 
|  | 878 | /// lookup are captured by the LookupResult class, which provides | 
|  | 879 | /// the ability to distinguish among them. | 
|  | 880 | //@{ | 
| Douglas Gregor | f780abc | 2008-12-30 03:27:21 +0000 | [diff] [blame] | 881 |  | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 882 | /// @brief Describes the kind of name lookup to perform. | 
|  | 883 | enum LookupNameKind { | 
|  | 884 | /// Ordinary name lookup, which finds ordinary names (functions, | 
|  | 885 | /// variables, typedefs, etc.) in C and most kinds of names | 
|  | 886 | /// (functions, variables, members, types, etc.) in C++. | 
|  | 887 | LookupOrdinaryName = 0, | 
|  | 888 | /// Tag name lookup, which finds the names of enums, classes, | 
|  | 889 | /// structs, and unions. | 
|  | 890 | LookupTagName, | 
|  | 891 | /// Member name lookup, which finds the names of | 
|  | 892 | /// class/struct/union members. | 
|  | 893 | LookupMemberName, | 
| Douglas Gregor | f680a0f | 2009-02-04 16:44:47 +0000 | [diff] [blame] | 894 | // Look up of an operator name (e.g., operator+) for use with | 
|  | 895 | // operator overloading. This lookup is similar to ordinary name | 
|  | 896 | // lookup, but will ignore any declarations that are class | 
|  | 897 | // members. | 
|  | 898 | LookupOperatorName, | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 899 | /// Look up of a name that precedes the '::' scope resolution | 
|  | 900 | /// operator in C++. This lookup completely ignores operator, | 
|  | 901 | /// function, and enumerator names (C++ [basic.lookup.qual]p1). | 
|  | 902 | LookupNestedNameSpecifierName, | 
|  | 903 | /// Look up a namespace name within a C++ using directive or | 
|  | 904 | /// namespace alias definition, ignoring non-namespace names (C++ | 
|  | 905 | /// [basic.lookup.udir]p1). | 
| Douglas Gregor | d6f7e9d | 2009-02-24 20:03:32 +0000 | [diff] [blame] | 906 | LookupNamespaceName, | 
| Douglas Gregor | 6e378de | 2009-04-23 23:18:26 +0000 | [diff] [blame] | 907 | /// Look up an ordinary name that is going to be redeclared as a | 
|  | 908 | /// name with linkage. This lookup ignores any declarations that | 
|  | 909 | /// are outside of the current scope unless they have linkage. See | 
|  | 910 | /// C99 6.2.2p4-5 and C++ [basic.link]p6. | 
|  | 911 | LookupRedeclarationWithLinkage, | 
|  | 912 | /// Look up the name of an Objective-C protocol. | 
| Douglas Gregor | 8fc463a | 2009-04-24 00:11:27 +0000 | [diff] [blame] | 913 | LookupObjCProtocolName, | 
|  | 914 | /// Look up the name of an Objective-C implementation | 
|  | 915 | LookupObjCImplementationName, | 
|  | 916 | /// Look up the name of an Objective-C category implementation | 
|  | 917 | LookupObjCCategoryImplName | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 918 | }; | 
|  | 919 |  | 
|  | 920 | /// @brief Represents the results of name lookup. | 
|  | 921 | /// | 
|  | 922 | /// An instance of the LookupResult class captures the results of a | 
|  | 923 | /// single name lookup, which can return no result (nothing found), | 
|  | 924 | /// a single declaration, a set of overloaded functions, or an | 
|  | 925 | /// ambiguity. Use the getKind() method to determine which of these | 
|  | 926 | /// results occurred for a given lookup. | 
|  | 927 | /// | 
|  | 928 | /// Any non-ambiguous lookup can be converted into a single | 
| Douglas Gregor | 47b9a1c | 2009-02-04 17:27:36 +0000 | [diff] [blame] | 929 | /// (possibly NULL) @c NamedDecl* via a conversion function or the | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 930 | /// getAsDecl() method. This conversion permits the common-case | 
|  | 931 | /// usage in C and Objective-C where name lookup will always return | 
|  | 932 | /// a single declaration. | 
| Douglas Gregor | 69d993a | 2009-01-17 01:13:24 +0000 | [diff] [blame] | 933 | struct LookupResult { | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 934 | /// The kind of entity that is actually stored within the | 
|  | 935 | /// LookupResult object. | 
| Douglas Gregor | 69d993a | 2009-01-17 01:13:24 +0000 | [diff] [blame] | 936 | enum { | 
| Douglas Gregor | 47b9a1c | 2009-02-04 17:27:36 +0000 | [diff] [blame] | 937 | /// First is a single declaration (a NamedDecl*), which may be NULL. | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 938 | SingleDecl, | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 939 |  | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 940 | /// First is a single declaration (an OverloadedFunctionDecl*). | 
|  | 941 | OverloadedDeclSingleDecl, | 
|  | 942 |  | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 943 | /// [First, Last) is an iterator range represented as opaque | 
|  | 944 | /// pointers used to reconstruct IdentifierResolver::iterators. | 
|  | 945 | OverloadedDeclFromIdResolver, | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 946 |  | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 947 | /// [First, Last) is an iterator range represented as opaque | 
|  | 948 | /// pointers used to reconstruct DeclContext::lookup_iterators. | 
|  | 949 | OverloadedDeclFromDeclContext, | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 950 |  | 
|  | 951 | /// First is a pointer to a BasePaths structure, which is owned | 
|  | 952 | /// by the LookupResult. Last is non-zero to indicate that the | 
|  | 953 | /// ambiguity is caused by two names found in base class | 
|  | 954 | /// subobjects of different types. | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 955 | AmbiguousLookupStoresBasePaths, | 
|  | 956 |  | 
|  | 957 | /// [First, Last) is an iterator range represented as opaque | 
|  | 958 | /// pointers used to reconstruct new'ed Decl*[] array containing | 
|  | 959 | /// found ambiguous decls. LookupResult is owner of this array. | 
|  | 960 | AmbiguousLookupStoresDecls | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 961 | } StoredKind; | 
|  | 962 |  | 
|  | 963 | /// The first lookup result, whose contents depend on the kind of | 
| Douglas Gregor | 47b9a1c | 2009-02-04 17:27:36 +0000 | [diff] [blame] | 964 | /// lookup result. This may be a NamedDecl* (if StoredKind == | 
|  | 965 | /// SingleDecl), OverloadedFunctionDecl* (if StoredKind == | 
|  | 966 | /// OverloadedDeclSingleDecl), the opaque pointer from an | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 967 | /// IdentifierResolver::iterator (if StoredKind == | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 968 | /// OverloadedDeclFromIdResolver), a DeclContext::lookup_iterator | 
|  | 969 | /// (if StoredKind == OverloadedDeclFromDeclContext), or a | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 970 | /// BasePaths pointer (if StoredKind == AmbiguousLookupStoresBasePaths). | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 971 | mutable uintptr_t First; | 
|  | 972 |  | 
|  | 973 | /// The last lookup result, whose contents depend on the kind of | 
|  | 974 | /// lookup result. This may be unused (if StoredKind == | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 975 | /// SingleDecl), it may have the same type as First (for | 
|  | 976 | /// overloaded function declarations), or is may be used as a | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 977 | /// Boolean value (if StoredKind == AmbiguousLookupStoresBasePaths). | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 978 | mutable uintptr_t Last; | 
|  | 979 |  | 
|  | 980 | /// Context - The context in which we will build any | 
|  | 981 | /// OverloadedFunctionDecl nodes needed by the conversion to | 
|  | 982 | /// Decl*. | 
|  | 983 | ASTContext *Context; | 
|  | 984 |  | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 985 | /// @brief The kind of entity found by name lookup. | 
|  | 986 | enum LookupKind { | 
|  | 987 | /// @brief No entity found met the criteria. | 
|  | 988 | NotFound = 0, | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 989 |  | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 990 | /// @brief Name lookup found a single declaration that met the | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 991 | /// criteria. getAsDecl will return this declaration. | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 992 | Found, | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 993 |  | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 994 | /// @brief Name lookup found a set of overloaded functions that | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 995 | /// met the criteria. getAsDecl will turn this set of overloaded | 
|  | 996 | /// functions into an OverloadedFunctionDecl. | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 997 | FoundOverloaded, | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 998 |  | 
|  | 999 | /// Name lookup results in an ambiguity because multiple | 
|  | 1000 | /// entities that meet the lookup criteria were found in | 
|  | 1001 | /// subobjects of different types. For example: | 
|  | 1002 | /// @code | 
|  | 1003 | /// struct A { void f(int); } | 
|  | 1004 | /// struct B { void f(double); } | 
|  | 1005 | /// struct C : A, B { }; | 
|  | 1006 | /// void test(C c) { | 
|  | 1007 | ///   c.f(0); // error: A::f and B::f come from subobjects of different | 
|  | 1008 | ///           // types. overload resolution is not performed. | 
|  | 1009 | /// } | 
|  | 1010 | /// @endcode | 
|  | 1011 | AmbiguousBaseSubobjectTypes, | 
|  | 1012 |  | 
|  | 1013 | /// Name lookup results in an ambiguity because multiple | 
|  | 1014 | /// nonstatic entities that meet the lookup criteria were found | 
|  | 1015 | /// in different subobjects of the same type. For example: | 
|  | 1016 | /// @code | 
|  | 1017 | /// struct A { int x; }; | 
|  | 1018 | /// struct B : A { }; | 
|  | 1019 | /// struct C : A { }; | 
|  | 1020 | /// struct D : B, C { }; | 
|  | 1021 | /// int test(D d) { | 
|  | 1022 | ///   return d.x; // error: 'x' is found in two A subobjects (of B and C) | 
|  | 1023 | /// } | 
|  | 1024 | /// @endcode | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 1025 | AmbiguousBaseSubobjects, | 
|  | 1026 |  | 
|  | 1027 | /// Name lookup results in an ambiguity because multiple definitions | 
|  | 1028 | /// of entity that meet the lookup criteria were found in different | 
|  | 1029 | /// declaration contexts. | 
|  | 1030 | /// @code | 
|  | 1031 | /// namespace A { | 
|  | 1032 | ///   int i; | 
|  | 1033 | ///   namespace B { int i; } | 
|  | 1034 | ///   int test() { | 
|  | 1035 | ///     using namespace B; | 
|  | 1036 | ///     return i; // error 'i' is found in namespace A and A::B | 
|  | 1037 | ///    } | 
|  | 1038 | /// } | 
|  | 1039 | /// @endcode | 
|  | 1040 | AmbiguousReference | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 1041 | }; | 
|  | 1042 |  | 
| Douglas Gregor | 47b9a1c | 2009-02-04 17:27:36 +0000 | [diff] [blame] | 1043 | static LookupResult CreateLookupResult(ASTContext &Context, NamedDecl *D); | 
| Douglas Gregor | 4bb64e7 | 2009-01-15 02:19:31 +0000 | [diff] [blame] | 1044 |  | 
| Douglas Gregor | 69d993a | 2009-01-17 01:13:24 +0000 | [diff] [blame] | 1045 | static LookupResult CreateLookupResult(ASTContext &Context, | 
|  | 1046 | IdentifierResolver::iterator F, | 
|  | 1047 | IdentifierResolver::iterator L); | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 1048 |  | 
| Douglas Gregor | 69d993a | 2009-01-17 01:13:24 +0000 | [diff] [blame] | 1049 | static LookupResult CreateLookupResult(ASTContext &Context, | 
|  | 1050 | DeclContext::lookup_iterator F, | 
|  | 1051 | DeclContext::lookup_iterator L); | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 1052 |  | 
| Douglas Gregor | 69d993a | 2009-01-17 01:13:24 +0000 | [diff] [blame] | 1053 | static LookupResult CreateLookupResult(ASTContext &Context, BasePaths *Paths, | 
|  | 1054 | bool DifferentSubobjectTypes) { | 
|  | 1055 | LookupResult Result; | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 1056 | Result.StoredKind = AmbiguousLookupStoresBasePaths; | 
| Douglas Gregor | 69d993a | 2009-01-17 01:13:24 +0000 | [diff] [blame] | 1057 | Result.First = reinterpret_cast<uintptr_t>(Paths); | 
|  | 1058 | Result.Last = DifferentSubobjectTypes? 1 : 0; | 
|  | 1059 | Result.Context = &Context; | 
|  | 1060 | return Result; | 
|  | 1061 | } | 
| Douglas Gregor | 4bb64e7 | 2009-01-15 02:19:31 +0000 | [diff] [blame] | 1062 |  | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 1063 | template <typename Iterator> | 
|  | 1064 | static LookupResult CreateLookupResult(ASTContext &Context, | 
|  | 1065 | Iterator B, std::size_t Len) { | 
| Douglas Gregor | 47b9a1c | 2009-02-04 17:27:36 +0000 | [diff] [blame] | 1066 | NamedDecl ** Array = new NamedDecl*[Len]; | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 1067 | for (std::size_t Idx = 0; Idx < Len; ++Idx, ++B) | 
|  | 1068 | Array[Idx] = *B; | 
|  | 1069 | LookupResult Result; | 
|  | 1070 | Result.StoredKind = AmbiguousLookupStoresDecls; | 
|  | 1071 | Result.First = reinterpret_cast<uintptr_t>(Array); | 
|  | 1072 | Result.Last = reinterpret_cast<uintptr_t>(Array + Len); | 
|  | 1073 | Result.Context = &Context; | 
|  | 1074 | return Result; | 
|  | 1075 | } | 
|  | 1076 |  | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 1077 | LookupKind getKind() const; | 
|  | 1078 |  | 
|  | 1079 | /// @brief Determine whether name look found something. | 
|  | 1080 | operator bool() const { return getKind() != NotFound; } | 
|  | 1081 |  | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 1082 | /// @brief Determines whether the lookup resulted in an ambiguity. | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 1083 | bool isAmbiguous() const { | 
|  | 1084 | return StoredKind == AmbiguousLookupStoresBasePaths || | 
|  | 1085 | StoredKind == AmbiguousLookupStoresDecls; | 
|  | 1086 | } | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 1087 |  | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 1088 | /// @brief Allows conversion of a lookup result into a | 
|  | 1089 | /// declaration, with the same behavior as getAsDecl. | 
| Douglas Gregor | 47b9a1c | 2009-02-04 17:27:36 +0000 | [diff] [blame] | 1090 | operator NamedDecl*() const { return getAsDecl(); } | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 1091 |  | 
| Douglas Gregor | 47b9a1c | 2009-02-04 17:27:36 +0000 | [diff] [blame] | 1092 | NamedDecl* getAsDecl() const; | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 1093 |  | 
|  | 1094 | BasePaths *getBasePaths() const; | 
| Douglas Gregor | d863517 | 2009-02-02 21:35:47 +0000 | [diff] [blame] | 1095 |  | 
|  | 1096 | /// \brief Iterate over the results of name lookup. | 
|  | 1097 | /// | 
|  | 1098 | /// The @c iterator class provides iteration over the results of a | 
|  | 1099 | /// non-ambiguous name lookup. | 
|  | 1100 | class iterator { | 
|  | 1101 | /// The LookupResult structure we're iterating through. | 
|  | 1102 | LookupResult *Result; | 
|  | 1103 |  | 
|  | 1104 | /// The current position of this iterator within the sequence of | 
|  | 1105 | /// results. This value will have the same representation as the | 
|  | 1106 | /// @c First field in the LookupResult structure. | 
|  | 1107 | mutable uintptr_t Current; | 
|  | 1108 |  | 
|  | 1109 | public: | 
| Douglas Gregor | 47b9a1c | 2009-02-04 17:27:36 +0000 | [diff] [blame] | 1110 | typedef NamedDecl *                value_type; | 
|  | 1111 | typedef NamedDecl *                reference; | 
|  | 1112 | typedef NamedDecl *                pointer; | 
| Douglas Gregor | d863517 | 2009-02-02 21:35:47 +0000 | [diff] [blame] | 1113 | typedef std::ptrdiff_t             difference_type; | 
|  | 1114 | typedef std::forward_iterator_tag  iterator_category; | 
|  | 1115 |  | 
|  | 1116 | iterator() : Result(0), Current(0) { } | 
|  | 1117 |  | 
|  | 1118 | iterator(LookupResult *Res, uintptr_t Cur) : Result(Res), Current(Cur) { } | 
|  | 1119 |  | 
|  | 1120 | reference operator*() const; | 
|  | 1121 |  | 
|  | 1122 | pointer operator->() const { return **this; } | 
|  | 1123 |  | 
|  | 1124 | iterator &operator++(); | 
|  | 1125 |  | 
|  | 1126 | iterator operator++(int) { | 
|  | 1127 | iterator tmp(*this); | 
|  | 1128 | ++(*this); | 
|  | 1129 | return tmp; | 
|  | 1130 | } | 
|  | 1131 |  | 
|  | 1132 | friend inline bool operator==(iterator const& x, iterator const& y) { | 
|  | 1133 | return x.Current == y.Current; | 
|  | 1134 | } | 
|  | 1135 |  | 
|  | 1136 | friend inline bool operator!=(iterator const& x, iterator const& y) { | 
|  | 1137 | return x.Current != y.Current; | 
|  | 1138 | } | 
|  | 1139 | }; | 
|  | 1140 | friend class iterator; | 
|  | 1141 |  | 
|  | 1142 | iterator begin(); | 
|  | 1143 | iterator end(); | 
| Douglas Gregor | 31a19b6 | 2009-04-01 21:51:26 +0000 | [diff] [blame] | 1144 |  | 
|  | 1145 | /// \brief Free the memory associated with this lookup. | 
|  | 1146 | void Destroy(); | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 1147 | }; | 
|  | 1148 |  | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 1149 | private: | 
|  | 1150 | typedef llvm::SmallVector<LookupResult, 3> LookupResultsVecTy; | 
|  | 1151 |  | 
|  | 1152 | std::pair<bool, LookupResult> CppLookupName(Scope *S, DeclarationName Name, | 
|  | 1153 | LookupNameKind NameKind, | 
|  | 1154 | bool RedeclarationOnly); | 
| Fariborz Jahanian | ef79bc9 | 2009-04-07 18:28:06 +0000 | [diff] [blame] | 1155 | ObjCMethodDecl *FindMethodInNestedImplementations( | 
|  | 1156 | const ObjCInterfaceDecl *IFace, | 
|  | 1157 | const Selector &Sel); | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 1158 |  | 
|  | 1159 | public: | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 1160 | /// Determines whether D is a suitable lookup result according to the | 
|  | 1161 | /// lookup criteria. | 
| Douglas Gregor | d6f7e9d | 2009-02-24 20:03:32 +0000 | [diff] [blame] | 1162 | static bool isAcceptableLookupResult(NamedDecl *D, LookupNameKind NameKind, | 
| Douglas Gregor | 7dda67d | 2009-02-05 19:25:20 +0000 | [diff] [blame] | 1163 | unsigned IDNS) { | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 1164 | switch (NameKind) { | 
|  | 1165 | case Sema::LookupOrdinaryName: | 
|  | 1166 | case Sema::LookupTagName: | 
|  | 1167 | case Sema::LookupMemberName: | 
| Douglas Gregor | d6f7e9d | 2009-02-24 20:03:32 +0000 | [diff] [blame] | 1168 | case Sema::LookupRedeclarationWithLinkage: // FIXME: check linkage, scoping | 
| Douglas Gregor | 8fc463a | 2009-04-24 00:11:27 +0000 | [diff] [blame] | 1169 | case Sema::LookupObjCProtocolName: | 
|  | 1170 | case Sema::LookupObjCImplementationName: | 
|  | 1171 | case Sema::LookupObjCCategoryImplName: | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 1172 | return D->isInIdentifierNamespace(IDNS); | 
|  | 1173 |  | 
| Douglas Gregor | f680a0f | 2009-02-04 16:44:47 +0000 | [diff] [blame] | 1174 | case Sema::LookupOperatorName: | 
|  | 1175 | return D->isInIdentifierNamespace(IDNS) && | 
|  | 1176 | !D->getDeclContext()->isRecord(); | 
|  | 1177 |  | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 1178 | case Sema::LookupNestedNameSpecifierName: | 
|  | 1179 | return isa<TypedefDecl>(D) || D->isInIdentifierNamespace(Decl::IDNS_Tag); | 
|  | 1180 |  | 
|  | 1181 | case Sema::LookupNamespaceName: | 
| Anders Carlsson | 81c85c4 | 2009-03-28 23:53:49 +0000 | [diff] [blame] | 1182 | return isa<NamespaceDecl>(D) || isa<NamespaceAliasDecl>(D); | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 1183 | } | 
|  | 1184 |  | 
|  | 1185 | assert(false && | 
| Douglas Gregor | 7dda67d | 2009-02-05 19:25:20 +0000 | [diff] [blame] | 1186 | "isAcceptableLookupResult always returns before this point"); | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 1187 | return false; | 
|  | 1188 | } | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 1189 |  | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 1190 | LookupResult LookupName(Scope *S, DeclarationName Name, | 
|  | 1191 | LookupNameKind NameKind, | 
| Douglas Gregor | 3e41d60 | 2009-02-13 23:20:09 +0000 | [diff] [blame] | 1192 | bool RedeclarationOnly = false, | 
| Eli Friedman | 6eb32f4 | 2009-06-06 02:08:44 +0000 | [diff] [blame] | 1193 | bool AllowBuiltinCreation = false, | 
| Douglas Gregor | 3e41d60 | 2009-02-13 23:20:09 +0000 | [diff] [blame] | 1194 | SourceLocation Loc = SourceLocation()); | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 1195 | LookupResult LookupQualifiedName(DeclContext *LookupCtx, DeclarationName Name, | 
|  | 1196 | LookupNameKind NameKind, | 
|  | 1197 | bool RedeclarationOnly = false); | 
| John McCall | 67d1a67 | 2009-08-06 02:15:43 +0000 | [diff] [blame] | 1198 | Decl *LookupQualifiedNameWithType(DeclContext *LookupCtx, | 
|  | 1199 | DeclarationName Name, | 
|  | 1200 | QualType T); | 
| Douglas Gregor | 4c921ae | 2009-01-30 01:04:22 +0000 | [diff] [blame] | 1201 | LookupResult LookupParsedName(Scope *S, const CXXScopeSpec *SS, | 
|  | 1202 | DeclarationName Name, | 
|  | 1203 | LookupNameKind NameKind, | 
| Douglas Gregor | 3e41d60 | 2009-02-13 23:20:09 +0000 | [diff] [blame] | 1204 | bool RedeclarationOnly = false, | 
| Eli Friedman | 6eb32f4 | 2009-06-06 02:08:44 +0000 | [diff] [blame] | 1205 | bool AllowBuiltinCreation = false, | 
| Douglas Gregor | 3e41d60 | 2009-02-13 23:20:09 +0000 | [diff] [blame] | 1206 | SourceLocation Loc = SourceLocation()); | 
| Douglas Gregor | 3fd95ce | 2009-03-13 00:33:25 +0000 | [diff] [blame] | 1207 |  | 
| Douglas Gregor | 6e378de | 2009-04-23 23:18:26 +0000 | [diff] [blame] | 1208 | ObjCProtocolDecl *LookupProtocol(IdentifierInfo *II); | 
| Douglas Gregor | 8fc463a | 2009-04-24 00:11:27 +0000 | [diff] [blame] | 1209 | ObjCCategoryImplDecl *LookupObjCCategoryImpl(IdentifierInfo *II); | 
| Douglas Gregor | 6e378de | 2009-04-23 23:18:26 +0000 | [diff] [blame] | 1210 |  | 
| Douglas Gregor | 3fd95ce | 2009-03-13 00:33:25 +0000 | [diff] [blame] | 1211 | void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, | 
|  | 1212 | QualType T1, QualType T2, | 
|  | 1213 | FunctionSet &Functions); | 
|  | 1214 |  | 
|  | 1215 | void ArgumentDependentLookup(DeclarationName Name, | 
|  | 1216 | Expr **Args, unsigned NumArgs, | 
|  | 1217 | FunctionSet &Functions); | 
|  | 1218 |  | 
| Douglas Gregor | fa04764 | 2009-02-04 00:32:51 +0000 | [diff] [blame] | 1219 | void FindAssociatedClassesAndNamespaces(Expr **Args, unsigned NumArgs, | 
|  | 1220 | AssociatedNamespaceSet &AssociatedNamespaces, | 
| John McCall | 6ff0785 | 2009-08-07 22:18:02 +0000 | [diff] [blame] | 1221 | AssociatedClassSet &AssociatedClasses); | 
| Douglas Gregor | fa04764 | 2009-02-04 00:32:51 +0000 | [diff] [blame] | 1222 |  | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 1223 | bool DiagnoseAmbiguousLookup(LookupResult &Result, DeclarationName Name, | 
|  | 1224 | SourceLocation NameLoc, | 
|  | 1225 | SourceRange LookupRange = SourceRange()); | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 1226 | //@} | 
|  | 1227 |  | 
| Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 1228 | ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *Id); | 
| Douglas Gregor | 4afa39d | 2009-01-20 01:17:11 +0000 | [diff] [blame] | 1229 | NamedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, | 
| Douglas Gregor | 3e41d60 | 2009-02-13 23:20:09 +0000 | [diff] [blame] | 1230 | Scope *S, bool ForRedeclaration, | 
|  | 1231 | SourceLocation Loc); | 
| Douglas Gregor | 4afa39d | 2009-01-20 01:17:11 +0000 | [diff] [blame] | 1232 | NamedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, | 
|  | 1233 | Scope *S); | 
| Douglas Gregor | 3c385e5 | 2009-02-14 18:57:46 +0000 | [diff] [blame] | 1234 | void AddKnownFunctionAttributes(FunctionDecl *FD); | 
| Douglas Gregor | eb11cd0 | 2009-01-14 22:20:51 +0000 | [diff] [blame] | 1235 |  | 
|  | 1236 | // More parsing and symbol table subroutines. | 
|  | 1237 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1238 | // Decl attributes - this routine is the top level dispatcher. | 
| Douglas Gregor | 9cdda0c | 2009-06-17 21:51:59 +0000 | [diff] [blame] | 1239 | void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD); | 
|  | 1240 | void ProcessDeclAttributeList(Scope *S, Decl *D, const AttributeList *AttrList); | 
| Christopher Lamb | ebb97e9 | 2008-02-04 02:31:56 +0000 | [diff] [blame] | 1241 |  | 
| Steve Naroff | 3c2eb66 | 2008-02-10 21:38:56 +0000 | [diff] [blame] | 1242 | void WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method, | 
|  | 1243 | bool &IncompleteImpl); | 
| Fariborz Jahanian | 8daab97 | 2008-12-05 18:18:52 +0000 | [diff] [blame] | 1244 | void WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethod, | 
|  | 1245 | ObjCMethodDecl *IntfMethod); | 
| Sebastian Redl | c42e118 | 2008-11-11 11:37:55 +0000 | [diff] [blame] | 1246 |  | 
|  | 1247 | NamespaceDecl *GetStdNamespace(); | 
| Fariborz Jahanian | d1fa644 | 2009-01-12 19:55:42 +0000 | [diff] [blame] | 1248 |  | 
|  | 1249 | bool isPropertyReadonly(ObjCPropertyDecl *PropertyDecl, | 
| Steve Naroff | 22dc0b0 | 2009-02-26 19:11:32 +0000 | [diff] [blame] | 1250 | ObjCInterfaceDecl *IDecl); | 
| Steve Naroff | 3c2eb66 | 2008-02-10 21:38:56 +0000 | [diff] [blame] | 1251 |  | 
| Chris Lattner | 823c44e | 2009-01-06 07:27:21 +0000 | [diff] [blame] | 1252 | /// CheckProtocolMethodDefs - This routine checks unimplemented | 
| Daniel Dunbar | 7ad1b1f | 2008-09-04 20:01:15 +0000 | [diff] [blame] | 1253 | /// methods declared in protocol, and those referenced by it. | 
|  | 1254 | /// \param IDecl - Used for checking for methods which may have been | 
|  | 1255 | /// inherited. | 
| Steve Naroff | efe7f36 | 2008-02-08 22:06:17 +0000 | [diff] [blame] | 1256 | void CheckProtocolMethodDefs(SourceLocation ImpLoc, | 
|  | 1257 | ObjCProtocolDecl *PDecl, | 
| Fariborz Jahanian | ca3adf7 | 2007-10-02 20:06:01 +0000 | [diff] [blame] | 1258 | bool& IncompleteImpl, | 
| Steve Naroff | eefc418 | 2007-10-08 21:05:34 +0000 | [diff] [blame] | 1259 | const llvm::DenseSet<Selector> &InsMap, | 
| Daniel Dunbar | 7ad1b1f | 2008-09-04 20:01:15 +0000 | [diff] [blame] | 1260 | const llvm::DenseSet<Selector> &ClsMap, | 
|  | 1261 | ObjCInterfaceDecl *IDecl); | 
| Fariborz Jahanian | 8c74fa4 | 2007-09-29 17:14:55 +0000 | [diff] [blame] | 1262 |  | 
| Steve Naroff | a5997c4 | 2007-10-02 21:43:37 +0000 | [diff] [blame] | 1263 | /// CheckImplementationIvars - This routine checks if the instance variables | 
|  | 1264 | /// listed in the implelementation match those listed in the interface. | 
| Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 1265 | void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, | 
|  | 1266 | ObjCIvarDecl **Fields, unsigned nIvars, | 
| Steve Naroff | 3c2eb66 | 2008-02-10 21:38:56 +0000 | [diff] [blame] | 1267 | SourceLocation Loc); | 
| Steve Naroff | a5997c4 | 2007-10-02 21:43:37 +0000 | [diff] [blame] | 1268 |  | 
| Fariborz Jahanian | 8c74fa4 | 2007-09-29 17:14:55 +0000 | [diff] [blame] | 1269 | /// ImplMethodsVsClassMethods - This is main routine to warn if any method | 
| Chris Lattner | cddc888 | 2009-03-01 00:56:52 +0000 | [diff] [blame] | 1270 | /// remains unimplemented in the class or category @implementation. | 
|  | 1271 | void ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl, | 
|  | 1272 | ObjCContainerDecl* IDecl, | 
|  | 1273 | bool IncompleteImpl = false); | 
| Fariborz Jahanian | 8c74fa4 | 2007-09-29 17:14:55 +0000 | [diff] [blame] | 1274 |  | 
| Fariborz Jahanian | 85ff264 | 2007-10-05 18:00:57 +0000 | [diff] [blame] | 1275 | /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns | 
|  | 1276 | /// true, or false, accordingly. | 
| Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 1277 | bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, | 
| Steve Naroff | fe6b0dc | 2008-10-21 10:37:50 +0000 | [diff] [blame] | 1278 | const ObjCMethodDecl *PrevMethod, | 
|  | 1279 | bool matchBasedOnSizeAndAlignment = false); | 
| Steve Naroff | 3b95017 | 2007-10-10 21:53:07 +0000 | [diff] [blame] | 1280 |  | 
| Fariborz Jahanian | b33f3ad | 2009-05-01 20:07:12 +0000 | [diff] [blame] | 1281 | /// MatchAllMethodDeclarations - Check methods declaraed in interface or | 
|  | 1282 | /// or protocol against those declared in their implementations. | 
|  | 1283 | void MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap, | 
|  | 1284 | const llvm::DenseSet<Selector> &ClsMap, | 
|  | 1285 | llvm::DenseSet<Selector> &InsMapSeen, | 
|  | 1286 | llvm::DenseSet<Selector> &ClsMapSeen, | 
|  | 1287 | ObjCImplDecl* IMPDecl, | 
|  | 1288 | ObjCContainerDecl* IDecl, | 
|  | 1289 | bool &IncompleteImpl, | 
|  | 1290 | bool ImmediateClass); | 
|  | 1291 |  | 
| Steve Naroff | 58ff9e8 | 2007-10-14 00:58:41 +0000 | [diff] [blame] | 1292 | /// AddInstanceMethodToGlobalPool - All instance methods in a translation | 
|  | 1293 | /// unit are added to a global pool. This allows us to efficiently associate | 
|  | 1294 | /// a selector with a method declaraation for purposes of typechecking | 
|  | 1295 | /// messages sent to "id" (where the class of the object is unknown). | 
| Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 1296 | void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method); | 
| Steve Naroff | 58ff9e8 | 2007-10-14 00:58:41 +0000 | [diff] [blame] | 1297 |  | 
| Steve Naroff | 037cda5 | 2008-09-30 14:38:43 +0000 | [diff] [blame] | 1298 | /// LookupInstanceMethodInGlobalPool - Returns the method and warns if | 
|  | 1299 | /// there are multiple signatures. | 
|  | 1300 | ObjCMethodDecl *LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R); | 
| Douglas Gregor | f0aaf7a | 2009-04-24 21:10:55 +0000 | [diff] [blame] | 1301 |  | 
|  | 1302 | /// LookupFactoryMethodInGlobalPool - Returns the method and warns if | 
|  | 1303 | /// there are multiple signatures. | 
|  | 1304 | ObjCMethodDecl *LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R); | 
| Steve Naroff | 037cda5 | 2008-09-30 14:38:43 +0000 | [diff] [blame] | 1305 |  | 
| Steve Naroff | 58ff9e8 | 2007-10-14 00:58:41 +0000 | [diff] [blame] | 1306 | /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods. | 
| Ted Kremenek | a526c5c | 2008-01-07 19:49:32 +0000 | [diff] [blame] | 1307 | void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1308 | //===--------------------------------------------------------------------===// | 
|  | 1309 | // Statement Parsing Callbacks: SemaStmt.cpp. | 
|  | 1310 | public: | 
| Anders Carlsson | 6b1d283 | 2009-05-17 21:11:30 +0000 | [diff] [blame] | 1311 | virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr); | 
| Sebastian Redl | a60528c | 2008-12-21 12:04:03 +0000 | [diff] [blame] | 1312 |  | 
|  | 1313 | virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc); | 
|  | 1314 | virtual OwningStmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, | 
|  | 1315 | MultiStmtArg Elts, | 
|  | 1316 | bool isStmtExpr); | 
| Chris Lattner | 682bf92 | 2009-03-29 16:50:03 +0000 | [diff] [blame] | 1317 | virtual OwningStmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1318 | SourceLocation StartLoc, | 
| Sebastian Redl | a60528c | 2008-12-21 12:04:03 +0000 | [diff] [blame] | 1319 | SourceLocation EndLoc); | 
| Sebastian Redl | 117054a | 2008-12-28 16:13:43 +0000 | [diff] [blame] | 1320 | virtual OwningStmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprArg LHSVal, | 
|  | 1321 | SourceLocation DotDotDotLoc, ExprArg RHSVal, | 
| Chris Lattner | 24e1e70 | 2009-03-04 04:23:07 +0000 | [diff] [blame] | 1322 | SourceLocation ColonLoc); | 
|  | 1323 | virtual void ActOnCaseStmtBody(StmtTy *CaseStmt, StmtArg SubStmt); | 
|  | 1324 |  | 
| Sebastian Redl | 117054a | 2008-12-28 16:13:43 +0000 | [diff] [blame] | 1325 | virtual OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, | 
|  | 1326 | SourceLocation ColonLoc, | 
|  | 1327 | StmtArg SubStmt, Scope *CurScope); | 
| Sebastian Redl | de30747 | 2009-01-11 00:38:46 +0000 | [diff] [blame] | 1328 | virtual OwningStmtResult ActOnLabelStmt(SourceLocation IdentLoc, | 
|  | 1329 | IdentifierInfo *II, | 
|  | 1330 | SourceLocation ColonLoc, | 
|  | 1331 | StmtArg SubStmt); | 
| Anders Carlsson | a99fad8 | 2009-05-17 18:26:53 +0000 | [diff] [blame] | 1332 | virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc, | 
|  | 1333 | FullExprArg CondVal, StmtArg ThenVal, | 
|  | 1334 | SourceLocation ElseLoc, StmtArg ElseVal); | 
| Sebastian Redl | de30747 | 2009-01-11 00:38:46 +0000 | [diff] [blame] | 1335 | virtual OwningStmtResult ActOnStartOfSwitchStmt(ExprArg Cond); | 
|  | 1336 | virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, | 
|  | 1337 | StmtArg Switch, StmtArg Body); | 
| Anders Carlsson | 7f537c1 | 2009-05-17 21:22:26 +0000 | [diff] [blame] | 1338 | virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc, | 
|  | 1339 | FullExprArg Cond, StmtArg Body); | 
| Sebastian Redl | f05b152 | 2009-01-16 23:28:06 +0000 | [diff] [blame] | 1340 | virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body, | 
| Chris Lattner | 9891359 | 2009-06-12 23:04:47 +0000 | [diff] [blame] | 1341 | SourceLocation WhileLoc, | 
|  | 1342 | SourceLocation CondLParen, ExprArg Cond, | 
|  | 1343 | SourceLocation CondRParen); | 
| Sebastian Redl | f05b152 | 2009-01-16 23:28:06 +0000 | [diff] [blame] | 1344 |  | 
|  | 1345 | virtual OwningStmtResult ActOnForStmt(SourceLocation ForLoc, | 
|  | 1346 | SourceLocation LParenLoc, | 
|  | 1347 | StmtArg First, ExprArg Second, | 
|  | 1348 | ExprArg Third, SourceLocation RParenLoc, | 
|  | 1349 | StmtArg Body); | 
|  | 1350 | virtual OwningStmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, | 
|  | 1351 | SourceLocation LParenLoc, | 
|  | 1352 | StmtArg First, ExprArg Second, | 
|  | 1353 | SourceLocation RParenLoc, StmtArg Body); | 
| Sebastian Redl | 4cffe2f | 2009-01-18 13:19:59 +0000 | [diff] [blame] | 1354 |  | 
|  | 1355 | virtual OwningStmtResult ActOnGotoStmt(SourceLocation GotoLoc, | 
|  | 1356 | SourceLocation LabelLoc, | 
|  | 1357 | IdentifierInfo *LabelII); | 
|  | 1358 | virtual OwningStmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, | 
|  | 1359 | SourceLocation StarLoc, | 
|  | 1360 | ExprArg DestExp); | 
|  | 1361 | virtual OwningStmtResult ActOnContinueStmt(SourceLocation ContinueLoc, | 
|  | 1362 | Scope *CurScope); | 
|  | 1363 | virtual OwningStmtResult ActOnBreakStmt(SourceLocation GotoLoc, | 
|  | 1364 | Scope *CurScope); | 
|  | 1365 |  | 
|  | 1366 | virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc, | 
| Anders Carlsson | a0ab25d | 2009-05-30 21:42:34 +0000 | [diff] [blame] | 1367 | FullExprArg RetValExp); | 
| Sebastian Redl | 4cffe2f | 2009-01-18 13:19:59 +0000 | [diff] [blame] | 1368 | OwningStmtResult ActOnBlockReturnStmt(SourceLocation ReturnLoc, | 
|  | 1369 | Expr *RetValExp); | 
|  | 1370 |  | 
| Sebastian Redl | 3037ed0 | 2009-01-18 16:53:17 +0000 | [diff] [blame] | 1371 | virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc, | 
|  | 1372 | bool IsSimple, | 
|  | 1373 | bool IsVolatile, | 
|  | 1374 | unsigned NumOutputs, | 
|  | 1375 | unsigned NumInputs, | 
|  | 1376 | std::string *Names, | 
|  | 1377 | MultiExprArg Constraints, | 
|  | 1378 | MultiExprArg Exprs, | 
|  | 1379 | ExprArg AsmString, | 
|  | 1380 | MultiExprArg Clobbers, | 
|  | 1381 | SourceLocation RParenLoc); | 
| Sebastian Redl | 431e90e | 2009-01-18 17:43:11 +0000 | [diff] [blame] | 1382 |  | 
|  | 1383 | virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, | 
|  | 1384 | SourceLocation RParen, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1385 | DeclPtrTy Parm, StmtArg Body, | 
| Sebastian Redl | 431e90e | 2009-01-18 17:43:11 +0000 | [diff] [blame] | 1386 | StmtArg CatchList); | 
|  | 1387 |  | 
|  | 1388 | virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, | 
|  | 1389 | StmtArg Body); | 
|  | 1390 |  | 
|  | 1391 | virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, | 
|  | 1392 | StmtArg Try, | 
|  | 1393 | StmtArg Catch, StmtArg Finally); | 
|  | 1394 |  | 
|  | 1395 | virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, | 
| Steve Naroff | e21dd6f | 2009-02-11 20:05:44 +0000 | [diff] [blame] | 1396 | ExprArg Throw, | 
|  | 1397 | Scope *CurScope); | 
| Sebastian Redl | 431e90e | 2009-01-18 17:43:11 +0000 | [diff] [blame] | 1398 | virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, | 
|  | 1399 | ExprArg SynchExpr, | 
|  | 1400 | StmtArg SynchBody); | 
| Sebastian Redl | a0fd865 | 2008-12-21 16:41:36 +0000 | [diff] [blame] | 1401 |  | 
| Douglas Gregor | d308e62 | 2009-05-18 20:51:54 +0000 | [diff] [blame] | 1402 | VarDecl *BuildExceptionDeclaration(Scope *S, QualType ExDeclType, | 
|  | 1403 | IdentifierInfo *Name, | 
|  | 1404 | SourceLocation Loc, | 
|  | 1405 | SourceRange Range); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1406 | virtual DeclPtrTy ActOnExceptionDeclarator(Scope *S, Declarator &D); | 
| Douglas Gregor | d308e62 | 2009-05-18 20:51:54 +0000 | [diff] [blame] | 1407 |  | 
| Sebastian Redl | 4b07b29 | 2008-12-22 19:15:10 +0000 | [diff] [blame] | 1408 | virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1409 | DeclPtrTy ExDecl, | 
| Sebastian Redl | 4b07b29 | 2008-12-22 19:15:10 +0000 | [diff] [blame] | 1410 | StmtArg HandlerBlock); | 
| Sebastian Redl | 8351da0 | 2008-12-22 21:35:02 +0000 | [diff] [blame] | 1411 | virtual OwningStmtResult ActOnCXXTryBlock(SourceLocation TryLoc, | 
|  | 1412 | StmtArg TryBlock, | 
|  | 1413 | MultiStmtArg Handlers); | 
| Sebastian Redl | 13e8854 | 2009-04-27 21:33:24 +0000 | [diff] [blame] | 1414 | void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock); | 
| Sebastian Redl | a0fd865 | 2008-12-21 16:41:36 +0000 | [diff] [blame] | 1415 |  | 
| Anders Carlsson | 636463e | 2009-07-30 22:17:18 +0000 | [diff] [blame] | 1416 | /// DiagnoseUnusedExprResult - If the statement passed in is an expression | 
|  | 1417 | /// whose result is unused, warn. | 
|  | 1418 | void DiagnoseUnusedExprResult(const Stmt *S); | 
|  | 1419 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1420 | //===--------------------------------------------------------------------===// | 
|  | 1421 | // Expression Parsing Callbacks: SemaExpr.cpp. | 
|  | 1422 |  | 
| Douglas Gregor | 48f3bb9 | 2009-02-18 21:56:37 +0000 | [diff] [blame] | 1423 | bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc); | 
| Fariborz Jahanian | c001e89 | 2009-05-08 20:20:55 +0000 | [diff] [blame] | 1424 | bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, | 
|  | 1425 | ObjCMethodDecl *Getter, | 
|  | 1426 | SourceLocation Loc); | 
| Fariborz Jahanian | 5b53005 | 2009-05-13 18:09:35 +0000 | [diff] [blame] | 1427 | void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, | 
|  | 1428 | Expr **Args, unsigned NumArgs); | 
| Chris Lattner | 76a642f | 2009-02-15 22:43:40 +0000 | [diff] [blame] | 1429 |  | 
| Douglas Gregor | ac7610d | 2009-06-22 20:57:11 +0000 | [diff] [blame] | 1430 | virtual ExpressionEvaluationContext | 
|  | 1431 | PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext); | 
|  | 1432 |  | 
|  | 1433 | virtual void | 
|  | 1434 | PopExpressionEvaluationContext(ExpressionEvaluationContext OldContext, | 
|  | 1435 | ExpressionEvaluationContext NewContext); | 
|  | 1436 |  | 
| Douglas Gregor | e0762c9 | 2009-06-19 23:52:42 +0000 | [diff] [blame] | 1437 | void MarkDeclarationReferenced(SourceLocation Loc, Decl *D); | 
|  | 1438 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1439 | // Primary Expressions. | 
| Douglas Gregor | 4b2d3f7 | 2009-02-26 21:00:50 +0000 | [diff] [blame] | 1440 | virtual SourceRange getExprRange(ExprTy *E) const; | 
|  | 1441 |  | 
| Sebastian Redl | cd965b9 | 2009-01-18 18:53:16 +0000 | [diff] [blame] | 1442 | virtual OwningExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc, | 
|  | 1443 | IdentifierInfo &II, | 
|  | 1444 | bool HasTrailingLParen, | 
| Sebastian Redl | ebc07d5 | 2009-02-03 20:19:35 +0000 | [diff] [blame] | 1445 | const CXXScopeSpec *SS = 0, | 
|  | 1446 | bool isAddressOfOperand = false); | 
| Sebastian Redl | cd965b9 | 2009-01-18 18:53:16 +0000 | [diff] [blame] | 1447 | virtual OwningExprResult ActOnCXXOperatorFunctionIdExpr(Scope *S, | 
| Douglas Gregor | 487a75a | 2008-11-19 19:09:45 +0000 | [diff] [blame] | 1448 | SourceLocation OperatorLoc, | 
|  | 1449 | OverloadedOperatorKind Op, | 
|  | 1450 | bool HasTrailingLParen, | 
| Sebastian Redl | ebc07d5 | 2009-02-03 20:19:35 +0000 | [diff] [blame] | 1451 | const CXXScopeSpec &SS, | 
|  | 1452 | bool isAddressOfOperand); | 
| Sebastian Redl | cd965b9 | 2009-01-18 18:53:16 +0000 | [diff] [blame] | 1453 | virtual OwningExprResult ActOnCXXConversionFunctionExpr(Scope *S, | 
| Douglas Gregor | 487a75a | 2008-11-19 19:09:45 +0000 | [diff] [blame] | 1454 | SourceLocation OperatorLoc, | 
|  | 1455 | TypeTy *Ty, | 
|  | 1456 | bool HasTrailingLParen, | 
| Sebastian Redl | ebc07d5 | 2009-02-03 20:19:35 +0000 | [diff] [blame] | 1457 | const CXXScopeSpec &SS, | 
|  | 1458 | bool isAddressOfOperand); | 
| Anders Carlsson | e41590d | 2009-06-24 00:10:43 +0000 | [diff] [blame] | 1459 | OwningExprResult BuildDeclRefExpr(NamedDecl *D, QualType Ty, | 
|  | 1460 | SourceLocation Loc, bool TypeDependent, | 
|  | 1461 | bool ValueDependent, | 
|  | 1462 | const CXXScopeSpec *SS = 0); | 
| Douglas Gregor | ffb4b6e | 2009-04-15 06:41:24 +0000 | [diff] [blame] | 1463 | VarDecl *BuildAnonymousStructUnionMemberPath(FieldDecl *Field, | 
|  | 1464 | llvm::SmallVectorImpl<FieldDecl *> &Path); | 
| Sebastian Redl | cd965b9 | 2009-01-18 18:53:16 +0000 | [diff] [blame] | 1465 | OwningExprResult | 
| Douglas Gregor | bcbffc4 | 2009-01-07 00:43:41 +0000 | [diff] [blame] | 1466 | BuildAnonymousStructUnionMemberReference(SourceLocation Loc, | 
|  | 1467 | FieldDecl *Field, | 
|  | 1468 | Expr *BaseObjectExpr = 0, | 
|  | 1469 | SourceLocation OpLoc = SourceLocation()); | 
| Sebastian Redl | cd965b9 | 2009-01-18 18:53:16 +0000 | [diff] [blame] | 1470 | OwningExprResult ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, | 
|  | 1471 | DeclarationName Name, | 
|  | 1472 | bool HasTrailingLParen, | 
|  | 1473 | const CXXScopeSpec *SS, | 
| Sebastian Redl | ebc07d5 | 2009-02-03 20:19:35 +0000 | [diff] [blame] | 1474 | bool isAddressOfOperand = false); | 
| Douglas Gregor | 751f9a4 | 2009-06-30 15:47:41 +0000 | [diff] [blame] | 1475 | OwningExprResult BuildDeclarationNameExpr(SourceLocation Loc, NamedDecl *D, | 
|  | 1476 | bool HasTrailingLParen, | 
|  | 1477 | const CXXScopeSpec *SS, | 
|  | 1478 | bool isAddressOfOperand); | 
|  | 1479 |  | 
| Sebastian Redl | cd965b9 | 2009-01-18 18:53:16 +0000 | [diff] [blame] | 1480 | virtual OwningExprResult ActOnPredefinedExpr(SourceLocation Loc, | 
|  | 1481 | tok::TokenKind Kind); | 
|  | 1482 | virtual OwningExprResult ActOnNumericConstant(const Token &); | 
|  | 1483 | virtual OwningExprResult ActOnCharacterConstant(const Token &); | 
|  | 1484 | virtual OwningExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, | 
|  | 1485 | ExprArg Val); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1486 |  | 
| Steve Naroff | f69936d | 2007-09-16 03:34:24 +0000 | [diff] [blame] | 1487 | /// ActOnStringLiteral - The specified tokens were lexed as pasted string | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1488 | /// fragments (e.g. "foo" "bar" L"baz"). | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 1489 | virtual OwningExprResult ActOnStringLiteral(const Token *Toks, | 
|  | 1490 | unsigned NumToks); | 
| Sebastian Redl | cd965b9 | 2009-01-18 18:53:16 +0000 | [diff] [blame] | 1491 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1492 | // Binary/Unary Operators.  'Tok' is the token for the operator. | 
| Douglas Gregor | bc736fc | 2009-03-13 23:49:33 +0000 | [diff] [blame] | 1493 | OwningExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, | 
|  | 1494 | unsigned OpcIn, | 
|  | 1495 | ExprArg InputArg); | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 1496 | virtual OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, | 
|  | 1497 | tok::TokenKind Op, ExprArg Input); | 
| Sebastian Redl | 0518999 | 2008-11-11 17:56:53 +0000 | [diff] [blame] | 1498 |  | 
| Douglas Gregor | ba49817 | 2009-03-13 21:01:28 +0000 | [diff] [blame] | 1499 | OwningExprResult CreateSizeOfAlignOfExpr(QualType T, SourceLocation OpLoc, | 
|  | 1500 | bool isSizeOf, SourceRange R); | 
|  | 1501 | OwningExprResult CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc, | 
|  | 1502 | bool isSizeOf, SourceRange R); | 
| Douglas Gregor | bc736fc | 2009-03-13 23:49:33 +0000 | [diff] [blame] | 1503 | virtual OwningExprResult | 
|  | 1504 | ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType, | 
|  | 1505 | void *TyOrEx, const SourceRange &ArgRange); | 
| Douglas Gregor | ba49817 | 2009-03-13 21:01:28 +0000 | [diff] [blame] | 1506 |  | 
| Chris Lattner | 31e21e0 | 2009-01-24 20:17:12 +0000 | [diff] [blame] | 1507 | bool CheckAlignOfExpr(Expr *E, SourceLocation OpLoc, const SourceRange &R); | 
| Sebastian Redl | 0518999 | 2008-11-11 17:56:53 +0000 | [diff] [blame] | 1508 | bool CheckSizeOfAlignOfOperand(QualType type, SourceLocation OpLoc, | 
|  | 1509 | const SourceRange &R, bool isSizeof); | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 1510 |  | 
|  | 1511 | virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, | 
|  | 1512 | tok::TokenKind Kind, | 
|  | 1513 | ExprArg Input); | 
|  | 1514 |  | 
|  | 1515 | virtual OwningExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base, | 
|  | 1516 | SourceLocation LLoc, | 
|  | 1517 | ExprArg Idx, | 
|  | 1518 | SourceLocation RLoc); | 
|  | 1519 | virtual OwningExprResult ActOnMemberReferenceExpr(Scope *S, ExprArg Base, | 
|  | 1520 | SourceLocation OpLoc, | 
|  | 1521 | tok::TokenKind OpKind, | 
|  | 1522 | SourceLocation MemberLoc, | 
| Fariborz Jahanian | a6e3ac5 | 2009-03-04 22:30:12 +0000 | [diff] [blame] | 1523 | IdentifierInfo &Member, | 
| Douglas Gregor | fe85ced | 2009-08-06 03:17:00 +0000 | [diff] [blame] | 1524 | DeclPtrTy ImplDecl, | 
|  | 1525 | const CXXScopeSpec *SS = 0); | 
| Fariborz Jahanian | 393612e | 2009-07-21 22:36:06 +0000 | [diff] [blame] | 1526 | virtual void ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl); | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 1527 | bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, | 
| Douglas Gregor | 88a3514 | 2008-12-22 05:46:06 +0000 | [diff] [blame] | 1528 | FunctionDecl *FDecl, | 
| Douglas Gregor | 72564e7 | 2009-02-26 23:50:07 +0000 | [diff] [blame] | 1529 | const FunctionProtoType *Proto, | 
| Douglas Gregor | 88a3514 | 2008-12-22 05:46:06 +0000 | [diff] [blame] | 1530 | Expr **Args, unsigned NumArgs, | 
|  | 1531 | SourceLocation RParenLoc); | 
| Fariborz Jahanian | 87595e4 | 2009-07-23 23:32:59 +0000 | [diff] [blame] | 1532 | void BuildBaseOrMemberInitializers(ASTContext &C, | 
|  | 1533 | CXXConstructorDecl *Constructor, | 
|  | 1534 | CXXBaseOrMemberInitializer **Initializers, | 
|  | 1535 | unsigned NumInitializers | 
|  | 1536 | ); | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 1537 |  | 
| Steve Naroff | f69936d | 2007-09-16 03:34:24 +0000 | [diff] [blame] | 1538 | /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments. | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1539 | /// This provides the location of the left/right parens and a list of comma | 
|  | 1540 | /// locations. | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 1541 | virtual OwningExprResult ActOnCallExpr(Scope *S, ExprArg Fn, | 
|  | 1542 | SourceLocation LParenLoc, | 
|  | 1543 | MultiExprArg Args, | 
|  | 1544 | SourceLocation *CommaLocs, | 
|  | 1545 | SourceLocation RParenLoc); | 
|  | 1546 |  | 
| Sebastian Redl | b8a6aca | 2009-01-19 22:31:54 +0000 | [diff] [blame] | 1547 | virtual OwningExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty, | 
|  | 1548 | SourceLocation RParenLoc, ExprArg Op); | 
|  | 1549 |  | 
|  | 1550 | virtual OwningExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, | 
|  | 1551 | TypeTy *Ty, | 
|  | 1552 | SourceLocation RParenLoc, | 
|  | 1553 | ExprArg Op); | 
|  | 1554 |  | 
|  | 1555 | virtual OwningExprResult ActOnInitList(SourceLocation LParenLoc, | 
|  | 1556 | MultiExprArg InitList, | 
| Sebastian Redl | b8a6aca | 2009-01-19 22:31:54 +0000 | [diff] [blame] | 1557 | SourceLocation RParenLoc); | 
|  | 1558 |  | 
| Douglas Gregor | 05c13a3 | 2009-01-22 00:58:24 +0000 | [diff] [blame] | 1559 | virtual OwningExprResult ActOnDesignatedInitializer(Designation &Desig, | 
|  | 1560 | SourceLocation Loc, | 
| Douglas Gregor | eeae8f0 | 2009-03-28 00:41:23 +0000 | [diff] [blame] | 1561 | bool GNUSyntax, | 
| Douglas Gregor | 05c13a3 | 2009-01-22 00:58:24 +0000 | [diff] [blame] | 1562 | OwningExprResult Init); | 
|  | 1563 |  | 
| Sebastian Redl | b8a6aca | 2009-01-19 22:31:54 +0000 | [diff] [blame] | 1564 | virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, | 
|  | 1565 | tok::TokenKind Kind, | 
|  | 1566 | ExprArg LHS, ExprArg RHS); | 
|  | 1567 | OwningExprResult CreateBuiltinBinOp(SourceLocation TokLoc, | 
|  | 1568 | unsigned Opc, Expr *lhs, Expr *rhs); | 
| Douglas Gregor | eaebc75 | 2008-11-06 23:29:22 +0000 | [diff] [blame] | 1569 |  | 
| Steve Naroff | f69936d | 2007-09-16 03:34:24 +0000 | [diff] [blame] | 1570 | /// ActOnConditionalOp - Parse a ?: operation.  Note that 'LHS' may be null | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1571 | /// in the case of a the GNU conditional expr extension. | 
| Sebastian Redl | b8a6aca | 2009-01-19 22:31:54 +0000 | [diff] [blame] | 1572 | virtual OwningExprResult ActOnConditionalOp(SourceLocation QuestionLoc, | 
|  | 1573 | SourceLocation ColonLoc, | 
|  | 1574 | ExprArg Cond, ExprArg LHS, | 
|  | 1575 | ExprArg RHS); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1576 |  | 
| Steve Naroff | 1b273c4 | 2007-09-16 14:56:35 +0000 | [diff] [blame] | 1577 | /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo". | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1578 | virtual OwningExprResult ActOnAddrLabel(SourceLocation OpLoc, | 
|  | 1579 | SourceLocation LabLoc, | 
|  | 1580 | IdentifierInfo *LabelII); | 
|  | 1581 |  | 
|  | 1582 | virtual OwningExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt, | 
|  | 1583 | SourceLocation RPLoc); // "({..})" | 
| Chris Lattner | 73d0d4f | 2007-08-30 17:45:32 +0000 | [diff] [blame] | 1584 |  | 
|  | 1585 | /// __builtin_offsetof(type, a.b[123][456].c) | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1586 | virtual OwningExprResult ActOnBuiltinOffsetOf(Scope *S, | 
|  | 1587 | SourceLocation BuiltinLoc, | 
|  | 1588 | SourceLocation TypeLoc, | 
|  | 1589 | TypeTy *Arg1, | 
|  | 1590 | OffsetOfComponent *CompPtr, | 
|  | 1591 | unsigned NumComponents, | 
|  | 1592 | SourceLocation RParenLoc); | 
|  | 1593 |  | 
| Steve Naroff | d34e915 | 2007-08-01 22:05:33 +0000 | [diff] [blame] | 1594 | // __builtin_types_compatible_p(type1, type2) | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1595 | virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc, | 
|  | 1596 | TypeTy *arg1, TypeTy *arg2, | 
|  | 1597 | SourceLocation RPLoc); | 
|  | 1598 |  | 
| Steve Naroff | d04fdd5 | 2007-08-03 21:21:27 +0000 | [diff] [blame] | 1599 | // __builtin_choose_expr(constExpr, expr1, expr2) | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1600 | virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, | 
|  | 1601 | ExprArg cond, ExprArg expr1, | 
|  | 1602 | ExprArg expr2, SourceLocation RPLoc); | 
|  | 1603 |  | 
| Anders Carlsson | 7c50aca | 2007-10-15 20:28:48 +0000 | [diff] [blame] | 1604 | // __builtin_va_arg(expr, type) | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1605 | virtual OwningExprResult ActOnVAArg(SourceLocation BuiltinLoc, | 
|  | 1606 | ExprArg expr, TypeTy *type, | 
|  | 1607 | SourceLocation RPLoc); | 
| Steve Naroff | 4eb206b | 2008-09-03 18:15:37 +0000 | [diff] [blame] | 1608 |  | 
| Douglas Gregor | 2d8b273 | 2008-11-29 04:51:27 +0000 | [diff] [blame] | 1609 | // __null | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1610 | virtual OwningExprResult ActOnGNUNullExpr(SourceLocation TokenLoc); | 
| Douglas Gregor | 2d8b273 | 2008-11-29 04:51:27 +0000 | [diff] [blame] | 1611 |  | 
| Steve Naroff | 4eb206b | 2008-09-03 18:15:37 +0000 | [diff] [blame] | 1612 | //===------------------------- "Block" Extension ------------------------===// | 
|  | 1613 |  | 
|  | 1614 | /// ActOnBlockStart - This callback is invoked when a block literal is | 
|  | 1615 | /// started. | 
| Steve Naroff | 090276f | 2008-10-10 01:28:17 +0000 | [diff] [blame] | 1616 | virtual void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope); | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1617 |  | 
| Steve Naroff | 090276f | 2008-10-10 01:28:17 +0000 | [diff] [blame] | 1618 | /// ActOnBlockArguments - This callback allows processing of block arguments. | 
|  | 1619 | /// If there are no arguments, this is still invoked. | 
| Mike Stump | 98eb8a7 | 2009-02-04 22:31:32 +0000 | [diff] [blame] | 1620 | virtual void ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope); | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1621 |  | 
| Steve Naroff | 4eb206b | 2008-09-03 18:15:37 +0000 | [diff] [blame] | 1622 | /// ActOnBlockError - If there is an error parsing a block, this callback | 
|  | 1623 | /// is invoked to pop the information about the block from the action impl. | 
|  | 1624 | virtual void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope); | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1625 |  | 
| Steve Naroff | 4eb206b | 2008-09-03 18:15:37 +0000 | [diff] [blame] | 1626 | /// ActOnBlockStmtExpr - This is called when the body of a block statement | 
|  | 1627 | /// literal was successfully completed.  ^(int x){...} | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1628 | virtual OwningExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, | 
|  | 1629 | StmtArg Body, Scope *CurScope); | 
| Steve Naroff | 4eb206b | 2008-09-03 18:15:37 +0000 | [diff] [blame] | 1630 |  | 
| Chris Lattner | 76a642f | 2009-02-15 22:43:40 +0000 | [diff] [blame] | 1631 | //===---------------------------- C++ Features --------------------------===// | 
|  | 1632 |  | 
| Argyrios Kyrtzidis | 2d1c5d3 | 2008-04-27 13:50:30 +0000 | [diff] [blame] | 1633 | // Act on C++ namespaces | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1634 | virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc, | 
|  | 1635 | IdentifierInfo *Ident, | 
|  | 1636 | SourceLocation LBrace); | 
|  | 1637 | virtual void ActOnFinishNamespaceDef(DeclPtrTy Dcl, SourceLocation RBrace); | 
| Argyrios Kyrtzidis | 2d1c5d3 | 2008-04-27 13:50:30 +0000 | [diff] [blame] | 1638 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1639 | virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope, | 
|  | 1640 | SourceLocation UsingLoc, | 
|  | 1641 | SourceLocation NamespcLoc, | 
|  | 1642 | const CXXScopeSpec &SS, | 
|  | 1643 | SourceLocation IdentLoc, | 
|  | 1644 | IdentifierInfo *NamespcName, | 
|  | 1645 | AttributeList *AttrList); | 
| Anders Carlsson | dbb0094 | 2009-03-28 05:27:17 +0000 | [diff] [blame] | 1646 |  | 
| Douglas Gregor | 2a3009a | 2009-02-03 19:21:40 +0000 | [diff] [blame] | 1647 | void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir); | 
|  | 1648 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1649 | virtual DeclPtrTy ActOnNamespaceAliasDef(Scope *CurScope, | 
| Anders Carlsson | 03bd5a1 | 2009-03-28 22:53:22 +0000 | [diff] [blame] | 1650 | SourceLocation NamespaceLoc, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1651 | SourceLocation AliasLoc, | 
|  | 1652 | IdentifierInfo *Alias, | 
|  | 1653 | const CXXScopeSpec &SS, | 
| Anders Carlsson | 03bd5a1 | 2009-03-28 22:53:22 +0000 | [diff] [blame] | 1654 | SourceLocation IdentLoc, | 
|  | 1655 | IdentifierInfo *Ident); | 
| Douglas Gregor | 9cfbe48 | 2009-06-20 00:51:54 +0000 | [diff] [blame] | 1656 |  | 
|  | 1657 | virtual DeclPtrTy ActOnUsingDeclaration(Scope *CurScope, | 
|  | 1658 | SourceLocation UsingLoc, | 
|  | 1659 | const CXXScopeSpec &SS, | 
|  | 1660 | SourceLocation IdentLoc, | 
|  | 1661 | IdentifierInfo *TargetName, | 
| Anders Carlsson | 0c6139d | 2009-06-27 00:27:47 +0000 | [diff] [blame] | 1662 | OverloadedOperatorKind Op, | 
| Douglas Gregor | 9cfbe48 | 2009-06-20 00:51:54 +0000 | [diff] [blame] | 1663 | AttributeList *AttrList, | 
|  | 1664 | bool IsTypeName); | 
| Anders Carlsson | dbb0094 | 2009-03-28 05:27:17 +0000 | [diff] [blame] | 1665 |  | 
| Argyrios Kyrtzidis | 73a0d88 | 2008-10-06 17:10:33 +0000 | [diff] [blame] | 1666 | /// AddCXXDirectInitializerToDecl - This action is called immediately after | 
|  | 1667 | /// ActOnDeclarator, when a C++ direct initializer is present. | 
|  | 1668 | /// e.g: "int x(1);" | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1669 | virtual void AddCXXDirectInitializerToDecl(DeclPtrTy Dcl, | 
| Argyrios Kyrtzidis | 73a0d88 | 2008-10-06 17:10:33 +0000 | [diff] [blame] | 1670 | SourceLocation LParenLoc, | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1671 | MultiExprArg Exprs, | 
| Argyrios Kyrtzidis | 73a0d88 | 2008-10-06 17:10:33 +0000 | [diff] [blame] | 1672 | SourceLocation *CommaLocs, | 
|  | 1673 | SourceLocation RParenLoc); | 
|  | 1674 |  | 
| Anders Carlsson | 49d4401 | 2009-04-24 05:16:06 +0000 | [diff] [blame] | 1675 | /// InitializeVarWithConstructor - Creates an CXXConstructExpr | 
|  | 1676 | /// and sets it as the initializer for the the passed in VarDecl. | 
| Anders Carlsson | 930e8d0 | 2009-04-16 23:50:50 +0000 | [diff] [blame] | 1677 | void InitializeVarWithConstructor(VarDecl *VD, | 
|  | 1678 | CXXConstructorDecl *Constructor, | 
|  | 1679 | QualType DeclInitType, | 
|  | 1680 | Expr **Exprs, unsigned NumExprs); | 
| Fariborz Jahanian | b2c352e | 2009-08-05 17:03:54 +0000 | [diff] [blame] | 1681 |  | 
|  | 1682 | /// BuildCXXConstructExpr - Creates a complete call to a constructor, | 
|  | 1683 | /// including handling of its default argument expressions. | 
|  | 1684 | Expr * BuildCXXConstructExpr(ASTContext &C, | 
|  | 1685 | QualType DeclInitType, | 
|  | 1686 | CXXConstructorDecl *Constructor, | 
|  | 1687 | bool Elidable, | 
|  | 1688 | Expr **Exprs, unsigned NumExprs); | 
| Fariborz Jahanian | 8d2b356 | 2009-06-26 23:49:16 +0000 | [diff] [blame] | 1689 |  | 
| Fariborz Jahanian | a83f7ed | 2009-08-03 19:13:25 +0000 | [diff] [blame] | 1690 | /// FinalizeVarWithDestructor - Prepare for calling destructor on the | 
|  | 1691 | /// constructed variable. | 
|  | 1692 | void FinalizeVarWithDestructor(VarDecl *VD, QualType DeclInitType); | 
| Fariborz Jahanian | f8dcb86 | 2009-06-19 19:55:27 +0000 | [diff] [blame] | 1693 |  | 
| Fariborz Jahanian | 485f087 | 2009-06-22 23:34:40 +0000 | [diff] [blame] | 1694 | /// DefineImplicitDefaultConstructor - Checks for feasibility of | 
| Fariborz Jahanian | f8dcb86 | 2009-06-19 19:55:27 +0000 | [diff] [blame] | 1695 | /// defining this constructor as the default constructor. | 
|  | 1696 | void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, | 
|  | 1697 | CXXConstructorDecl *Constructor); | 
| Fariborz Jahanian | 485f087 | 2009-06-22 23:34:40 +0000 | [diff] [blame] | 1698 |  | 
| Fariborz Jahanian | 8d2b356 | 2009-06-26 23:49:16 +0000 | [diff] [blame] | 1699 | /// DefineImplicitDestructor - Checks for feasibility of | 
|  | 1700 | /// defining this destructor as the default destructor. | 
|  | 1701 | void DefineImplicitDestructor(SourceLocation CurrentLocation, | 
|  | 1702 | CXXDestructorDecl *Destructor); | 
|  | 1703 |  | 
| Fariborz Jahanian | 485f087 | 2009-06-22 23:34:40 +0000 | [diff] [blame] | 1704 | /// DefineImplicitCopyConstructor - Checks for feasibility of | 
|  | 1705 | /// defining this constructor as the copy constructor. | 
|  | 1706 | void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, | 
|  | 1707 | CXXConstructorDecl *Constructor, | 
|  | 1708 | unsigned TypeQuals); | 
| Fariborz Jahanian | c75bc2d | 2009-06-25 21:45:19 +0000 | [diff] [blame] | 1709 |  | 
|  | 1710 | /// DefineImplicitOverloadedAssign - Checks for feasibility of | 
|  | 1711 | /// defining implicit this overloaded assignment operator. | 
|  | 1712 | void DefineImplicitOverloadedAssign(SourceLocation CurrentLocation, | 
|  | 1713 | CXXMethodDecl *MethodDecl); | 
|  | 1714 |  | 
|  | 1715 | /// getAssignOperatorMethod - Returns the default copy assignmment operator | 
|  | 1716 | /// for the class. | 
|  | 1717 | CXXMethodDecl *getAssignOperatorMethod(ParmVarDecl *Decl, | 
|  | 1718 | CXXRecordDecl *ClassDecl); | 
| Anders Carlsson | def1199 | 2009-05-30 20:36:53 +0000 | [diff] [blame] | 1719 |  | 
|  | 1720 | /// MaybeBindToTemporary - If the passed in expression has a record type with | 
|  | 1721 | /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise | 
|  | 1722 | /// it simply returns the passed in expression. | 
|  | 1723 | OwningExprResult MaybeBindToTemporary(Expr *E); | 
| Anders Carlsson | b27615a | 2009-05-30 22:47:03 +0000 | [diff] [blame] | 1724 |  | 
| Douglas Gregor | f03d7c7 | 2008-11-05 15:29:30 +0000 | [diff] [blame] | 1725 | /// InitializationKind - Represents which kind of C++ initialization | 
|  | 1726 | /// [dcl.init] a routine is to perform. | 
|  | 1727 | enum InitializationKind { | 
|  | 1728 | IK_Direct, ///< Direct initialization | 
|  | 1729 | IK_Copy,   ///< Copy initialization | 
|  | 1730 | IK_Default ///< Default initialization | 
|  | 1731 | }; | 
|  | 1732 |  | 
| Douglas Gregor | 18fe568 | 2008-11-03 20:45:27 +0000 | [diff] [blame] | 1733 | CXXConstructorDecl * | 
| Douglas Gregor | f03d7c7 | 2008-11-05 15:29:30 +0000 | [diff] [blame] | 1734 | PerformInitializationByConstructor(QualType ClassType, | 
|  | 1735 | Expr **Args, unsigned NumArgs, | 
|  | 1736 | SourceLocation Loc, SourceRange Range, | 
| Chris Lattner | d9d22dd | 2008-11-24 05:29:24 +0000 | [diff] [blame] | 1737 | DeclarationName InitEntity, | 
| Douglas Gregor | f03d7c7 | 2008-11-05 15:29:30 +0000 | [diff] [blame] | 1738 | InitializationKind Kind); | 
| Douglas Gregor | 18fe568 | 2008-11-03 20:45:27 +0000 | [diff] [blame] | 1739 |  | 
| Douglas Gregor | 49badde | 2008-10-27 19:41:14 +0000 | [diff] [blame] | 1740 | /// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's. | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1741 | virtual OwningExprResult ActOnCXXNamedCast(SourceLocation OpLoc, | 
|  | 1742 | tok::TokenKind Kind, | 
|  | 1743 | SourceLocation LAngleBracketLoc, | 
|  | 1744 | TypeTy *Ty, | 
|  | 1745 | SourceLocation RAngleBracketLoc, | 
|  | 1746 | SourceLocation LParenLoc, | 
|  | 1747 | ExprArg E, | 
|  | 1748 | SourceLocation RParenLoc); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1749 |  | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1750 | /// ActOnCXXTypeid - Parse typeid( something ). | 
|  | 1751 | virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc, | 
|  | 1752 | SourceLocation LParenLoc, bool isType, | 
|  | 1753 | void *TyOrExpr, | 
|  | 1754 | SourceLocation RParenLoc); | 
| Sebastian Redl | c42e118 | 2008-11-11 11:37:55 +0000 | [diff] [blame] | 1755 |  | 
| Argyrios Kyrtzidis | 0795232 | 2008-07-01 10:37:29 +0000 | [diff] [blame] | 1756 | //// ActOnCXXThis -  Parse 'this' pointer. | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1757 | virtual OwningExprResult ActOnCXXThis(SourceLocation ThisLoc); | 
| Argyrios Kyrtzidis | 0795232 | 2008-07-01 10:37:29 +0000 | [diff] [blame] | 1758 |  | 
| Steve Naroff | 1b273c4 | 2007-09-16 14:56:35 +0000 | [diff] [blame] | 1759 | /// ActOnCXXBoolLiteral - Parse {true,false} literals. | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1760 | virtual OwningExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, | 
|  | 1761 | tok::TokenKind Kind); | 
|  | 1762 |  | 
| Sebastian Redl | 6e8ed16 | 2009-05-10 18:38:11 +0000 | [diff] [blame] | 1763 | /// ActOnCXXNullPtrLiteral - Parse 'nullptr'. | 
|  | 1764 | virtual OwningExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc); | 
|  | 1765 |  | 
| Chris Lattner | 50dd289 | 2008-02-26 00:51:44 +0000 | [diff] [blame] | 1766 | //// ActOnCXXThrow -  Parse throw expressions. | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1767 | virtual OwningExprResult ActOnCXXThrow(SourceLocation OpLoc, | 
|  | 1768 | ExprArg expr); | 
| Sebastian Redl | 972041f | 2009-04-27 20:27:31 +0000 | [diff] [blame] | 1769 | bool CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E); | 
| Chris Lattner | 50dd289 | 2008-02-26 00:51:44 +0000 | [diff] [blame] | 1770 |  | 
| Argyrios Kyrtzidis | 987a14b | 2008-08-22 15:38:55 +0000 | [diff] [blame] | 1771 | /// ActOnCXXTypeConstructExpr - Parse construction of a specified type. | 
|  | 1772 | /// Can be interpreted either as function-style casting ("int(x)") | 
|  | 1773 | /// or class type construction ("ClassType(x,y,z)") | 
|  | 1774 | /// or creation of a value-initialized type ("int()"). | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1775 | virtual OwningExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange, | 
|  | 1776 | TypeTy *TypeRep, | 
|  | 1777 | SourceLocation LParenLoc, | 
|  | 1778 | MultiExprArg Exprs, | 
|  | 1779 | SourceLocation *CommaLocs, | 
|  | 1780 | SourceLocation RParenLoc); | 
| Argyrios Kyrtzidis | 987a14b | 2008-08-22 15:38:55 +0000 | [diff] [blame] | 1781 |  | 
| Sebastian Redl | 4c5d320 | 2008-11-21 19:14:01 +0000 | [diff] [blame] | 1782 | /// ActOnCXXNew - Parsed a C++ 'new' expression. | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1783 | virtual OwningExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, | 
|  | 1784 | SourceLocation PlacementLParen, | 
|  | 1785 | MultiExprArg PlacementArgs, | 
|  | 1786 | SourceLocation PlacementRParen, | 
|  | 1787 | bool ParenTypeId, Declarator &D, | 
|  | 1788 | SourceLocation ConstructorLParen, | 
|  | 1789 | MultiExprArg ConstructorArgs, | 
|  | 1790 | SourceLocation ConstructorRParen); | 
| Douglas Gregor | 3433cf7 | 2009-05-21 00:00:09 +0000 | [diff] [blame] | 1791 | OwningExprResult BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, | 
|  | 1792 | SourceLocation PlacementLParen, | 
|  | 1793 | MultiExprArg PlacementArgs, | 
|  | 1794 | SourceLocation PlacementRParen, | 
|  | 1795 | bool ParenTypeId, | 
|  | 1796 | QualType AllocType, | 
|  | 1797 | SourceLocation TypeLoc, | 
|  | 1798 | SourceRange TypeRange, | 
|  | 1799 | ExprArg ArraySize, | 
|  | 1800 | SourceLocation ConstructorLParen, | 
|  | 1801 | MultiExprArg ConstructorArgs, | 
|  | 1802 | SourceLocation ConstructorRParen); | 
|  | 1803 |  | 
|  | 1804 | bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, | 
|  | 1805 | SourceRange R); | 
| Sebastian Redl | 00e68e2 | 2009-02-09 18:24:27 +0000 | [diff] [blame] | 1806 | bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, | 
|  | 1807 | bool UseGlobal, QualType AllocType, bool IsArray, | 
| Sebastian Redl | b5a57a6 | 2008-12-03 20:26:15 +0000 | [diff] [blame] | 1808 | Expr **PlaceArgs, unsigned NumPlaceArgs, | 
|  | 1809 | FunctionDecl *&OperatorNew, | 
|  | 1810 | FunctionDecl *&OperatorDelete); | 
| Sebastian Redl | 00e68e2 | 2009-02-09 18:24:27 +0000 | [diff] [blame] | 1811 | bool FindAllocationOverload(SourceLocation StartLoc, SourceRange Range, | 
|  | 1812 | DeclarationName Name, Expr** Args, | 
|  | 1813 | unsigned NumArgs, DeclContext *Ctx, | 
| Sebastian Redl | 7f66239 | 2008-12-04 22:20:51 +0000 | [diff] [blame] | 1814 | bool AllowMissing, FunctionDecl *&Operator); | 
| Sebastian Redl | b5a57a6 | 2008-12-03 20:26:15 +0000 | [diff] [blame] | 1815 | void DeclareGlobalNewDelete(); | 
|  | 1816 | void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, | 
|  | 1817 | QualType Argument); | 
| Sebastian Redl | 4c5d320 | 2008-11-21 19:14:01 +0000 | [diff] [blame] | 1818 |  | 
|  | 1819 | /// ActOnCXXDelete - Parsed a C++ 'delete' expression | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1820 | virtual OwningExprResult ActOnCXXDelete(SourceLocation StartLoc, | 
|  | 1821 | bool UseGlobal, bool ArrayForm, | 
|  | 1822 | ExprArg Operand); | 
| Sebastian Redl | 4c5d320 | 2008-11-21 19:14:01 +0000 | [diff] [blame] | 1823 |  | 
| Argyrios Kyrtzidis | 5921093 | 2008-09-10 02:17:11 +0000 | [diff] [blame] | 1824 | /// ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a | 
|  | 1825 | /// C++ if/switch/while/for statement. | 
|  | 1826 | /// e.g: "if (int x = f()) {...}" | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1827 | virtual OwningExprResult ActOnCXXConditionDeclarationExpr(Scope *S, | 
| Argyrios Kyrtzidis | 5921093 | 2008-09-10 02:17:11 +0000 | [diff] [blame] | 1828 | SourceLocation StartLoc, | 
|  | 1829 | Declarator &D, | 
|  | 1830 | SourceLocation EqualLoc, | 
| Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 1831 | ExprArg AssignExprVal); | 
| Argyrios Kyrtzidis | 5921093 | 2008-09-10 02:17:11 +0000 | [diff] [blame] | 1832 |  | 
| Sebastian Redl | 64b45f7 | 2009-01-05 20:52:13 +0000 | [diff] [blame] | 1833 | /// ActOnUnaryTypeTrait - Parsed one of the unary type trait support | 
|  | 1834 | /// pseudo-functions. | 
|  | 1835 | virtual OwningExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT, | 
|  | 1836 | SourceLocation KWLoc, | 
|  | 1837 | SourceLocation LParen, | 
|  | 1838 | TypeTy *Ty, | 
|  | 1839 | SourceLocation RParen); | 
|  | 1840 |  | 
| Anders Carlsson | 99ba36d | 2009-06-05 15:38:08 +0000 | [diff] [blame] | 1841 | /// MaybeCreateCXXExprWithTemporaries - If the list of temporaries is | 
|  | 1842 | /// non-empty, will create a new CXXExprWithTemporaries expression. | 
|  | 1843 | /// Otherwise, just returs the passed in expression. | 
| Anders Carlsson | f54741e | 2009-06-16 03:37:31 +0000 | [diff] [blame] | 1844 | Expr *MaybeCreateCXXExprWithTemporaries(Expr *SubExpr, | 
|  | 1845 | bool ShouldDestroyTemporaries); | 
| Anders Carlsson | 99ba36d | 2009-06-05 15:38:08 +0000 | [diff] [blame] | 1846 |  | 
| Anders Carlsson | 165a0a0 | 2009-05-17 18:41:29 +0000 | [diff] [blame] | 1847 | virtual OwningExprResult ActOnFinishFullExpr(ExprArg Expr); | 
|  | 1848 |  | 
| Douglas Gregor | 4fdf1fa | 2009-03-11 16:48:53 +0000 | [diff] [blame] | 1849 | bool RequireCompleteDeclContext(const CXXScopeSpec &SS); | 
| Douglas Gregor | e4e5b05 | 2009-03-19 00:18:19 +0000 | [diff] [blame] | 1850 |  | 
| Douglas Gregor | f59a56e | 2009-07-21 23:53:31 +0000 | [diff] [blame] | 1851 | DeclContext *computeDeclContext(const CXXScopeSpec &SS, | 
|  | 1852 | bool EnteringContext = false); | 
| Douglas Gregor | 5953d8b | 2009-03-19 17:26:29 +0000 | [diff] [blame] | 1853 | bool isDependentScopeSpecifier(const CXXScopeSpec &SS); | 
| Douglas Gregor | 42af25f | 2009-05-11 19:58:34 +0000 | [diff] [blame] | 1854 | CXXRecordDecl *getCurrentInstantiationOf(NestedNameSpecifier *NNS); | 
|  | 1855 | bool isUnknownSpecialization(const CXXScopeSpec &SS); | 
| Douglas Gregor | ca5e77f | 2009-03-18 00:36:05 +0000 | [diff] [blame] | 1856 |  | 
| Argyrios Kyrtzidis | ef6e647 | 2008-11-08 17:17:31 +0000 | [diff] [blame] | 1857 | /// ActOnCXXGlobalScopeSpecifier - Return the object that represents the | 
|  | 1858 | /// global scope ('::'). | 
|  | 1859 | virtual CXXScopeTy *ActOnCXXGlobalScopeSpecifier(Scope *S, | 
|  | 1860 | SourceLocation CCLoc); | 
|  | 1861 |  | 
|  | 1862 | /// ActOnCXXNestedNameSpecifier - Called during parsing of a | 
|  | 1863 | /// nested-name-specifier. e.g. for "foo::bar::" we parsed "foo::" and now | 
|  | 1864 | /// we want to resolve "bar::". 'SS' is empty or the previously parsed | 
|  | 1865 | /// nested-name part ("foo::"), 'IdLoc' is the source location of 'bar', | 
|  | 1866 | /// 'CCLoc' is the location of '::' and 'II' is the identifier for 'bar'. | 
|  | 1867 | /// Returns a CXXScopeTy* object representing the C++ scope. | 
|  | 1868 | virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S, | 
|  | 1869 | const CXXScopeSpec &SS, | 
|  | 1870 | SourceLocation IdLoc, | 
|  | 1871 | SourceLocation CCLoc, | 
| Douglas Gregor | 2def483 | 2008-11-17 20:34:05 +0000 | [diff] [blame] | 1872 | IdentifierInfo &II); | 
| Argyrios Kyrtzidis | ef6e647 | 2008-11-08 17:17:31 +0000 | [diff] [blame] | 1873 |  | 
| Douglas Gregor | 39a8de1 | 2009-02-25 19:37:18 +0000 | [diff] [blame] | 1874 | /// ActOnCXXNestedNameSpecifier - Called during parsing of a | 
|  | 1875 | /// nested-name-specifier that involves a template-id, e.g., | 
|  | 1876 | /// "foo::bar<int, float>::", and now we need to build a scope | 
|  | 1877 | /// specifier. \p SS is empty or the previously parsed nested-name | 
|  | 1878 | /// part ("foo::"), \p Type is the already-parsed class template | 
|  | 1879 | /// specialization (or other template-id that names a type), \p | 
|  | 1880 | /// TypeRange is the source range where the type is located, and \p | 
|  | 1881 | /// CCLoc is the location of the trailing '::'. | 
|  | 1882 | virtual CXXScopeTy *ActOnCXXNestedNameSpecifier(Scope *S, | 
|  | 1883 | const CXXScopeSpec &SS, | 
|  | 1884 | TypeTy *Type, | 
|  | 1885 | SourceRange TypeRange, | 
|  | 1886 | SourceLocation CCLoc); | 
|  | 1887 |  | 
| Douglas Gregor | fe85ced | 2009-08-06 03:17:00 +0000 | [diff] [blame] | 1888 | /// ActOnCXXEnterMemberScope - Called when a C++ class member accessor ('.' | 
|  | 1889 | /// or '->') is parsed. After this method is called, according to | 
|  | 1890 | /// [C++ 3.4.5p4], qualified-ids should be looked up in the contexts of both | 
|  | 1891 | /// the entire postfix-expression and the scope of the class of the object | 
|  | 1892 | /// expression. | 
|  | 1893 | /// 'SS' should be an empty CXXScopeSpec to be filled with the class's scope. | 
|  | 1894 | virtual OwningExprResult ActOnCXXEnterMemberScope(Scope *S, CXXScopeSpec &SS, | 
|  | 1895 | ExprArg Base, | 
|  | 1896 | tok::TokenKind OpKind); | 
|  | 1897 |  | 
|  | 1898 | /// ActOnCXXExitMemberScope - Called when a postfix-expression that previously | 
|  | 1899 | /// invoked ActOnCXXEnterMemberScope() is finished. 'SS' is the same | 
|  | 1900 | /// CXXScopeSpec that was passed to ActOnCXXEnterMemberScope. Used to | 
|  | 1901 | /// indicate that names should revert to being looked up in the defining | 
|  | 1902 | /// scope. | 
|  | 1903 | virtual void ActOnCXXExitMemberScope(Scope *S, const CXXScopeSpec &SS); | 
|  | 1904 |  | 
| Argyrios Kyrtzidis | ef6e647 | 2008-11-08 17:17:31 +0000 | [diff] [blame] | 1905 | /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global | 
|  | 1906 | /// scope or nested-name-specifier) is parsed, part of a declarator-id. | 
|  | 1907 | /// After this method is called, according to [C++ 3.4.3p3], names should be | 
|  | 1908 | /// looked up in the declarator-id's scope, until the declarator is parsed and | 
|  | 1909 | /// ActOnCXXExitDeclaratorScope is called. | 
|  | 1910 | /// The 'SS' should be a non-empty valid CXXScopeSpec. | 
|  | 1911 | virtual void ActOnCXXEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS); | 
|  | 1912 |  | 
|  | 1913 | /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously | 
|  | 1914 | /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same | 
|  | 1915 | /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well. | 
|  | 1916 | /// Used to indicate that names should revert to being looked up in the | 
|  | 1917 | /// defining scope. | 
| Douglas Gregor | 0a59acb | 2008-12-16 00:38:16 +0000 | [diff] [blame] | 1918 | virtual void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS); | 
| Argyrios Kyrtzidis | ef6e647 | 2008-11-08 17:17:31 +0000 | [diff] [blame] | 1919 |  | 
| Argyrios Kyrtzidis | 0ffd9ff | 2009-06-17 22:50:06 +0000 | [diff] [blame] | 1920 | /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an | 
|  | 1921 | /// initializer for the declaration 'Dcl'. | 
|  | 1922 | /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a | 
|  | 1923 | /// static data member of class X, names should be looked up in the scope of | 
|  | 1924 | /// class X. | 
|  | 1925 | virtual void ActOnCXXEnterDeclInitializer(Scope *S, DeclPtrTy Dcl); | 
|  | 1926 |  | 
|  | 1927 | /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an | 
|  | 1928 | /// initializer for the declaration 'Dcl'. | 
|  | 1929 | virtual void ActOnCXXExitDeclInitializer(Scope *S, DeclPtrTy Dcl); | 
|  | 1930 |  | 
| Anders Carlsson | 5508518 | 2007-08-21 17:43:55 +0000 | [diff] [blame] | 1931 | // ParseObjCStringLiteral - Parse Objective-C string literals. | 
| Chris Lattner | b3a99cd | 2007-12-12 01:04:12 +0000 | [diff] [blame] | 1932 | virtual ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, | 
|  | 1933 | ExprTy **Strings, | 
|  | 1934 | unsigned NumStrings); | 
| Anders Carlsson | fc0f021 | 2009-06-07 18:45:35 +0000 | [diff] [blame] | 1935 |  | 
|  | 1936 | Expr *BuildObjCEncodeExpression(SourceLocation AtLoc, | 
|  | 1937 | QualType EncodedType, | 
|  | 1938 | SourceLocation RParenLoc); | 
| Anders Carlsson | f9bcf01 | 2007-08-22 15:14:15 +0000 | [diff] [blame] | 1939 | virtual ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, | 
| Chris Lattner | 674af95 | 2007-10-16 22:51:17 +0000 | [diff] [blame] | 1940 | SourceLocation EncodeLoc, | 
| Anders Carlsson | f9bcf01 | 2007-08-22 15:14:15 +0000 | [diff] [blame] | 1941 | SourceLocation LParenLoc, | 
|  | 1942 | TypeTy *Ty, | 
|  | 1943 | SourceLocation RParenLoc); | 
|  | 1944 |  | 
| Fariborz Jahanian | b62f681 | 2007-10-16 20:40:23 +0000 | [diff] [blame] | 1945 | // ParseObjCSelectorExpression - Build selector expression for @selector | 
|  | 1946 | virtual ExprResult ParseObjCSelectorExpression(Selector Sel, | 
|  | 1947 | SourceLocation AtLoc, | 
| Fariborz Jahanian | 2a35fa9 | 2007-10-16 23:21:02 +0000 | [diff] [blame] | 1948 | SourceLocation SelLoc, | 
| Fariborz Jahanian | b62f681 | 2007-10-16 20:40:23 +0000 | [diff] [blame] | 1949 | SourceLocation LParenLoc, | 
|  | 1950 | SourceLocation RParenLoc); | 
|  | 1951 |  | 
| Fariborz Jahanian | 390d50a | 2007-10-17 16:58:11 +0000 | [diff] [blame] | 1952 | // ParseObjCProtocolExpression - Build protocol expression for @protocol | 
|  | 1953 | virtual ExprResult ParseObjCProtocolExpression(IdentifierInfo * ProtocolName, | 
|  | 1954 | SourceLocation AtLoc, | 
|  | 1955 | SourceLocation ProtoLoc, | 
|  | 1956 | SourceLocation LParenLoc, | 
|  | 1957 | SourceLocation RParenLoc); | 
| Douglas Gregor | e37ac4f | 2008-04-13 21:30:24 +0000 | [diff] [blame] | 1958 |  | 
|  | 1959 | //===--------------------------------------------------------------------===// | 
| Douglas Gregor | 074149e | 2009-01-05 19:45:36 +0000 | [diff] [blame] | 1960 | // C++ Declarations | 
|  | 1961 | // | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1962 | virtual DeclPtrTy ActOnStartLinkageSpecification(Scope *S, | 
|  | 1963 | SourceLocation ExternLoc, | 
|  | 1964 | SourceLocation LangLoc, | 
|  | 1965 | const char *Lang, | 
|  | 1966 | unsigned StrSize, | 
|  | 1967 | SourceLocation LBraceLoc); | 
|  | 1968 | virtual DeclPtrTy ActOnFinishLinkageSpecification(Scope *S, | 
|  | 1969 | DeclPtrTy LinkageSpec, | 
|  | 1970 | SourceLocation RBraceLoc); | 
| Douglas Gregor | 074149e | 2009-01-05 19:45:36 +0000 | [diff] [blame] | 1971 |  | 
|  | 1972 |  | 
|  | 1973 | //===--------------------------------------------------------------------===// | 
| Douglas Gregor | e37ac4f | 2008-04-13 21:30:24 +0000 | [diff] [blame] | 1974 | // C++ Classes | 
|  | 1975 | // | 
| Argyrios Kyrtzidis | eb83ecd | 2008-11-08 16:45:02 +0000 | [diff] [blame] | 1976 | virtual bool isCurrentClassName(const IdentifierInfo &II, Scope *S, | 
|  | 1977 | const CXXScopeSpec *SS); | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 1978 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1979 | virtual DeclPtrTy ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, | 
|  | 1980 | Declarator &D, | 
|  | 1981 | ExprTy *BitfieldWidth, | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 1982 | ExprTy *Init, | 
|  | 1983 | bool Deleted = false); | 
| Argyrios Kyrtzidis | 0795232 | 2008-07-01 10:37:29 +0000 | [diff] [blame] | 1984 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 1985 | virtual MemInitResult ActOnMemInitializer(DeclPtrTy ConstructorD, | 
| Douglas Gregor | 7ad8390 | 2008-11-05 04:29:56 +0000 | [diff] [blame] | 1986 | Scope *S, | 
| Fariborz Jahanian | bcfad54 | 2009-06-30 23:26:25 +0000 | [diff] [blame] | 1987 | const CXXScopeSpec &SS, | 
| Douglas Gregor | 7ad8390 | 2008-11-05 04:29:56 +0000 | [diff] [blame] | 1988 | IdentifierInfo *MemberOrBase, | 
| Fariborz Jahanian | 9617433 | 2009-07-01 19:21:19 +0000 | [diff] [blame] | 1989 | TypeTy *TemplateTypeTy, | 
| Douglas Gregor | 7ad8390 | 2008-11-05 04:29:56 +0000 | [diff] [blame] | 1990 | SourceLocation IdLoc, | 
|  | 1991 | SourceLocation LParenLoc, | 
|  | 1992 | ExprTy **Args, unsigned NumArgs, | 
|  | 1993 | SourceLocation *CommaLocs, | 
|  | 1994 | SourceLocation RParenLoc); | 
|  | 1995 |  | 
| Eli Friedman | 59c0437 | 2009-07-29 19:44:27 +0000 | [diff] [blame] | 1996 | MemInitResult BuildMemberInitializer(FieldDecl *Member, Expr **Args, | 
|  | 1997 | unsigned NumArgs, SourceLocation IdLoc, | 
|  | 1998 | SourceLocation RParenLoc); | 
|  | 1999 |  | 
|  | 2000 | MemInitResult BuildBaseInitializer(QualType BaseType, Expr **Args, | 
|  | 2001 | unsigned NumArgs, SourceLocation IdLoc, | 
|  | 2002 | SourceLocation RParenLoc, | 
|  | 2003 | CXXRecordDecl *ClassDecl); | 
|  | 2004 |  | 
| Douglas Gregor | 396b7cd | 2008-11-03 17:51:48 +0000 | [diff] [blame] | 2005 | void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl); | 
|  | 2006 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2007 | virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl, | 
| Anders Carlsson | a7b3521 | 2009-03-25 02:58:17 +0000 | [diff] [blame] | 2008 | SourceLocation ColonLoc, | 
|  | 2009 | MemInitTy **MemInits, unsigned NumMemInits); | 
|  | 2010 |  | 
| Argyrios Kyrtzidis | 0795232 | 2008-07-01 10:37:29 +0000 | [diff] [blame] | 2011 | virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2012 | DeclPtrTy TagDecl, | 
| Argyrios Kyrtzidis | 0795232 | 2008-07-01 10:37:29 +0000 | [diff] [blame] | 2013 | SourceLocation LBrac, | 
|  | 2014 | SourceLocation RBrac); | 
|  | 2015 |  | 
| Douglas Gregor | 6569d68 | 2009-05-27 23:11:45 +0000 | [diff] [blame] | 2016 | virtual void ActOnReenterTemplateScope(Scope *S, DeclPtrTy Template); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2017 | virtual void ActOnStartDelayedCXXMethodDeclaration(Scope *S, | 
|  | 2018 | DeclPtrTy Method); | 
|  | 2019 | virtual void ActOnDelayedCXXMethodParameter(Scope *S, DeclPtrTy Param); | 
|  | 2020 | virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, | 
|  | 2021 | DeclPtrTy Method); | 
| Douglas Gregor | 72b505b | 2008-12-16 21:30:33 +0000 | [diff] [blame] | 2022 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2023 | virtual DeclPtrTy ActOnStaticAssertDeclaration(SourceLocation AssertLoc, | 
|  | 2024 | ExprArg AssertExpr, | 
|  | 2025 | ExprArg AssertMessageExpr); | 
| Anders Carlsson | fb31176 | 2009-03-14 00:25:26 +0000 | [diff] [blame] | 2026 |  | 
| John McCall | 67d1a67 | 2009-08-06 02:15:43 +0000 | [diff] [blame] | 2027 | virtual DeclPtrTy ActOnFriendDecl(Scope *S, | 
|  | 2028 | llvm::PointerUnion<const DeclSpec*,Declarator*> D); | 
| Anders Carlsson | 0033836 | 2009-05-11 22:55:49 +0000 | [diff] [blame] | 2029 |  | 
| Chris Lattner | 6540180 | 2009-04-25 08:28:21 +0000 | [diff] [blame] | 2030 | QualType CheckConstructorDeclarator(Declarator &D, QualType R, | 
|  | 2031 | FunctionDecl::StorageClass& SC); | 
| Chris Lattner | 6e47501 | 2009-04-25 08:35:12 +0000 | [diff] [blame] | 2032 | void CheckConstructor(CXXConstructorDecl *Constructor); | 
| Chris Lattner | 6540180 | 2009-04-25 08:28:21 +0000 | [diff] [blame] | 2033 | QualType CheckDestructorDeclarator(Declarator &D, | 
|  | 2034 | FunctionDecl::StorageClass& SC); | 
| Chris Lattner | 6e47501 | 2009-04-25 08:35:12 +0000 | [diff] [blame] | 2035 | void CheckConversionDeclarator(Declarator &D, QualType &R, | 
| Douglas Gregor | 2f1bc52 | 2008-11-07 20:08:42 +0000 | [diff] [blame] | 2036 | FunctionDecl::StorageClass& SC); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2037 | DeclPtrTy ActOnConversionDeclarator(CXXConversionDecl *Conversion); | 
| Douglas Gregor | b48fe38 | 2008-10-31 09:07:45 +0000 | [diff] [blame] | 2038 |  | 
| Douglas Gregor | bc0805a | 2008-10-23 00:40:37 +0000 | [diff] [blame] | 2039 | //===--------------------------------------------------------------------===// | 
|  | 2040 | // C++ Derived Classes | 
|  | 2041 | // | 
|  | 2042 |  | 
|  | 2043 | /// ActOnBaseSpecifier - Parsed a base specifier | 
| Douglas Gregor | 2943aed | 2009-03-03 04:44:36 +0000 | [diff] [blame] | 2044 | CXXBaseSpecifier *CheckBaseSpecifier(CXXRecordDecl *Class, | 
|  | 2045 | SourceRange SpecifierRange, | 
|  | 2046 | bool Virtual, AccessSpecifier Access, | 
|  | 2047 | QualType BaseType, | 
|  | 2048 | SourceLocation BaseLoc); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2049 | virtual BaseResult ActOnBaseSpecifier(DeclPtrTy classdecl, | 
| Douglas Gregor | bc0805a | 2008-10-23 00:40:37 +0000 | [diff] [blame] | 2050 | SourceRange SpecifierRange, | 
|  | 2051 | bool Virtual, AccessSpecifier Access, | 
| Douglas Gregor | 2943aed | 2009-03-03 04:44:36 +0000 | [diff] [blame] | 2052 | TypeTy *basetype, SourceLocation | 
|  | 2053 | BaseLoc); | 
| Douglas Gregor | bc0805a | 2008-10-23 00:40:37 +0000 | [diff] [blame] | 2054 |  | 
| Douglas Gregor | 2943aed | 2009-03-03 04:44:36 +0000 | [diff] [blame] | 2055 | bool AttachBaseSpecifiers(CXXRecordDecl *Class, CXXBaseSpecifier **Bases, | 
|  | 2056 | unsigned NumBases); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2057 | virtual void ActOnBaseSpecifiers(DeclPtrTy ClassDecl, BaseTy **Bases, | 
| Douglas Gregor | bc0805a | 2008-10-23 00:40:37 +0000 | [diff] [blame] | 2058 | unsigned NumBases); | 
|  | 2059 |  | 
|  | 2060 | bool IsDerivedFrom(QualType Derived, QualType Base); | 
| Douglas Gregor | 94b1dd2 | 2008-10-24 04:54:22 +0000 | [diff] [blame] | 2061 | bool IsDerivedFrom(QualType Derived, QualType Base, BasePaths &Paths); | 
| Douglas Gregor | 7176fff | 2009-01-15 00:26:24 +0000 | [diff] [blame] | 2062 | bool LookupInBases(CXXRecordDecl *Class, const MemberLookupCriteria& Criteria, | 
|  | 2063 | BasePaths &Paths); | 
| Douglas Gregor | 0575d4a | 2008-10-24 16:17:19 +0000 | [diff] [blame] | 2064 | bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, | 
|  | 2065 | SourceLocation Loc, SourceRange Range); | 
| Anders Carlsson | d8f9cb0 | 2009-05-13 21:11:42 +0000 | [diff] [blame] | 2066 | bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, | 
|  | 2067 | unsigned InaccessibleBaseID, | 
|  | 2068 | unsigned AmbigiousBaseConvID, | 
|  | 2069 | SourceLocation Loc, SourceRange Range, | 
|  | 2070 | DeclarationName Name); | 
|  | 2071 |  | 
| Douglas Gregor | 4dc6b1c | 2009-01-16 00:38:09 +0000 | [diff] [blame] | 2072 | std::string getAmbiguousPathsDisplayString(BasePaths &Paths); | 
| Anders Carlsson | d7ba27d | 2009-05-14 01:09:04 +0000 | [diff] [blame] | 2073 |  | 
| Sebastian Redl | 23c7d06 | 2009-07-07 20:29:57 +0000 | [diff] [blame] | 2074 | /// CheckOverridingFunctionReturnType - Checks whether the return types are | 
|  | 2075 | /// covariant, according to C++ [class.virtual]p5. | 
|  | 2076 | bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, | 
| Anders Carlsson | d7ba27d | 2009-05-14 01:09:04 +0000 | [diff] [blame] | 2077 | const CXXMethodDecl *Old); | 
| Sebastian Redl | 23c7d06 | 2009-07-07 20:29:57 +0000 | [diff] [blame] | 2078 |  | 
|  | 2079 | /// CheckOverridingFunctionExceptionSpec - Checks whether the exception | 
|  | 2080 | /// spec is a subset of base spec. | 
|  | 2081 | bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, | 
|  | 2082 | const CXXMethodDecl *Old); | 
| Douglas Gregor | e37ac4f | 2008-04-13 21:30:24 +0000 | [diff] [blame] | 2083 |  | 
| Anders Carlsson | 29f006b | 2009-03-27 05:05:05 +0000 | [diff] [blame] | 2084 | //===--------------------------------------------------------------------===// | 
|  | 2085 | // C++ Access Control | 
|  | 2086 | // | 
| Sebastian Redl | 726212f | 2009-07-18 14:32:15 +0000 | [diff] [blame] | 2087 |  | 
| Anders Carlsson | 29f006b | 2009-03-27 05:05:05 +0000 | [diff] [blame] | 2088 | bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, | 
|  | 2089 | NamedDecl *PrevMemberDecl, | 
|  | 2090 | AccessSpecifier LexicalAS); | 
| Sebastian Redl | 726212f | 2009-07-18 14:32:15 +0000 | [diff] [blame] | 2091 |  | 
|  | 2092 | const CXXBaseSpecifier *FindInaccessibleBase(QualType Derived, QualType Base, | 
|  | 2093 | BasePaths &Paths, | 
|  | 2094 | bool NoPrivileges = false); | 
|  | 2095 |  | 
|  | 2096 | bool CheckBaseClassAccess(QualType Derived, QualType Base, | 
| Anders Carlsson | d8f9cb0 | 2009-05-13 21:11:42 +0000 | [diff] [blame] | 2097 | unsigned InaccessibleBaseID, | 
|  | 2098 | BasePaths& Paths, SourceLocation AccessLoc, | 
|  | 2099 | DeclarationName Name); | 
| Sebastian Redl | 726212f | 2009-07-18 14:32:15 +0000 | [diff] [blame] | 2100 |  | 
|  | 2101 |  | 
| Anders Carlsson | 8211eff | 2009-03-24 01:19:16 +0000 | [diff] [blame] | 2102 | enum AbstractDiagSelID { | 
|  | 2103 | AbstractNone = -1, | 
|  | 2104 | AbstractReturnType, | 
|  | 2105 | AbstractParamType, | 
|  | 2106 | AbstractVariableType, | 
|  | 2107 | AbstractFieldType | 
|  | 2108 | }; | 
|  | 2109 |  | 
|  | 2110 | bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID, | 
| Anders Carlsson | e65a3c8 | 2009-03-24 17:23:42 +0000 | [diff] [blame] | 2111 | AbstractDiagSelID SelID = AbstractNone, | 
|  | 2112 | const CXXRecordDecl *CurrentRD = 0); | 
| Anders Carlsson | 4681ebd | 2009-03-22 20:18:17 +0000 | [diff] [blame] | 2113 |  | 
| Douglas Gregor | 1cd1b1e | 2008-11-06 22:13:31 +0000 | [diff] [blame] | 2114 | //===--------------------------------------------------------------------===// | 
|  | 2115 | // C++ Overloaded Operators [C++ 13.5] | 
|  | 2116 | // | 
|  | 2117 |  | 
|  | 2118 | bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl); | 
|  | 2119 |  | 
| Douglas Gregor | 72c3f31 | 2008-12-05 18:15:24 +0000 | [diff] [blame] | 2120 | //===--------------------------------------------------------------------===// | 
|  | 2121 | // C++ Templates [C++ 14] | 
|  | 2122 | // | 
| Douglas Gregor | c45c232 | 2009-03-31 00:43:58 +0000 | [diff] [blame] | 2123 | virtual TemplateNameKind isTemplateName(const IdentifierInfo &II, Scope *S, | 
| Douglas Gregor | 7532dc6 | 2009-03-30 22:58:21 +0000 | [diff] [blame] | 2124 | TemplateTy &Template, | 
| Douglas Gregor | 55f6b14 | 2009-02-09 18:46:07 +0000 | [diff] [blame] | 2125 | const CXXScopeSpec *SS = 0); | 
| Douglas Gregor | 72c3f31 | 2008-12-05 18:15:24 +0000 | [diff] [blame] | 2126 | bool DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2127 | TemplateDecl *AdjustDeclIfTemplate(DeclPtrTy &Decl); | 
| Douglas Gregor | aaba5e3 | 2009-02-04 19:02:06 +0000 | [diff] [blame] | 2128 |  | 
| Anders Carlsson | 941df7d | 2009-06-12 19:58:00 +0000 | [diff] [blame] | 2129 | virtual DeclPtrTy ActOnTypeParameter(Scope *S, bool Typename, bool Ellipsis, | 
|  | 2130 | SourceLocation EllipsisLoc, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2131 | SourceLocation KeyLoc, | 
|  | 2132 | IdentifierInfo *ParamName, | 
|  | 2133 | SourceLocation ParamNameLoc, | 
|  | 2134 | unsigned Depth, unsigned Position); | 
|  | 2135 | virtual void ActOnTypeParameterDefault(DeclPtrTy TypeParam, | 
| Douglas Gregor | d684b00 | 2009-02-10 19:49:53 +0000 | [diff] [blame] | 2136 | SourceLocation EqualLoc, | 
|  | 2137 | SourceLocation DefaultLoc, | 
|  | 2138 | TypeTy *Default); | 
|  | 2139 |  | 
| Douglas Gregor | 2943aed | 2009-03-03 04:44:36 +0000 | [diff] [blame] | 2140 | QualType CheckNonTypeTemplateParameterType(QualType T, SourceLocation Loc); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2141 | virtual DeclPtrTy ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, | 
|  | 2142 | unsigned Depth, | 
|  | 2143 | unsigned Position); | 
|  | 2144 | virtual void ActOnNonTypeTemplateParameterDefault(DeclPtrTy TemplateParam, | 
| Douglas Gregor | d684b00 | 2009-02-10 19:49:53 +0000 | [diff] [blame] | 2145 | SourceLocation EqualLoc, | 
|  | 2146 | ExprArg Default); | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2147 | virtual DeclPtrTy ActOnTemplateTemplateParameter(Scope *S, | 
|  | 2148 | SourceLocation TmpLoc, | 
|  | 2149 | TemplateParamsTy *Params, | 
|  | 2150 | IdentifierInfo *ParamName, | 
|  | 2151 | SourceLocation ParamNameLoc, | 
|  | 2152 | unsigned Depth, | 
|  | 2153 | unsigned Position); | 
|  | 2154 | virtual void ActOnTemplateTemplateParameterDefault(DeclPtrTy TemplateParam, | 
| Douglas Gregor | d684b00 | 2009-02-10 19:49:53 +0000 | [diff] [blame] | 2155 | SourceLocation EqualLoc, | 
|  | 2156 | ExprArg Default); | 
|  | 2157 |  | 
| Douglas Gregor | c4b4e7b | 2008-12-24 02:52:09 +0000 | [diff] [blame] | 2158 | virtual TemplateParamsTy * | 
|  | 2159 | ActOnTemplateParameterList(unsigned Depth, | 
|  | 2160 | SourceLocation ExportLoc, | 
|  | 2161 | SourceLocation TemplateLoc, | 
|  | 2162 | SourceLocation LAngleLoc, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2163 | DeclPtrTy *Params, unsigned NumParams, | 
| Douglas Gregor | c4b4e7b | 2008-12-24 02:52:09 +0000 | [diff] [blame] | 2164 | SourceLocation RAngleLoc); | 
| Douglas Gregor | d684b00 | 2009-02-10 19:49:53 +0000 | [diff] [blame] | 2165 | bool CheckTemplateParameterList(TemplateParameterList *NewParams, | 
|  | 2166 | TemplateParameterList *OldParams); | 
| Douglas Gregor | f59a56e | 2009-07-21 23:53:31 +0000 | [diff] [blame] | 2167 | TemplateParameterList * | 
|  | 2168 | MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, | 
|  | 2169 | const CXXScopeSpec &SS, | 
|  | 2170 | TemplateParameterList **ParamLists, | 
|  | 2171 | unsigned NumParamLists); | 
|  | 2172 |  | 
| John McCall | 0f434ec | 2009-07-31 02:45:11 +0000 | [diff] [blame] | 2173 | DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, | 
| Douglas Gregor | bd1099e | 2009-07-23 16:36:45 +0000 | [diff] [blame] | 2174 | SourceLocation KWLoc, const CXXScopeSpec &SS, | 
|  | 2175 | IdentifierInfo *Name, SourceLocation NameLoc, | 
|  | 2176 | AttributeList *Attr, | 
|  | 2177 | MultiTemplateParamsArg TemplateParameterLists, | 
|  | 2178 | AccessSpecifier AS); | 
| Douglas Gregor | ddc29e1 | 2009-02-06 22:42:48 +0000 | [diff] [blame] | 2179 |  | 
| Douglas Gregor | 7532dc6 | 2009-03-30 22:58:21 +0000 | [diff] [blame] | 2180 | QualType CheckTemplateIdType(TemplateName Template, | 
|  | 2181 | SourceLocation TemplateLoc, | 
|  | 2182 | SourceLocation LAngleLoc, | 
|  | 2183 | const TemplateArgument *TemplateArgs, | 
|  | 2184 | unsigned NumTemplateArgs, | 
|  | 2185 | SourceLocation RAngleLoc); | 
| Douglas Gregor | 40808ce | 2009-03-09 23:48:35 +0000 | [diff] [blame] | 2186 |  | 
| Douglas Gregor | cc63668 | 2009-02-17 23:15:12 +0000 | [diff] [blame] | 2187 | virtual TypeResult | 
| Douglas Gregor | 7532dc6 | 2009-03-30 22:58:21 +0000 | [diff] [blame] | 2188 | ActOnTemplateIdType(TemplateTy Template, SourceLocation TemplateLoc, | 
|  | 2189 | SourceLocation LAngleLoc, | 
|  | 2190 | ASTTemplateArgsPtr TemplateArgs, | 
|  | 2191 | SourceLocation *TemplateArgLocs, | 
|  | 2192 | SourceLocation RAngleLoc); | 
| Douglas Gregor | cc63668 | 2009-02-17 23:15:12 +0000 | [diff] [blame] | 2193 |  | 
| Douglas Gregor | edce4dd | 2009-06-30 22:34:41 +0000 | [diff] [blame] | 2194 | OwningExprResult BuildTemplateIdExpr(TemplateName Template, | 
|  | 2195 | SourceLocation TemplateNameLoc, | 
|  | 2196 | SourceLocation LAngleLoc, | 
|  | 2197 | const TemplateArgument *TemplateArgs, | 
|  | 2198 | unsigned NumTemplateArgs, | 
|  | 2199 | SourceLocation RAngleLoc); | 
|  | 2200 |  | 
|  | 2201 | virtual OwningExprResult ActOnTemplateIdExpr(TemplateTy Template, | 
|  | 2202 | SourceLocation TemplateNameLoc, | 
|  | 2203 | SourceLocation LAngleLoc, | 
|  | 2204 | ASTTemplateArgsPtr TemplateArgs, | 
|  | 2205 | SourceLocation *TemplateArgLocs, | 
|  | 2206 | SourceLocation RAngleLoc); | 
|  | 2207 |  | 
| Douglas Gregor | c45c232 | 2009-03-31 00:43:58 +0000 | [diff] [blame] | 2208 | virtual TemplateTy ActOnDependentTemplateName(SourceLocation TemplateKWLoc, | 
|  | 2209 | const IdentifierInfo &Name, | 
|  | 2210 | SourceLocation NameLoc, | 
|  | 2211 | const CXXScopeSpec &SS); | 
|  | 2212 |  | 
| Douglas Gregor | 88b7094 | 2009-02-25 22:02:03 +0000 | [diff] [blame] | 2213 | bool CheckClassTemplateSpecializationScope(ClassTemplateDecl *ClassTemplate, | 
|  | 2214 | ClassTemplateSpecializationDecl *PrevDecl, | 
|  | 2215 | SourceLocation TemplateNameLoc, | 
| Douglas Gregor | ff66803 | 2009-05-13 18:28:20 +0000 | [diff] [blame] | 2216 | SourceRange ScopeSpecifierRange, | 
| Douglas Gregor | 16df850 | 2009-06-12 22:21:45 +0000 | [diff] [blame] | 2217 | bool PartialSpecialization, | 
| Douglas Gregor | ff66803 | 2009-05-13 18:28:20 +0000 | [diff] [blame] | 2218 | bool ExplicitInstantiation); | 
| Douglas Gregor | 88b7094 | 2009-02-25 22:02:03 +0000 | [diff] [blame] | 2219 |  | 
| Douglas Gregor | e94866f | 2009-06-12 21:21:02 +0000 | [diff] [blame] | 2220 | bool CheckClassTemplatePartialSpecializationArgs( | 
|  | 2221 | TemplateParameterList *TemplateParams, | 
| Anders Carlsson | 6360be7 | 2009-06-13 18:20:51 +0000 | [diff] [blame] | 2222 | const TemplateArgumentListBuilder &TemplateArgs, | 
| Douglas Gregor | 6aa75cf | 2009-06-12 22:08:06 +0000 | [diff] [blame] | 2223 | bool &MirrorsPrimaryTemplate); | 
| Douglas Gregor | e94866f | 2009-06-12 21:21:02 +0000 | [diff] [blame] | 2224 |  | 
| Douglas Gregor | 212e81c | 2009-03-25 00:13:59 +0000 | [diff] [blame] | 2225 | virtual DeclResult | 
| John McCall | 0f434ec | 2009-07-31 02:45:11 +0000 | [diff] [blame] | 2226 | ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, | 
| Douglas Gregor | cc63668 | 2009-02-17 23:15:12 +0000 | [diff] [blame] | 2227 | SourceLocation KWLoc, | 
|  | 2228 | const CXXScopeSpec &SS, | 
| Douglas Gregor | 7532dc6 | 2009-03-30 22:58:21 +0000 | [diff] [blame] | 2229 | TemplateTy Template, | 
| Douglas Gregor | cc63668 | 2009-02-17 23:15:12 +0000 | [diff] [blame] | 2230 | SourceLocation TemplateNameLoc, | 
| Douglas Gregor | 55f6b14 | 2009-02-09 18:46:07 +0000 | [diff] [blame] | 2231 | SourceLocation LAngleLoc, | 
| Douglas Gregor | 5908e9f | 2009-02-09 19:34:22 +0000 | [diff] [blame] | 2232 | ASTTemplateArgsPtr TemplateArgs, | 
| Douglas Gregor | c15cb38 | 2009-02-09 23:23:08 +0000 | [diff] [blame] | 2233 | SourceLocation *TemplateArgLocs, | 
| Douglas Gregor | 55f6b14 | 2009-02-09 18:46:07 +0000 | [diff] [blame] | 2234 | SourceLocation RAngleLoc, | 
| Douglas Gregor | cc63668 | 2009-02-17 23:15:12 +0000 | [diff] [blame] | 2235 | AttributeList *Attr, | 
|  | 2236 | MultiTemplateParamsArg TemplateParameterLists); | 
| Douglas Gregor | 55f6b14 | 2009-02-09 18:46:07 +0000 | [diff] [blame] | 2237 |  | 
| Douglas Gregor | e542c86 | 2009-06-23 23:11:28 +0000 | [diff] [blame] | 2238 | virtual DeclPtrTy ActOnTemplateDeclarator(Scope *S, | 
|  | 2239 | MultiTemplateParamsArg TemplateParameterLists, | 
|  | 2240 | Declarator &D); | 
|  | 2241 |  | 
| Douglas Gregor | 52591bf | 2009-06-24 00:54:41 +0000 | [diff] [blame] | 2242 | virtual DeclPtrTy ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope, | 
|  | 2243 | MultiTemplateParamsArg TemplateParameterLists, | 
|  | 2244 | Declarator &D); | 
|  | 2245 |  | 
| Douglas Gregor | 93dfdb1 | 2009-05-13 00:25:59 +0000 | [diff] [blame] | 2246 | virtual DeclResult | 
|  | 2247 | ActOnExplicitInstantiation(Scope *S, SourceLocation TemplateLoc, | 
|  | 2248 | unsigned TagSpec, | 
|  | 2249 | SourceLocation KWLoc, | 
|  | 2250 | const CXXScopeSpec &SS, | 
|  | 2251 | TemplateTy Template, | 
|  | 2252 | SourceLocation TemplateNameLoc, | 
|  | 2253 | SourceLocation LAngleLoc, | 
|  | 2254 | ASTTemplateArgsPtr TemplateArgs, | 
|  | 2255 | SourceLocation *TemplateArgLocs, | 
|  | 2256 | SourceLocation RAngleLoc, | 
|  | 2257 | AttributeList *Attr); | 
|  | 2258 |  | 
| Douglas Gregor | 3f5b61c | 2009-05-14 00:28:11 +0000 | [diff] [blame] | 2259 | virtual DeclResult | 
|  | 2260 | ActOnExplicitInstantiation(Scope *S, SourceLocation TemplateLoc, | 
|  | 2261 | unsigned TagSpec, | 
|  | 2262 | SourceLocation KWLoc, | 
|  | 2263 | const CXXScopeSpec &SS, | 
|  | 2264 | IdentifierInfo *Name, | 
|  | 2265 | SourceLocation NameLoc, | 
|  | 2266 | AttributeList *Attr); | 
|  | 2267 |  | 
| Douglas Gregor | c15cb38 | 2009-02-09 23:23:08 +0000 | [diff] [blame] | 2268 | bool CheckTemplateArgumentList(TemplateDecl *Template, | 
|  | 2269 | SourceLocation TemplateLoc, | 
|  | 2270 | SourceLocation LAngleLoc, | 
| Douglas Gregor | 40808ce | 2009-03-09 23:48:35 +0000 | [diff] [blame] | 2271 | const TemplateArgument *TemplateArgs, | 
|  | 2272 | unsigned NumTemplateArgs, | 
| Douglas Gregor | 3e00bad | 2009-02-17 01:05:43 +0000 | [diff] [blame] | 2273 | SourceLocation RAngleLoc, | 
| Douglas Gregor | 16134c6 | 2009-07-01 00:28:38 +0000 | [diff] [blame] | 2274 | bool PartialTemplateArgs, | 
| Anders Carlsson | 1c5976e | 2009-06-05 03:43:12 +0000 | [diff] [blame] | 2275 | TemplateArgumentListBuilder &Converted); | 
| Douglas Gregor | c15cb38 | 2009-02-09 23:23:08 +0000 | [diff] [blame] | 2276 |  | 
| Anders Carlsson | 436b156 | 2009-06-13 00:33:33 +0000 | [diff] [blame] | 2277 | bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, | 
|  | 2278 | const TemplateArgument &Arg, | 
|  | 2279 | TemplateArgumentListBuilder &Converted); | 
|  | 2280 |  | 
| Douglas Gregor | c15cb38 | 2009-02-09 23:23:08 +0000 | [diff] [blame] | 2281 | bool CheckTemplateArgument(TemplateTypeParmDecl *Param, QualType Arg, | 
|  | 2282 | SourceLocation ArgLoc); | 
| Douglas Gregor | 3e00bad | 2009-02-17 01:05:43 +0000 | [diff] [blame] | 2283 | bool CheckTemplateArgumentAddressOfObjectOrFunction(Expr *Arg, | 
|  | 2284 | NamedDecl *&Entity); | 
|  | 2285 | bool CheckTemplateArgumentPointerToMember(Expr *Arg, NamedDecl *&Member); | 
| Douglas Gregor | 2943aed | 2009-03-03 04:44:36 +0000 | [diff] [blame] | 2286 | bool CheckTemplateArgument(NonTypeTemplateParmDecl *Param, | 
|  | 2287 | QualType InstantiatedParamType, Expr *&Arg, | 
| Douglas Gregor | 02cbbd2 | 2009-06-11 18:10:32 +0000 | [diff] [blame] | 2288 | TemplateArgument &Converted); | 
| Douglas Gregor | c15cb38 | 2009-02-09 23:23:08 +0000 | [diff] [blame] | 2289 | bool CheckTemplateArgument(TemplateTemplateParmDecl *Param, DeclRefExpr *Arg); | 
| Douglas Gregor | ddc29e1 | 2009-02-06 22:42:48 +0000 | [diff] [blame] | 2290 | bool TemplateParameterListsAreEqual(TemplateParameterList *New, | 
|  | 2291 | TemplateParameterList *Old, | 
|  | 2292 | bool Complain, | 
| Douglas Gregor | dd0574e | 2009-02-10 00:24:35 +0000 | [diff] [blame] | 2293 | bool IsTemplateTemplateParm = false, | 
|  | 2294 | SourceLocation TemplateArgLoc | 
|  | 2295 | = SourceLocation()); | 
| Douglas Gregor | ddc29e1 | 2009-02-06 22:42:48 +0000 | [diff] [blame] | 2296 |  | 
|  | 2297 | bool CheckTemplateDeclScope(Scope *S, | 
|  | 2298 | MultiTemplateParamsArg &TemplateParameterLists); | 
| Douglas Gregor | aaba5e3 | 2009-02-04 19:02:06 +0000 | [diff] [blame] | 2299 |  | 
| Douglas Gregor | d57959a | 2009-03-27 23:10:48 +0000 | [diff] [blame] | 2300 | /// \brief Called when the parser has parsed a C++ typename | 
|  | 2301 | /// specifier, e.g., "typename T::type". | 
|  | 2302 | /// | 
|  | 2303 | /// \param TypenameLoc the location of the 'typename' keyword | 
|  | 2304 | /// \param SS the nested-name-specifier following the typename (e.g., 'T::'). | 
|  | 2305 | /// \param II the identifier we're retrieving (e.g., 'type' in the example). | 
|  | 2306 | /// \param IdLoc the location of the identifier. | 
|  | 2307 | virtual TypeResult | 
|  | 2308 | ActOnTypenameType(SourceLocation TypenameLoc, const CXXScopeSpec &SS, | 
|  | 2309 | const IdentifierInfo &II, SourceLocation IdLoc); | 
| Douglas Gregor | 1734317 | 2009-04-01 00:28:59 +0000 | [diff] [blame] | 2310 |  | 
|  | 2311 | /// \brief Called when the parser has parsed a C++ typename | 
|  | 2312 | /// specifier that ends in a template-id, e.g., | 
|  | 2313 | /// "typename MetaFun::template apply<T1, T2>". | 
|  | 2314 | /// | 
|  | 2315 | /// \param TypenameLoc the location of the 'typename' keyword | 
|  | 2316 | /// \param SS the nested-name-specifier following the typename (e.g., 'T::'). | 
|  | 2317 | /// \param TemplateLoc the location of the 'template' keyword, if any. | 
|  | 2318 | /// \param Ty the type that the typename specifier refers to. | 
|  | 2319 | virtual TypeResult | 
|  | 2320 | ActOnTypenameType(SourceLocation TypenameLoc, const CXXScopeSpec &SS, | 
|  | 2321 | SourceLocation TemplateLoc, TypeTy *Ty); | 
|  | 2322 |  | 
| Douglas Gregor | d57959a | 2009-03-27 23:10:48 +0000 | [diff] [blame] | 2323 | QualType CheckTypenameType(NestedNameSpecifier *NNS, | 
|  | 2324 | const IdentifierInfo &II, | 
|  | 2325 | SourceRange Range); | 
| Douglas Gregor | c8ab256 | 2009-05-31 09:31:02 +0000 | [diff] [blame] | 2326 |  | 
| Douglas Gregor | 4a959d8 | 2009-08-06 16:20:37 +0000 | [diff] [blame] | 2327 | QualType RebuildTypeInCurrentInstantiation(QualType T, SourceLocation Loc, | 
|  | 2328 | DeclarationName Name); | 
|  | 2329 |  | 
| Douglas Gregor | f67875d | 2009-06-12 18:26:56 +0000 | [diff] [blame] | 2330 | /// \brief Describes the result of template argument deduction. | 
|  | 2331 | /// | 
|  | 2332 | /// The TemplateDeductionResult enumeration describes the result of | 
|  | 2333 | /// template argument deduction, as returned from | 
|  | 2334 | /// DeduceTemplateArguments(). The separate TemplateDeductionInfo | 
|  | 2335 | /// structure provides additional information about the results of | 
|  | 2336 | /// template argument deduction, e.g., the deduced template argument | 
|  | 2337 | /// list (if successful) or the specific template parameters or | 
|  | 2338 | /// deduced arguments that were involved in the failure. | 
|  | 2339 | enum TemplateDeductionResult { | 
|  | 2340 | /// \brief Template argument deduction was successful. | 
|  | 2341 | TDK_Success = 0, | 
|  | 2342 | /// \brief Template argument deduction exceeded the maximum template | 
|  | 2343 | /// instantiation depth (which has already been diagnosed). | 
|  | 2344 | TDK_InstantiationDepth, | 
|  | 2345 | /// \brief Template argument deduction did not deduce a value | 
|  | 2346 | /// for every template parameter. | 
|  | 2347 | TDK_Incomplete, | 
|  | 2348 | /// \brief Template argument deduction produced inconsistent | 
|  | 2349 | /// deduced values for the given template parameter. | 
|  | 2350 | TDK_Inconsistent, | 
|  | 2351 | /// \brief Template argument deduction failed due to inconsistent | 
|  | 2352 | /// cv-qualifiers on a template parameter type that would | 
|  | 2353 | /// otherwise be deduced, e.g., we tried to deduce T in "const T" | 
|  | 2354 | /// but were given a non-const "X". | 
|  | 2355 | TDK_InconsistentQuals, | 
|  | 2356 | /// \brief Substitution of the deduced template argument values | 
|  | 2357 | /// resulted in an error. | 
|  | 2358 | TDK_SubstitutionFailure, | 
|  | 2359 | /// \brief Substitution of the deduced template argument values | 
|  | 2360 | /// into a non-deduced context produced a type or value that | 
|  | 2361 | /// produces a type that does not match the original template | 
|  | 2362 | /// arguments provided. | 
| Douglas Gregor | e53060f | 2009-06-25 22:08:12 +0000 | [diff] [blame] | 2363 | TDK_NonDeducedMismatch, | 
|  | 2364 | /// \brief When performing template argument deduction for a function | 
|  | 2365 | /// template, there were too many call arguments. | 
|  | 2366 | TDK_TooManyArguments, | 
| Douglas Gregor | de0cb8b | 2009-07-07 23:09:34 +0000 | [diff] [blame] | 2367 | /// \brief When performing template argument deduction for a function | 
| Douglas Gregor | e53060f | 2009-06-25 22:08:12 +0000 | [diff] [blame] | 2368 | /// template, there were too few call arguments. | 
| Douglas Gregor | 6db8ed4 | 2009-06-30 23:57:56 +0000 | [diff] [blame] | 2369 | TDK_TooFewArguments, | 
|  | 2370 | /// \brief The explicitly-specified template arguments were not valid | 
|  | 2371 | /// template arguments for the given template. | 
|  | 2372 | TDK_InvalidExplicitArguments | 
| Douglas Gregor | f67875d | 2009-06-12 18:26:56 +0000 | [diff] [blame] | 2373 | }; | 
|  | 2374 |  | 
|  | 2375 | /// \brief Provides information about an attempted template argument | 
|  | 2376 | /// deduction, whose success or failure was described by a | 
|  | 2377 | /// TemplateDeductionResult value. | 
|  | 2378 | class TemplateDeductionInfo { | 
|  | 2379 | /// \brief The context in which the template arguments are stored. | 
|  | 2380 | ASTContext &Context; | 
|  | 2381 |  | 
|  | 2382 | /// \brief The deduced template argument list. | 
|  | 2383 | /// | 
|  | 2384 | TemplateArgumentList *Deduced; | 
|  | 2385 |  | 
|  | 2386 | // do not implement these | 
|  | 2387 | TemplateDeductionInfo(const TemplateDeductionInfo&); | 
|  | 2388 | TemplateDeductionInfo &operator=(const TemplateDeductionInfo&); | 
|  | 2389 |  | 
|  | 2390 | public: | 
|  | 2391 | TemplateDeductionInfo(ASTContext &Context) : Context(Context), Deduced(0) { } | 
|  | 2392 |  | 
|  | 2393 | ~TemplateDeductionInfo() { | 
|  | 2394 | // FIXME: if (Deduced) Deduced->Destroy(Context); | 
|  | 2395 | } | 
|  | 2396 |  | 
|  | 2397 | /// \brief Take ownership of the deduced template argument list. | 
|  | 2398 | TemplateArgumentList *take() { | 
|  | 2399 | TemplateArgumentList *Result = Deduced; | 
|  | 2400 | Deduced = 0; | 
|  | 2401 | return Result; | 
|  | 2402 | } | 
|  | 2403 |  | 
|  | 2404 | /// \brief Provide a new template argument list that contains the | 
|  | 2405 | /// results of template argument deduction. | 
|  | 2406 | void reset(TemplateArgumentList *NewDeduced) { | 
|  | 2407 | // FIXME: if (Deduced) Deduced->Destroy(Context); | 
|  | 2408 | Deduced = NewDeduced; | 
|  | 2409 | } | 
|  | 2410 |  | 
|  | 2411 | /// \brief The template parameter to which a template argument | 
|  | 2412 | /// deduction failure refers. | 
|  | 2413 | /// | 
|  | 2414 | /// Depending on the result of template argument deduction, this | 
|  | 2415 | /// template parameter may have different meanings: | 
|  | 2416 | /// | 
|  | 2417 | ///   TDK_Incomplete: this is the first template parameter whose | 
|  | 2418 | ///   corresponding template argument was not deduced. | 
|  | 2419 | /// | 
|  | 2420 | ///   TDK_Inconsistent: this is the template parameter for which | 
|  | 2421 | ///   two different template argument values were deduced. | 
|  | 2422 | TemplateParameter Param; | 
|  | 2423 |  | 
|  | 2424 | /// \brief The first template argument to which the template | 
|  | 2425 | /// argument deduction failure refers. | 
|  | 2426 | /// | 
|  | 2427 | /// Depending on the result of the template argument deduction, | 
|  | 2428 | /// this template argument may have different meanings: | 
|  | 2429 | /// | 
|  | 2430 | ///   TDK_Inconsistent: this argument is the first value deduced | 
|  | 2431 | ///   for the corresponding template parameter. | 
|  | 2432 | /// | 
|  | 2433 | ///   TDK_SubstitutionFailure: this argument is the template | 
|  | 2434 | ///   argument we were instantiating when we encountered an error. | 
|  | 2435 | /// | 
|  | 2436 | ///   TDK_NonDeducedMismatch: this is the template argument | 
|  | 2437 | ///   provided in the source code. | 
|  | 2438 | TemplateArgument FirstArg; | 
|  | 2439 |  | 
|  | 2440 | /// \brief The second template argument to which the template | 
|  | 2441 | /// argument deduction failure refers. | 
|  | 2442 | /// | 
|  | 2443 | /// FIXME: Finish documenting this. | 
|  | 2444 | TemplateArgument SecondArg; | 
|  | 2445 | }; | 
|  | 2446 |  | 
|  | 2447 | TemplateDeductionResult | 
| Douglas Gregor | 199d991 | 2009-06-05 00:53:49 +0000 | [diff] [blame] | 2448 | DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, | 
| Douglas Gregor | f67875d | 2009-06-12 18:26:56 +0000 | [diff] [blame] | 2449 | const TemplateArgumentList &TemplateArgs, | 
|  | 2450 | TemplateDeductionInfo &Info); | 
| Douglas Gregor | 83314aa | 2009-07-08 20:55:45 +0000 | [diff] [blame] | 2451 |  | 
|  | 2452 | TemplateDeductionResult | 
|  | 2453 | SubstituteExplicitTemplateArguments(FunctionTemplateDecl *FunctionTemplate, | 
|  | 2454 | const TemplateArgument *ExplicitTemplateArgs, | 
|  | 2455 | unsigned NumExplicitTemplateArgs, | 
|  | 2456 | llvm::SmallVectorImpl<TemplateArgument> &Deduced, | 
|  | 2457 | llvm::SmallVectorImpl<QualType> &ParamTypes, | 
|  | 2458 | QualType *FunctionType, | 
|  | 2459 | TemplateDeductionInfo &Info); | 
|  | 2460 |  | 
|  | 2461 | TemplateDeductionResult | 
|  | 2462 | FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, | 
|  | 2463 | llvm::SmallVectorImpl<TemplateArgument> &Deduced, | 
|  | 2464 | FunctionDecl *&Specialization, | 
|  | 2465 | TemplateDeductionInfo &Info); | 
|  | 2466 |  | 
| Douglas Gregor | e53060f | 2009-06-25 22:08:12 +0000 | [diff] [blame] | 2467 | TemplateDeductionResult | 
|  | 2468 | DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, | 
| Douglas Gregor | 6db8ed4 | 2009-06-30 23:57:56 +0000 | [diff] [blame] | 2469 | bool HasExplicitTemplateArgs, | 
|  | 2470 | const TemplateArgument *ExplicitTemplateArgs, | 
|  | 2471 | unsigned NumExplicitTemplateArgs, | 
| Douglas Gregor | e53060f | 2009-06-25 22:08:12 +0000 | [diff] [blame] | 2472 | Expr **Args, unsigned NumArgs, | 
|  | 2473 | FunctionDecl *&Specialization, | 
|  | 2474 | TemplateDeductionInfo &Info); | 
| Douglas Gregor | 83314aa | 2009-07-08 20:55:45 +0000 | [diff] [blame] | 2475 |  | 
|  | 2476 | TemplateDeductionResult | 
|  | 2477 | DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, | 
|  | 2478 | bool HasExplicitTemplateArgs, | 
|  | 2479 | const TemplateArgument *ExplicitTemplateArgs, | 
|  | 2480 | unsigned NumExplicitTemplateArgs, | 
|  | 2481 | QualType ArgFunctionType, | 
|  | 2482 | FunctionDecl *&Specialization, | 
|  | 2483 | TemplateDeductionInfo &Info); | 
| Douglas Gregor | e53060f | 2009-06-25 22:08:12 +0000 | [diff] [blame] | 2484 |  | 
| Douglas Gregor | 031a588 | 2009-06-13 00:26:55 +0000 | [diff] [blame] | 2485 | void MarkDeducedTemplateParameters(const TemplateArgumentList &TemplateArgs, | 
|  | 2486 | llvm::SmallVectorImpl<bool> &Deduced); | 
|  | 2487 |  | 
| Douglas Gregor | 99ebf65 | 2009-02-27 19:31:52 +0000 | [diff] [blame] | 2488 | //===--------------------------------------------------------------------===// | 
|  | 2489 | // C++ Template Instantiation | 
|  | 2490 | // | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2491 |  | 
| Douglas Gregor | 54dabfc | 2009-05-14 23:26:13 +0000 | [diff] [blame] | 2492 | const TemplateArgumentList &getTemplateInstantiationArgs(NamedDecl *D); | 
|  | 2493 |  | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2494 | /// \brief A template instantiation that is currently in progress. | 
|  | 2495 | struct ActiveTemplateInstantiation { | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2496 | /// \brief The kind of template instantiation we are performing | 
| Douglas Gregor | cca9e96 | 2009-07-01 22:01:06 +0000 | [diff] [blame] | 2497 | enum InstantiationKind { | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2498 | /// We are instantiating a template declaration. The entity is | 
| Douglas Gregor | b9f1b8d | 2009-05-15 00:01:03 +0000 | [diff] [blame] | 2499 | /// the declaration we're instantiating (e.g., a CXXRecordDecl). | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2500 | TemplateInstantiation, | 
|  | 2501 |  | 
|  | 2502 | /// We are instantiating a default argument for a template | 
|  | 2503 | /// parameter. The Entity is the template, and | 
|  | 2504 | /// TemplateArgs/NumTemplateArguments provides the template | 
|  | 2505 | /// arguments as specified. | 
| Douglas Gregor | 637a409 | 2009-06-10 23:47:09 +0000 | [diff] [blame] | 2506 | /// FIXME: Use a TemplateArgumentList | 
|  | 2507 | DefaultTemplateArgumentInstantiation, | 
|  | 2508 |  | 
| Douglas Gregor | cca9e96 | 2009-07-01 22:01:06 +0000 | [diff] [blame] | 2509 | /// We are substituting explicit template arguments provided for | 
|  | 2510 | /// a function template. The entity is a FunctionTemplateDecl. | 
|  | 2511 | ExplicitTemplateArgumentSubstitution, | 
|  | 2512 |  | 
|  | 2513 | /// We are substituting template argument determined as part of | 
|  | 2514 | /// template argument deduction for either a class template | 
|  | 2515 | /// partial specialization or a function template. The | 
|  | 2516 | /// Entity is either a ClassTemplatePartialSpecializationDecl or | 
|  | 2517 | /// a FunctionTemplateDecl. | 
|  | 2518 | DeducedTemplateArgumentSubstitution | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2519 | } Kind; | 
|  | 2520 |  | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2521 | /// \brief The point of instantiation within the source code. | 
|  | 2522 | SourceLocation PointOfInstantiation; | 
|  | 2523 |  | 
|  | 2524 | /// \brief The entity that is being instantiated. | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2525 | uintptr_t Entity; | 
|  | 2526 |  | 
|  | 2527 | // \brief If this the instantiation of a default template | 
| Douglas Gregor | 7e06390 | 2009-05-11 23:53:27 +0000 | [diff] [blame] | 2528 | // argument, the list of template arguments. | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2529 | const TemplateArgument *TemplateArgs; | 
|  | 2530 |  | 
|  | 2531 | /// \brief The number of template arguments in TemplateArgs. | 
|  | 2532 | unsigned NumTemplateArgs; | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2533 |  | 
|  | 2534 | /// \brief The source range that covers the construct that cause | 
|  | 2535 | /// the instantiation, e.g., the template-id that causes a class | 
|  | 2536 | /// template instantiation. | 
|  | 2537 | SourceRange InstantiationRange; | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2538 |  | 
|  | 2539 | friend bool operator==(const ActiveTemplateInstantiation &X, | 
|  | 2540 | const ActiveTemplateInstantiation &Y) { | 
|  | 2541 | if (X.Kind != Y.Kind) | 
|  | 2542 | return false; | 
|  | 2543 |  | 
|  | 2544 | if (X.Entity != Y.Entity) | 
|  | 2545 | return false; | 
|  | 2546 |  | 
|  | 2547 | switch (X.Kind) { | 
|  | 2548 | case TemplateInstantiation: | 
|  | 2549 | return true; | 
|  | 2550 |  | 
|  | 2551 | case DefaultTemplateArgumentInstantiation: | 
| Douglas Gregor | cca9e96 | 2009-07-01 22:01:06 +0000 | [diff] [blame] | 2552 | case ExplicitTemplateArgumentSubstitution: | 
|  | 2553 | case DeducedTemplateArgumentSubstitution: | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2554 | return X.TemplateArgs == Y.TemplateArgs; | 
|  | 2555 | } | 
|  | 2556 |  | 
|  | 2557 | return true; | 
|  | 2558 | } | 
|  | 2559 |  | 
|  | 2560 | friend bool operator!=(const ActiveTemplateInstantiation &X, | 
|  | 2561 | const ActiveTemplateInstantiation &Y) { | 
|  | 2562 | return !(X == Y); | 
|  | 2563 | } | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2564 | }; | 
|  | 2565 |  | 
|  | 2566 | /// \brief List of active template instantiations. | 
|  | 2567 | /// | 
|  | 2568 | /// This vector is treated as a stack. As one template instantiation | 
|  | 2569 | /// requires another template instantiation, additional | 
|  | 2570 | /// instantiations are pushed onto the stack up to a | 
|  | 2571 | /// user-configurable limit LangOptions::InstantiationDepth. | 
|  | 2572 | llvm::SmallVector<ActiveTemplateInstantiation, 16> | 
|  | 2573 | ActiveTemplateInstantiations; | 
|  | 2574 |  | 
| Douglas Gregor | 27b152f | 2009-03-10 18:52:44 +0000 | [diff] [blame] | 2575 | /// \brief The last template from which a template instantiation | 
|  | 2576 | /// error or warning was produced. | 
|  | 2577 | /// | 
|  | 2578 | /// This value is used to suppress printing of redundant template | 
|  | 2579 | /// instantiation backtraces when there are multiple errors in the | 
|  | 2580 | /// same instantiation. FIXME: Does this belong in Sema? It's tough | 
|  | 2581 | /// to implement it anywhere else. | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2582 | ActiveTemplateInstantiation LastTemplateInstantiationErrorContext; | 
| Douglas Gregor | 27b152f | 2009-03-10 18:52:44 +0000 | [diff] [blame] | 2583 |  | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2584 | /// \brief A stack object to be created when performing template | 
|  | 2585 | /// instantiation. | 
|  | 2586 | /// | 
|  | 2587 | /// Construction of an object of type \c InstantiatingTemplate | 
|  | 2588 | /// pushes the current instantiation onto the stack of active | 
|  | 2589 | /// instantiations. If the size of this stack exceeds the maximum | 
|  | 2590 | /// number of recursive template instantiations, construction | 
|  | 2591 | /// produces an error and evaluates true. | 
|  | 2592 | /// | 
|  | 2593 | /// Destruction of this object will pop the named instantiation off | 
|  | 2594 | /// the stack. | 
|  | 2595 | struct InstantiatingTemplate { | 
| Douglas Gregor | f3e7ce4 | 2009-05-18 17:01:57 +0000 | [diff] [blame] | 2596 | /// \brief Note that we are instantiating a class template, | 
|  | 2597 | /// function template, or a member thereof. | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2598 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, | 
| Douglas Gregor | f3e7ce4 | 2009-05-18 17:01:57 +0000 | [diff] [blame] | 2599 | Decl *Entity, | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2600 | SourceRange InstantiationRange = SourceRange()); | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2601 |  | 
|  | 2602 | /// \brief Note that we are instantiating a default argument in a | 
|  | 2603 | /// template-id. | 
|  | 2604 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, | 
|  | 2605 | TemplateDecl *Template, | 
|  | 2606 | const TemplateArgument *TemplateArgs, | 
|  | 2607 | unsigned NumTemplateArgs, | 
|  | 2608 | SourceRange InstantiationRange = SourceRange()); | 
|  | 2609 |  | 
| Douglas Gregor | cca9e96 | 2009-07-01 22:01:06 +0000 | [diff] [blame] | 2610 | /// \brief Note that we are instantiating a default argument in a | 
|  | 2611 | /// template-id. | 
|  | 2612 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, | 
|  | 2613 | FunctionTemplateDecl *FunctionTemplate, | 
|  | 2614 | const TemplateArgument *TemplateArgs, | 
|  | 2615 | unsigned NumTemplateArgs, | 
|  | 2616 | ActiveTemplateInstantiation::InstantiationKind Kind, | 
|  | 2617 | SourceRange InstantiationRange = SourceRange()); | 
|  | 2618 |  | 
| Douglas Gregor | 637a409 | 2009-06-10 23:47:09 +0000 | [diff] [blame] | 2619 | /// \brief Note that we are instantiating as part of template | 
|  | 2620 | /// argument deduction for a class template partial | 
|  | 2621 | /// specialization. | 
|  | 2622 | InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, | 
|  | 2623 | ClassTemplatePartialSpecializationDecl *PartialSpec, | 
|  | 2624 | const TemplateArgument *TemplateArgs, | 
|  | 2625 | unsigned NumTemplateArgs, | 
|  | 2626 | SourceRange InstantiationRange = SourceRange()); | 
|  | 2627 |  | 
| Douglas Gregor | f3e7ce4 | 2009-05-18 17:01:57 +0000 | [diff] [blame] | 2628 | /// \brief Note that we have finished instantiating this template. | 
|  | 2629 | void Clear(); | 
|  | 2630 |  | 
|  | 2631 | ~InstantiatingTemplate() { Clear(); } | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2632 |  | 
|  | 2633 | /// \brief Determines whether we have exceeded the maximum | 
|  | 2634 | /// recursive template instantiations. | 
|  | 2635 | operator bool() const { return Invalid; } | 
|  | 2636 |  | 
|  | 2637 | private: | 
|  | 2638 | Sema &SemaRef; | 
|  | 2639 | bool Invalid; | 
|  | 2640 |  | 
| Douglas Gregor | df667e7 | 2009-03-10 20:44:00 +0000 | [diff] [blame] | 2641 | bool CheckInstantiationDepth(SourceLocation PointOfInstantiation, | 
|  | 2642 | SourceRange InstantiationRange); | 
|  | 2643 |  | 
| Douglas Gregor | 26dce44 | 2009-03-10 00:06:19 +0000 | [diff] [blame] | 2644 | InstantiatingTemplate(const InstantiatingTemplate&); // not implemented | 
|  | 2645 |  | 
|  | 2646 | InstantiatingTemplate& | 
|  | 2647 | operator=(const InstantiatingTemplate&); // not implemented | 
|  | 2648 | }; | 
|  | 2649 |  | 
| Douglas Gregor | ee1828a | 2009-03-10 18:03:33 +0000 | [diff] [blame] | 2650 | void PrintInstantiationStack(); | 
|  | 2651 |  | 
| Douglas Gregor | 5e9f35c | 2009-06-14 07:33:30 +0000 | [diff] [blame] | 2652 | /// \brief Determines whether we are currently in a context where | 
|  | 2653 | /// template argument substitution failures are not considered | 
|  | 2654 | /// errors. | 
|  | 2655 | /// | 
|  | 2656 | /// When this routine returns true, the emission of most diagnostics | 
|  | 2657 | /// will be suppressed and there will be no local error recovery. | 
|  | 2658 | bool isSFINAEContext() const; | 
|  | 2659 |  | 
| Douglas Gregor | bb26041 | 2009-06-14 08:02:22 +0000 | [diff] [blame] | 2660 | /// \brief RAII class used to determine whether SFINAE has | 
|  | 2661 | /// trapped any errors that occur during template argument | 
|  | 2662 | /// deduction. | 
|  | 2663 | class SFINAETrap { | 
|  | 2664 | Sema &SemaRef; | 
|  | 2665 | unsigned PrevSFINAEErrors; | 
|  | 2666 | public: | 
|  | 2667 | explicit SFINAETrap(Sema &SemaRef) | 
|  | 2668 | : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors) { } | 
|  | 2669 |  | 
|  | 2670 | ~SFINAETrap() { SemaRef.NumSFINAEErrors = PrevSFINAEErrors; } | 
|  | 2671 |  | 
|  | 2672 | /// \brief Determine whether any SFINAE errors have been trapped. | 
|  | 2673 | bool hasErrorOccurred() const { | 
|  | 2674 | return SemaRef.NumSFINAEErrors > PrevSFINAEErrors; | 
|  | 2675 | } | 
|  | 2676 | }; | 
|  | 2677 |  | 
| Douglas Gregor | 48dd19b | 2009-05-14 21:44:34 +0000 | [diff] [blame] | 2678 | /// \brief A stack-allocated class that identifies which local | 
|  | 2679 | /// variable declaration instantiations are present in this scope. | 
|  | 2680 | /// | 
|  | 2681 | /// A new instance of this class type will be created whenever we | 
|  | 2682 | /// instantiate a new function declaration, which will have its own | 
|  | 2683 | /// set of parameter declarations. | 
|  | 2684 | class LocalInstantiationScope { | 
|  | 2685 | /// \brief Reference to the semantic analysis that is performing | 
|  | 2686 | /// this template instantiation. | 
|  | 2687 | Sema &SemaRef; | 
|  | 2688 |  | 
| Douglas Gregor | 815215d | 2009-05-27 05:35:12 +0000 | [diff] [blame] | 2689 | /// \brief A mapping from local declarations that occur | 
| Douglas Gregor | 48dd19b | 2009-05-14 21:44:34 +0000 | [diff] [blame] | 2690 | /// within a template to their instantiations. | 
|  | 2691 | /// | 
|  | 2692 | /// This mapping is used during instantiation to keep track of, | 
|  | 2693 | /// e.g., function parameter and variable declarations. For example, | 
|  | 2694 | /// given: | 
|  | 2695 | /// | 
|  | 2696 | /// \code | 
|  | 2697 | ///   template<typename T> T add(T x, T y) { return x + y; } | 
|  | 2698 | /// \endcode | 
|  | 2699 | /// | 
|  | 2700 | /// when we instantiate add<int>, we will introduce a mapping from | 
|  | 2701 | /// the ParmVarDecl for 'x' that occurs in the template to the | 
|  | 2702 | /// instantiated ParmVarDecl for 'x'. | 
| Douglas Gregor | 815215d | 2009-05-27 05:35:12 +0000 | [diff] [blame] | 2703 | llvm::DenseMap<const Decl *, Decl *> LocalDecls; | 
| Douglas Gregor | 48dd19b | 2009-05-14 21:44:34 +0000 | [diff] [blame] | 2704 |  | 
|  | 2705 | /// \brief The outer scope, in which contains local variable | 
|  | 2706 | /// definitions from some other instantiation (that is not | 
|  | 2707 | /// relevant to this particular scope). | 
|  | 2708 | LocalInstantiationScope *Outer; | 
|  | 2709 |  | 
|  | 2710 | // This class is non-copyable | 
|  | 2711 | LocalInstantiationScope(const LocalInstantiationScope &); | 
|  | 2712 | LocalInstantiationScope &operator=(const LocalInstantiationScope &); | 
|  | 2713 |  | 
|  | 2714 | public: | 
|  | 2715 | LocalInstantiationScope(Sema &SemaRef) | 
|  | 2716 | : SemaRef(SemaRef), Outer(SemaRef.CurrentInstantiationScope) { | 
|  | 2717 | SemaRef.CurrentInstantiationScope = this; | 
|  | 2718 | } | 
|  | 2719 |  | 
|  | 2720 | ~LocalInstantiationScope() { | 
|  | 2721 | SemaRef.CurrentInstantiationScope = Outer; | 
|  | 2722 | } | 
|  | 2723 |  | 
| Douglas Gregor | 815215d | 2009-05-27 05:35:12 +0000 | [diff] [blame] | 2724 | Decl *getInstantiationOf(const Decl *D) { | 
|  | 2725 | Decl *Result = LocalDecls[D]; | 
|  | 2726 | assert(Result && "declaration was not instantiated in this scope!"); | 
| Douglas Gregor | 48dd19b | 2009-05-14 21:44:34 +0000 | [diff] [blame] | 2727 | return Result; | 
|  | 2728 | } | 
|  | 2729 |  | 
| Douglas Gregor | 815215d | 2009-05-27 05:35:12 +0000 | [diff] [blame] | 2730 | VarDecl *getInstantiationOf(const VarDecl *Var) { | 
|  | 2731 | return cast<VarDecl>(getInstantiationOf(cast<Decl>(Var))); | 
| Douglas Gregor | 48dd19b | 2009-05-14 21:44:34 +0000 | [diff] [blame] | 2732 | } | 
|  | 2733 |  | 
| Douglas Gregor | 815215d | 2009-05-27 05:35:12 +0000 | [diff] [blame] | 2734 | ParmVarDecl *getInstantiationOf(const ParmVarDecl *Var) { | 
|  | 2735 | return cast<ParmVarDecl>(getInstantiationOf(cast<Decl>(Var))); | 
|  | 2736 | } | 
|  | 2737 |  | 
|  | 2738 | void InstantiatedLocal(const Decl *D, Decl *Inst) { | 
|  | 2739 | Decl *&Stored = LocalDecls[D]; | 
|  | 2740 | assert(!Stored && "Already instantiated this local"); | 
|  | 2741 | Stored = Inst; | 
| Douglas Gregor | 48dd19b | 2009-05-14 21:44:34 +0000 | [diff] [blame] | 2742 | } | 
|  | 2743 | }; | 
|  | 2744 |  | 
|  | 2745 | /// \brief The current instantiation scope used to store local | 
|  | 2746 | /// variables. | 
|  | 2747 | LocalInstantiationScope *CurrentInstantiationScope; | 
|  | 2748 |  | 
| Douglas Gregor | d7f37bf | 2009-06-22 23:06:13 +0000 | [diff] [blame] | 2749 | /// \brief An entity for which implicit template instantiation is required. | 
|  | 2750 | /// | 
|  | 2751 | /// The source location associated with the declaration is the first place in | 
|  | 2752 | /// the source code where the declaration was "used". It is not necessarily | 
|  | 2753 | /// the point of instantiation (which will be either before or after the | 
|  | 2754 | /// namespace-scope declaration that triggered this implicit instantiation), | 
|  | 2755 | /// However, it is the location that diagnostics should generally refer to, | 
|  | 2756 | /// because users will need to know what code triggered the instantiation. | 
|  | 2757 | typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation; | 
|  | 2758 |  | 
|  | 2759 | /// \brief The queue of implicit template instantiations that are required | 
|  | 2760 | /// but have not yet been performed. | 
| Douglas Gregor | b33fe2f | 2009-06-30 17:20:14 +0000 | [diff] [blame] | 2761 | std::deque<PendingImplicitInstantiation> PendingImplicitInstantiations; | 
| Douglas Gregor | d7f37bf | 2009-06-22 23:06:13 +0000 | [diff] [blame] | 2762 |  | 
|  | 2763 | void PerformPendingImplicitInstantiations(); | 
|  | 2764 |  | 
| Douglas Gregor | 7e06390 | 2009-05-11 23:53:27 +0000 | [diff] [blame] | 2765 | QualType InstantiateType(QualType T, const TemplateArgumentList &TemplateArgs, | 
| Douglas Gregor | 99ebf65 | 2009-02-27 19:31:52 +0000 | [diff] [blame] | 2766 | SourceLocation Loc, DeclarationName Entity); | 
| Douglas Gregor | 199d991 | 2009-06-05 00:53:49 +0000 | [diff] [blame] | 2767 |  | 
| Douglas Gregor | a0e500d | 2009-03-12 16:53:44 +0000 | [diff] [blame] | 2768 | OwningExprResult InstantiateExpr(Expr *E, | 
| Douglas Gregor | 7e06390 | 2009-05-11 23:53:27 +0000 | [diff] [blame] | 2769 | const TemplateArgumentList &TemplateArgs); | 
| Douglas Gregor | a0e500d | 2009-03-12 16:53:44 +0000 | [diff] [blame] | 2770 |  | 
| Douglas Gregor | 54dabfc | 2009-05-14 23:26:13 +0000 | [diff] [blame] | 2771 | OwningStmtResult InstantiateStmt(Stmt *S, | 
|  | 2772 | const TemplateArgumentList &TemplateArgs); | 
| Douglas Gregor | 66b46be | 2009-05-20 22:57:03 +0000 | [diff] [blame] | 2773 | OwningStmtResult InstantiateCompoundStmt(CompoundStmt *S, | 
|  | 2774 | const TemplateArgumentList &TemplateArgs, | 
|  | 2775 | bool isStmtExpr); | 
| Douglas Gregor | 54dabfc | 2009-05-14 23:26:13 +0000 | [diff] [blame] | 2776 |  | 
| Douglas Gregor | 8dbc269 | 2009-03-17 21:15:40 +0000 | [diff] [blame] | 2777 | Decl *InstantiateDecl(Decl *D, DeclContext *Owner, | 
| Douglas Gregor | 7e06390 | 2009-05-11 23:53:27 +0000 | [diff] [blame] | 2778 | const TemplateArgumentList &TemplateArgs); | 
| Douglas Gregor | 8dbc269 | 2009-03-17 21:15:40 +0000 | [diff] [blame] | 2779 |  | 
| Douglas Gregor | 2943aed | 2009-03-03 04:44:36 +0000 | [diff] [blame] | 2780 | bool | 
| Douglas Gregor | d475b8d | 2009-03-25 21:17:03 +0000 | [diff] [blame] | 2781 | InstantiateBaseSpecifiers(CXXRecordDecl *Instantiation, | 
|  | 2782 | CXXRecordDecl *Pattern, | 
| Douglas Gregor | 7e06390 | 2009-05-11 23:53:27 +0000 | [diff] [blame] | 2783 | const TemplateArgumentList &TemplateArgs); | 
| Douglas Gregor | d475b8d | 2009-03-25 21:17:03 +0000 | [diff] [blame] | 2784 |  | 
|  | 2785 | bool | 
|  | 2786 | InstantiateClass(SourceLocation PointOfInstantiation, | 
|  | 2787 | CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, | 
| Douglas Gregor | 93dfdb1 | 2009-05-13 00:25:59 +0000 | [diff] [blame] | 2788 | const TemplateArgumentList &TemplateArgs, | 
|  | 2789 | bool ExplicitInstantiation); | 
| Douglas Gregor | d475b8d | 2009-03-25 21:17:03 +0000 | [diff] [blame] | 2790 |  | 
| Douglas Gregor | 2943aed | 2009-03-03 04:44:36 +0000 | [diff] [blame] | 2791 | bool | 
|  | 2792 | InstantiateClassTemplateSpecialization( | 
|  | 2793 | ClassTemplateSpecializationDecl *ClassTemplateSpec, | 
|  | 2794 | bool ExplicitInstantiation); | 
| Douglas Gregor | 99ebf65 | 2009-02-27 19:31:52 +0000 | [diff] [blame] | 2795 |  | 
| Douglas Gregor | a58861f | 2009-05-13 20:28:22 +0000 | [diff] [blame] | 2796 | void InstantiateClassMembers(SourceLocation PointOfInstantiation, | 
|  | 2797 | CXXRecordDecl *Instantiation, | 
|  | 2798 | const TemplateArgumentList &TemplateArgs); | 
|  | 2799 |  | 
|  | 2800 | void InstantiateClassTemplateSpecializationMembers( | 
|  | 2801 | SourceLocation PointOfInstantiation, | 
|  | 2802 | ClassTemplateSpecializationDecl *ClassTemplateSpec); | 
|  | 2803 |  | 
| Douglas Gregor | ab452ba | 2009-03-26 23:50:42 +0000 | [diff] [blame] | 2804 | NestedNameSpecifier * | 
|  | 2805 | InstantiateNestedNameSpecifier(NestedNameSpecifier *NNS, | 
|  | 2806 | SourceRange Range, | 
| Douglas Gregor | 7e06390 | 2009-05-11 23:53:27 +0000 | [diff] [blame] | 2807 | const TemplateArgumentList &TemplateArgs); | 
| Douglas Gregor | 5953d8b | 2009-03-19 17:26:29 +0000 | [diff] [blame] | 2808 |  | 
| Douglas Gregor | de650ae | 2009-03-31 18:38:02 +0000 | [diff] [blame] | 2809 | TemplateName | 
|  | 2810 | InstantiateTemplateName(TemplateName Name, SourceLocation Loc, | 
| Douglas Gregor | 7e06390 | 2009-05-11 23:53:27 +0000 | [diff] [blame] | 2811 | const TemplateArgumentList &TemplateArgs); | 
| Douglas Gregor | 9133300 | 2009-06-11 00:06:24 +0000 | [diff] [blame] | 2812 | TemplateArgument Instantiate(TemplateArgument Arg, | 
|  | 2813 | const TemplateArgumentList &TemplateArgs); | 
| Douglas Gregor | de650ae | 2009-03-31 18:38:02 +0000 | [diff] [blame] | 2814 |  | 
| Douglas Gregor | f3e7ce4 | 2009-05-18 17:01:57 +0000 | [diff] [blame] | 2815 | void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, | 
| Douglas Gregor | b33fe2f | 2009-06-30 17:20:14 +0000 | [diff] [blame] | 2816 | FunctionDecl *Function, | 
|  | 2817 | bool Recursive = false); | 
| Douglas Gregor | 7caa682 | 2009-07-24 20:34:43 +0000 | [diff] [blame] | 2818 | void InstantiateStaticDataMemberDefinition( | 
|  | 2819 | SourceLocation PointOfInstantiation, | 
|  | 2820 | VarDecl *Var, | 
|  | 2821 | bool Recursive = false); | 
| Douglas Gregor | a58861f | 2009-05-13 20:28:22 +0000 | [diff] [blame] | 2822 |  | 
| Douglas Gregor | ed961e7 | 2009-05-27 17:54:46 +0000 | [diff] [blame] | 2823 | NamedDecl *InstantiateCurrentDeclRef(NamedDecl *D); | 
| Douglas Gregor | d7f37bf | 2009-06-22 23:06:13 +0000 | [diff] [blame] | 2824 |  | 
| Steve Naroff | 3536b44 | 2007-09-06 21:24:23 +0000 | [diff] [blame] | 2825 | // Objective-C declarations. | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2826 | virtual DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc, | 
|  | 2827 | IdentifierInfo *ClassName, | 
|  | 2828 | SourceLocation ClassLoc, | 
|  | 2829 | IdentifierInfo *SuperName, | 
|  | 2830 | SourceLocation SuperLoc, | 
|  | 2831 | const DeclPtrTy *ProtoRefs, | 
|  | 2832 | unsigned NumProtoRefs, | 
|  | 2833 | SourceLocation EndProtoLoc, | 
|  | 2834 | AttributeList *AttrList); | 
| Fariborz Jahanian | 243b64b | 2007-10-11 23:42:27 +0000 | [diff] [blame] | 2835 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2836 | virtual DeclPtrTy ActOnCompatiblityAlias( | 
| Fariborz Jahanian | 243b64b | 2007-10-11 23:42:27 +0000 | [diff] [blame] | 2837 | SourceLocation AtCompatibilityAliasLoc, | 
|  | 2838 | IdentifierInfo *AliasName,  SourceLocation AliasLocation, | 
|  | 2839 | IdentifierInfo *ClassName, SourceLocation ClassLocation); | 
| Steve Naroff | 61d6852 | 2009-03-05 15:22:01 +0000 | [diff] [blame] | 2840 |  | 
|  | 2841 | void CheckForwardProtocolDeclarationForCircularDependency( | 
|  | 2842 | IdentifierInfo *PName, | 
|  | 2843 | SourceLocation &PLoc, SourceLocation PrevLoc, | 
|  | 2844 | const ObjCList<ObjCProtocolDecl> &PList); | 
| Steve Naroff | 3536b44 | 2007-09-06 21:24:23 +0000 | [diff] [blame] | 2845 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2846 | virtual DeclPtrTy ActOnStartProtocolInterface( | 
| Nate Begeman | 1abc7f6 | 2008-02-20 22:57:40 +0000 | [diff] [blame] | 2847 | SourceLocation AtProtoInterfaceLoc, | 
| Fariborz Jahanian | 25e077d | 2007-09-17 21:07:36 +0000 | [diff] [blame] | 2848 | IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2849 | const DeclPtrTy *ProtoRefNames, unsigned NumProtoRefs, | 
| Daniel Dunbar | 246e70f | 2008-09-26 04:48:09 +0000 | [diff] [blame] | 2850 | SourceLocation EndProtoLoc, | 
|  | 2851 | AttributeList *AttrList); | 
| Fariborz Jahanian | 25e077d | 2007-09-17 21:07:36 +0000 | [diff] [blame] | 2852 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2853 | virtual DeclPtrTy ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, | 
|  | 2854 | IdentifierInfo *ClassName, | 
|  | 2855 | SourceLocation ClassLoc, | 
|  | 2856 | IdentifierInfo *CategoryName, | 
|  | 2857 | SourceLocation CategoryLoc, | 
|  | 2858 | const DeclPtrTy *ProtoRefs, | 
|  | 2859 | unsigned NumProtoRefs, | 
|  | 2860 | SourceLocation EndProtoLoc); | 
| Fariborz Jahanian | fd225cc | 2007-09-18 20:26:58 +0000 | [diff] [blame] | 2861 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2862 | virtual DeclPtrTy ActOnStartClassImplementation( | 
| Nate Begeman | 1abc7f6 | 2008-02-20 22:57:40 +0000 | [diff] [blame] | 2863 | SourceLocation AtClassImplLoc, | 
| Fariborz Jahanian | ccb4f31 | 2007-09-25 18:38:09 +0000 | [diff] [blame] | 2864 | IdentifierInfo *ClassName, SourceLocation ClassLoc, | 
|  | 2865 | IdentifierInfo *SuperClassname, | 
|  | 2866 | SourceLocation SuperClassLoc); | 
|  | 2867 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2868 | virtual DeclPtrTy ActOnStartCategoryImplementation( | 
| Fariborz Jahanian | 8f3fde0 | 2007-10-02 16:38:50 +0000 | [diff] [blame] | 2869 | SourceLocation AtCatImplLoc, | 
|  | 2870 | IdentifierInfo *ClassName, | 
|  | 2871 | SourceLocation ClassLoc, | 
|  | 2872 | IdentifierInfo *CatName, | 
|  | 2873 | SourceLocation CatLoc); | 
|  | 2874 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2875 | virtual DeclPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, | 
| Steve Naroff | 37e58d1 | 2007-10-02 22:39:18 +0000 | [diff] [blame] | 2876 | IdentifierInfo **IdentList, | 
|  | 2877 | unsigned NumElts); | 
| Fariborz Jahanian | 894c57f | 2007-09-21 15:40:54 +0000 | [diff] [blame] | 2878 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2879 | virtual DeclPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, | 
| Chris Lattner | 7caeabd | 2008-07-21 22:17:28 +0000 | [diff] [blame] | 2880 | const IdentifierLocPair *IdentList, | 
| Fariborz Jahanian | bc1c877 | 2008-12-17 01:07:27 +0000 | [diff] [blame] | 2881 | unsigned NumElts, | 
|  | 2882 | AttributeList *attrList); | 
| Fariborz Jahanian | 245f92a | 2007-10-05 21:01:53 +0000 | [diff] [blame] | 2883 |  | 
| Chris Lattner | e13b959 | 2008-07-26 04:03:38 +0000 | [diff] [blame] | 2884 | virtual void FindProtocolDeclaration(bool WarnOnDeclarations, | 
| Chris Lattner | 7caeabd | 2008-07-21 22:17:28 +0000 | [diff] [blame] | 2885 | const IdentifierLocPair *ProtocolId, | 
| Fariborz Jahanian | 4b6c905 | 2007-10-11 00:55:41 +0000 | [diff] [blame] | 2886 | unsigned NumProtocols, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2887 | llvm::SmallVectorImpl<DeclPtrTy> &Protocols); | 
| Fariborz Jahanian | 02edb98 | 2008-05-01 00:03:38 +0000 | [diff] [blame] | 2888 |  | 
| Daniel Dunbar | 95e61fb | 2008-09-23 21:53:23 +0000 | [diff] [blame] | 2889 | /// Ensure attributes are consistent with type. | 
|  | 2890 | /// \param [in, out] Attributes The attributes to check; they will | 
|  | 2891 | /// be modified to be consistent with \arg PropertyTy. | 
|  | 2892 | void CheckObjCPropertyAttributes(QualType PropertyTy, | 
|  | 2893 | SourceLocation Loc, | 
|  | 2894 | unsigned &Attributes); | 
| Steve Naroff | 0701bbb | 2009-01-08 17:28:14 +0000 | [diff] [blame] | 2895 | void ProcessPropertyDecl(ObjCPropertyDecl *property, ObjCContainerDecl *DC); | 
| Fariborz Jahanian | 02edb98 | 2008-05-01 00:03:38 +0000 | [diff] [blame] | 2896 | void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, | 
|  | 2897 | ObjCPropertyDecl *SuperProperty, | 
| Chris Lattner | 8ec03f5 | 2008-11-24 03:54:41 +0000 | [diff] [blame] | 2898 | const IdentifierInfo *Name); | 
| Fariborz Jahanian | 02edb98 | 2008-05-01 00:03:38 +0000 | [diff] [blame] | 2899 | void ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl); | 
| Fariborz Jahanian | b5e0224 | 2008-04-24 19:58:34 +0000 | [diff] [blame] | 2900 |  | 
| Fariborz Jahanian | dbdec8b | 2009-08-04 01:07:16 +0000 | [diff] [blame] | 2901 | void CompareMethodParamsInBaseAndSuper(Decl *IDecl, | 
|  | 2902 | ObjCMethodDecl *MethodDecl, | 
|  | 2903 | bool IsInstance); | 
|  | 2904 |  | 
| Fariborz Jahanian | 1ac2bc4 | 2008-12-06 23:03:39 +0000 | [diff] [blame] | 2905 | void MergeProtocolPropertiesIntoClass(Decl *CDecl, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2906 | DeclPtrTy MergeProtocols); | 
| Fariborz Jahanian | aebf0cb | 2008-05-02 19:17:30 +0000 | [diff] [blame] | 2907 |  | 
| Fariborz Jahanian | b7f95f5 | 2009-03-02 19:05:07 +0000 | [diff] [blame] | 2908 | void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, | 
|  | 2909 | ObjCInterfaceDecl *ID); | 
|  | 2910 |  | 
| Fariborz Jahanian | 1ac2bc4 | 2008-12-06 23:03:39 +0000 | [diff] [blame] | 2911 | void MergeOneProtocolPropertiesIntoClass(Decl *CDecl, | 
| Fariborz Jahanian | aebf0cb | 2008-05-02 19:17:30 +0000 | [diff] [blame] | 2912 | ObjCProtocolDecl *PDecl); | 
|  | 2913 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2914 | virtual void ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl, | 
|  | 2915 | DeclPtrTy *allMethods = 0, unsigned allNum = 0, | 
|  | 2916 | DeclPtrTy *allProperties = 0, unsigned pNum = 0, | 
| Chris Lattner | 682bf92 | 2009-03-29 16:50:03 +0000 | [diff] [blame] | 2917 | DeclGroupPtrTy *allTUVars = 0, unsigned tuvNum = 0); | 
| Fariborz Jahanian | d0b90bf | 2007-09-26 18:27:25 +0000 | [diff] [blame] | 2918 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2919 | virtual DeclPtrTy ActOnProperty(Scope *S, SourceLocation AtLoc, | 
|  | 2920 | FieldDeclarator &FD, ObjCDeclSpec &ODS, | 
|  | 2921 | Selector GetterSel, Selector SetterSel, | 
|  | 2922 | DeclPtrTy ClassCategory, | 
|  | 2923 | bool *OverridingProperty, | 
|  | 2924 | tok::ObjCKeywordKind MethodImplKind); | 
| Fariborz Jahanian | 46b55e5 | 2008-05-05 18:51:55 +0000 | [diff] [blame] | 2925 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2926 | virtual DeclPtrTy ActOnPropertyImplDecl(SourceLocation AtLoc, | 
|  | 2927 | SourceLocation PropertyLoc, | 
|  | 2928 | bool ImplKind,DeclPtrTy ClassImplDecl, | 
|  | 2929 | IdentifierInfo *PropertyId, | 
|  | 2930 | IdentifierInfo *PropertyIvar); | 
| Fariborz Jahanian | f624f81 | 2008-04-18 00:19:30 +0000 | [diff] [blame] | 2931 |  | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2932 | virtual DeclPtrTy ActOnMethodDeclaration( | 
| Steve Naroff | bef1185 | 2007-10-26 20:53:56 +0000 | [diff] [blame] | 2933 | SourceLocation BeginLoc, // location of the + or -. | 
|  | 2934 | SourceLocation EndLoc,   // location of the ; or {. | 
| Fariborz Jahanian | 1f7b6f8 | 2007-11-09 19:52:12 +0000 | [diff] [blame] | 2935 | tok::TokenKind MethodType, | 
| Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 2936 | DeclPtrTy ClassDecl, ObjCDeclSpec &ReturnQT, TypeTy *ReturnType, | 
| Fariborz Jahanian | f1de0ca | 2007-10-31 23:53:01 +0000 | [diff] [blame] | 2937 | Selector Sel, | 
| Steve Naroff | 68d331a | 2007-09-27 14:38:14 +0000 | [diff] [blame] | 2938 | // optional arguments. The number of types/arguments is obtained | 
|  | 2939 | // from the Sel.getNumArgs(). | 
| Chris Lattner | e294d3f | 2009-04-11 18:57:04 +0000 | [diff] [blame] | 2940 | ObjCArgInfo *ArgInfo, | 
| Fariborz Jahanian | 439c658 | 2009-01-09 00:38:19 +0000 | [diff] [blame] | 2941 | llvm::SmallVectorImpl<Declarator> &Cdecls, | 
| Steve Naroff | 335eafa | 2007-11-15 12:35:21 +0000 | [diff] [blame] | 2942 | AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind, | 
|  | 2943 | bool isVariadic = false); | 
| Steve Naroff | 81bfde9 | 2007-10-16 23:12:48 +0000 | [diff] [blame] | 2944 |  | 
| Steve Naroff | f1afaf6 | 2009-02-26 15:55:06 +0000 | [diff] [blame] | 2945 | // Helper method for ActOnClassMethod/ActOnInstanceMethod. | 
|  | 2946 | // Will search "local" class/category implementations for a method decl. | 
| Fariborz Jahanian | 175ba1e | 2009-03-04 18:15:57 +0000 | [diff] [blame] | 2947 | // Will also search in class's root looking for instance method. | 
| Steve Naroff | f1afaf6 | 2009-02-26 15:55:06 +0000 | [diff] [blame] | 2948 | // Returns 0 if no method is found. | 
| Steve Naroff | 5609ec0 | 2009-03-08 18:56:13 +0000 | [diff] [blame] | 2949 | ObjCMethodDecl *LookupPrivateClassMethod(Selector Sel, | 
|  | 2950 | ObjCInterfaceDecl *CDecl); | 
|  | 2951 | ObjCMethodDecl *LookupPrivateInstanceMethod(Selector Sel, | 
|  | 2952 | ObjCInterfaceDecl *ClassDecl); | 
| Steve Naroff | f1afaf6 | 2009-02-26 15:55:06 +0000 | [diff] [blame] | 2953 |  | 
| Steve Naroff | 61f72cb | 2009-03-09 21:12:44 +0000 | [diff] [blame] | 2954 | virtual OwningExprResult ActOnClassPropertyRefExpr( | 
|  | 2955 | IdentifierInfo &receiverName, | 
|  | 2956 | IdentifierInfo &propertyName, | 
|  | 2957 | SourceLocation &receiverNameLoc, | 
|  | 2958 | SourceLocation &propertyNameLoc); | 
|  | 2959 |  | 
| Steve Naroff | 68d331a | 2007-09-27 14:38:14 +0000 | [diff] [blame] | 2960 | // ActOnClassMessage - used for both unary and keyword messages. | 
|  | 2961 | // ArgExprs is optional - if it is present, the number of expressions | 
| Steve Naroff | 49f109c | 2007-11-15 13:05:42 +0000 | [diff] [blame] | 2962 | // is obtained from NumArgs. | 
| Steve Naroff | 68d331a | 2007-09-27 14:38:14 +0000 | [diff] [blame] | 2963 | virtual ExprResult ActOnClassMessage( | 
| Fariborz Jahanian | 0523aaf | 2007-11-12 20:13:27 +0000 | [diff] [blame] | 2964 | Scope *S, | 
| Anders Carlsson | ff975cf | 2009-02-14 18:21:46 +0000 | [diff] [blame] | 2965 | IdentifierInfo *receivingClassName, Selector Sel, SourceLocation lbrac, | 
|  | 2966 | SourceLocation receiverLoc, SourceLocation selectorLoc,SourceLocation rbrac, | 
| Steve Naroff | 49f109c | 2007-11-15 13:05:42 +0000 | [diff] [blame] | 2967 | ExprTy **ArgExprs, unsigned NumArgs); | 
| Steve Naroff | 68d331a | 2007-09-27 14:38:14 +0000 | [diff] [blame] | 2968 |  | 
|  | 2969 | // ActOnInstanceMessage - used for both unary and keyword messages. | 
|  | 2970 | // ArgExprs is optional - if it is present, the number of expressions | 
| Steve Naroff | 49f109c | 2007-11-15 13:05:42 +0000 | [diff] [blame] | 2971 | // is obtained from NumArgs. | 
| Steve Naroff | 68d331a | 2007-09-27 14:38:14 +0000 | [diff] [blame] | 2972 | virtual ExprResult ActOnInstanceMessage( | 
| Steve Naroff | bcfb06a | 2007-09-28 22:22:11 +0000 | [diff] [blame] | 2973 | ExprTy *receiver, Selector Sel, | 
| Anders Carlsson | ff975cf | 2009-02-14 18:21:46 +0000 | [diff] [blame] | 2974 | SourceLocation lbrac, SourceLocation receiverLoc, SourceLocation rbrac, | 
| Steve Naroff | 49f109c | 2007-11-15 13:05:42 +0000 | [diff] [blame] | 2975 | ExprTy **ArgExprs, unsigned NumArgs); | 
| Daniel Dunbar | 4cde927 | 2008-10-14 05:35:18 +0000 | [diff] [blame] | 2976 |  | 
|  | 2977 | /// ActOnPragmaPack - Called on well formed #pragma pack(...). | 
|  | 2978 | virtual void ActOnPragmaPack(PragmaPackKind Kind, | 
|  | 2979 | IdentifierInfo *Name, | 
|  | 2980 | ExprTy *Alignment, | 
|  | 2981 | SourceLocation PragmaLoc, | 
|  | 2982 | SourceLocation LParenLoc, | 
|  | 2983 | SourceLocation RParenLoc); | 
| Chris Lattner | 574aa40 | 2009-02-17 01:09:29 +0000 | [diff] [blame] | 2984 |  | 
| Ted Kremenek | 4726d03 | 2009-03-23 22:28:25 +0000 | [diff] [blame] | 2985 | /// ActOnPragmaUnused - Called on well-formed '#pragma unused'. | 
| Ted Kremenek | 7a02a37 | 2009-08-03 23:24:57 +0000 | [diff] [blame] | 2986 | virtual void ActOnPragmaUnused(const Token *Identifiers, | 
|  | 2987 | unsigned NumIdentifiers, Scope *curScope, | 
| Ted Kremenek | 4726d03 | 2009-03-23 22:28:25 +0000 | [diff] [blame] | 2988 | SourceLocation PragmaLoc, | 
|  | 2989 | SourceLocation LParenLoc, | 
|  | 2990 | SourceLocation RParenLoc); | 
| Eli Friedman | c49f19b | 2009-06-05 02:44:36 +0000 | [diff] [blame] | 2991 |  | 
| Ryan Flynn | 7b1fdbd | 2009-07-31 02:52:19 +0000 | [diff] [blame] | 2992 | NamedDecl *DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II); | 
|  | 2993 | void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W); | 
| Ryan Flynn | e25ff83 | 2009-07-30 03:15:39 +0000 | [diff] [blame] | 2994 |  | 
| Eli Friedman | dec7c76 | 2009-06-05 06:28:29 +0000 | [diff] [blame] | 2995 | /// ActOnPragmaWeakID - Called on well formed #pragma weak ident. | 
| Eli Friedman | c49f19b | 2009-06-05 02:44:36 +0000 | [diff] [blame] | 2996 | virtual void ActOnPragmaWeakID(IdentifierInfo* WeakName, | 
|  | 2997 | SourceLocation PragmaLoc, | 
|  | 2998 | SourceLocation WeakNameLoc); | 
|  | 2999 |  | 
| Eli Friedman | dec7c76 | 2009-06-05 06:28:29 +0000 | [diff] [blame] | 3000 | /// ActOnPragmaWeakAlias - Called on well formed #pragma weak ident = ident. | 
| Eli Friedman | c49f19b | 2009-06-05 02:44:36 +0000 | [diff] [blame] | 3001 | virtual void ActOnPragmaWeakAlias(IdentifierInfo* WeakName, | 
|  | 3002 | IdentifierInfo* AliasName, | 
|  | 3003 | SourceLocation PragmaLoc, | 
|  | 3004 | SourceLocation WeakNameLoc, | 
|  | 3005 | SourceLocation AliasNameLoc); | 
|  | 3006 |  | 
| Chris Lattner | 574aa40 | 2009-02-17 01:09:29 +0000 | [diff] [blame] | 3007 | /// getPragmaPackAlignment() - Return the current alignment as specified by | 
|  | 3008 | /// the current #pragma pack directive, or 0 if none is currently active. | 
|  | 3009 | unsigned getPragmaPackAlignment() const; | 
|  | 3010 |  | 
|  | 3011 | /// FreePackedContext - Deallocate and null out PackContext. | 
|  | 3012 | void FreePackedContext(); | 
| Daniel Dunbar | 4cde927 | 2008-10-14 05:35:18 +0000 | [diff] [blame] | 3013 |  | 
| Chris Lattner | 1e0a390 | 2008-01-16 19:17:22 +0000 | [diff] [blame] | 3014 | /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit | 
|  | 3015 | /// cast.  If there is already an implicit cast, merge into the existing one. | 
| Douglas Gregor | eb8f306 | 2008-11-12 17:17:38 +0000 | [diff] [blame] | 3016 | /// If isLvalue, the result of the cast is an lvalue. | 
| Anders Carlsson | 3503d04 | 2009-07-31 01:23:52 +0000 | [diff] [blame] | 3017 | void ImpCastExprToType(Expr *&Expr, QualType Type, | 
|  | 3018 | CastExpr::CastKind Kind = CastExpr::CK_Unknown, | 
|  | 3019 | bool isLvalue = false); | 
| Chris Lattner | 1e0a390 | 2008-01-16 19:17:22 +0000 | [diff] [blame] | 3020 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3021 | // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts | 
| Chris Lattner | 925e60d | 2007-12-28 05:29:59 +0000 | [diff] [blame] | 3022 | // functions and arrays to their respective pointers (C99 6.3.2.1). | 
|  | 3023 | Expr *UsualUnaryConversions(Expr *&expr); | 
| Eli Friedman | 3c0eb16 | 2008-05-27 03:33:27 +0000 | [diff] [blame] | 3024 |  | 
| Steve Naroff | c80b4ee | 2007-07-16 21:54:35 +0000 | [diff] [blame] | 3025 | // DefaultFunctionArrayConversion - converts functions and arrays | 
|  | 3026 | // to their respective pointers (C99 6.3.2.1). | 
|  | 3027 | void DefaultFunctionArrayConversion(Expr *&expr); | 
| Steve Naroff | 90045e8 | 2007-07-13 23:32:42 +0000 | [diff] [blame] | 3028 |  | 
| Steve Naroff | b291ab6 | 2007-08-28 23:30:39 +0000 | [diff] [blame] | 3029 | // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that | 
|  | 3030 | // do not have a prototype. Integer promotions are performed on each | 
|  | 3031 | // argument, and arguments that have type float are promoted to double. | 
| Chris Lattner | 925e60d | 2007-12-28 05:29:59 +0000 | [diff] [blame] | 3032 | void DefaultArgumentPromotion(Expr *&Expr); | 
| Anders Carlsson | dce5e2c | 2009-01-16 16:48:51 +0000 | [diff] [blame] | 3033 |  | 
|  | 3034 | // Used for emitting the right warning by DefaultVariadicArgumentPromotion | 
|  | 3035 | enum VariadicCallType { | 
|  | 3036 | VariadicFunction, | 
|  | 3037 | VariadicBlock, | 
|  | 3038 | VariadicMethod | 
|  | 3039 | }; | 
|  | 3040 |  | 
|  | 3041 | // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but | 
|  | 3042 | // will warn if the resulting type is not a POD type. | 
| Chris Lattner | 312531a | 2009-04-12 08:11:20 +0000 | [diff] [blame] | 3043 | bool DefaultVariadicArgumentPromotion(Expr *&Expr, VariadicCallType CT); | 
| Steve Naroff | b291ab6 | 2007-08-28 23:30:39 +0000 | [diff] [blame] | 3044 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3045 | // UsualArithmeticConversions - performs the UsualUnaryConversions on it's | 
|  | 3046 | // operands and then handles various conversions that are common to binary | 
|  | 3047 | // operators (C99 6.3.1.8). If both operands aren't arithmetic, this | 
|  | 3048 | // routine returns the first non-arithmetic type found. The client is | 
|  | 3049 | // responsible for emitting appropriate error diagnostics. | 
| Steve Naroff | 9f5fa9b | 2007-08-24 19:07:16 +0000 | [diff] [blame] | 3050 | QualType UsualArithmeticConversions(Expr *&lExpr, Expr *&rExpr, | 
|  | 3051 | bool isCompAssign = false); | 
| Chris Lattner | b7b6115 | 2008-01-04 18:22:42 +0000 | [diff] [blame] | 3052 |  | 
| Douglas Gregor | eb8f306 | 2008-11-12 17:17:38 +0000 | [diff] [blame] | 3053 | /// UsualArithmeticConversionsType - handles the various conversions | 
|  | 3054 | /// that are common to binary operators (C99 6.3.1.8, C++ [expr]p9) | 
|  | 3055 | /// and returns the result type of that conversion. | 
|  | 3056 | QualType UsualArithmeticConversionsType(QualType lhs, QualType rhs); | 
|  | 3057 |  | 
|  | 3058 |  | 
| Chris Lattner | b7b6115 | 2008-01-04 18:22:42 +0000 | [diff] [blame] | 3059 | /// AssignConvertType - All of the 'assignment' semantic checks return this | 
|  | 3060 | /// enum to indicate whether the assignment was allowed.  These checks are | 
|  | 3061 | /// done for simple assignments, as well as initialization, return from | 
|  | 3062 | /// function, argument passing, etc.  The query is phrased in terms of a | 
|  | 3063 | /// source and destination type. | 
| Chris Lattner | 5cf216b | 2008-01-04 18:04:52 +0000 | [diff] [blame] | 3064 | enum AssignConvertType { | 
| Chris Lattner | b7b6115 | 2008-01-04 18:22:42 +0000 | [diff] [blame] | 3065 | /// Compatible - the types are compatible according to the standard. | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3066 | Compatible, | 
| Chris Lattner | b7b6115 | 2008-01-04 18:22:42 +0000 | [diff] [blame] | 3067 |  | 
|  | 3068 | /// PointerToInt - The assignment converts a pointer to an int, which we | 
|  | 3069 | /// accept as an extension. | 
|  | 3070 | PointerToInt, | 
|  | 3071 |  | 
|  | 3072 | /// IntToPointer - The assignment converts an int to a pointer, which we | 
|  | 3073 | /// accept as an extension. | 
|  | 3074 | IntToPointer, | 
|  | 3075 |  | 
|  | 3076 | /// FunctionVoidPointer - The assignment is between a function pointer and | 
|  | 3077 | /// void*, which the standard doesn't allow, but we accept as an extension. | 
| Chris Lattner | bfe639e | 2008-01-03 22:56:36 +0000 | [diff] [blame] | 3078 | FunctionVoidPointer, | 
| Chris Lattner | b7b6115 | 2008-01-04 18:22:42 +0000 | [diff] [blame] | 3079 |  | 
|  | 3080 | /// IncompatiblePointer - The assignment is between two pointers types that | 
|  | 3081 | /// are not compatible, but we accept them as an extension. | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3082 | IncompatiblePointer, | 
| Eli Friedman | f05c05d | 2009-03-22 23:59:44 +0000 | [diff] [blame] | 3083 |  | 
|  | 3084 | /// IncompatiblePointer - The assignment is between two pointers types which | 
|  | 3085 | /// point to integers which have a different sign, but are otherwise identical. | 
|  | 3086 | /// This is a subset of the above, but broken out because it's by far the most | 
|  | 3087 | /// common case of incompatible pointers. | 
|  | 3088 | IncompatiblePointerSign, | 
|  | 3089 |  | 
| Chris Lattner | b7b6115 | 2008-01-04 18:22:42 +0000 | [diff] [blame] | 3090 | /// CompatiblePointerDiscardsQualifiers - The assignment discards | 
|  | 3091 | /// c/v/r qualifiers, which we accept as an extension. | 
|  | 3092 | CompatiblePointerDiscardsQualifiers, | 
| Steve Naroff | 1c7d067 | 2008-09-04 15:10:53 +0000 | [diff] [blame] | 3093 |  | 
| Anders Carlsson | b0f90cc | 2009-01-30 23:17:46 +0000 | [diff] [blame] | 3094 | /// IncompatibleVectors - The assignment is between two vector types that | 
|  | 3095 | /// have the same size, which we accept as an extension. | 
|  | 3096 | IncompatibleVectors, | 
|  | 3097 |  | 
| Steve Naroff | bfdcae6 | 2008-09-04 15:31:07 +0000 | [diff] [blame] | 3098 | /// IntToBlockPointer - The assignment converts an int to a block | 
| Steve Naroff | 1c7d067 | 2008-09-04 15:10:53 +0000 | [diff] [blame] | 3099 | /// pointer. We disallow this. | 
|  | 3100 | IntToBlockPointer, | 
|  | 3101 |  | 
| Steve Naroff | bfdcae6 | 2008-09-04 15:31:07 +0000 | [diff] [blame] | 3102 | /// IncompatibleBlockPointer - The assignment is between two block | 
| Steve Naroff | 1c7d067 | 2008-09-04 15:10:53 +0000 | [diff] [blame] | 3103 | /// pointers types that are not compatible. | 
|  | 3104 | IncompatibleBlockPointer, | 
|  | 3105 |  | 
| Steve Naroff | 3957907 | 2008-10-14 22:18:38 +0000 | [diff] [blame] | 3106 | /// IncompatibleObjCQualifiedId - The assignment is between a qualified | 
|  | 3107 | /// id type and something else (that is incompatible with it). For example, | 
|  | 3108 | /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol. | 
|  | 3109 | IncompatibleObjCQualifiedId, | 
|  | 3110 |  | 
| Chris Lattner | b7b6115 | 2008-01-04 18:22:42 +0000 | [diff] [blame] | 3111 | /// Incompatible - We reject this conversion outright, it is invalid to | 
|  | 3112 | /// represent it in the AST. | 
|  | 3113 | Incompatible | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3114 | }; | 
| Chris Lattner | 5cf216b | 2008-01-04 18:04:52 +0000 | [diff] [blame] | 3115 |  | 
|  | 3116 | /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the | 
|  | 3117 | /// assignment conversion type specified by ConvTy.  This returns true if the | 
|  | 3118 | /// conversion was invalid or false if the conversion was accepted. | 
|  | 3119 | bool DiagnoseAssignmentResult(AssignConvertType ConvTy, | 
|  | 3120 | SourceLocation Loc, | 
|  | 3121 | QualType DstType, QualType SrcType, | 
|  | 3122 | Expr *SrcExpr, const char *Flavor); | 
|  | 3123 |  | 
|  | 3124 | /// CheckAssignmentConstraints - Perform type checking for assignment, | 
|  | 3125 | /// argument passing, variable initialization, and function return values. | 
|  | 3126 | /// This routine is only used by the following two methods. C99 6.5.16. | 
|  | 3127 | AssignConvertType CheckAssignmentConstraints(QualType lhs, QualType rhs); | 
| Steve Naroff | 90045e8 | 2007-07-13 23:32:42 +0000 | [diff] [blame] | 3128 |  | 
| Douglas Gregor | 0c74e8a | 2009-04-29 22:16:16 +0000 | [diff] [blame] | 3129 | // CheckSingleAssignmentConstraints - Currently used by | 
| Steve Naroff | 1b273c4 | 2007-09-16 14:56:35 +0000 | [diff] [blame] | 3130 | // CheckAssignmentOperands, and ActOnReturnStmt. Prior to type checking, | 
| Steve Naroff | 90045e8 | 2007-07-13 23:32:42 +0000 | [diff] [blame] | 3131 | // this routine performs the default function/array converions. | 
| Chris Lattner | 5cf216b | 2008-01-04 18:04:52 +0000 | [diff] [blame] | 3132 | AssignConvertType CheckSingleAssignmentConstraints(QualType lhs, | 
|  | 3133 | Expr *&rExpr); | 
| Douglas Gregor | 0c74e8a | 2009-04-29 22:16:16 +0000 | [diff] [blame] | 3134 |  | 
|  | 3135 | // \brief If the lhs type is a transparent union, check whether we | 
|  | 3136 | // can initialize the transparent union with the given expression. | 
|  | 3137 | AssignConvertType CheckTransparentUnionArgumentConstraints(QualType lhs, | 
|  | 3138 | Expr *&rExpr); | 
| Steve Naroff | 90045e8 | 2007-07-13 23:32:42 +0000 | [diff] [blame] | 3139 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3140 | // Helper function for CheckAssignmentConstraints (C99 6.5.16.1p1) | 
| Chris Lattner | 5cf216b | 2008-01-04 18:04:52 +0000 | [diff] [blame] | 3141 | AssignConvertType CheckPointerTypesForAssignment(QualType lhsType, | 
|  | 3142 | QualType rhsType); | 
| Steve Naroff | 1c7d067 | 2008-09-04 15:10:53 +0000 | [diff] [blame] | 3143 |  | 
|  | 3144 | // Helper function for CheckAssignmentConstraints involving two | 
| Sebastian Redl | d1bd7fc | 2009-04-19 19:26:31 +0000 | [diff] [blame] | 3145 | // block pointer types. | 
| Steve Naroff | 1c7d067 | 2008-09-04 15:10:53 +0000 | [diff] [blame] | 3146 | AssignConvertType CheckBlockPointerTypesForAssignment(QualType lhsType, | 
|  | 3147 | QualType rhsType); | 
| Douglas Gregor | 77a5223 | 2008-09-12 00:47:35 +0000 | [diff] [blame] | 3148 |  | 
|  | 3149 | bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType); | 
| Douglas Gregor | 94b1dd2 | 2008-10-24 04:54:22 +0000 | [diff] [blame] | 3150 |  | 
| Douglas Gregor | 45920e8 | 2008-12-19 17:40:08 +0000 | [diff] [blame] | 3151 | bool PerformImplicitConversion(Expr *&From, QualType ToType, | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 3152 | const char *Flavor, | 
|  | 3153 | bool AllowExplicit = false, | 
|  | 3154 | bool Elidable = false); | 
| Douglas Gregor | 09f41cf | 2009-01-14 15:45:31 +0000 | [diff] [blame] | 3155 | bool PerformImplicitConversion(Expr *&From, QualType ToType, | 
|  | 3156 | const ImplicitConversionSequence& ICS, | 
| Douglas Gregor | 45920e8 | 2008-12-19 17:40:08 +0000 | [diff] [blame] | 3157 | const char *Flavor); | 
| Douglas Gregor | 94b1dd2 | 2008-10-24 04:54:22 +0000 | [diff] [blame] | 3158 | bool PerformImplicitConversion(Expr *&From, QualType ToType, | 
| Douglas Gregor | 45920e8 | 2008-12-19 17:40:08 +0000 | [diff] [blame] | 3159 | const StandardConversionSequence& SCS, | 
|  | 3160 | const char *Flavor); | 
| Sebastian Redl | 2246050 | 2009-02-07 00:15:38 +0000 | [diff] [blame] | 3161 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3162 | /// the following "Check" methods will return a valid/converted QualType | 
|  | 3163 | /// or a null QualType (indicating an error diagnostic was issued). | 
| Sebastian Redl | 2246050 | 2009-02-07 00:15:38 +0000 | [diff] [blame] | 3164 |  | 
|  | 3165 | /// type checking binary operators (subroutines of CreateBuiltinBinOp). | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3166 | QualType InvalidOperands(SourceLocation l, Expr *&lex, Expr *&rex); | 
| Sebastian Redl | 7c8bd60 | 2009-02-07 20:10:22 +0000 | [diff] [blame] | 3167 | QualType CheckPointerToMemberOperands( // C++ 5.5 | 
| Sebastian Redl | 2246050 | 2009-02-07 00:15:38 +0000 | [diff] [blame] | 3168 | Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isIndirect); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3169 | QualType CheckMultiplyDivideOperands( // C99 6.5.5 | 
| Sebastian Redl | 2246050 | 2009-02-07 00:15:38 +0000 | [diff] [blame] | 3170 | Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3171 | QualType CheckRemainderOperands( // C99 6.5.5 | 
| Sebastian Redl | 2246050 | 2009-02-07 00:15:38 +0000 | [diff] [blame] | 3172 | Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3173 | QualType CheckAdditionOperands( // C99 6.5.6 | 
| Eli Friedman | ab3a852 | 2009-03-28 01:22:36 +0000 | [diff] [blame] | 3174 | Expr *&lex, Expr *&rex, SourceLocation OpLoc, QualType* CompLHSTy = 0); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3175 | QualType CheckSubtractionOperands( // C99 6.5.6 | 
| Eli Friedman | ab3a852 | 2009-03-28 01:22:36 +0000 | [diff] [blame] | 3176 | Expr *&lex, Expr *&rex, SourceLocation OpLoc, QualType* CompLHSTy = 0); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3177 | QualType CheckShiftOperands( // C99 6.5.7 | 
| Steve Naroff | 9f5fa9b | 2007-08-24 19:07:16 +0000 | [diff] [blame] | 3178 | Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3179 | QualType CheckCompareOperands( // C99 6.5.8/9 | 
| Douglas Gregor | a86b832 | 2009-04-06 18:45:53 +0000 | [diff] [blame] | 3180 | Expr *&lex, Expr *&rex, SourceLocation OpLoc, unsigned Opc, bool isRelational); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3181 | QualType CheckBitwiseOperands( // C99 6.5.[10...12] | 
| Sebastian Redl | 2246050 | 2009-02-07 00:15:38 +0000 | [diff] [blame] | 3182 | Expr *&lex, Expr *&rex, SourceLocation OpLoc, bool isCompAssign = false); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3183 | QualType CheckLogicalOperands( // C99 6.5.[13,14] | 
| Steve Naroff | 49b4526 | 2007-07-13 16:58:59 +0000 | [diff] [blame] | 3184 | Expr *&lex, Expr *&rex, SourceLocation OpLoc); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3185 | // CheckAssignmentOperands is used for both simple and compound assignment. | 
|  | 3186 | // For simple assignment, pass both expressions and a null converted type. | 
|  | 3187 | // For compound assignment, pass both expressions and the converted type. | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3188 | QualType CheckAssignmentOperands( // C99 6.5.16.[1,2] | 
| Steve Naroff | f1120de | 2007-08-24 22:33:52 +0000 | [diff] [blame] | 3189 | Expr *lex, Expr *&rex, SourceLocation OpLoc, QualType convertedType); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3190 | QualType CheckCommaOperands( // C99 6.5.17 | 
| Chris Lattner | 29a1cfb | 2008-11-18 01:30:42 +0000 | [diff] [blame] | 3191 | Expr *lex, Expr *&rex, SourceLocation OpLoc); | 
| Douglas Gregor | df03251 | 2009-03-12 22:46:12 +0000 | [diff] [blame] | 3192 | QualType CheckConditionalOperands( // C99 6.5.15 | 
| Steve Naroff | 49b4526 | 2007-07-13 16:58:59 +0000 | [diff] [blame] | 3193 | Expr *&cond, Expr *&lhs, Expr *&rhs, SourceLocation questionLoc); | 
| Sebastian Redl | 3201f6b | 2009-04-16 17:51:27 +0000 | [diff] [blame] | 3194 | QualType CXXCheckConditionalOperands( // C++ 5.16 | 
|  | 3195 | Expr *&cond, Expr *&lhs, Expr *&rhs, SourceLocation questionLoc); | 
| Sebastian Redl | d1bd7fc | 2009-04-19 19:26:31 +0000 | [diff] [blame] | 3196 | QualType FindCompositePointerType(Expr *&E1, Expr *&E2); // C++ 5.9 | 
| Nate Begeman | be2341d | 2008-07-14 18:02:46 +0000 | [diff] [blame] | 3197 |  | 
|  | 3198 | /// type checking for vector binary operators. | 
|  | 3199 | inline QualType CheckVectorOperands(SourceLocation l, Expr *&lex, Expr *&rex); | 
|  | 3200 | inline QualType CheckVectorCompareOperands(Expr *&lex, Expr *&rx, | 
|  | 3201 | SourceLocation l, bool isRel); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3202 |  | 
| Steve Naroff | f69936d | 2007-09-16 03:34:24 +0000 | [diff] [blame] | 3203 | /// type checking unary operators (subroutines of ActOnUnaryOp). | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3204 | /// C99 6.5.3.1, 6.5.3.2, 6.5.3.4 | 
| Sebastian Redl | e6d5a4a | 2008-12-20 09:35:34 +0000 | [diff] [blame] | 3205 | QualType CheckIncrementDecrementOperand(Expr *op, SourceLocation OpLoc, | 
|  | 3206 | bool isInc); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3207 | QualType CheckAddressOfOperand(Expr *op, SourceLocation OpLoc); | 
|  | 3208 | QualType CheckIndirectionOperand(Expr *op, SourceLocation OpLoc); | 
| Chris Lattner | ba27e2a | 2009-02-17 08:12:06 +0000 | [diff] [blame] | 3209 | QualType CheckRealImagOperand(Expr *&Op, SourceLocation OpLoc, bool isReal); | 
| Steve Naroff | e1b31fe | 2007-07-27 22:15:19 +0000 | [diff] [blame] | 3210 |  | 
|  | 3211 | /// type checking primary expressions. | 
| Nate Begeman | 213541a | 2008-04-18 23:10:10 +0000 | [diff] [blame] | 3212 | QualType CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc, | 
| Steve Naroff | e1b31fe | 2007-07-27 22:15:19 +0000 | [diff] [blame] | 3213 | IdentifierInfo &Comp, SourceLocation CmpLoc); | 
|  | 3214 |  | 
| Steve Naroff | f009063 | 2007-09-02 02:04:30 +0000 | [diff] [blame] | 3215 | /// type checking declaration initializers (C99 6.7.8) | 
| Anders Carlsson | 2078bb9 | 2009-05-27 16:10:08 +0000 | [diff] [blame] | 3216 |  | 
| Douglas Gregor | f03d7c7 | 2008-11-05 15:29:30 +0000 | [diff] [blame] | 3217 | bool CheckInitializerTypes(Expr *&simpleInit_or_initList, QualType &declType, | 
| Douglas Gregor | 09f41cf | 2009-01-14 15:45:31 +0000 | [diff] [blame] | 3218 | SourceLocation InitLoc,DeclarationName InitEntity, | 
| Anders Carlsson | 0f5f2c6 | 2009-05-30 20:41:30 +0000 | [diff] [blame] | 3219 | bool DirectInit); | 
| Douglas Gregor | c34ee5e | 2009-01-29 00:45:39 +0000 | [diff] [blame] | 3220 | bool CheckInitList(InitListExpr *&InitList, QualType &DeclType); | 
| Steve Naroff | d0091aa | 2008-01-10 22:15:12 +0000 | [diff] [blame] | 3221 | bool CheckForConstantInitializer(Expr *e, QualType t); | 
| Steve Naroff | 2fdc374 | 2007-12-10 22:44:33 +0000 | [diff] [blame] | 3222 |  | 
| Douglas Gregor | 87fd703 | 2009-02-02 17:43:21 +0000 | [diff] [blame] | 3223 | bool CheckValueInitialization(QualType Type, SourceLocation Loc); | 
| Argyrios Kyrtzidis | 6c2dc4d | 2008-08-16 20:27:34 +0000 | [diff] [blame] | 3224 |  | 
| Douglas Gregor | 27c8dc0 | 2008-10-29 00:13:59 +0000 | [diff] [blame] | 3225 | // type checking C++ declaration initializers (C++ [dcl.init]). | 
|  | 3226 |  | 
|  | 3227 | /// ReferenceCompareResult - Expresses the result of comparing two | 
|  | 3228 | /// types (cv1 T1 and cv2 T2) to determine their compatibility for the | 
|  | 3229 | /// purposes of initialization by reference (C++ [dcl.init.ref]p4). | 
|  | 3230 | enum ReferenceCompareResult { | 
|  | 3231 | /// Ref_Incompatible - The two types are incompatible, so direct | 
|  | 3232 | /// reference binding is not possible. | 
|  | 3233 | Ref_Incompatible = 0, | 
|  | 3234 | /// Ref_Related - The two types are reference-related, which means | 
|  | 3235 | /// that their unqualified forms (T1 and T2) are either the same | 
|  | 3236 | /// or T1 is a base class of T2. | 
|  | 3237 | Ref_Related, | 
|  | 3238 | /// Ref_Compatible_With_Added_Qualification - The two types are | 
|  | 3239 | /// reference-compatible with added qualification, meaning that | 
|  | 3240 | /// they are reference-compatible and the qualifiers on T1 (cv1) | 
|  | 3241 | /// are greater than the qualifiers on T2 (cv2). | 
|  | 3242 | Ref_Compatible_With_Added_Qualification, | 
|  | 3243 | /// Ref_Compatible - The two types are reference-compatible and | 
|  | 3244 | /// have equivalent qualifiers (cv1 == cv2). | 
|  | 3245 | Ref_Compatible | 
|  | 3246 | }; | 
|  | 3247 |  | 
| Douglas Gregor | 15da57e | 2008-10-29 02:00:59 +0000 | [diff] [blame] | 3248 | ReferenceCompareResult CompareReferenceRelationship(QualType T1, QualType T2, | 
|  | 3249 | bool& DerivedToBase); | 
| Douglas Gregor | 27c8dc0 | 2008-10-29 00:13:59 +0000 | [diff] [blame] | 3250 |  | 
| Sebastian Redl | 3201f6b | 2009-04-16 17:51:27 +0000 | [diff] [blame] | 3251 | bool CheckReferenceInit(Expr *&simpleInit_or_initList, QualType declType, | 
| Douglas Gregor | 225c41e | 2008-11-03 19:09:14 +0000 | [diff] [blame] | 3252 | ImplicitConversionSequence *ICS = 0, | 
| Douglas Gregor | 09f41cf | 2009-01-14 15:45:31 +0000 | [diff] [blame] | 3253 | bool SuppressUserConversions = false, | 
| Sebastian Redl | e2b6833 | 2009-04-12 17:16:29 +0000 | [diff] [blame] | 3254 | bool AllowExplicit = false, | 
|  | 3255 | bool ForceRValue = false); | 
| Douglas Gregor | 27c8dc0 | 2008-10-29 00:13:59 +0000 | [diff] [blame] | 3256 |  | 
| Sebastian Redl | 9cc11e7 | 2009-07-25 15:41:38 +0000 | [diff] [blame] | 3257 | /// CheckCastTypes - Check type constraints for casting between types under | 
| Sebastian Redl | ef0cb8e | 2009-07-29 13:50:23 +0000 | [diff] [blame] | 3258 | /// C semantics, or forward to CXXCheckCStyleCast in C++. | 
|  | 3259 | bool CheckCastTypes(SourceRange TyRange, QualType CastTy, Expr *&CastExpr, | 
| Anders Carlsson | cdb6197 | 2009-08-07 22:21:05 +0000 | [diff] [blame] | 3260 | CastExpr::CastKind &Kind, bool FunctionalStyle = false); | 
| Sebastian Redl | 9cc11e7 | 2009-07-25 15:41:38 +0000 | [diff] [blame] | 3261 |  | 
| Anders Carlsson | 584b247 | 2007-11-27 07:16:40 +0000 | [diff] [blame] | 3262 | // CheckVectorCast - check type constraints for vectors. | 
|  | 3263 | // Since vectors are an extension, there are no C standard reference for this. | 
|  | 3264 | // We allow casting between vectors and integer datatypes of the same size. | 
| Anders Carlsson | a64db8f | 2007-11-27 05:51:55 +0000 | [diff] [blame] | 3265 | // returns true if the cast is invalid | 
|  | 3266 | bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty); | 
|  | 3267 |  | 
| Nate Begeman | 58d29a4 | 2009-06-26 00:50:28 +0000 | [diff] [blame] | 3268 | // CheckExtVectorCast - check type constraints for extended vectors. | 
|  | 3269 | // Since vectors are an extension, there are no C standard reference for this. | 
|  | 3270 | // We allow casting between vectors and integer datatypes of the same size, | 
|  | 3271 | // or vectors and the element type of that vector. | 
|  | 3272 | // returns true if the cast is invalid | 
|  | 3273 | bool CheckExtVectorCast(SourceRange R, QualType VectorTy, QualType Ty); | 
| Sebastian Redl | 9cc11e7 | 2009-07-25 15:41:38 +0000 | [diff] [blame] | 3274 |  | 
|  | 3275 | /// CXXCheckCStyleCast - Check constraints of a C-style or function-style | 
|  | 3276 | /// cast under C++ semantics. | 
| Sebastian Redl | ef0cb8e | 2009-07-29 13:50:23 +0000 | [diff] [blame] | 3277 | bool CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr, | 
| Anders Carlsson | cdb6197 | 2009-08-07 22:21:05 +0000 | [diff] [blame] | 3278 | CastExpr::CastKind &Kind, bool FunctionalStyle); | 
| Sebastian Redl | 9cc11e7 | 2009-07-25 15:41:38 +0000 | [diff] [blame] | 3279 |  | 
| Daniel Dunbar | 637cebb | 2008-09-11 00:01:56 +0000 | [diff] [blame] | 3280 | /// CheckMessageArgumentTypes - Check types in an Obj-C message send. | 
|  | 3281 | /// \param Method - May be null. | 
|  | 3282 | /// \param [out] ReturnType - The return type of the send. | 
|  | 3283 | /// \return true iff there were any incompatible types. | 
| Daniel Dunbar | 91e19b2 | 2008-09-11 00:50:25 +0000 | [diff] [blame] | 3284 | bool CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs, Selector Sel, | 
| Chris Lattner | 077bf5e | 2008-11-24 03:33:13 +0000 | [diff] [blame] | 3285 | ObjCMethodDecl *Method, bool isClassMessage, | 
| Daniel Dunbar | 637cebb | 2008-09-11 00:01:56 +0000 | [diff] [blame] | 3286 | SourceLocation lbrac, SourceLocation rbrac, | 
|  | 3287 | QualType &ReturnType); | 
| Argyrios Kyrtzidis | 5921093 | 2008-09-10 02:17:11 +0000 | [diff] [blame] | 3288 |  | 
|  | 3289 | /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid. | 
|  | 3290 | bool CheckCXXBooleanCondition(Expr *&CondExpr); | 
| Sebastian Redl | 9cc11e7 | 2009-07-25 15:41:38 +0000 | [diff] [blame] | 3291 |  | 
| Chris Lattner | f4021e7 | 2007-08-23 05:46:52 +0000 | [diff] [blame] | 3292 | /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have | 
|  | 3293 | /// the specified width and sign.  If an overflow occurs, detect it and emit | 
|  | 3294 | /// the specified diagnostic. | 
|  | 3295 | void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal, | 
|  | 3296 | unsigned NewWidth, bool NewSign, | 
|  | 3297 | SourceLocation Loc, unsigned DiagID); | 
|  | 3298 |  | 
| Anders Carlsson | 1528145 | 2008-11-04 16:57:32 +0000 | [diff] [blame] | 3299 | /// Checks that the Objective-C declaration is declared in the global scope. | 
|  | 3300 | /// Emits an error and marks the declaration as invalid if it's not declared | 
|  | 3301 | /// in the global scope. | 
|  | 3302 | bool CheckObjCDeclScope(Decl *D); | 
|  | 3303 |  | 
| Anders Carlsson | 7c50aca | 2007-10-15 20:28:48 +0000 | [diff] [blame] | 3304 | void InitBuiltinVaListType(); | 
| Eli Friedman | 1b76ada | 2008-06-03 21:01:11 +0000 | [diff] [blame] | 3305 |  | 
| Anders Carlsson | e21555e | 2008-11-30 19:50:32 +0000 | [diff] [blame] | 3306 | /// VerifyIntegerConstantExpression - verifies that an expression is an ICE, | 
|  | 3307 | /// and reports the appropriate diagnostics. Returns false on success. | 
|  | 3308 | /// Can optionally return the value of the expression. | 
| Anders Carlsson | 9f1e572 | 2008-12-06 20:33:04 +0000 | [diff] [blame] | 3309 | bool VerifyIntegerConstantExpression(const Expr *E, llvm::APSInt *Result = 0); | 
| Anders Carlsson | 4000ea6 | 2008-12-01 02:17:22 +0000 | [diff] [blame] | 3310 |  | 
| Anders Carlsson | 9f1e572 | 2008-12-06 20:33:04 +0000 | [diff] [blame] | 3311 | /// VerifyBitField - verifies that a bit field expression is an ICE and has | 
|  | 3312 | /// the correct width, and that the field type is valid. | 
|  | 3313 | /// Returns false on success. | 
|  | 3314 | bool VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName, | 
|  | 3315 | QualType FieldTy, const Expr *BitWidth); | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 3316 |  | 
| Chris Lattner | 59907c4 | 2007-08-10 20:18:51 +0000 | [diff] [blame] | 3317 | //===--------------------------------------------------------------------===// | 
|  | 3318 | // Extra semantic analysis beyond the C type system | 
| Chris Lattner | 925e60d | 2007-12-28 05:29:59 +0000 | [diff] [blame] | 3319 | private: | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 3320 | Action::OwningExprResult CheckFunctionCall(FunctionDecl *FDecl, | 
|  | 3321 | CallExpr *TheCall); | 
| Fariborz Jahanian | 725165f | 2009-05-18 21:05:18 +0000 | [diff] [blame] | 3322 |  | 
|  | 3323 | Action::OwningExprResult CheckBlockCall(NamedDecl *NDecl, CallExpr *TheCall); | 
| Chris Lattner | 6080008 | 2009-02-18 17:49:48 +0000 | [diff] [blame] | 3324 | SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL, | 
|  | 3325 | unsigned ByteNo) const; | 
| Ryan Flynn | 4403a5e | 2009-08-06 03:00:50 +0000 | [diff] [blame] | 3326 | bool CheckablePrintfAttr(const FormatAttr *Format, CallExpr *TheCall); | 
| Chris Lattner | 6903981 | 2009-02-18 06:01:06 +0000 | [diff] [blame] | 3327 | bool CheckObjCString(Expr *Arg); | 
| Chris Lattner | 925e60d | 2007-12-28 05:29:59 +0000 | [diff] [blame] | 3328 | bool SemaBuiltinVAStart(CallExpr *TheCall); | 
|  | 3329 | bool SemaBuiltinUnorderedCompare(CallExpr *TheCall); | 
| Eli Friedman | 6cfda23 | 2008-05-20 08:23:37 +0000 | [diff] [blame] | 3330 | bool SemaBuiltinStackAddress(CallExpr *TheCall); | 
| Douglas Gregor | cde0173 | 2009-05-19 22:10:17 +0000 | [diff] [blame] | 3331 |  | 
|  | 3332 | public: | 
|  | 3333 | // Used by C++ template instantiation. | 
| Sebastian Redl | 0eb2330 | 2009-01-19 00:08:26 +0000 | [diff] [blame] | 3334 | Action::OwningExprResult SemaBuiltinShuffleVector(CallExpr *TheCall); | 
| Douglas Gregor | cde0173 | 2009-05-19 22:10:17 +0000 | [diff] [blame] | 3335 |  | 
|  | 3336 | private: | 
| Daniel Dunbar | 4493f79 | 2008-07-21 22:59:13 +0000 | [diff] [blame] | 3337 | bool SemaBuiltinPrefetch(CallExpr *TheCall); | 
| Eli Friedman | d875fed | 2009-05-03 04:46:36 +0000 | [diff] [blame] | 3338 | bool SemaBuiltinObjectSize(CallExpr *TheCall); | 
|  | 3339 | bool SemaBuiltinLongjmp(CallExpr *TheCall); | 
| Chris Lattner | 5caa370 | 2009-05-08 06:58:22 +0000 | [diff] [blame] | 3340 | bool SemaBuiltinAtomicOverloaded(CallExpr *TheCall); | 
| Ted Kremenek | 082d936 | 2009-03-20 21:35:28 +0000 | [diff] [blame] | 3341 | bool SemaCheckStringLiteral(const Expr *E, const CallExpr *TheCall, | 
|  | 3342 | bool HasVAListArg, unsigned format_idx, | 
|  | 3343 | unsigned firstDataArg); | 
|  | 3344 | void CheckPrintfString(const StringLiteral *FExpr, const Expr *OrigFormatExpr, | 
|  | 3345 | const CallExpr *TheCall, bool HasVAListArg, | 
| Douglas Gregor | 3c385e5 | 2009-02-14 18:57:46 +0000 | [diff] [blame] | 3346 | unsigned format_idx, unsigned firstDataArg); | 
| Fariborz Jahanian | e898f8a | 2009-05-21 18:48:51 +0000 | [diff] [blame] | 3347 | void CheckNonNullArguments(const NonNullAttr *NonNull, | 
|  | 3348 | const CallExpr *TheCall); | 
| Ted Kremenek | 082d936 | 2009-03-20 21:35:28 +0000 | [diff] [blame] | 3349 | void CheckPrintfArguments(const CallExpr *TheCall, bool HasVAListArg, | 
| Douglas Gregor | 3c385e5 | 2009-02-14 18:57:46 +0000 | [diff] [blame] | 3350 | unsigned format_idx, unsigned firstDataArg); | 
| Ted Kremenek | 06de276 | 2007-08-17 16:46:58 +0000 | [diff] [blame] | 3351 | void CheckReturnStackAddr(Expr *RetValExp, QualType lhsType, | 
|  | 3352 | SourceLocation ReturnLoc); | 
| Ted Kremenek | 588e5eb | 2007-11-25 00:58:00 +0000 | [diff] [blame] | 3353 | void CheckFloatComparison(SourceLocation loc, Expr* lex, Expr* rex); | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3354 | }; | 
|  | 3355 |  | 
| Mike Stump | b83d287 | 2009-02-19 22:01:56 +0000 | [diff] [blame] | 3356 |  | 
| Ted Kremenek | 8189cde | 2009-02-07 01:47:29 +0000 | [diff] [blame] | 3357 | //===--------------------------------------------------------------------===// | 
|  | 3358 | // Typed version of Parser::ExprArg (smart pointer for wrapping Expr pointers). | 
|  | 3359 | template <typename T> | 
|  | 3360 | class ExprOwningPtr : public Action::ExprArg { | 
|  | 3361 | public: | 
| Douglas Gregor | a0e500d | 2009-03-12 16:53:44 +0000 | [diff] [blame] | 3362 | ExprOwningPtr(Sema *S, T *expr) : Action::ExprArg(*S, expr) {} | 
| Ted Kremenek | 8189cde | 2009-02-07 01:47:29 +0000 | [diff] [blame] | 3363 |  | 
|  | 3364 | void reset(T* p) { Action::ExprArg::operator=(p); } | 
|  | 3365 | T* get() const { return static_cast<T*>(Action::ExprArg::get()); } | 
|  | 3366 | T* take() { return static_cast<T*>(Action::ExprArg::take()); } | 
|  | 3367 | T* release() { return take(); } | 
|  | 3368 |  | 
|  | 3369 | T& operator*() const { return *get(); } | 
|  | 3370 | T* operator->() const { return get(); } | 
|  | 3371 | }; | 
| Douglas Gregor | d7e2705 | 2009-05-20 22:33:37 +0000 | [diff] [blame] | 3372 |  | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 3373 | }  // end namespace clang | 
|  | 3374 |  | 
|  | 3375 | #endif |