DeclarationName.cpp (198398) | DeclarationName.cpp (198954) |
---|---|
1//===-- DeclarationName.cpp - Declaration names implementation --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file implements the DeclarationName and DeclarationNameTable 11// classes. 12// 13//===----------------------------------------------------------------------===// 14#include "clang/AST/DeclarationName.h" 15#include "clang/AST/Type.h" | 1//===-- DeclarationName.cpp - Declaration names implementation --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file implements the DeclarationName and DeclarationNameTable 11// classes. 12// 13//===----------------------------------------------------------------------===// 14#include "clang/AST/DeclarationName.h" 15#include "clang/AST/Type.h" |
16#include "clang/AST/TypeOrdering.h" |
|
16#include "clang/AST/Decl.h" 17#include "clang/Basic/IdentifierTable.h" 18#include "llvm/ADT/DenseMap.h" 19#include "llvm/ADT/FoldingSet.h" 20using namespace clang; 21 22namespace clang { 23/// CXXSpecialName - Records the type associated with one of the --- 20 unchanged lines hidden (view full) --- 44class CXXOperatorIdName : public DeclarationNameExtra { 45public: 46 /// FETokenInfo - Extra information associated with this operator 47 /// name that can be used by the front end. 48 void *FETokenInfo; 49}; 50 51bool operator<(DeclarationName LHS, DeclarationName RHS) { | 17#include "clang/AST/Decl.h" 18#include "clang/Basic/IdentifierTable.h" 19#include "llvm/ADT/DenseMap.h" 20#include "llvm/ADT/FoldingSet.h" 21using namespace clang; 22 23namespace clang { 24/// CXXSpecialName - Records the type associated with one of the --- 20 unchanged lines hidden (view full) --- 45class CXXOperatorIdName : public DeclarationNameExtra { 46public: 47 /// FETokenInfo - Extra information associated with this operator 48 /// name that can be used by the front end. 49 void *FETokenInfo; 50}; 51 52bool operator<(DeclarationName LHS, DeclarationName RHS) { |
52 if (IdentifierInfo *LhsId = LHS.getAsIdentifierInfo()) 53 if (IdentifierInfo *RhsId = RHS.getAsIdentifierInfo()) 54 return LhsId->getName() < RhsId->getName(); | 53 if (LHS.getNameKind() != RHS.getNameKind()) 54 return LHS.getNameKind() < RHS.getNameKind(); 55 56 switch (LHS.getNameKind()) { 57 case DeclarationName::Identifier: 58 return LHS.getAsIdentifierInfo()->getName() < 59 RHS.getAsIdentifierInfo()->getName(); |
55 | 60 |
56 return LHS.getAsOpaqueInteger() < RHS.getAsOpaqueInteger(); | 61 case DeclarationName::ObjCZeroArgSelector: 62 case DeclarationName::ObjCOneArgSelector: 63 case DeclarationName::ObjCMultiArgSelector: { 64 Selector LHSSelector = LHS.getObjCSelector(); 65 Selector RHSSelector = RHS.getObjCSelector(); 66 for (unsigned I = 0, 67 N = std::min(LHSSelector.getNumArgs(), RHSSelector.getNumArgs()); 68 I != N; ++I) { 69 IdentifierInfo *LHSId = LHSSelector.getIdentifierInfoForSlot(I); 70 IdentifierInfo *RHSId = RHSSelector.getIdentifierInfoForSlot(I); 71 if (!LHSId || !RHSId) 72 return LHSId && !RHSId; 73 74 switch (LHSId->getName().compare(RHSId->getName())) { 75 case -1: return true; 76 case 1: return false; 77 default: break; 78 } 79 } 80 81 return LHSSelector.getNumArgs() < RHSSelector.getNumArgs(); 82 } 83 84 case DeclarationName::CXXConstructorName: 85 case DeclarationName::CXXDestructorName: 86 case DeclarationName::CXXConversionFunctionName: 87 return QualTypeOrdering()(LHS.getCXXNameType(), RHS.getCXXNameType()); 88 89 case DeclarationName::CXXOperatorName: 90 return LHS.getCXXOverloadedOperator() < RHS.getCXXOverloadedOperator(); 91 92 case DeclarationName::CXXUsingDirective: 93 return false; 94 } 95 96 return false; |
57} 58 59} // end namespace clang 60 61DeclarationName::DeclarationName(Selector Sel) { 62 if (!Sel.getAsOpaquePtr()) { 63 Ptr = 0; 64 return; --- 289 unchanged lines hidden --- | 97} 98 99} // end namespace clang 100 101DeclarationName::DeclarationName(Selector Sel) { 102 if (!Sel.getAsOpaquePtr()) { 103 Ptr = 0; 104 return; --- 289 unchanged lines hidden --- |