Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 1 | //===--- DeclBase.cpp - Declaration AST Node Implementation ---------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements the Decl and DeclContext classes. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "clang/AST/DeclBase.h" |
Daniel Dunbar | e91593e | 2008-08-11 04:54:23 +0000 | [diff] [blame] | 15 | #include "clang/AST/DeclObjC.h" |
Argyrios Kyrtzidis | d3bb44f | 2008-06-09 21:05:31 +0000 | [diff] [blame] | 16 | #include "clang/AST/DeclCXX.h" |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 17 | #include "clang/AST/ASTContext.h" |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 18 | #include "clang/AST/Type.h" |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/DenseMap.h" |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 20 | #include <vector> |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 21 | using namespace clang; |
| 22 | |
| 23 | //===----------------------------------------------------------------------===// |
| 24 | // Statistics |
| 25 | //===----------------------------------------------------------------------===// |
| 26 | |
| 27 | // temporary statistics gathering |
| 28 | static unsigned nFuncs = 0; |
| 29 | static unsigned nVars = 0; |
| 30 | static unsigned nParmVars = 0; |
Fariborz Jahanian | 4f5420d | 2008-12-20 21:06:28 +0000 | [diff] [blame] | 31 | static unsigned nOriginalParmVars = 0; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 32 | static unsigned nSUC = 0; |
Argyrios Kyrtzidis | 55d71f9 | 2008-08-10 01:47:31 +0000 | [diff] [blame] | 33 | static unsigned nCXXSUC = 0; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 34 | static unsigned nEnumConst = 0; |
| 35 | static unsigned nEnumDecls = 0; |
| 36 | static unsigned nNamespaces = 0; |
Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 37 | static unsigned nOverFuncs = 0; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 38 | static unsigned nTypedef = 0; |
| 39 | static unsigned nFieldDecls = 0; |
| 40 | static unsigned nInterfaceDecls = 0; |
| 41 | static unsigned nClassDecls = 0; |
| 42 | static unsigned nMethodDecls = 0; |
| 43 | static unsigned nProtocolDecls = 0; |
| 44 | static unsigned nForwardProtocolDecls = 0; |
| 45 | static unsigned nCategoryDecls = 0; |
| 46 | static unsigned nIvarDecls = 0; |
Ted Kremenek | 01e6779 | 2008-08-20 03:26:33 +0000 | [diff] [blame] | 47 | static unsigned nAtDefsFieldDecls = 0; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 48 | static unsigned nObjCImplementationDecls = 0; |
| 49 | static unsigned nObjCCategoryImpl = 0; |
| 50 | static unsigned nObjCCompatibleAlias = 0; |
| 51 | static unsigned nObjCPropertyDecl = 0; |
| 52 | static unsigned nObjCPropertyImplDecl = 0; |
| 53 | static unsigned nLinkageSpecDecl = 0; |
| 54 | static unsigned nFileScopeAsmDecl = 0; |
Steve Naroff | 56ee689 | 2008-10-08 17:01:13 +0000 | [diff] [blame] | 55 | static unsigned nBlockDecls = 0; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 56 | |
| 57 | static bool StatSwitch = false; |
| 58 | |
| 59 | // This keeps track of all decl attributes. Since so few decls have attrs, we |
| 60 | // keep them in a hash map instead of wasting space in the Decl class. |
| 61 | typedef llvm::DenseMap<const Decl*, Attr*> DeclAttrMapTy; |
| 62 | |
| 63 | static DeclAttrMapTy *DeclAttrs = 0; |
| 64 | |
| 65 | const char *Decl::getDeclKindName() const { |
| 66 | switch (DeclKind) { |
| 67 | default: assert(0 && "Unknown decl kind!"); |
| 68 | case Namespace: return "Namespace"; |
Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 69 | case OverloadedFunction: return "OverloadedFunction"; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 70 | case Typedef: return "Typedef"; |
| 71 | case Function: return "Function"; |
| 72 | case Var: return "Var"; |
| 73 | case ParmVar: return "ParmVar"; |
Fariborz Jahanian | 4f5420d | 2008-12-20 21:06:28 +0000 | [diff] [blame] | 74 | case OriginalParmVar: return "OriginalParmVar"; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 75 | case EnumConstant: return "EnumConstant"; |
| 76 | case ObjCIvar: return "ObjCIvar"; |
| 77 | case ObjCInterface: return "ObjCInterface"; |
Steve Naroff | d40910b | 2008-12-01 20:33:01 +0000 | [diff] [blame] | 78 | case ObjCImplementation: return "ObjCImplementation"; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 79 | case ObjCClass: return "ObjCClass"; |
| 80 | case ObjCMethod: return "ObjCMethod"; |
| 81 | case ObjCProtocol: return "ObjCProtocol"; |
Steve Naroff | d40910b | 2008-12-01 20:33:01 +0000 | [diff] [blame] | 82 | case ObjCProperty: return "ObjCProperty"; |
| 83 | case ObjCPropertyImpl: return "ObjCPropertyImpl"; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 84 | case ObjCForwardProtocol: return "ObjCForwardProtocol"; |
Argyrios Kyrtzidis | 35bc082 | 2008-10-15 00:42:39 +0000 | [diff] [blame] | 85 | case Record: return "Record"; |
| 86 | case CXXRecord: return "CXXRecord"; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 87 | case Enum: return "Enum"; |
Steve Naroff | 56ee689 | 2008-10-08 17:01:13 +0000 | [diff] [blame] | 88 | case Block: return "Block"; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 89 | } |
| 90 | } |
| 91 | |
| 92 | bool Decl::CollectingStats(bool Enable) { |
| 93 | if (Enable) |
| 94 | StatSwitch = true; |
| 95 | return StatSwitch; |
| 96 | } |
| 97 | |
| 98 | void Decl::PrintStats() { |
| 99 | fprintf(stderr, "*** Decl Stats:\n"); |
| 100 | fprintf(stderr, " %d decls total.\n", |
Fariborz Jahanian | 4f5420d | 2008-12-20 21:06:28 +0000 | [diff] [blame] | 101 | int(nFuncs+nVars+nParmVars+nOriginalParmVars+nFieldDecls+nSUC+nCXXSUC+ |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 102 | nEnumDecls+nEnumConst+nTypedef+nInterfaceDecls+nClassDecls+ |
| 103 | nMethodDecls+nProtocolDecls+nCategoryDecls+nIvarDecls+ |
Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 104 | nAtDefsFieldDecls+nNamespaces+nOverFuncs)); |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 105 | fprintf(stderr, " %d namespace decls, %d each (%d bytes)\n", |
| 106 | nNamespaces, (int)sizeof(NamespaceDecl), |
| 107 | int(nNamespaces*sizeof(NamespaceDecl))); |
Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 108 | fprintf(stderr, " %d overloaded function decls, %d each (%d bytes)\n", |
| 109 | nOverFuncs, (int)sizeof(OverloadedFunctionDecl), |
| 110 | int(nOverFuncs*sizeof(OverloadedFunctionDecl))); |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 111 | fprintf(stderr, " %d function decls, %d each (%d bytes)\n", |
| 112 | nFuncs, (int)sizeof(FunctionDecl), int(nFuncs*sizeof(FunctionDecl))); |
| 113 | fprintf(stderr, " %d variable decls, %d each (%d bytes)\n", |
| 114 | nVars, (int)sizeof(VarDecl), |
| 115 | int(nVars*sizeof(VarDecl))); |
| 116 | fprintf(stderr, " %d parameter variable decls, %d each (%d bytes)\n", |
| 117 | nParmVars, (int)sizeof(ParmVarDecl), |
| 118 | int(nParmVars*sizeof(ParmVarDecl))); |
Fariborz Jahanian | 4f5420d | 2008-12-20 21:06:28 +0000 | [diff] [blame] | 119 | fprintf(stderr, " %d original parameter variable decls, %d each (%d bytes)\n", |
| 120 | nOriginalParmVars, (int)sizeof(ParmVarWithOriginalTypeDecl), |
| 121 | int(nOriginalParmVars*sizeof(ParmVarWithOriginalTypeDecl))); |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 122 | fprintf(stderr, " %d field decls, %d each (%d bytes)\n", |
| 123 | nFieldDecls, (int)sizeof(FieldDecl), |
| 124 | int(nFieldDecls*sizeof(FieldDecl))); |
Ted Kremenek | 01e6779 | 2008-08-20 03:26:33 +0000 | [diff] [blame] | 125 | fprintf(stderr, " %d @defs generated field decls, %d each (%d bytes)\n", |
| 126 | nAtDefsFieldDecls, (int)sizeof(ObjCAtDefsFieldDecl), |
| 127 | int(nAtDefsFieldDecls*sizeof(ObjCAtDefsFieldDecl))); |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 128 | fprintf(stderr, " %d struct/union/class decls, %d each (%d bytes)\n", |
| 129 | nSUC, (int)sizeof(RecordDecl), |
| 130 | int(nSUC*sizeof(RecordDecl))); |
Argyrios Kyrtzidis | 55d71f9 | 2008-08-10 01:47:31 +0000 | [diff] [blame] | 131 | fprintf(stderr, " %d C++ struct/union/class decls, %d each (%d bytes)\n", |
| 132 | nCXXSUC, (int)sizeof(CXXRecordDecl), |
| 133 | int(nCXXSUC*sizeof(CXXRecordDecl))); |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 134 | fprintf(stderr, " %d enum decls, %d each (%d bytes)\n", |
| 135 | nEnumDecls, (int)sizeof(EnumDecl), |
| 136 | int(nEnumDecls*sizeof(EnumDecl))); |
| 137 | fprintf(stderr, " %d enum constant decls, %d each (%d bytes)\n", |
| 138 | nEnumConst, (int)sizeof(EnumConstantDecl), |
| 139 | int(nEnumConst*sizeof(EnumConstantDecl))); |
| 140 | fprintf(stderr, " %d typedef decls, %d each (%d bytes)\n", |
| 141 | nTypedef, (int)sizeof(TypedefDecl),int(nTypedef*sizeof(TypedefDecl))); |
| 142 | // Objective-C decls... |
| 143 | fprintf(stderr, " %d interface decls, %d each (%d bytes)\n", |
| 144 | nInterfaceDecls, (int)sizeof(ObjCInterfaceDecl), |
| 145 | int(nInterfaceDecls*sizeof(ObjCInterfaceDecl))); |
| 146 | fprintf(stderr, " %d instance variable decls, %d each (%d bytes)\n", |
| 147 | nIvarDecls, (int)sizeof(ObjCIvarDecl), |
| 148 | int(nIvarDecls*sizeof(ObjCIvarDecl))); |
| 149 | fprintf(stderr, " %d class decls, %d each (%d bytes)\n", |
| 150 | nClassDecls, (int)sizeof(ObjCClassDecl), |
| 151 | int(nClassDecls*sizeof(ObjCClassDecl))); |
| 152 | fprintf(stderr, " %d method decls, %d each (%d bytes)\n", |
| 153 | nMethodDecls, (int)sizeof(ObjCMethodDecl), |
| 154 | int(nMethodDecls*sizeof(ObjCMethodDecl))); |
| 155 | fprintf(stderr, " %d protocol decls, %d each (%d bytes)\n", |
| 156 | nProtocolDecls, (int)sizeof(ObjCProtocolDecl), |
| 157 | int(nProtocolDecls*sizeof(ObjCProtocolDecl))); |
| 158 | fprintf(stderr, " %d forward protocol decls, %d each (%d bytes)\n", |
| 159 | nForwardProtocolDecls, (int)sizeof(ObjCForwardProtocolDecl), |
| 160 | int(nForwardProtocolDecls*sizeof(ObjCForwardProtocolDecl))); |
| 161 | fprintf(stderr, " %d category decls, %d each (%d bytes)\n", |
| 162 | nCategoryDecls, (int)sizeof(ObjCCategoryDecl), |
| 163 | int(nCategoryDecls*sizeof(ObjCCategoryDecl))); |
| 164 | |
| 165 | fprintf(stderr, " %d class implementation decls, %d each (%d bytes)\n", |
| 166 | nObjCImplementationDecls, (int)sizeof(ObjCImplementationDecl), |
| 167 | int(nObjCImplementationDecls*sizeof(ObjCImplementationDecl))); |
| 168 | |
| 169 | fprintf(stderr, " %d class implementation decls, %d each (%d bytes)\n", |
| 170 | nObjCCategoryImpl, (int)sizeof(ObjCCategoryImplDecl), |
| 171 | int(nObjCCategoryImpl*sizeof(ObjCCategoryImplDecl))); |
| 172 | |
| 173 | fprintf(stderr, " %d compatibility alias decls, %d each (%d bytes)\n", |
| 174 | nObjCCompatibleAlias, (int)sizeof(ObjCCompatibleAliasDecl), |
| 175 | int(nObjCCompatibleAlias*sizeof(ObjCCompatibleAliasDecl))); |
| 176 | |
| 177 | fprintf(stderr, " %d property decls, %d each (%d bytes)\n", |
| 178 | nObjCPropertyDecl, (int)sizeof(ObjCPropertyDecl), |
| 179 | int(nObjCPropertyDecl*sizeof(ObjCPropertyDecl))); |
| 180 | |
| 181 | fprintf(stderr, " %d property implementation decls, %d each (%d bytes)\n", |
| 182 | nObjCPropertyImplDecl, (int)sizeof(ObjCPropertyImplDecl), |
| 183 | int(nObjCPropertyImplDecl*sizeof(ObjCPropertyImplDecl))); |
| 184 | |
| 185 | fprintf(stderr, "Total bytes = %d\n", |
| 186 | int(nFuncs*sizeof(FunctionDecl)+ |
| 187 | nVars*sizeof(VarDecl)+nParmVars*sizeof(ParmVarDecl)+ |
Fariborz Jahanian | 4f5420d | 2008-12-20 21:06:28 +0000 | [diff] [blame] | 188 | nOriginalParmVars*sizeof(ParmVarWithOriginalTypeDecl)+ |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 189 | nFieldDecls*sizeof(FieldDecl)+nSUC*sizeof(RecordDecl)+ |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 190 | nCXXSUC*sizeof(CXXRecordDecl)+ |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 191 | nEnumDecls*sizeof(EnumDecl)+nEnumConst*sizeof(EnumConstantDecl)+ |
| 192 | nTypedef*sizeof(TypedefDecl)+ |
| 193 | nInterfaceDecls*sizeof(ObjCInterfaceDecl)+ |
| 194 | nIvarDecls*sizeof(ObjCIvarDecl)+ |
| 195 | nClassDecls*sizeof(ObjCClassDecl)+ |
| 196 | nMethodDecls*sizeof(ObjCMethodDecl)+ |
| 197 | nProtocolDecls*sizeof(ObjCProtocolDecl)+ |
| 198 | nForwardProtocolDecls*sizeof(ObjCForwardProtocolDecl)+ |
| 199 | nCategoryDecls*sizeof(ObjCCategoryDecl)+ |
| 200 | nObjCImplementationDecls*sizeof(ObjCImplementationDecl)+ |
| 201 | nObjCCategoryImpl*sizeof(ObjCCategoryImplDecl)+ |
| 202 | nObjCCompatibleAlias*sizeof(ObjCCompatibleAliasDecl)+ |
| 203 | nObjCPropertyDecl*sizeof(ObjCPropertyDecl)+ |
| 204 | nObjCPropertyImplDecl*sizeof(ObjCPropertyImplDecl)+ |
| 205 | nLinkageSpecDecl*sizeof(LinkageSpecDecl)+ |
| 206 | nFileScopeAsmDecl*sizeof(FileScopeAsmDecl)+ |
Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 207 | nNamespaces*sizeof(NamespaceDecl)+ |
| 208 | nOverFuncs*sizeof(OverloadedFunctionDecl))); |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 209 | |
| 210 | } |
| 211 | |
| 212 | void Decl::addDeclKind(Kind k) { |
| 213 | switch (k) { |
| 214 | case Namespace: nNamespaces++; break; |
Douglas Gregor | 8e9bebd | 2008-10-21 16:13:35 +0000 | [diff] [blame] | 215 | case OverloadedFunction: nOverFuncs++; break; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 216 | case Typedef: nTypedef++; break; |
| 217 | case Function: nFuncs++; break; |
| 218 | case Var: nVars++; break; |
| 219 | case ParmVar: nParmVars++; break; |
Fariborz Jahanian | 4f5420d | 2008-12-20 21:06:28 +0000 | [diff] [blame] | 220 | case OriginalParmVar: nOriginalParmVars++; break; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 221 | case EnumConstant: nEnumConst++; break; |
| 222 | case Field: nFieldDecls++; break; |
Argyrios Kyrtzidis | 35bc082 | 2008-10-15 00:42:39 +0000 | [diff] [blame] | 223 | case Record: nSUC++; break; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 224 | case Enum: nEnumDecls++; break; |
| 225 | case ObjCInterface: nInterfaceDecls++; break; |
| 226 | case ObjCClass: nClassDecls++; break; |
| 227 | case ObjCMethod: nMethodDecls++; break; |
| 228 | case ObjCProtocol: nProtocolDecls++; break; |
| 229 | case ObjCForwardProtocol: nForwardProtocolDecls++; break; |
| 230 | case ObjCCategory: nCategoryDecls++; break; |
| 231 | case ObjCIvar: nIvarDecls++; break; |
Ted Kremenek | 01e6779 | 2008-08-20 03:26:33 +0000 | [diff] [blame] | 232 | case ObjCAtDefsField: nAtDefsFieldDecls++; break; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 233 | case ObjCImplementation: nObjCImplementationDecls++; break; |
| 234 | case ObjCCategoryImpl: nObjCCategoryImpl++; break; |
| 235 | case ObjCCompatibleAlias: nObjCCompatibleAlias++; break; |
| 236 | case ObjCProperty: nObjCPropertyDecl++; break; |
| 237 | case ObjCPropertyImpl: nObjCPropertyImplDecl++; break; |
| 238 | case LinkageSpec: nLinkageSpecDecl++; break; |
| 239 | case FileScopeAsm: nFileScopeAsmDecl++; break; |
Steve Naroff | 56ee689 | 2008-10-08 17:01:13 +0000 | [diff] [blame] | 240 | case Block: nBlockDecls++; break; |
Chris Lattner | 4111024 | 2008-06-17 18:05:57 +0000 | [diff] [blame] | 241 | case ImplicitParam: |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 242 | case TranslationUnit: break; |
Argyrios Kyrtzidis | d3bb44f | 2008-06-09 21:05:31 +0000 | [diff] [blame] | 243 | |
Argyrios Kyrtzidis | 35bc082 | 2008-10-15 00:42:39 +0000 | [diff] [blame] | 244 | case CXXRecord: nCXXSUC++; break; |
Argyrios Kyrtzidis | d3bb44f | 2008-06-09 21:05:31 +0000 | [diff] [blame] | 245 | // FIXME: Statistics for C++ decls. |
Douglas Gregor | 72c3f31 | 2008-12-05 18:15:24 +0000 | [diff] [blame] | 246 | case TemplateTypeParm: |
| 247 | case NonTypeTemplateParm: |
Argyrios Kyrtzidis | d3bb44f | 2008-06-09 21:05:31 +0000 | [diff] [blame] | 248 | case CXXMethod: |
Douglas Gregor | b48fe38 | 2008-10-31 09:07:45 +0000 | [diff] [blame] | 249 | case CXXConstructor: |
Douglas Gregor | 42a552f | 2008-11-05 20:51:48 +0000 | [diff] [blame] | 250 | case CXXDestructor: |
Douglas Gregor | 2f1bc52 | 2008-11-07 20:08:42 +0000 | [diff] [blame] | 251 | case CXXConversion: |
Argyrios Kyrtzidis | d3bb44f | 2008-06-09 21:05:31 +0000 | [diff] [blame] | 252 | case CXXClassVar: |
| 253 | break; |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 254 | } |
| 255 | } |
| 256 | |
| 257 | //===----------------------------------------------------------------------===// |
| 258 | // Decl Implementation |
| 259 | //===----------------------------------------------------------------------===// |
| 260 | |
| 261 | // Out-of-line virtual method providing a home for Decl. |
| 262 | Decl::~Decl() { |
| 263 | if (!HasAttrs) |
| 264 | return; |
| 265 | |
| 266 | DeclAttrMapTy::iterator it = DeclAttrs->find(this); |
| 267 | assert(it != DeclAttrs->end() && "No attrs found but HasAttrs is true!"); |
| 268 | |
| 269 | // release attributes. |
| 270 | delete it->second; |
| 271 | invalidateAttrs(); |
| 272 | } |
| 273 | |
| 274 | void Decl::addAttr(Attr *NewAttr) { |
| 275 | if (!DeclAttrs) |
| 276 | DeclAttrs = new DeclAttrMapTy(); |
| 277 | |
| 278 | Attr *&ExistingAttr = (*DeclAttrs)[this]; |
| 279 | |
| 280 | NewAttr->setNext(ExistingAttr); |
| 281 | ExistingAttr = NewAttr; |
| 282 | |
| 283 | HasAttrs = true; |
| 284 | } |
| 285 | |
| 286 | void Decl::invalidateAttrs() { |
| 287 | if (!HasAttrs) return; |
| 288 | |
| 289 | HasAttrs = false; |
| 290 | (*DeclAttrs)[this] = 0; |
| 291 | DeclAttrs->erase(this); |
| 292 | |
| 293 | if (DeclAttrs->empty()) { |
| 294 | delete DeclAttrs; |
| 295 | DeclAttrs = 0; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | const Attr *Decl::getAttrs() const { |
| 300 | if (!HasAttrs) |
| 301 | return 0; |
| 302 | |
| 303 | return (*DeclAttrs)[this]; |
| 304 | } |
| 305 | |
| 306 | void Decl::swapAttrs(Decl *RHS) { |
| 307 | bool HasLHSAttr = this->HasAttrs; |
| 308 | bool HasRHSAttr = RHS->HasAttrs; |
| 309 | |
| 310 | // Usually, neither decl has attrs, nothing to do. |
| 311 | if (!HasLHSAttr && !HasRHSAttr) return; |
| 312 | |
| 313 | // If 'this' has no attrs, swap the other way. |
| 314 | if (!HasLHSAttr) |
| 315 | return RHS->swapAttrs(this); |
| 316 | |
| 317 | // Handle the case when both decls have attrs. |
| 318 | if (HasRHSAttr) { |
| 319 | std::swap((*DeclAttrs)[this], (*DeclAttrs)[RHS]); |
| 320 | return; |
| 321 | } |
| 322 | |
| 323 | // Otherwise, LHS has an attr and RHS doesn't. |
| 324 | (*DeclAttrs)[RHS] = (*DeclAttrs)[this]; |
| 325 | (*DeclAttrs).erase(this); |
| 326 | this->HasAttrs = false; |
| 327 | RHS->HasAttrs = true; |
| 328 | } |
| 329 | |
| 330 | |
| 331 | void Decl::Destroy(ASTContext& C) { |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 332 | if (ScopedDecl* SD = dyn_cast<ScopedDecl>(this)) { |
| 333 | |
| 334 | // Observe the unrolled recursion. By setting N->NextDeclarator = 0x0 |
| 335 | // within the loop, only the Destroy method for the first ScopedDecl |
| 336 | // will deallocate all of the ScopedDecls in a chain. |
| 337 | |
| 338 | ScopedDecl* N = SD->getNextDeclarator(); |
| 339 | |
| 340 | while (N) { |
| 341 | ScopedDecl* Tmp = N->getNextDeclarator(); |
| 342 | N->NextDeclarator = 0x0; |
| 343 | N->Destroy(C); |
| 344 | N = Tmp; |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | this->~Decl(); |
| 349 | C.getAllocator().Deallocate((void *)this); |
| 350 | } |
| 351 | |
Argyrios Kyrtzidis | 42220c5 | 2008-10-12 16:14:48 +0000 | [diff] [blame] | 352 | Decl *Decl::castFromDeclContext (const DeclContext *D) { |
| 353 | return DeclContext::CastTo<Decl>(D); |
| 354 | } |
| 355 | |
| 356 | DeclContext *Decl::castToDeclContext(const Decl *D) { |
| 357 | return DeclContext::CastTo<DeclContext>(D); |
| 358 | } |
| 359 | |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 360 | //===----------------------------------------------------------------------===// |
| 361 | // DeclContext Implementation |
| 362 | //===----------------------------------------------------------------------===// |
| 363 | |
Argyrios Kyrtzidis | 20bc676 | 2008-11-19 17:36:39 +0000 | [diff] [blame] | 364 | const DeclContext *DeclContext::getParent() const { |
| 365 | if (const ScopedDecl *SD = dyn_cast<ScopedDecl>(this)) |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 366 | return SD->getDeclContext(); |
Argyrios Kyrtzidis | 20bc676 | 2008-11-19 17:36:39 +0000 | [diff] [blame] | 367 | else if (const BlockDecl *BD = dyn_cast<BlockDecl>(this)) |
Steve Naroff | 090276f | 2008-10-10 01:28:17 +0000 | [diff] [blame] | 368 | return BD->getParentContext(); |
Eli Friedman | 56d2937 | 2008-06-07 16:52:53 +0000 | [diff] [blame] | 369 | else |
| 370 | return NULL; |
| 371 | } |
Argyrios Kyrtzidis | 77407b8 | 2008-11-19 18:01:13 +0000 | [diff] [blame] | 372 | |
| 373 | const DeclContext *DeclContext::getLexicalParent() const { |
| 374 | if (const ScopedDecl *SD = dyn_cast<ScopedDecl>(this)) |
| 375 | return SD->getLexicalDeclContext(); |
Argyrios Kyrtzidis | 051c13a | 2008-11-19 18:07:24 +0000 | [diff] [blame] | 376 | return getParent(); |
Argyrios Kyrtzidis | 77407b8 | 2008-11-19 18:01:13 +0000 | [diff] [blame] | 377 | } |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 378 | |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 379 | // FIXME: We really want to use a DenseSet here to eliminate the |
| 380 | // redundant storage of the declaration names, but (1) it doesn't give |
| 381 | // us the ability to search based on DeclarationName, (2) we really |
| 382 | // need something more like a DenseMultiSet, and (3) it's |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 383 | // implemented in terms of DenseMap anyway. However, this data |
| 384 | // structure is really space-inefficient, so we'll have to do |
| 385 | // something. |
| 386 | typedef llvm::DenseMap<DeclarationName, std::vector<ScopedDecl*> > |
| 387 | StoredDeclsMap; |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 388 | |
| 389 | DeclContext::~DeclContext() { |
| 390 | unsigned Size = LookupPtr.getInt(); |
| 391 | if (Size == LookupIsMap) { |
| 392 | StoredDeclsMap *Map = static_cast<StoredDeclsMap*>(LookupPtr.getPointer()); |
| 393 | delete Map; |
| 394 | } else { |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 395 | ScopedDecl **Array = static_cast<ScopedDecl**>(LookupPtr.getPointer()); |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 396 | delete [] Array; |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | void DeclContext::DestroyDecls(ASTContext &C) { |
| 401 | for (decl_iterator D = Decls.begin(); D != Decls.end(); ++D) { |
| 402 | if ((*D)->getLexicalDeclContext() == this) |
| 403 | (*D)->Destroy(C); |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | DeclContext *DeclContext::getPrimaryContext(ASTContext &Context) { |
| 408 | switch (DeclKind) { |
| 409 | case Decl::Block: |
| 410 | case Decl::TranslationUnit: |
| 411 | // There is only one DeclContext for these entities. |
| 412 | return this; |
| 413 | |
| 414 | case Decl::Namespace: |
| 415 | // The original namespace is our primary context. |
| 416 | return static_cast<NamespaceDecl*>(this)->getOriginalNamespace(); |
| 417 | |
| 418 | case Decl::Enum: |
| 419 | // The declaration associated with the enumeration type is our |
| 420 | // primary context. |
| 421 | return Context.getTypeDeclType(static_cast<EnumDecl*>(this)) |
| 422 | ->getAsEnumType()->getDecl(); |
| 423 | |
| 424 | case Decl::Record: |
| 425 | case Decl::CXXRecord: { |
| 426 | // The declaration associated with the type is be our primary |
| 427 | // context. |
| 428 | #if 0 |
| 429 | // FIXME: This is what we expect to do. However, it doesn't work |
| 430 | // because ASTContext::setTagDefinition changes the result of |
| 431 | // Context.getTypeDeclType, meaning that our "primary" declaration |
| 432 | // of a RecordDecl/CXXRecordDecl will change, and we won't be able |
| 433 | // to find any values inserted into the earlier "primary" |
| 434 | // declaration. We need better tracking of redeclarations and |
| 435 | // definitions. |
| 436 | QualType Type = Context.getTypeDeclType(static_cast<RecordDecl*>(this)); |
| 437 | return Type->getAsRecordType()->getDecl(); |
| 438 | #else |
| 439 | // FIXME: This hack will work for now, because the declaration we |
| 440 | // create when we're defining the record is the one we'll use as |
| 441 | // the definition later. |
| 442 | return this; |
| 443 | #endif |
| 444 | } |
| 445 | |
| 446 | case Decl::ObjCMethod: |
| 447 | return this; |
| 448 | |
| 449 | case Decl::ObjCInterface: |
| 450 | // FIXME: Can Objective-C interfaces be forward-declared? |
| 451 | return this; |
| 452 | |
| 453 | default: |
| 454 | assert(DeclKind >= Decl::FunctionFirst && DeclKind <= Decl::FunctionLast && |
| 455 | "Unknown DeclContext kind"); |
| 456 | return this; |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | DeclContext *DeclContext::getNextContext() { |
| 461 | switch (DeclKind) { |
| 462 | case Decl::Block: |
| 463 | case Decl::TranslationUnit: |
| 464 | case Decl::Enum: |
| 465 | case Decl::Record: |
| 466 | case Decl::CXXRecord: |
| 467 | case Decl::ObjCMethod: |
| 468 | case Decl::ObjCInterface: |
| 469 | // There is only one DeclContext for these entities. |
| 470 | return 0; |
| 471 | |
| 472 | case Decl::Namespace: |
| 473 | // Return the next namespace |
| 474 | return static_cast<NamespaceDecl*>(this)->getNextNamespace(); |
| 475 | |
| 476 | default: |
| 477 | assert(DeclKind >= Decl::FunctionFirst && DeclKind <= Decl::FunctionLast && |
| 478 | "Unknown DeclContext kind"); |
| 479 | return 0; |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | void DeclContext::addDecl(ASTContext &Context, ScopedDecl *D, bool AllowLookup) { |
| 484 | Decls.push_back(D); |
| 485 | if (AllowLookup) |
| 486 | D->getDeclContext()->insert(Context, D); |
| 487 | } |
| 488 | |
| 489 | DeclContext::lookup_result |
| 490 | DeclContext::lookup(ASTContext &Context, DeclarationName Name) { |
| 491 | DeclContext *PrimaryContext = getPrimaryContext(Context); |
| 492 | if (PrimaryContext != this) |
| 493 | return PrimaryContext->lookup(Context, Name); |
| 494 | |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 495 | /// If there is no lookup data structure, build one now by walking |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 496 | /// all of the linked DeclContexts (in declaration order!) and |
| 497 | /// inserting their values. |
| 498 | if (LookupPtr.getPointer() == 0) { |
| 499 | for (DeclContext *DCtx = this; DCtx; DCtx = DCtx->getNextContext()) |
| 500 | for (decl_iterator D = DCtx->decls_begin(); D != DCtx->decls_end(); ++D) |
| 501 | insertImpl(*D); |
| 502 | } |
| 503 | |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 504 | if (isLookupMap()) { |
| 505 | StoredDeclsMap *Map = static_cast<StoredDeclsMap*>(LookupPtr.getPointer()); |
| 506 | StoredDeclsMap::iterator Pos = Map->find(Name); |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 507 | if (Pos != Map->end()) |
| 508 | return lookup_result(&Pos->second.front(), |
| 509 | &Pos->second.front() + Pos->second.size()); |
| 510 | return lookup_result(0, 0); |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 511 | } |
| 512 | |
| 513 | // We have a small array. Look into it. |
| 514 | unsigned Size = LookupPtr.getInt(); |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 515 | ScopedDecl **Array = static_cast<ScopedDecl**>(LookupPtr.getPointer()); |
Douglas Gregor | e267ff3 | 2008-12-11 20:41:00 +0000 | [diff] [blame] | 516 | for (unsigned Idx = 0; Idx != Size; ++Idx) |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 517 | if (Array[Idx]->getDeclName() == Name) { |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 518 | unsigned Last = Idx + 1; |
| 519 | while (Last != Size && Array[Last]->getDeclName() == Name) |
| 520 | ++Last; |
| 521 | return lookup_result(&Array[Idx], &Array[Last]); |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 522 | } |
| 523 | |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 524 | return lookup_result(0, 0); |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 525 | } |
| 526 | |
| 527 | DeclContext::lookup_const_result |
| 528 | DeclContext::lookup(ASTContext &Context, DeclarationName Name) const { |
| 529 | return const_cast<DeclContext*>(this)->lookup(Context, Name); |
| 530 | } |
| 531 | |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 532 | void DeclContext::insert(ASTContext &Context, ScopedDecl *D) { |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 533 | DeclContext *PrimaryContext = getPrimaryContext(Context); |
| 534 | if (PrimaryContext != this) { |
| 535 | PrimaryContext->insert(Context, D); |
| 536 | return; |
| 537 | } |
| 538 | |
| 539 | // If we already have a lookup data structure, perform the insertion |
| 540 | // into it. Otherwise, be lazy and don't build that structure until |
| 541 | // someone asks for it. |
| 542 | if (LookupPtr.getPointer()) |
| 543 | insertImpl(D); |
| 544 | } |
| 545 | |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 546 | static bool isRedeclarationOf(ScopedDecl *D, ScopedDecl *OldD) { |
| 547 | assert(D->getDeclName() == OldD->getDeclName() && "Declaration name mismatch"); |
| 548 | |
| 549 | if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) |
| 550 | // For function declarations, we keep track of redeclarations. |
| 551 | return FD->getPreviousDeclaration() == OldD; |
| 552 | |
| 553 | // For non-function declarations, if the declarations are of the |
| 554 | // same kind then this must be a redeclaration, or semantic analysis |
| 555 | // would not have given us the new declaration. |
| 556 | return D->getKind() == OldD->getKind(); |
| 557 | } |
| 558 | |
| 559 | void DeclContext::insertImpl(ScopedDecl *D) { |
| 560 | bool MayBeRedeclaration = true; |
| 561 | |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 562 | if (!isLookupMap()) { |
| 563 | unsigned Size = LookupPtr.getInt(); |
| 564 | |
| 565 | // The lookup data is stored as an array. Search through the array |
| 566 | // to find the insertion location. |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 567 | ScopedDecl **Array; |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 568 | if (Size == 0) { |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 569 | Array = new ScopedDecl*[LookupIsMap - 1]; |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 570 | LookupPtr.setPointer(Array); |
| 571 | } else { |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 572 | Array = static_cast<ScopedDecl **>(LookupPtr.getPointer()); |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 573 | } |
| 574 | |
| 575 | // We always keep declarations of the same name next to each other |
| 576 | // in the array, so that it is easy to return multiple results |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 577 | // from lookup(). |
| 578 | unsigned FirstMatch; |
| 579 | for (FirstMatch = 0; FirstMatch != Size; ++FirstMatch) |
| 580 | if (Array[FirstMatch]->getDeclName() == D->getDeclName()) |
Douglas Gregor | e267ff3 | 2008-12-11 20:41:00 +0000 | [diff] [blame] | 581 | break; |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 582 | |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 583 | unsigned InsertPos = FirstMatch; |
| 584 | if (FirstMatch != Size) { |
| 585 | // We found another declaration with the same name. First |
| 586 | // determine whether this is a redeclaration of an existing |
| 587 | // declaration in this scope, in which case we will replace the |
| 588 | // existing declaration. |
| 589 | unsigned LastMatch = FirstMatch; |
| 590 | for (; LastMatch != Size; ++LastMatch) { |
| 591 | if (Array[LastMatch]->getDeclName() != D->getDeclName()) |
| 592 | break; |
| 593 | |
| 594 | if (isRedeclarationOf(D, Array[LastMatch])) { |
| 595 | // D is a redeclaration of an existing element in the |
| 596 | // array. Replace that element with D. |
| 597 | Array[LastMatch] = D; |
| 598 | return; |
| 599 | } |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 600 | } |
| 601 | |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 602 | // [FirstMatch, LastMatch) contains the set of declarations that |
| 603 | // have the same name as this declaration. Determine where the |
| 604 | // declaration D will be inserted into this range. |
| 605 | if (D->getIdentifierNamespace() == Decl::IDNS_Tag) |
| 606 | InsertPos = LastMatch; |
| 607 | else if (Array[LastMatch-1]->getIdentifierNamespace() == Decl::IDNS_Tag) |
| 608 | InsertPos = LastMatch - 1; |
| 609 | else |
| 610 | InsertPos = LastMatch; |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 611 | } |
| 612 | |
| 613 | if (Size < LookupIsMap - 1) { |
| 614 | // The new declaration will fit in the array. Insert the new |
| 615 | // declaration at the position Match in the array. |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 616 | for (unsigned Idx = Size; Idx > InsertPos; --Idx) |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 617 | Array[Idx] = Array[Idx-1]; |
| 618 | |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 619 | Array[InsertPos] = D; |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 620 | LookupPtr.setInt(Size + 1); |
| 621 | return; |
| 622 | } |
| 623 | |
| 624 | // We've reached capacity in this array. Create a map and copy in |
| 625 | // all of the declarations that were stored in the array. |
| 626 | StoredDeclsMap *Map = new StoredDeclsMap(16); |
| 627 | LookupPtr.setPointer(Map); |
| 628 | LookupPtr.setInt(LookupIsMap); |
Douglas Gregor | e267ff3 | 2008-12-11 20:41:00 +0000 | [diff] [blame] | 629 | for (unsigned Idx = 0; Idx != LookupIsMap - 1; ++Idx) |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 630 | insertImpl(Array[Idx]); |
| 631 | delete [] Array; |
| 632 | |
| 633 | // Fall through to perform insertion into the map. |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 634 | MayBeRedeclaration = false; |
| 635 | } |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 636 | |
| 637 | // Insert this declaration into the map. |
| 638 | StoredDeclsMap *Map = static_cast<StoredDeclsMap*>(LookupPtr.getPointer()); |
| 639 | StoredDeclsMap::iterator Pos = Map->find(D->getDeclName()); |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 640 | if (Pos != Map->end()) { |
| 641 | if (MayBeRedeclaration) { |
| 642 | // Determine if this declaration is actually a redeclaration. |
| 643 | for (std::vector<ScopedDecl *>::iterator I = Pos->second.begin(), |
| 644 | IEnd = Pos->second.end(); |
| 645 | I != IEnd; ++I) { |
| 646 | if (isRedeclarationOf(D, *I)) { |
| 647 | // D is a redeclaration of *I. Replace *I with D and we're |
| 648 | // done. |
| 649 | *I = D; |
| 650 | return; |
| 651 | } |
| 652 | } |
| 653 | } |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 654 | |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 655 | // Put this declaration into the appropriate slot. |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 656 | if (D->getIdentifierNamespace() == Decl::IDNS_Tag || Pos->second.empty()) |
| 657 | Pos->second.push_back(D); |
| 658 | else if (Pos->second.back()->getIdentifierNamespace() == Decl::IDNS_Tag) { |
| 659 | ScopedDecl *TagD = Pos->second.back(); |
| 660 | Pos->second.back() = D; |
| 661 | Pos->second.push_back(TagD); |
| 662 | } else |
| 663 | Pos->second.push_back(D); |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 664 | } else { |
Douglas Gregor | 3fc749d | 2008-12-23 00:26:44 +0000 | [diff] [blame^] | 665 | (*Map)[D->getDeclName()].push_back(D); |
Douglas Gregor | 44b4321 | 2008-12-11 16:49:14 +0000 | [diff] [blame] | 666 | } |
| 667 | } |