diff options
Diffstat (limited to 'clang/lib/CodeGen')
33 files changed, 338 insertions, 339 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 9544cb4eb79..8edf2eda063 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -62,7 +62,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM, llvm::Type *ulong = CGM.getTypes().ConvertType(C.UnsignedLongTy); llvm::Type *i8p = CGM.getTypes().ConvertType(C.VoidPtrTy); - llvm::SmallVector<llvm::Constant*, 6> elements; + SmallVector<llvm::Constant*, 6> elements; // reserved elements.push_back(llvm::ConstantInt::get(ulong, 0)); @@ -243,7 +243,7 @@ static CharUnits getLowBit(CharUnits v) { } static void initializeForBlockHeader(CodeGenModule &CGM, CGBlockInfo &info, - llvm::SmallVectorImpl<llvm::Type*> &elementTypes) { + SmallVectorImpl<llvm::Type*> &elementTypes) { ASTContext &C = CGM.getContext(); // The header is basically a 'struct { void *; int; int; void *; void *; }'. @@ -280,7 +280,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { ASTContext &C = CGM.getContext(); const BlockDecl *block = info.getBlockDecl(); - llvm::SmallVector<llvm::Type*, 8> elementTypes; + SmallVector<llvm::Type*, 8> elementTypes; initializeForBlockHeader(CGM, info, elementTypes); if (!block->hasCaptures()) { @@ -291,7 +291,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { } // Collect the layout chunks. - llvm::SmallVector<BlockLayoutChunk, 16> layout; + SmallVector<BlockLayoutChunk, 16> layout; layout.reserve(block->capturesCXXThis() + (block->capture_end() - block->capture_begin())); @@ -422,7 +422,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { // which has 7 bytes of padding, as opposed to the naive solution // which might have less (?). if (endAlign < maxFieldAlign) { - llvm::SmallVectorImpl<BlockLayoutChunk>::iterator + SmallVectorImpl<BlockLayoutChunk>::iterator li = layout.begin() + 1, le = layout.end(); // Look for something that the header end is already @@ -433,7 +433,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { // If we found something that's naturally aligned for the end of // the header, keep adding things... if (li != le) { - llvm::SmallVectorImpl<BlockLayoutChunk>::iterator first = li; + SmallVectorImpl<BlockLayoutChunk>::iterator first = li; for (; li != le; ++li) { assert(endAlign >= li->Alignment); @@ -468,7 +468,7 @@ static void computeBlockInfo(CodeGenModule &CGM, CGBlockInfo &info) { // Slam everything else on now. This works because they have // strictly decreasing alignment and we expect that size is always a // multiple of alignment. - for (llvm::SmallVectorImpl<BlockLayoutChunk>::iterator + for (SmallVectorImpl<BlockLayoutChunk>::iterator li = layout.begin(), le = layout.end(); li != le; ++li) { assert(endAlign >= li->Alignment); li->setIndex(info, elementTypes.size()); @@ -1665,7 +1665,7 @@ llvm::Type *CodeGenFunction::BuildByRefType(const VarDecl *D) { QualType Ty = D->getType(); - llvm::SmallVector<llvm::Type *, 8> types; + SmallVector<llvm::Type *, 8> types; llvm::StructType *ByRefType = llvm::StructType::createNamed(getLLVMContext(), diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index dedac9da0a3..5c49d5945cd 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -1193,12 +1193,12 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID, const FunctionDecl *FD = E->getDirectCallee(); // Oddly people write this call without args on occasion and gcc accepts // it - it's also marked as varargs in the description file. - llvm::SmallVector<Value*, 2> Ops; + SmallVector<Value*, 2> Ops; for (unsigned i = 0; i < E->getNumArgs(); i++) Ops.push_back(EmitScalarExpr(E->getArg(i))); llvm::Type *Ty = CGM.getTypes().ConvertType(FD->getType()); llvm::FunctionType *FTy = cast<llvm::FunctionType>(Ty); - llvm::StringRef Name = FD->getName(); + StringRef Name = FD->getName(); return Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name), Ops); } @@ -1236,7 +1236,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID, return Builder.CreateCall3(F, Arg0, Arg1, StPtr, "strexd"); } - llvm::SmallVector<Value*, 4> Ops; + SmallVector<Value*, 4> Ops; for (unsigned i = 0, e = E->getNumArgs() - 1; i != e; i++) Ops.push_back(EmitScalarExpr(E->getArg(i))); @@ -1918,7 +1918,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID, } llvm::Value *CodeGenFunction:: -BuildVector(const llvm::SmallVectorImpl<llvm::Value*> &Ops) { +BuildVector(const SmallVectorImpl<llvm::Value*> &Ops) { assert((Ops.size() & (Ops.size() - 1)) == 0 && "Not a power-of-two sized vector!"); bool AllConstants = true; @@ -1946,7 +1946,7 @@ BuildVector(const llvm::SmallVectorImpl<llvm::Value*> &Ops) { Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, const CallExpr *E) { - llvm::SmallVector<Value*, 4> Ops; + SmallVector<Value*, 4> Ops; // Find out if any arguments are required to be integer constant expressions. unsigned ICEArguments = 0; @@ -2141,7 +2141,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, // If palignr is shifting the pair of input vectors less than 9 bytes, // emit a shuffle instruction. if (shiftVal <= 8) { - llvm::SmallVector<llvm::Constant*, 8> Indices; + SmallVector<llvm::Constant*, 8> Indices; for (unsigned i = 0; i != 8; ++i) Indices.push_back(llvm::ConstantInt::get(Int32Ty, shiftVal + i)); @@ -2172,7 +2172,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, // If palignr is shifting the pair of input vectors less than 17 bytes, // emit a shuffle instruction. if (shiftVal <= 16) { - llvm::SmallVector<llvm::Constant*, 16> Indices; + SmallVector<llvm::Constant*, 16> Indices; for (unsigned i = 0; i != 16; ++i) Indices.push_back(llvm::ConstantInt::get(Int32Ty, shiftVal + i)); @@ -2349,7 +2349,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { - llvm::SmallVector<Value*, 4> Ops; + SmallVector<Value*, 4> Ops; for (unsigned i = 0, e = E->getNumArgs(); i != e; i++) Ops.push_back(EmitScalarExpr(E->getArg(i))); diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index f841b250095..f7f8a1271cd 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -154,7 +154,7 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl, new llvm::GlobalAlias(AliasType, Linkage, "", Aliasee, &getModule()); // Switch any previous uses to the alias. - llvm::StringRef MangledName = getMangledName(AliasDecl); + StringRef MangledName = getMangledName(AliasDecl); llvm::GlobalValue *Entry = GetGlobalValue(MangledName); if (Entry) { assert(Entry->isDeclaration() && "definition already exists for alias"); @@ -214,7 +214,7 @@ CodeGenModule::GetAddrOfCXXConstructor(const CXXConstructorDecl *ctor, const CGFunctionInfo *fnInfo) { GlobalDecl GD(ctor, ctorType); - llvm::StringRef name = getMangledName(GD); + StringRef name = getMangledName(GD); if (llvm::GlobalValue *existing = GetGlobalValue(name)) return existing; @@ -282,7 +282,7 @@ CodeGenModule::GetAddrOfCXXDestructor(const CXXDestructorDecl *dtor, const CGFunctionInfo *fnInfo) { GlobalDecl GD(dtor, dtorType); - llvm::StringRef name = getMangledName(GD); + StringRef name = getMangledName(GD); if (llvm::GlobalValue *existing = GetGlobalValue(name)) return existing; diff --git a/clang/lib/CodeGen/CGCXXABI.cpp b/clang/lib/CodeGen/CGCXXABI.cpp index ff7213df1f3..8106507e0d4 100644 --- a/clang/lib/CodeGen/CGCXXABI.cpp +++ b/clang/lib/CodeGen/CGCXXABI.cpp @@ -20,7 +20,7 @@ using namespace CodeGen; CGCXXABI::~CGCXXABI() { } static void ErrorUnsupportedABI(CodeGenFunction &CGF, - llvm::StringRef S) { + StringRef S) { Diagnostic &Diags = CGF.CGM.getDiags(); unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error, "cannot yet compile %1 in this ABI"); diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index e3b93a3f458..d13fd017cd6 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -69,14 +69,14 @@ static CanQualType GetReturnType(QualType RetTy) { const CGFunctionInfo & CodeGenTypes::getFunctionInfo(CanQual<FunctionNoProtoType> FTNP) { return getFunctionInfo(FTNP->getResultType().getUnqualifiedType(), - llvm::SmallVector<CanQualType, 16>(), + SmallVector<CanQualType, 16>(), FTNP->getExtInfo()); } /// \param Args - contains any initial parameters besides those /// in the formal type static const CGFunctionInfo &getFunctionInfo(CodeGenTypes &CGT, - llvm::SmallVectorImpl<CanQualType> &ArgTys, + SmallVectorImpl<CanQualType> &ArgTys, CanQual<FunctionProtoType> FTP) { // FIXME: Kill copy. for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i) @@ -87,7 +87,7 @@ static const CGFunctionInfo &getFunctionInfo(CodeGenTypes &CGT, const CGFunctionInfo & CodeGenTypes::getFunctionInfo(CanQual<FunctionProtoType> FTP) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; return ::getFunctionInfo(*this, ArgTys, FTP); } @@ -113,7 +113,7 @@ static CallingConv getCallingConventionForDecl(const Decl *D) { const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXRecordDecl *RD, const FunctionProtoType *FTP) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; // Add the 'this' pointer. ArgTys.push_back(GetThisType(Context, RD)); @@ -123,7 +123,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXRecordDecl *RD, } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXMethodDecl *MD) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; assert(!isa<CXXConstructorDecl>(MD) && "wrong method for contructors!"); assert(!isa<CXXDestructorDecl>(MD) && "wrong method for destructors!"); @@ -137,7 +137,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXMethodDecl *MD) { const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXConstructorDecl *D, CXXCtorType Type) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; ArgTys.push_back(GetThisType(Context, D->getParent())); CanQualType ResTy = Context.VoidTy; @@ -154,7 +154,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXConstructorDecl *D, const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXDestructorDecl *D, CXXDtorType Type) { - llvm::SmallVector<CanQualType, 2> ArgTys; + SmallVector<CanQualType, 2> ArgTys; ArgTys.push_back(GetThisType(Context, D->getParent())); CanQualType ResTy = Context.VoidTy; @@ -180,7 +180,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionDecl *FD) { } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const ObjCMethodDecl *MD) { - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; ArgTys.push_back(Context.getCanonicalParamType(MD->getSelfDecl()->getType())); ArgTys.push_back(Context.getCanonicalParamType(Context.getObjCSelType())); // FIXME: Kill copy? @@ -216,7 +216,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(QualType ResTy, const CallArgList &Args, const FunctionType::ExtInfo &Info) { // FIXME: Kill copy. - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; for (CallArgList::const_iterator i = Args.begin(), e = Args.end(); i != e; ++i) ArgTys.push_back(Context.getCanonicalParamType(i->Ty)); @@ -227,7 +227,7 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(QualType ResTy, const FunctionArgList &Args, const FunctionType::ExtInfo &Info) { // FIXME: Kill copy. - llvm::SmallVector<CanQualType, 16> ArgTys; + SmallVector<CanQualType, 16> ArgTys; for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end(); i != e; ++i) ArgTys.push_back(Context.getCanonicalParamType((*i)->getType())); @@ -235,15 +235,15 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(QualType ResTy, } const CGFunctionInfo &CodeGenTypes::getNullaryFunctionInfo() { - llvm::SmallVector<CanQualType, 1> args; + SmallVector<CanQualType, 1> args; return getFunctionInfo(getContext().VoidTy, args, FunctionType::ExtInfo()); } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(CanQualType ResTy, - const llvm::SmallVectorImpl<CanQualType> &ArgTys, + const SmallVectorImpl<CanQualType> &ArgTys, const FunctionType::ExtInfo &Info) { #ifndef NDEBUG - for (llvm::SmallVectorImpl<CanQualType>::const_iterator + for (SmallVectorImpl<CanQualType>::const_iterator I = ArgTys.begin(), E = ArgTys.end(); I != E; ++I) assert(I->isCanonicalAsParam()); #endif @@ -312,7 +312,7 @@ CGFunctionInfo::CGFunctionInfo(unsigned _CallingConvention, /***/ void CodeGenTypes::GetExpandedTypes(QualType type, - llvm::SmallVectorImpl<llvm::Type*> &expandedTypes) { + SmallVectorImpl<llvm::Type*> &expandedTypes) { const RecordType *RT = type->getAsStructureType(); assert(RT && "Can only expand structure types."); const RecordDecl *RD = RT->getDecl(); @@ -614,7 +614,7 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool isVariadic) { bool Inserted = FunctionsBeingProcessed.insert(&FI); (void)Inserted; assert(Inserted && "Recursively being processed?"); - llvm::SmallVector<llvm::Type*, 8> argTypes; + SmallVector<llvm::Type*, 8> argTypes; llvm::Type *resultType = 0; const ABIArgInfo &retAI = FI.getReturnInfo(); @@ -824,7 +824,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, continue; case ABIArgInfo::Expand: { - llvm::SmallVector<llvm::Type*, 8> types; + SmallVector<llvm::Type*, 8> types; // FIXME: This is rather inefficient. Do we ever actually need to do // anything here? The result should be just reconstructed on the other // side, so extension should be a non-issue. @@ -995,7 +995,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { assert(AI != Fn->arg_end() && "Argument mismatch!"); - AI->setName(Arg->getName() + ".coerce" + llvm::Twine(i)); + AI->setName(Arg->getName() + ".coerce" + Twine(i)); llvm::Value *EltPtr = Builder.CreateConstGEP2_32(Ptr, 0, i); Builder.CreateStore(AI++, EltPtr); } @@ -1029,7 +1029,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, // Name the arguments used in expansion and increment AI. unsigned Index = 0; for (; AI != End; ++AI, ++Index) - AI->setName(Arg->getName() + "." + llvm::Twine(Index)); + AI->setName(Arg->getName() + "." + Twine(Index)); continue; } @@ -1063,7 +1063,7 @@ static llvm::Value *tryEmitFusedAutoreleaseOfResult(CodeGenFunction &CGF, // result is in a BasicBlock and is therefore an Instruction. llvm::Instruction *generator = cast<llvm::Instruction>(result); - llvm::SmallVector<llvm::Instruction*,4> insnsToKill; + SmallVector<llvm::Instruction*,4> insnsToKill; // Look for: // %generator = bitcast %type1* %generator2 to %type2* @@ -1116,7 +1116,7 @@ static llvm::Value *tryEmitFusedAutoreleaseOfResult(CodeGenFunction &CGF, } // Delete all the unnecessary instructions, from latest to earliest. - for (llvm::SmallVectorImpl<llvm::Instruction*>::iterator + for (SmallVectorImpl<llvm::Instruction*>::iterator i = insnsToKill.begin(), e = insnsToKill.end(); i != e; ++i) (*i)->eraseFromParent(); @@ -1432,7 +1432,7 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, llvm::CallSite CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, llvm::ArrayRef<llvm::Value *> Args, - const llvm::Twine &Name) { + const Twine &Name) { llvm::BasicBlock *InvokeDest = getInvokeDest(); if (!InvokeDest) return Builder.CreateCall(Callee, Args, Name); @@ -1446,7 +1446,7 @@ CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, llvm::CallSite CodeGenFunction::EmitCallOrInvoke(llvm::Value *Callee, - const llvm::Twine &Name) { + const Twine &Name) { return EmitCallOrInvoke(Callee, llvm::ArrayRef<llvm::Value *>(), Name); } @@ -1460,7 +1460,7 @@ static void checkArgMatches(llvm::Value *Elt, unsigned &ArgNo, } void CodeGenFunction::ExpandTypeToArgs(QualType Ty, RValue RV, - llvm::SmallVector<llvm::Value*,16> &Args, + SmallVector<llvm::Value*,16> &Args, llvm::FunctionType *IRFuncTy) { const RecordType *RT = Ty->getAsStructureType(); assert(RT && "Can only expand structure types."); @@ -1503,7 +1503,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, const Decl *TargetDecl, llvm::Instruction **callOrInvoke) { // FIXME: We no longer need the types from CallArgs; lift up and simplify. - llvm::SmallVector<llvm::Value*, 16> Args; + SmallVector<llvm::Value*, 16> Args; // Handle struct-return functions by passing a pointer to the // location that we would like to return into. diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index d2b104eec05..2d32b83b128 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -729,7 +729,7 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD, const CXXRecordDecl *ClassDecl = CD->getParent(); - llvm::SmallVector<CXXCtorInitializer *, 8> MemberInitializers; + SmallVector<CXXCtorInitializer *, 8> MemberInitializers; for (CXXConstructorDecl::init_const_iterator B = CD->init_begin(), E = CD->init_end(); @@ -1018,7 +1018,7 @@ void CodeGenFunction::EnterDtorCleanups(const CXXDestructorDecl *DD, } // Destroy direct fields. - llvm::SmallVector<const FieldDecl *, 16> FieldDecls; + SmallVector<const FieldDecl *, 16> FieldDecls; for (CXXRecordDecl::field_iterator I = ClassDecl->field_begin(), E = ClassDecl->field_end(); I != E; ++I) { const FieldDecl *field = *I; diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index 564b6626380..10f716aa95d 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -583,7 +583,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { // Copy the cleanup emission data out. Note that SmallVector // guarantees maximal alignment for its buffer regardless of its // type parameter. - llvm::SmallVector<char, 8*sizeof(void*)> CleanupBuffer; + SmallVector<char, 8*sizeof(void*)> CleanupBuffer; CleanupBuffer.reserve(Scope.getCleanupSize()); memcpy(CleanupBuffer.data(), Scope.getCleanupBuffer(), Scope.getCleanupSize()); @@ -595,7 +595,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { // ahead and do the setup for the EH cleanup while the scope is still // alive. llvm::BasicBlock *EHEntry = 0; - llvm::SmallVector<llvm::Instruction*, 2> EHInstsToAppend; + SmallVector<llvm::Instruction*, 2> EHInstsToAppend; if (RequiresEHCleanup) { EHEntry = CreateEHEntry(*this, Scope); @@ -716,7 +716,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { } llvm::BasicBlock *FallthroughDest = 0; - llvm::SmallVector<llvm::Instruction*, 2> InstsToAppend; + SmallVector<llvm::Instruction*, 2> InstsToAppend; // If there's exactly one branch-after and no other threads, // we can route it without a switch. diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 3c9b3eb78f4..9cfb71e8253 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -81,7 +81,7 @@ llvm::DIDescriptor CGDebugInfo::getContextDescriptor(const Decl *Context) { /// getFunctionName - Get function name for the given FunctionDecl. If the /// name is constructred on demand (e.g. C++ destructor) then the name /// is stored on the side. -llvm::StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) { +StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) { assert (FD && "Invalid FunctionDecl!"); IdentifierInfo *FII = FD->getIdentifier(); if (FII) @@ -93,10 +93,10 @@ llvm::StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) { // Copy this name on the side and use its reference. char *StrPtr = DebugInfoNames.Allocate<char>(NS.length()); memcpy(StrPtr, NS.data(), NS.length()); - return llvm::StringRef(StrPtr, NS.length()); + return StringRef(StrPtr, NS.length()); } -llvm::StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) { +StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) { llvm::SmallString<256> MethodName; llvm::raw_svector_ostream OS(MethodName); OS << (OMD->isInstanceMethod() ? '-' : '+') << '['; @@ -116,22 +116,22 @@ llvm::StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) { char *StrPtr = DebugInfoNames.Allocate<char>(OS.tell()); memcpy(StrPtr, MethodName.begin(), OS.tell()); - return llvm::StringRef(StrPtr, OS.tell()); + return StringRef(StrPtr, OS.tell()); } /// getSelectorName - Return selector name. This is used for debugging /// info. -llvm::StringRef CGDebugInfo::getSelectorName(Selector S) { +StringRef CGDebugInfo::getSelectorName(Selector S) { llvm::SmallString<256> SName; llvm::raw_svector_ostream OS(SName); OS << S.getAsString(); char *StrPtr = DebugInfoNames.Allocate<char>(OS.tell()); memcpy(StrPtr, SName.begin(), OS.tell()); - return llvm::StringRef(StrPtr, OS.tell()); + return StringRef(StrPtr, OS.tell()); } /// getClassName - Get class name including template argument list. -llvm::StringRef +StringRef CGDebugInfo::getClassName(RecordDecl *RD) { ClassTemplateSpecializationDecl *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RD); @@ -160,7 +160,7 @@ CGDebugInfo::getClassName(RecordDecl *RD) { // Copy this name on the side and use its reference. char *StrPtr = DebugInfoNames.Allocate<char>(Buffer.length()); memcpy(StrPtr, Buffer.data(), Buffer.length()); - return llvm::StringRef(StrPtr, Buffer.length()); + return StringRef(StrPtr, Buffer.length()); } /// getOrCreateFile - Get the file debug info descriptor for the input location. @@ -172,7 +172,7 @@ llvm::DIFile CGDebugInfo::getOrCreateFile(SourceLocation Loc) { SourceManager &SM = CGM.getContext().getSourceManager(); PresumedLoc PLoc = SM.getPresumedLoc(Loc); - if (PLoc.isInvalid() || llvm::StringRef(PLoc.getFilename()).empty()) + if (PLoc.isInvalid() || StringRef(PLoc.getFilename()).empty()) // If the location is not valid then use main input file. return DBuilder.createFile(TheCU.getFilename(), TheCU.getDirectory()); @@ -217,14 +217,14 @@ unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc) { return PLoc.isValid()? PLoc.getColumn() : 0; } -llvm::StringRef CGDebugInfo::getCurrentDirname() { +StringRef CGDebugInfo::getCurrentDirname() { if (!CWDName.empty()) return CWDName; char *CompDirnamePtr = NULL; llvm::sys::Path CWD = llvm::sys::Path::GetCurrentDirectory(); CompDirnamePtr = DebugInfoNames.Allocate<char>(CWD.size()); memcpy(CompDirnamePtr, CWD.c_str(), CWD.size()); - return CWDName = llvm::StringRef(CompDirnamePtr, CWD.size()); + return CWDName = StringRef(CompDirnamePtr, CWD.size()); } /// CreateCompileUnit - Create new compile unit. @@ -250,7 +250,7 @@ void CGDebugInfo::CreateCompileUnit() { // Save filename string. char *FilenamePtr = DebugInfoNames.Allocate<char>(MainFileName.length()); memcpy(FilenamePtr, MainFileName.c_str(), MainFileName.length()); - llvm::StringRef Filename(FilenamePtr, MainFileName.length()); + StringRef Filename(FilenamePtr, MainFileName.length()); unsigned LangTag; const LangOptions &LO = CGM.getLangOptions(); @@ -312,7 +312,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { llvm::DIType ISATy = DBuilder.createPointerType(OCTy, Size); - llvm::SmallVector<llvm::Value *, 16> EltTys; + SmallVector<llvm::Value *, 16> EltTys; llvm::DIType FieldTy = DBuilder.createMemberType(getOrCreateMainFile(), "isa", getOrCreateMainFile(), 0, Size, @@ -489,7 +489,7 @@ llvm::DIType CGDebugInfo::CreateType(const BlockPointerType *Ty, if (BlockLiteralGenericSet) return BlockLiteralGeneric; - llvm::SmallVector<llvm::Value *, 8> EltTys; + SmallVector<llvm::Value *, 8> EltTys; llvm::DIType FieldTy; QualType FType; uint64_t FieldSize, FieldOffset; @@ -567,7 +567,7 @@ llvm::DIType CGDebugInfo::CreateType(const TypedefType *Ty, llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, llvm::DIFile Unit) { - llvm::SmallVector<llvm::Value *, 16> EltTys; + SmallVector<llvm::Value *, 16> EltTys; // Add the result type at least. EltTys.push_back(getOrCreateType(Ty->getResultType(), Unit)); @@ -587,7 +587,7 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, return DbgTy; } -llvm::DIType CGDebugInfo::createFieldType(llvm::StringRef name, +llvm::DIType CGDebugInfo::createFieldType(StringRef name, QualType type, Expr *bitWidth, SourceLocation loc, @@ -624,7 +624,7 @@ llvm::DIType CGDebugInfo::createFieldType(llvm::StringRef name, /// record fields. This is used while creating debug info entry for a Record. void CGDebugInfo:: CollectRecordFields(const RecordDecl *record, llvm::DIFile tunit, - llvm::SmallVectorImpl<llvm::Value *> &elements, + SmallVectorImpl<llvm::Value *> &elements, llvm::DIType RecordTy) { unsigned fieldNo = 0; const FieldDecl *LastFD = 0; @@ -644,7 +644,7 @@ CollectRecordFields(const RecordDecl *record, llvm::DIFile tunit, LastFD = field; } - llvm::StringRef name = field->getName(); + StringRef name = field->getName(); QualType type = field->getType(); // Ignore unnamed fields unless they're anonymous structs/unions. @@ -678,7 +678,7 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method, llvm::DIArray Args = llvm::DICompositeType(FnTy).getTypeArray(); assert (Args.getNumElements() && "Invalid number of arguments!"); - llvm::SmallVector<llvm::Value *, 16> Elts; + SmallVector<llvm::Value *, 16> Elts; // First element is always return type. For 'void' functions it is NULL. Elts.push_back(Args.getElement(0)); @@ -723,12 +723,12 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, bool IsCtorOrDtor = isa<CXXConstructorDecl>(Method) || isa<CXXDestructorDecl>(Method); - llvm::StringRef MethodName = getFunctionName(Method); + StringRef MethodName = getFunctionName(Method); llvm::DIType MethodTy = getOrCreateMethodType(Method, Unit); // Since a single ctor/dtor corresponds to multiple functions, it doesn't // make sense to give a single ctor/dtor a linkage name. - llvm::StringRef MethodLinkageName; + StringRef MethodLinkageName; if (!IsCtorOrDtor && !isFunctionLocalClass(Method->getParent())) MethodLinkageName = CGM.getMangledName(Method); @@ -791,7 +791,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, /// a Record. void CGDebugInfo:: CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit, - llvm::SmallVectorImpl<llvm::Value *> &EltTys, + SmallVectorImpl<llvm::Value *> &EltTys, llvm::DIType RecordTy) { for(CXXRecordDecl::method_iterator I = RD->method_begin(), E = RD->method_end(); I != E; ++I) { @@ -809,7 +809,7 @@ CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit, /// a Record. void CGDebugInfo:: CollectCXXFriends(const CXXRecordDecl *RD, llvm::DIFile Unit, - llvm::SmallVectorImpl<llvm::Value *> &EltTys, + SmallVectorImpl<llvm::Value *> &EltTys, llvm::DIType RecordTy) { for (CXXRecordDecl::friend_iterator BI = RD->friend_begin(), @@ -826,7 +826,7 @@ CollectCXXFriends(const CXXRecordDecl *RD, llvm::DIFile Unit, /// a Record. void CGDebugInfo:: CollectCXXBases(const CXXRecordDecl *RD, llvm::DIFile Unit, - llvm::SmallVectorImpl<llvm::Value *> &EltTys, + SmallVectorImpl<llvm::Value *> &EltTys, llvm::DIType RecordTy) { const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD); @@ -868,7 +868,7 @@ llvm::DIArray CGDebugInfo:: CollectTemplateParams(const TemplateParameterList *TPList, const TemplateArgumentList &TAList, llvm::DIFile Unit) { - llvm::SmallVector<llvm::Value *, 16> TemplateParams; + SmallVector<llvm::Value *, 16> TemplateParams; for (unsigned i = 0, e = TAList.size(); i != e; ++i) { const TemplateArgument &TA = TAList[i]; const NamedDecl *ND = TPList->getParam(i); @@ -936,14 +936,14 @@ llvm::DIType CGDebugInfo::getOrCreateVTablePtrType(llvm::DIFile Unit) { } /// getVTableName - Get vtable name for the given Class. -llvm::StringRef CGDebugInfo::getVTableName(const CXXRecordDecl *RD) { +StringRef CGDebugInfo::getVTableName(const CXXRecordDecl *RD) { // Otherwise construct gdb compatible name name. std::string Name = "_vptr$" + RD->getNameAsString(); // Copy this name on the side and use its reference. char *StrPtr = DebugInfoNames.Allocate<char>(Name.length()); memcpy(StrPtr, Name.data(), Name.length()); - return llvm::StringRef(StrPtr, Name.length()); + return StringRef(StrPtr, Name.length()); } @@ -951,7 +951,7 @@ llvm::StringRef CGDebugInfo::getVTableName(const CXXRecordDecl *RD) { /// debug info entry in EltTys vector. void CGDebugInfo:: CollectVTableInfo(const CXXRecordDecl *RD, llvm::DIFile Unit, - llvm::SmallVectorImpl<llvm::Value *> &EltTys) { + SmallVectorImpl<llvm::Value *> &EltTys) { const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD); // If there is a primary base then it will hold vtable info. @@ -1020,7 +1020,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl); // Convert all the elements. - llvm::SmallVector<llvm::Value *, 16> EltTys; + SmallVector<llvm::Value *, 16> EltTys; const CXXRecordDecl *CXXDecl = dyn_cast<CXXRecordDecl>(RD); if (CXXDecl) { @@ -1040,7 +1040,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { // Create the descriptor for static variable. llvm::DIFile VUnit = getOrCreateFile(V->getLocation()); - llvm::StringRef VName = V->getName(); + StringRef VName = V->getName(); llvm::DIType VTy = getOrCreateType(V->getType(), VUnit); // Do not use DIGlobalVariable for enums. if (VTy.getTag() != llvm::dwarf::DW_TAG_enumeration_type) { @@ -1070,7 +1070,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { llvm::DIDescriptor RDContext = getContextDescriptor(cast<Decl>(RD->getDeclContext())); - llvm::StringRef RDName = RD->getName(); + StringRef RDName = RD->getName(); uint64_t Size = CGM.getContext().getTypeSize(Ty); uint64_t Align = CGM.getContext().getTypeAlign(Ty); llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys); @@ -1162,7 +1162,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl); // Convert all the elements. - llvm::SmallVector<llvm::Value *, 16> EltTys; + SmallVector<llvm::Value *, 16> EltTys; ObjCInterfaceDecl *SClass = ID->getSuperClass(); if (SClass) { @@ -1185,7 +1185,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, if (!FieldTy.isValid()) return llvm::DIType(); - llvm::StringRef FieldName = Field->getName(); + StringRef FieldName = Field->getName(); // Ignore unnamed fields. if (FieldName.empty()) @@ -1217,9 +1217,9 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, else if (Field->getAccessControl() == ObjCIvarDecl::Private) Flags = llvm::DIDescriptor::FlagPrivate; - llvm::StringRef PropertyName; - llvm::StringRef PropertyGetter; - llvm::StringRef PropertySetter; + StringRef PropertyName; + StringRef PropertyGetter; + StringRef PropertySetter; unsigned PropertyAttributes = 0; if (ObjCPropertyDecl *PD = ID->FindPropertyVisibleInPrimaryClass(Field->getIdentifier())) { @@ -1322,7 +1322,7 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, // Add the dimensions of the array. FIXME: This loses CV qualifiers from // interior arrays, do we care? Why aren't nested arrays represented the // obvious/recursive way? - llvm::SmallVector<llvm::Value *, 8> Subscripts; + SmallVector<llvm::Value *, 8> Subscripts; QualType EltTy(Ty, 0); if (Ty->isIncompleteArrayType()) EltTy = Ty->getElementType(); @@ -1395,7 +1395,7 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty, llvm::DIArray Elements = DBuilder.getOrCreateArray(ElementTypes); - return DBuilder.createStructType(U, llvm::StringRef("test"), + return DBuilder.createStructType(U, StringRef("test"), U, 0, FieldOffset, 0, 0, Elements); } @@ -1403,7 +1403,7 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty, /// CreateEnumType - get enumeration type. llvm::DIType CGDebugInfo::CreateEnumType(const EnumDecl *ED) { llvm::DIFile Unit = getOrCreateFile(ED->getLocation()); - llvm::SmallVector<llvm::Value *, 16> Enumerators; + SmallVector<llvm::Value *, 16> Enumerators; // Create DIEnumerator elements for each enumerator. for (EnumDecl::enumerator_iterator @@ -1582,7 +1582,7 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty, /// CreateMemberType - Create new member and increase Offset by FType's size. llvm::DIType CGDebugInfo::CreateMemberType(llvm::DIFile Unit, QualType FType, - llvm::StringRef Name, + StringRef Name, uint64_t *Offset) { llvm::DIType FieldTy = CGDebugInfo::getOrCreateType(FType, Unit); uint64_t FieldSize = CGM.getContext().getTypeSize(FType); @@ -1633,7 +1633,7 @@ llvm::DIType CGDebugInfo::getOrCreateFunctionType(const Decl * D, QualType FnTyp return getOrCreateMethodType(Method, F); else if (const ObjCMethodDecl *OMethod = dyn_cast<ObjCMethodDecl>(D)) { // Add "self" and "_cmd" - llvm::SmallVector<llvm::Value *, 16> Elts; + SmallVector<llvm::Value *, 16> Elts; // First element is always return type. For 'void' functions it is NULL. Elts.push_back(getOrCreateType(OMethod->getResultType(), F)); @@ -1658,8 +1658,8 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, llvm::Function *Fn, CGBuilderTy &Builder) { - llvm::StringRef Name; - llvm::StringRef LinkageName; + StringRef Name; + StringRef LinkageName; FnBeginRegionCount.push_back(RegionStack.size()); @@ -1687,7 +1687,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, if (!Fn->hasInternalLinkage()) LinkageName = CGM.getMangledName(GD); if (LinkageName == Name) - LinkageName = llvm::StringRef(); + LinkageName = StringRef(); if (FD->hasPrototype()) Flags |= llvm::DIDescriptor::FlagPrototyped; if (const NamespaceDecl *NSDecl = @@ -1847,7 +1847,7 @@ void CGDebugInfo::EmitFunctionEnd(CGBuilderTy &Builder) { llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const ValueDecl *VD, uint64_t *XOffset) { - llvm::SmallVector<llvm::Value *, 5> EltTys; + SmallVector<llvm::Value *, 5> EltTys; QualType FType; uint64_t FieldSize, FieldOffset; unsigned FieldAlign; @@ -1951,11 +1951,11 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, Flags |= llvm::DIDescriptor::FlagArtificial; llvm::MDNode *Scope = RegionStack.back(); - llvm::StringRef Name = VD->getName(); + StringRef Name = VD->getName(); if (!Name.empty()) { if (VD->hasAttr<BlocksAttr>()) { CharUnits offset = CharUnits::fromQuantity(32); - llvm::SmallVector<llvm::Value *, 9> addr; + SmallVector<llvm::Value *, 9> addr; llvm::Type *Int64Ty = llvm::Type::getInt64Ty(CGM.getLLVMContext()); addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus)); // offset of __forwarding field @@ -2006,7 +2006,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, I != E; ++I) { FieldDecl *Field = *I; llvm::DIType FieldTy = getOrCreateType(Field->getType(), Unit); - llvm::StringRef FieldName = Field->getName(); + StringRef FieldName = Field->getName(); // Ignore unnamed fields. Do not ignore unnamed records. if (FieldName.empty() && !isa<RecordType>(Field->getType())) @@ -2063,7 +2063,7 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable( target.getStructLayout(blockInfo.StructureType) ->getElementOffset(blockInfo.getCapture(VD).getIndex())); - llvm::SmallVector<llvm::Value *, 9> addr; + SmallVector<llvm::Value *, 9> addr; llvm::Type *Int64Ty = llvm::Type::getInt64Ty(CGM.getLLVMContext()); addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus)); addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity())); @@ -2129,7 +2129,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, const llvm::StructLayout *blockLayout = CGM.getTargetData().getStructLayout(block.StructureType); - llvm::SmallVector<llvm::Value*, 16> fields; + SmallVector<llvm::Value*, 16> fields; fields.push_back(createFieldType("__isa", C.VoidPtrTy, 0, loc, AS_public, blockLayout->getElementOffsetInBits(0), tunit, tunit)); @@ -2152,7 +2152,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, // We want to sort the captures by offset, not because DWARF // requires this, but because we're paranoid about debuggers. - llvm::SmallVector<BlockLayoutChunk, 8> chunks; + SmallVector<BlockLayoutChunk, 8> chunks; // 'this' capture. if (blockDecl->capturesCXXThis()) { @@ -2185,7 +2185,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, // Sort by offset. llvm::array_pod_sort(chunks.begin(), chunks.end()); - for (llvm::SmallVectorImpl<BlockLayoutChunk>::iterator + for (SmallVectorImpl<BlockLayoutChunk>::iterator i = chunks.begin(), e = chunks.end(); i != e; ++i) { uint64_t offsetInBits = i->OffsetInBits; const BlockDecl::Capture *capture = i->Capture; @@ -2202,7 +2202,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, } const VarDecl *variable = capture->getVariable(); - llvm::StringRef name = variable->getName(); + StringRef name = variable->getName(); llvm::DIType fieldType; if (capture->isByRef()) { @@ -2238,7 +2238,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, // Get overall information about the block. unsigned flags = llvm::DIDescriptor::FlagArtificial; llvm::MDNode *scope = RegionStack.back(); - llvm::StringRef name = ".block_descriptor"; + StringRef name = ".block_descriptor"; // Create the descriptor for the parameter. llvm::DIVariable debugVar = @@ -2275,13 +2275,13 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, T = CGM.getContext().getConstantArrayType(ET, ConstVal, ArrayType::Normal, 0); } - llvm::StringRef DeclName = D->getName(); - llvm::StringRef LinkageName; + StringRef DeclName = D->getName(); + StringRef LinkageName; if (D->getDeclContext() && !isa<FunctionDecl>(D->getDeclContext()) && !isa<ObjCMethodDecl>(D->getDeclContext())) LinkageName = Var->getName(); if (LinkageName == DeclName) - LinkageName = llvm::StringRef(); + LinkageName = StringRef(); llvm::DIDescriptor DContext = getContextDescriptor(dyn_cast<Decl>(D->getDeclContext())); DBuilder.createStaticVariable(DContext, DeclName, LinkageName, @@ -2296,7 +2296,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, llvm::DIFile Unit = getOrCreateFile(ID->getLocation()); unsigned LineNo = getLineNumber(ID->getLocation()); - llvm::StringRef Name = ID->getName(); + StringRef Name = ID->getName(); QualType T = CGM.getContext().getObjCInterfaceType(ID); if (T->isIncompleteArrayType()) { @@ -2321,7 +2321,7 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, llvm::Constant *Init) { // Create the descriptor for the variable. llvm::DIFile Unit = getOrCreateFile(VD->getLocation()); - llvm::StringRef Name = VD->getName(); + StringRef Name = VD->getName(); llvm::DIType Ty = getOrCreateType(VD->getType(), Unit); if (const EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(VD)) { if (const EnumDecl *ED = dyn_cast<EnumDecl>(ECD->getDeclContext())) diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index b9e4e7dffd1..9b22c7f9567 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -139,7 +139,7 @@ static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D, const char *Separator) { CodeGenModule &CGM = CGF.CGM; if (CGF.getContext().getLangOptions().CPlusPlus) { - llvm::StringRef Name = CGM.getMangledName(&D); + StringRef Name = CGM.getMangledName(&D); return Name.str(); } @@ -156,7 +156,7 @@ static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D, else assert(0 && "Unknown context for block static var decl"); } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CGF.CurFuncDecl)) { - llvm::StringRef Name = CGM.getMangledName(FD); + StringRef Name = CGM.getMangledName(FD); ContextName = Name.str(); } else if (isa<ObjCMethodDecl>(CGF.CurFuncDecl)) ContextName = CGF.CurFn->getName(); @@ -1267,7 +1267,7 @@ static void emitPartialArrayDestroy(CodeGenFunction &CGF, if (arrayDepth) { llvm::Value *zero = llvm::ConstantInt::get(CGF.SizeTy, arrayDepth+1); - llvm::SmallVector<llvm::Value*,4> gepIndices(arrayDepth, zero); + SmallVector<llvm::Value*,4> gepIndices(arrayDepth, zero); begin = CGF.Builder.CreateInBoundsGEP(begin, gepIndices, "pad.arraybegin"); end = CGF.Builder.CreateInBoundsGEP(end, gepIndices, "pad.arrayend"); } diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index 1df8768d531..f9f5e86bef2 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -168,7 +168,7 @@ void CodeGenFunction::EmitCXXGuardedInit(const VarDecl &D, static llvm::Function * CreateGlobalInitOrDestructFunction(CodeGenModule &CGM, llvm::FunctionType *FTy, - llvm::StringRef Name) { + StringRef Name) { llvm::Function *Fn = llvm::Function::Create(FTy, llvm::GlobalValue::InternalLinkage, Name, &CGM.getModule()); @@ -234,7 +234,7 @@ CodeGenModule::EmitCXXGlobalInitFunc() { CreateGlobalInitOrDestructFunction(*this, FTy, "_GLOBAL__I_a"); if (!PrioritizedCXXGlobalInits.empty()) { - llvm::SmallVector<llvm::Constant*, 8> LocalCXXGlobalInits; + SmallVector<llvm::Constant*, 8> LocalCXXGlobalInits; llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(), PrioritizedCXXGlobalInits.end()); for (unsigned i = 0; i < PrioritizedCXXGlobalInits.size(); i++) { diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 5ce9c35581f..fd2684c51e7 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -131,7 +131,7 @@ static llvm::Constant *getTerminateFn(CodeGenFunction &CGF) { llvm::FunctionType *FTy = llvm::FunctionType::get(CGF.VoidTy, /*IsVarArgs=*/false); - llvm::StringRef name; + StringRef name; // In C++, use std::terminate(). if (CGF.getLangOptions().CPlusPlus) @@ -145,7 +145,7 @@ static llvm::Constant *getTerminateFn(CodeGenFunction &CGF) { } static llvm::Constant *getCatchallRethrowFn(CodeGenFunction &CGF, - llvm::StringRef Name) { + StringRef Name) { llvm::Type *ArgTys[] = { CGF.Int8PtrTy }; llvm::FunctionType *FTy = llvm::FunctionType::get(CGF.VoidTy, ArgTys, /*IsVarArgs=*/false); @@ -665,7 +665,7 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() { Builder.CreateStore(Exn, getExceptionSlot()); // Build the selector arguments. - llvm::SmallVector<llvm::Value*, 8> EHSelector; + SmallVector<llvm::Value*, 8> EHSelector; EHSelector.push_back(Exn); EHSelector.push_back(getOpaquePersonalityFn(CGM, Personality)); @@ -674,7 +674,7 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() { UnwindDest CatchAll; bool HasEHCleanup = false; bool HasEHFilter = false; - llvm::SmallVector<llvm::Value*, 8> EHFilters; + SmallVector<llvm::Value*, 8> EHFilters; for (EHScopeStack::iterator I = EHStack.begin(), E = EHStack.end(); I != E; ++I) { @@ -1153,7 +1153,7 @@ void CodeGenFunction::ExitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) { // Copy the handler blocks off before we pop the EH stack. Emitting // the handlers might scribble on this memory. - llvm::SmallVector<EHCatchScope::Handler, 8> Handlers(NumHandlers); + SmallVector<EHCatchScope::Handler, 8> Handlers(NumHandlers); memcpy(Handlers.data(), CatchScope.begin(), NumHandlers * sizeof(EHCatchScope::Handler)); EHStack.popCatch(); @@ -1464,7 +1464,7 @@ CodeGenFunction::UnwindDest CodeGenFunction::getRethrowDest() { // This can always be a call because we necessarily didn't find // anything on the EH stack which needs our help. - llvm::StringRef RethrowName = Personality.getCatchallRethrowFnName(); + StringRef RethrowName = Personality.getCatchallRethrowFnName(); if (!RethrowName.empty()) { Builder.CreateCall(getCatchallRethrowFn(*this, RethrowName), Builder.CreateLoad(getExceptionSlot())) diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index c030e2bf0b7..7fcd4047137 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -45,7 +45,7 @@ llvm::Value *CodeGenFunction::EmitCastToVoidPtr(llvm::Value *value) { /// CreateTempAlloca - This creates a alloca and inserts it into the entry /// block. llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, - const llvm::Twine &Name) { + const Twine &Name) { if (!Builder.isNamePreserving()) return new llvm::AllocaInst(Ty, 0, "", AllocaInsertPt); return new llvm::AllocaInst(Ty, 0, Name, AllocaInsertPt); @@ -59,7 +59,7 @@ void CodeGenFunction::InitTempAlloca(llvm::AllocaInst *Var, } llvm::AllocaInst *CodeGenFunction::CreateIRTemp(QualType Ty, - const llvm::Twine &Name) { + const Twine &Name) { llvm::AllocaInst *Alloc = CreateTempAlloca(ConvertType(Ty), Name); // FIXME: Should we prefer the preferred type alignment here? CharUnits Align = getContext().getTypeAlignInChars(Ty); @@ -68,7 +68,7 @@ llvm::AllocaInst *CodeGenFunction::CreateIRTemp(QualType Ty, } llvm::AllocaInst *CodeGenFunction::CreateMemTemp(QualType Ty, - const llvm::Twine &Name) { + const Twine &Name) { llvm::AllocaInst *Alloc = CreateTempAlloca(ConvertTypeForMem(Ty), Name); // FIXME: Should we prefer the preferred type alignment here? CharUnits Align = getContext().getTypeAlignInChars(Ty); @@ -310,7 +310,7 @@ EmitExprForReferenceBinding(CodeGenFunction &CGF, const Expr *E, return ReferenceTemporary; } - llvm::SmallVector<SubobjectAdjustment, 2> Adjustments; + SmallVector<SubobjectAdjustment, 2> Adjustments; while (true) { E = E->IgnoreParens(); @@ -921,7 +921,7 @@ RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV) { // Always use shuffle vector to try to retain the original program structure unsigned NumResultElts = ExprVT->getNumElements(); - llvm::SmallVector<llvm::Constant*, 4> Mask; + SmallVector<llvm::Constant*, 4> Mask; for (unsigned i = 0; i != NumResultElts; ++i) { unsigned InIdx = getAccessedFieldNo(i, Elts); Mask.push_back(llvm::ConstantInt::get(Int32Ty, InIdx)); @@ -1147,7 +1147,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, // Use shuffle vector is the src and destination are the same number of // elements and restore the vector mask since it is on the side it will be // stored. - llvm::SmallVector<llvm::Constant*, 4> Mask(NumDstElts); + SmallVector<llvm::Constant*, 4> Mask(NumDstElts); for (unsigned i = 0; i != NumSrcElts; ++i) { unsigned InIdx = getAccessedFieldNo(i, Elts); Mask[InIdx] = llvm::ConstantInt::get(Int32Ty, i); @@ -1162,7 +1162,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, // into the destination. // FIXME: since we're shuffling with undef, can we just use the indices // into that? This could be simpler. - llvm::SmallVector<llvm::Constant*, 4> ExtMask; + SmallVector<llvm::Constant*, 4> ExtMask; unsigned i; for (i = 0; i != NumSrcElts; ++i) ExtMask.push_back(llvm::ConstantInt::get(Int32Ty, i)); @@ -1174,7 +1174,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, llvm::UndefValue::get(SrcVal->getType()), ExtMaskV, "tmp"); // build identity - llvm::SmallVector<llvm::Constant*, 4> Mask; + SmallVector<llvm::Constant*, 4> Mask; for (unsigned i = 0; i != NumDstElts; ++i) Mask.push_back(llvm::ConstantInt::get(Int32Ty, i)); @@ -1290,7 +1290,7 @@ static void setObjCGCLValueClass(const ASTContext &Ctx, const Expr *E, static llvm::Value * EmitBitCastOfLValueToProperType(CodeGenFunction &CGF, llvm::Value *V, llvm::Type *IRType, - llvm::StringRef Name = llvm::StringRef()) { + StringRef Name = StringRef()) { unsigned AS = cast<llvm::PointerType>(V->getType())->getAddressSpace(); return CGF.Builder.CreateBitCast(V, IRType->getPointerTo(AS), Name); } @@ -1486,7 +1486,7 @@ LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) { break; } - llvm::StringRef FnName = CurFn->getName(); + StringRef FnName = CurFn->getName(); if (FnName.startswith("\01")) FnName = FnName.substr(1); GlobalVarName += FnName; @@ -1681,8 +1681,8 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { static llvm::Constant *GenerateConstantVector(llvm::LLVMContext &VMContext, - llvm::SmallVector<unsigned, 4> &Elts) { - llvm::SmallVector<llvm::Constant*, 4> CElts; + SmallVector<unsigned, 4> &Elts) { + SmallVector<llvm::Constant*, 4> CElts; llvm::Type *Int32Ty = llvm::Type::getInt32Ty(VMContext); for (unsigned i = 0, e = Elts.size(); i != e; ++i) @@ -1725,7 +1725,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) { E->getType().withCVRQualifiers(Base.getQuals().getCVRQualifiers()); // Encode the element access list into a vector of unsigned indices. - llvm::SmallVector<unsigned, 4> Indices; + SmallVector<unsigned, 4> Indices; E->getEncodedElementAccess(Indices); if (Base.isSimple()) { @@ -1735,7 +1735,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) { assert(Base.isExtVectorElt() && "Can only subscript lvalue vec elts here!"); llvm::Constant *BaseElts = Base.getExtVectorElts(); - llvm::SmallVector<llvm::Constant *, 4> CElts; + SmallVector<llvm::Constant *, 4> CElts; for (unsigned i = 0, e = Indices.size(); i != e; ++i) { if (isa<llvm::ConstantAggregateZero>(BaseElts)) diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 2579614809f..245640bfcf0 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -839,7 +839,7 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) { // We'll need to enter cleanup scopes in case any of the member // initializers throw an exception. - llvm::SmallVector<EHScopeStack::stable_iterator, 16> cleanups; + SmallVector<EHScopeStack::stable_iterator, 16> cleanups; // Here we iterate over the fields; this makes it simpler to both // default-initialize fields and skip over unnamed fields. diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 9a0eafeae8d..7967c822b36 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -1406,7 +1406,7 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) { QualType DeleteTy = Arg->getType()->getAs<PointerType>()->getPointeeType(); if (DeleteTy->isConstantArrayType()) { llvm::Value *Zero = Builder.getInt32(0); - llvm::SmallVector<llvm::Value*,8> GEP; + SmallVector<llvm::Value*,8> GEP; GEP.push_back(Zero); // point at the outermost array diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index b900e1f9c6e..006cf5bf999 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -1030,7 +1030,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E, return llvm::ConstantStruct::get(STy, Complex); } case APValue::Vector: { - llvm::SmallVector<llvm::Constant *, 4> Inits; + SmallVector<llvm::Constant *, 4> Inits; unsigned NumElts = Result.Val.getVectorLength(); if (Context.getLangOptions().AltiVec && diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 3eebbaa9a84..524d79e131d 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -595,7 +595,7 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, UnV = Builder.CreateInsertElement(UnV, Elt, Idx, "tmp"); // Splat the element across to all elements - llvm::SmallVector<llvm::Constant*, 16> Args; + SmallVector<llvm::Constant*, 16> Args; unsigned NumElements = cast<llvm::VectorType>(DstTy)->getNumElements(); for (unsigned i = 0; i != NumElements; ++i) Args.push_back(Builder.getInt32(0)); @@ -693,7 +693,7 @@ Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { Mask = CGF.EmitScalarExpr(E->getExpr(2)); // Shuffle LHS & RHS into one input vector. - llvm::SmallVector<llvm::Constant*, 32> concat; + SmallVector<llvm::Constant*, 32> concat; for (unsigned i = 0; i != LHSElts; ++i) { concat.push_back(Builder.getInt32(2*i)); concat.push_back(Builder.getInt32(2*i+1)); @@ -721,7 +721,7 @@ Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { (1 << llvm::Log2_32(LHSElts))-1); // Mask off the high bits of each shuffle index. - llvm::SmallVector<llvm::Constant *, 32> MaskV; + SmallVector<llvm::Constant *, 32> MaskV; for (unsigned i = 0, e = MTy->getNumElements(); i != e; ++i) MaskV.push_back(EltMask); @@ -761,7 +761,7 @@ Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { // Handle vec3 special since the index will be off by one for the RHS. llvm::VectorType *VTy = cast<llvm::VectorType>(V1->getType()); - llvm::SmallVector<llvm::Constant*, 32> indices; + SmallVector<llvm::Constant*, 32> indices; for (unsigned i = 2; i < E->getNumSubExprs(); i++) { unsigned Idx = E->getShuffleMaskIdx(CGF.getContext(), i-2); if (VTy->getNumElements() == 3 && Idx > 3) @@ -851,7 +851,7 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) { for (unsigned i = 0; i != NumInitElements; ++i) { Expr *IE = E->getInit(i); Value *Init = Visit(IE); - llvm::SmallVector<llvm::Constant*, 16> Args; + SmallVector<llvm::Constant*, 16> Args; llvm::VectorType *VVT = dyn_cast<llvm::VectorType>(Init->getType()); @@ -1174,7 +1174,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { UnV = Builder.CreateInsertElement(UnV, Elt, Idx, "tmp"); // Splat the element across to all elements - llvm::SmallVector<llvm::Constant*, 16> Args; + SmallVector<llvm::Constant*, 16> Args; unsigned NumElements = cast<llvm::VectorType>(DstTy)->getNumElements(); llvm::Constant *Zero = Builder.getInt32(0); for (unsigned i = 0; i < NumElements; i++) @@ -2610,7 +2610,7 @@ Value *ScalarExprEmitter::VisitAsTypeExpr(AsTypeExpr *E) { llvm::Value *UnV = llvm::UndefValue::get(Src->getType()); - llvm::SmallVector<llvm::Constant*, 3> Args; + SmallVector<llvm::Constant*, 3> Args; Args.push_back(Builder.getInt32(0)); Args.push_back(Builder.getInt32(1)); Args.push_back(Builder.getInt32(2)); diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 8e3532659d1..c817115cbe5 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -810,7 +810,7 @@ void CodeGenFunction::GenerateObjCCtorDtorMethod(ObjCImplementationDecl *IMP, // Suppress the final autorelease in ARC. AutoreleaseResult = false; - llvm::SmallVector<CXXCtorInitializer *, 8> IvarInitializers; + SmallVector<CXXCtorInitializer *, 8> IvarInitializers; for (ObjCImplementationDecl::init_const_iterator B = IMP->init_begin(), E = IMP->init_end(); B != E; ++B) { CXXCtorInitializer *IvarInit = (*B); @@ -1329,7 +1329,7 @@ llvm::Value *CodeGenFunction::EmitObjCExtendObjectLifetime(QualType type, static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM, llvm::FunctionType *type, - llvm::StringRef fnName) { + StringRef fnName) { llvm::Constant *fn = CGM.CreateRuntimeFunction(type, fnName); // In -fobjc-no-arc-runtime, emit weak references to the runtime @@ -1347,7 +1347,7 @@ static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM, static llvm::Value *emitARCValueOperation(CodeGenFunction &CGF, llvm::Value *value, llvm::Constant *&fn, - llvm::StringRef fnName) { + StringRef fnName) { if (isa<llvm::ConstantPointerNull>(value)) return value; if (!fn) { @@ -1374,7 +1374,7 @@ static llvm::Value *emitARCValueOperation(CodeGenFunction &CGF, static llvm::Value *emitARCLoadOperation(CodeGenFunction &CGF, llvm::Value *addr, llvm::Constant *&fn, - llvm::StringRef fnName) { + StringRef fnName) { if (!fn) { std::vector<llvm::Type*> args(1, CGF.Int8PtrPtrTy); llvm::FunctionType *fnType = @@ -1405,7 +1405,7 @@ static llvm::Value *emitARCStoreOperation(CodeGenFunction &CGF, llvm::Value *addr, llvm::Value *value, llvm::Constant *&fn, - llvm::StringRef fnName, + StringRef fnName, bool ignored) { assert(cast<llvm::PointerType>(addr->getType())->getElementType() == value->getType()); @@ -1439,7 +1439,7 @@ static void emitARCCopyOperation(CodeGenFunction &CGF, llvm::Value *dst, llvm::Value *src, llvm::Constant *&fn, - llvm::StringRef fnName) { + StringRef fnName) { assert(dst->getType() == src->getType()); if (!fn) { @@ -1494,7 +1494,7 @@ CodeGenFunction::EmitARCRetainAutoreleasedReturnValue(llvm::Value *value) { llvm::InlineAsm *&marker = CGM.getARCEntrypoints().retainAutoreleasedReturnValueMarker; if (!marker) { - llvm::StringRef assembly + StringRef assembly = CGM.getTargetCodeGenInfo() .getARCRetainAutoreleasedReturnValueMarker(); @@ -1555,7 +1555,7 @@ void CodeGenFunction::EmitARCRelease(llvm::Value *value, bool precise) { call->setDoesNotThrow(); if (!precise) { - llvm::SmallVector<llvm::Value*,1> args; + SmallVector<llvm::Value*,1> args; call->setMetadata("clang.imprecise_release", llvm::MDNode::get(Builder.getContext(), args)); } diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index af36fb54c4f..ba38bfa706c 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -36,12 +36,11 @@ #include "llvm/Support/Compiler.h" #include "llvm/Target/TargetData.h" -#include <stdarg.h> +#include <cstdarg> using namespace clang; using namespace CodeGen; -using llvm::dyn_cast; namespace { @@ -193,7 +192,7 @@ protected: /// first argument. llvm::GlobalVariable *MakeGlobal(llvm::StructType *Ty, std::vector<llvm::Constant*> &V, - llvm::StringRef Name="", + StringRef Name="", llvm::GlobalValue::LinkageTypes linkage =llvm::GlobalValue::InternalLinkage) { llvm::Constant *C = llvm::ConstantStruct::get(Ty, V); @@ -205,7 +204,7 @@ protected: /// element type. llvm::GlobalVariable *MakeGlobal(llvm::ArrayType *Ty, std::vector<llvm::Constant*> &V, - llvm::StringRef Name="", + StringRef Name="", llvm::GlobalValue::LinkageTypes linkage =llvm::GlobalValue::InternalLinkage) { llvm::Constant *C = llvm::ConstantArray::get(Ty, V); @@ -216,7 +215,7 @@ protected: /// element type and the size of the initialiser. llvm::GlobalVariable *MakeGlobalArray(llvm::Type *Ty, std::vector<llvm::Constant*> &V, - llvm::StringRef Name="", + StringRef Name="", llvm::GlobalValue::LinkageTypes linkage =llvm::GlobalValue::InternalLinkage) { llvm::ArrayType *ArrayTy = llvm::ArrayType::get(Ty, V.size()); @@ -268,7 +267,7 @@ private: /// Type of the selector map. This is roughly equivalent to the structure /// used in the GNUstep runtime, which maintains a list of all of the valid /// types for a selector in a table. - typedef llvm::DenseMap<Selector, llvm::SmallVector<TypedSelector, 2> > + typedef llvm::DenseMap<Selector, SmallVector<TypedSelector, 2> > SelectorMap; /// A map from selectors to selector types. This allows us to emit all /// selectors of the same name and type together. @@ -332,18 +331,18 @@ private: /// metadata. This is used purely for introspection in the fragile ABI. In /// the non-fragile ABI, it's used for instance variable fixup. llvm::Constant *GenerateIvarList( - const llvm::SmallVectorImpl<llvm::Constant *> &IvarNames, - const llvm::SmallVectorImpl<llvm::Constant *> &IvarTypes, - const llvm::SmallVectorImpl<llvm::Constant *> &IvarOffsets); + const SmallVectorImpl<llvm::Constant *> &IvarNames, + const SmallVectorImpl<llvm::Constant *> &IvarTypes, + const SmallVectorImpl<llvm::Constant *> &IvarOffsets); /// Generates a method list structure. This is a structure containing a size /// and an array of structures containing method metadata. /// /// This structure is used by both classes and categories, and contains a next /// pointer allowing them to be chained together in a linked list. - llvm::Constant *GenerateMethodList(const llvm::StringRef &ClassName, - const llvm::StringRef &CategoryName, - const llvm::SmallVectorImpl<Selector> &MethodSels, - const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes, + llvm::Constant *GenerateMethodList(const StringRef &ClassName, + const StringRef &CategoryName, + const SmallVectorImpl<Selector> &MethodSels, + const SmallVectorImpl<llvm::Constant *> &MethodTypes, bool isClassMethodList); /// Emits an empty protocol. This is used for @protocol() where no protocol /// is found. The runtime will (hopefully) fix up the pointer to refer to the @@ -352,12 +351,12 @@ private: /// Generates a list of property metadata structures. This follows the same /// pattern as method and instance variable metadata lists. llvm::Constant *GeneratePropertyList(const ObjCImplementationDecl *OID, - llvm::SmallVectorImpl<Selector> &InstanceMethodSels, - llvm::SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes); + SmallVectorImpl<Selector> &InstanceMethodSels, + SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes); /// Generates a list of referenced protocols. Classes, categories, and /// protocols all use this structure. llvm::Constant *GenerateProtocolList( - const llvm::SmallVectorImpl<std::string> &Protocols); + const SmallVectorImpl<std::string> &Protocols); /// To ensure that all protocols are seen by the runtime, we add a category on /// a class defined in the runtime, declaring no methods, but adopting the /// protocols. This is a horribly ugly hack, but it allows us to collect all @@ -380,8 +379,8 @@ private: /// Generates a method list. This is used by protocols to define the required /// and optional methods. llvm::Constant *GenerateProtocolMethodList( - const llvm::SmallVectorImpl<llvm::Constant *> &MethodNames, - const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes); + const SmallVectorImpl<llvm::Constant *> &MethodNames, + const SmallVectorImpl<llvm::Constant *> &MethodTypes); /// Returns a selector with the specified type encoding. An empty string is /// used to return an untyped selector (with the types field set to NULL). llvm::Value *GetSelector(CGBuilderTy &Builder, Selector Sel, @@ -650,13 +649,13 @@ void CGObjCGNU::EmitClassRef(const std::string &className) { llvm::GlobalValue::WeakAnyLinkage, ClassSymbol, symbolRef); } -static std::string SymbolNameForMethod(const llvm::StringRef &ClassName, - const llvm::StringRef &CategoryName, const Selector MethodName, +static std::string SymbolNameForMethod(const StringRef &ClassName, + const StringRef &CategoryName, const Selector MethodName, bool isClassMethod) { std::string MethodNameColonStripped = MethodName.getAsString(); std::replace(MethodNameColonStripped.begin(), MethodNameColonStripped.end(), ':', '_'); - return (llvm::Twine(isClassMethod ? "_c_" : "_i_") + ClassName + "_" + + return (Twine(isClassMethod ? "_c_" : "_i_") + ClassName + "_" + CategoryName + "_" + MethodNameColonStripped).str(); } @@ -813,11 +812,11 @@ llvm::Value *CGObjCGNU::EmitNSAutoreleasePoolClassRef(CGBuilderTy &Builder) { llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, Selector Sel, const std::string &TypeEncoding, bool lval) { - llvm::SmallVector<TypedSelector, 2> &Types = SelectorTable[Sel]; + SmallVector<TypedSelector, 2> &Types = SelectorTable[Sel]; llvm::GlobalAlias *SelValue = 0; - for (llvm::SmallVectorImpl<TypedSelector>::iterator i = Types.begin(), + for (SmallVectorImpl<TypedSelector>::iterator i = Types.begin(), e = Types.end() ; i!=e ; i++) { if (i->first == TypeEncoding) { SelValue = i->second; @@ -1201,10 +1200,10 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF, /// Generates a MethodList. Used in construction of a objc_class and /// objc_category structures. -llvm::Constant *CGObjCGNU::GenerateMethodList(const llvm::StringRef &ClassName, - const llvm::StringRef &CategoryName, - const llvm::SmallVectorImpl<Selector> &MethodSels, - const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes, +llvm::Constant *CGObjCGNU::GenerateMethodList(const StringRef &ClassName, + const StringRef &CategoryName, + const SmallVectorImpl<Selector> &MethodSels, + const SmallVectorImpl<llvm::Constant *> &MethodTypes, bool isClassMethodList) { if (MethodSels.empty()) return NULLPtr; @@ -1261,9 +1260,9 @@ llvm::Constant *CGObjCGNU::GenerateMethodList(const llvm::StringRef &ClassName, /// Generates an IvarList. Used in construction of a objc_class. llvm::Constant *CGObjCGNU::GenerateIvarList( - const llvm::SmallVectorImpl<llvm::Constant *> &IvarNames, - const llvm::SmallVectorImpl<llvm::Constant *> &IvarTypes, - const llvm::SmallVectorImpl<llvm::Constant *> &IvarOffsets) { + const SmallVectorImpl<llvm::Constant *> &IvarNames, + const SmallVectorImpl<llvm::Constant *> &IvarTypes, + const SmallVectorImpl<llvm::Constant *> &IvarOffsets) { if (IvarNames.size() == 0) return NULLPtr; // Get the method structure type. @@ -1374,8 +1373,8 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure( } llvm::Constant *CGObjCGNU::GenerateProtocolMethodList( - const llvm::SmallVectorImpl<llvm::Constant *> &MethodNames, - const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes) { + const SmallVectorImpl<llvm::Constant *> &MethodNames, + const SmallVectorImpl<llvm::Constant *> &MethodTypes) { // Get the method structure type. llvm::StructType *ObjCMethodDescTy = llvm::StructType::get( PtrToInt8Ty, // Really a selector, but the runtime does the casting for us. @@ -1403,7 +1402,7 @@ llvm::Constant *CGObjCGNU::GenerateProtocolMethodList( // Create the protocol list structure used in classes, categories and so on llvm::Constant *CGObjCGNU::GenerateProtocolList( - const llvm::SmallVectorImpl<std::string> &Protocols) { + const SmallVectorImpl<std::string> &Protocols) { llvm::ArrayType *ProtocolArrayTy = llvm::ArrayType::get(PtrToInt8Ty, Protocols.size()); llvm::StructType *ProtocolListTy = llvm::StructType::get( @@ -1445,8 +1444,8 @@ llvm::Value *CGObjCGNU::GenerateProtocolRef(CGBuilderTy &Builder, llvm::Constant *CGObjCGNU::GenerateEmptyProtocol( const std::string &ProtocolName) { - llvm::SmallVector<std::string, 0> EmptyStringVector; - llvm::SmallVector<llvm::Constant*, 0> EmptyConstantVector; + SmallVector<std::string, 0> EmptyStringVector; + SmallVector<llvm::Constant*, 0> EmptyConstantVector; llvm::Constant *ProtocolList = GenerateProtocolList(EmptyStringVector); llvm::Constant *MethodList = @@ -1479,14 +1478,14 @@ llvm::Constant *CGObjCGNU::GenerateEmptyProtocol( void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { ASTContext &Context = CGM.getContext(); std::string ProtocolName = PD->getNameAsString(); - llvm::SmallVector<std::string, 16> Protocols; + SmallVector<std::string, 16> Protocols; for (ObjCProtocolDecl::protocol_iterator PI = PD->protocol_begin(), E = PD->protocol_end(); PI != E; ++PI) Protocols.push_back((*PI)->getNameAsString()); - llvm::SmallVector<llvm::Constant*, 16> InstanceMethodNames; - llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes; - llvm::SmallVector<llvm::Constant*, 16> OptionalInstanceMethodNames; - llvm::SmallVector<llvm::Constant*, 16> OptionalInstanceMethodTypes; + SmallVector<llvm::Constant*, 16> InstanceMethodNames; + SmallVector<llvm::Constant*, 16> InstanceMethodTypes; + SmallVector<llvm::Constant*, 16> OptionalInstanceMethodNames; + SmallVector<llvm::Constant*, 16> OptionalInstanceMethodTypes; for (ObjCProtocolDecl::instmeth_iterator iter = PD->instmeth_begin(), E = PD->instmeth_end(); iter != E; iter++) { std::string TypeStr; @@ -1502,10 +1501,10 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { } } // Collect information about class methods: - llvm::SmallVector<llvm::Constant*, 16> ClassMethodNames; - llvm::SmallVector<llvm::Constant*, 16> ClassMethodTypes; - llvm::SmallVector<llvm::Constant*, 16> OptionalClassMethodNames; - llvm::SmallVector<llvm::Constant*, 16> OptionalClassMethodTypes; + SmallVector<llvm::Constant*, 16> ClassMethodNames; + SmallVector<llvm::Constant*, 16> ClassMethodTypes; + SmallVector<llvm::Constant*, 16> OptionalClassMethodNames; + SmallVector<llvm::Constant*, 16> OptionalClassMethodTypes; for (ObjCProtocolDecl::classmeth_iterator iter = PD->classmeth_begin(), endIter = PD->classmeth_end(); iter != endIter ; iter++) { @@ -1642,8 +1641,8 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { } void CGObjCGNU::GenerateProtocolHolderCategory(void) { // Collect information about instance methods - llvm::SmallVector<Selector, 1> MethodSels; - llvm::SmallVector<llvm::Constant*, 1> MethodTypes; + SmallVector<Selector, 1> MethodSels; + SmallVector<llvm::Constant*, 1> MethodTypes; std::vector<llvm::Constant*> Elements; const std::string ClassName = "__ObjC_Protocol_Holder_Ugly_Hack"; @@ -1690,8 +1689,8 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { std::string ClassName = OCD->getClassInterface()->getNameAsString(); std::string CategoryName = OCD->getNameAsString(); // Collect information about instance methods - llvm::SmallVector<Selector, 16> InstanceMethodSels; - llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes; + SmallVector<Selector, 16> InstanceMethodSels; + SmallVector<llvm::Constant*, 16> InstanceMethodTypes; for (ObjCCategoryImplDecl::instmeth_iterator iter = OCD->instmeth_begin(), endIter = OCD->instmeth_end(); iter != endIter ; iter++) { @@ -1702,8 +1701,8 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { } // Collect information about class methods - llvm::SmallVector<Selector, 16> ClassMethodSels; - llvm::SmallVector<llvm::Constant*, 16> ClassMethodTypes; + SmallVector<Selector, 16> ClassMethodSels; + SmallVector<llvm::Constant*, 16> ClassMethodTypes; for (ObjCCategoryImplDecl::classmeth_iterator iter = OCD->classmeth_begin(), endIter = OCD->classmeth_end(); iter != endIter ; iter++) { @@ -1714,7 +1713,7 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { } // Collect the names of referenced protocols - llvm::SmallVector<std::string, 16> Protocols; + SmallVector<std::string, 16> Protocols; const ObjCCategoryDecl *CatDecl = OCD->getCategoryDecl(); const ObjCList<ObjCProtocolDecl> &Protos = CatDecl->getReferencedProtocols(); for (ObjCList<ObjCProtocolDecl>::iterator I = Protos.begin(), @@ -1741,8 +1740,8 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { } llvm::Constant *CGObjCGNU::GeneratePropertyList(const ObjCImplementationDecl *OID, - llvm::SmallVectorImpl<Selector> &InstanceMethodSels, - llvm::SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes) { + SmallVectorImpl<Selector> &InstanceMethodSels, + SmallVectorImpl<llvm::Constant*> &InstanceMethodTypes) { ASTContext &Context = CGM.getContext(); // // Property metadata: name, attributes, isSynthesized, setter name, setter @@ -1845,9 +1844,9 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { Context.getASTObjCImplementationLayout(OID).getSize().getQuantity(); // Collect information about instance variables. - llvm::SmallVector<llvm::Constant*, 16> IvarNames; - llvm::SmallVector<llvm::Constant*, 16> IvarTypes; - llvm::SmallVector<llvm::Constant*, 16> IvarOffsets; + SmallVector<llvm::Constant*, 16> IvarNames; + SmallVector<llvm::Constant*, 16> IvarTypes; + SmallVector<llvm::Constant*, 16> IvarOffsets; std::vector<llvm::Constant*> IvarOffsetValues; @@ -1898,8 +1897,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { // Collect information about instance methods - llvm::SmallVector<Selector, 16> InstanceMethodSels; - llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes; + SmallVector<Selector, 16> InstanceMethodSels; + SmallVector<llvm::Constant*, 16> InstanceMethodTypes; for (ObjCImplementationDecl::instmeth_iterator iter = OID->instmeth_begin(), endIter = OID->instmeth_end(); iter != endIter ; iter++) { @@ -1914,8 +1913,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { // Collect information about class methods - llvm::SmallVector<Selector, 16> ClassMethodSels; - llvm::SmallVector<llvm::Constant*, 16> ClassMethodTypes; + SmallVector<Selector, 16> ClassMethodSels; + SmallVector<llvm::Constant*, 16> ClassMethodTypes; for (ObjCImplementationDecl::classmeth_iterator iter = OID->classmeth_begin(), endIter = OID->classmeth_end(); iter != endIter ; iter++) { @@ -1925,7 +1924,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { ClassMethodTypes.push_back(MakeConstantString(TypeStr)); } // Collect the names of referenced protocols - llvm::SmallVector<std::string, 16> Protocols; + SmallVector<std::string, 16> Protocols; const ObjCList<ObjCProtocolDecl> &Protos =ClassDecl->getReferencedProtocols(); for (ObjCList<ObjCProtocolDecl>::iterator I = Protos.begin(), E = Protos.end(); I != E; ++I) @@ -1941,7 +1940,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { SuperClass = llvm::ConstantPointerNull::get(PtrToInt8Ty); } // Empty vector used to construct empty method lists - llvm::SmallVector<llvm::Constant*, 1> empty; + SmallVector<llvm::Constant*, 1> empty; // Generate the method and instance variable lists llvm::Constant *MethodList = GenerateMethodList(ClassName, "", InstanceMethodSels, InstanceMethodTypes, false); @@ -2046,7 +2045,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { ConstantStrings.size() + 1); ConstantStrings.push_back(NULLPtr); - llvm::StringRef StringClass = CGM.getLangOptions().ObjCConstantStringClass; + StringRef StringClass = CGM.getLangOptions().ObjCConstantStringClass; if (StringClass.empty()) StringClass = "NXConstantString"; @@ -2085,8 +2084,8 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { std::string SelNameStr = iter->first.getAsString(); llvm::Constant *SelName = ExportUniqueString(SelNameStr, ".objc_sel_name"); - llvm::SmallVectorImpl<TypedSelector> &Types = iter->second; - for (llvm::SmallVectorImpl<TypedSelector>::iterator i = Types.begin(), + SmallVectorImpl<TypedSelector> &Types = iter->second; + for (SmallVectorImpl<TypedSelector>::iterator i = Types.begin(), e = Types.end() ; i!=e ; i++) { llvm::Constant *SelectorTypeEncoding = NULLPtr; @@ -2216,8 +2215,8 @@ llvm::Function *CGObjCGNU::GenerateMethod(const ObjCMethodDecl *OMD, const ObjCContainerDecl *CD) { const ObjCCategoryImplDecl *OCD = dyn_cast<ObjCCategoryImplDecl>(OMD->getDeclContext()); - llvm::StringRef CategoryName = OCD ? OCD->getName() : ""; - llvm::StringRef ClassName = CD->getName(); + StringRef CategoryName = OCD ? OCD->getName() : ""; + StringRef ClassName = CD->getName(); Selector MethodName = OMD->getSelector(); bool isClassMethod = !OMD->isInstanceMethod(); diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 67e3e9d43bc..5c56e81adb7 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -205,7 +205,7 @@ public: CodeGen::CodeGenTypes &Types = CGM.getTypes(); ASTContext &Ctx = CGM.getContext(); // id objc_getProperty (id, SEL, ptrdiff_t, bool) - llvm::SmallVector<CanQualType,4> Params; + SmallVector<CanQualType,4> Params; CanQualType IdType = Ctx.getCanonicalParamType(Ctx.getObjCIdType()); CanQualType SelType = Ctx.getCanonicalParamType(Ctx.getObjCSelType()); Params.push_back(IdType); @@ -223,7 +223,7 @@ public: CodeGen::CodeGenTypes &Types = CGM.getTypes(); ASTContext &Ctx = CGM.getContext(); // void objc_setProperty (id, SEL, ptrdiff_t, id, bool, bool) - llvm::SmallVector<CanQualType,6> Params; + SmallVector<CanQualType,6> Params; CanQualType IdType = Ctx.getCanonicalParamType(Ctx.getObjCIdType()); CanQualType SelType = Ctx.getCanonicalParamType(Ctx.getObjCSelType()); Params.push_back(IdType); @@ -244,7 +244,7 @@ public: CodeGen::CodeGenTypes &Types = CGM.getTypes(); ASTContext &Ctx = CGM.getContext(); // void objc_copyStruct (void *, const void *, size_t, bool, bool) - llvm::SmallVector<CanQualType,5> Params; + SmallVector<CanQualType,5> Params; Params.push_back(Ctx.VoidPtrTy); Params.push_back(Ctx.VoidPtrTy); Params.push_back(Ctx.LongTy); @@ -261,7 +261,7 @@ public: CodeGen::CodeGenTypes &Types = CGM.getTypes(); ASTContext &Ctx = CGM.getContext(); // void objc_enumerationMutation (id) - llvm::SmallVector<CanQualType,1> Params; + SmallVector<CanQualType,1> Params; Params.push_back(Ctx.getCanonicalParamType(Ctx.getObjCIdType())); llvm::FunctionType *FTy = Types.GetFunctionType(Types.getFunctionInfo(Ctx.VoidTy, Params, @@ -669,8 +669,8 @@ protected: unsigned ObjCABI; // gc ivar layout bitmap calculation helper caches. - llvm::SmallVector<GC_IVAR, 16> SkipIvars; - llvm::SmallVector<GC_IVAR, 16> IvarsInfo; + SmallVector<GC_IVAR, 16> SkipIvars; + SmallVector<GC_IVAR, 16> IvarsInfo; /// LazySymbols - Symbols to generate a lazy reference for. See /// DefinedSymbols and FinishModule(). @@ -733,7 +733,7 @@ protected: /// \param[out] NameOut - The return value. void GetNameForMethod(const ObjCMethodDecl *OMD, const ObjCContainerDecl *CD, - llvm::SmallVectorImpl<char> &NameOut); + SmallVectorImpl<char> &NameOut); /// GetMethodVarName - Return a unique constant for the given /// selector's name. The return value has type char *. @@ -786,7 +786,7 @@ protected: /// EmitPropertyList - Emit the given property list. The return /// value has type PropertyListPtrTy. - llvm::Constant *EmitPropertyList(llvm::Twine Name, + llvm::Constant *EmitPropertyList(Twine Name, const Decl *Container, const ObjCContainerDecl *OCD, const ObjCCommonTypesHelper &ObjCTypes); @@ -817,7 +817,7 @@ protected: /// \param Align - The alignment for the variable, or 0. /// \param AddToUsed - Whether the variable should be added to /// "llvm.used". - llvm::GlobalVariable *CreateMetadataVar(llvm::Twine Name, + llvm::GlobalVariable *CreateMetadataVar(Twine Name, llvm::Constant *Init, const char *Section, unsigned Align, @@ -923,7 +923,7 @@ private: /// EmitMethodList - Emit the method list for the given /// implementation. The return value has type MethodListPtrTy. - llvm::Constant *EmitMethodList(llvm::Twine Name, + llvm::Constant *EmitMethodList(Twine Name, const char *Section, const ConstantVector &Methods); @@ -938,7 +938,7 @@ private: /// - begin, end: The method list to output. /// /// The return value has type MethodDescriptionListPtrTy. - llvm::Constant *EmitMethodDescList(llvm::Twine Name, + llvm::Constant *EmitMethodDescList(Twine Name, const char *Section, const ConstantVector &Methods); @@ -964,7 +964,7 @@ private: /// EmitProtocolList - Generate the list of referenced /// protocols. The return value has type ProtocolListPtrTy. - llvm::Constant *EmitProtocolList(llvm::Twine Name, + llvm::Constant *EmitProtocolList(Twine Name, ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end); @@ -1117,7 +1117,7 @@ private: /// EmitMethodList - Emit the method list for the given /// implementation. The return value has type MethodListnfABITy. - llvm::Constant *EmitMethodList(llvm::Twine Name, + llvm::Constant *EmitMethodList(Twine Name, const char *Section, const ConstantVector &Methods); /// EmitIvarList - Emit the ivar list for the given @@ -1144,7 +1144,7 @@ private: /// EmitProtocolList - Generate the list of referenced /// protocols. The return value has type ProtocolListPtrTy. - llvm::Constant *EmitProtocolList(llvm::Twine Name, + llvm::Constant *EmitProtocolList(Twine Name, ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end); @@ -1878,7 +1878,7 @@ CGObjCMac::EmitProtocolExtension(const ObjCProtocolDecl *PD, }; */ llvm::Constant * -CGObjCMac::EmitProtocolList(llvm::Twine Name, +CGObjCMac::EmitProtocolList(Twine Name, ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end) { std::vector<llvm::Constant*> ProtocolRefs; @@ -1942,7 +1942,7 @@ void CGObjCCommonMac::PushProtocolProperties(llvm::SmallPtrSet<const IdentifierI struct _objc_property[prop_count]; }; */ -llvm::Constant *CGObjCCommonMac::EmitPropertyList(llvm::Twine Name, +llvm::Constant *CGObjCCommonMac::EmitPropertyList(Twine Name, const Decl *Container, const ObjCContainerDecl *OCD, const ObjCCommonTypesHelper &ObjCTypes) { @@ -2014,7 +2014,7 @@ CGObjCMac::GetMethodDescriptionConstant(const ObjCMethodDecl *MD) { Desc); } -llvm::Constant *CGObjCMac::EmitMethodDescList(llvm::Twine Name, +llvm::Constant *CGObjCMac::EmitMethodDescList(Twine Name, const char *Section, const ConstantVector &Methods) { // Return null for empty list. @@ -2475,7 +2475,7 @@ llvm::Constant *CGObjCMac::GetMethodConstant(const ObjCMethodDecl *MD) { return llvm::ConstantStruct::get(ObjCTypes.MethodTy, Method); } -llvm::Constant *CGObjCMac::EmitMethodList(llvm::Twine Name, +llvm::Constant *CGObjCMac::EmitMethodList(Twine Name, const char *Section, const ConstantVector &Methods) { // Return null for empty list. @@ -2513,7 +2513,7 @@ llvm::Function *CGObjCCommonMac::GenerateMethod(const ObjCMethodDecl *OMD, } llvm::GlobalVariable * -CGObjCCommonMac::CreateMetadataVar(llvm::Twine Name, +CGObjCCommonMac::CreateMetadataVar(Twine Name, llvm::Constant *Init, const char *Section, unsigned Align, @@ -2626,7 +2626,7 @@ namespace { class FragileHazards { CodeGenFunction &CGF; - llvm::SmallVector<llvm::Value*, 20> Locals; + SmallVector<llvm::Value*, 20> Locals; llvm::DenseSet<llvm::BasicBlock*> BlocksBeforeTry; llvm::InlineAsm *ReadHazard; @@ -2765,7 +2765,7 @@ void FragileHazards::collectLocals() { } llvm::FunctionType *FragileHazards::GetAsmFnType() { - llvm::SmallVector<llvm::Type *, 16> tys(Locals.size()); + SmallVector<llvm::Type *, 16> tys(Locals.size()); for (unsigned i = 0, e = Locals.size(); i != e; ++i) tys[i] = Locals[i]->getType(); return llvm::FunctionType::get(CGF.VoidTy, tys, false); @@ -3756,7 +3756,7 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayoutBitmap(std::string& BitMap) { llvm::Type *PtrTy = llvm::Type::getInt8PtrTy(VMContext); // Build the string of skip/scan nibbles - llvm::SmallVector<SKIP_SCAN, 32> SkipScanIvars; + SmallVector<SKIP_SCAN, 32> SkipScanIvars; unsigned int WordSize = CGM.getTypes().getTargetData().getTypeAllocSize(PtrTy); if (IvarsInfo[0].ivar_bytepos == 0) { @@ -4034,7 +4034,7 @@ CGObjCCommonMac::GetPropertyTypeString(const ObjCPropertyDecl *PD, void CGObjCCommonMac::GetNameForMethod(const ObjCMethodDecl *D, const ObjCContainerDecl *CD, - llvm::SmallVectorImpl<char> &Name) { + SmallVectorImpl<char> &Name) { llvm::raw_svector_ostream OS(Name); assert (CD && "Missing container decl in GetNameForMethod"); OS << '\01' << (D->isInstanceMethod() ? '-' : '+') @@ -5165,7 +5165,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetMethodConstant( /// struct _objc_method method_list[method_count]; /// } /// -llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList(llvm::Twine Name, +llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList(Twine Name, const char *Section, const ConstantVector &Methods) { // Return null for empty list. @@ -5458,7 +5458,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( /// @endcode /// llvm::Constant * -CGObjCNonFragileABIMac::EmitProtocolList(llvm::Twine Name, +CGObjCNonFragileABIMac::EmitProtocolList(Twine Name, ObjCProtocolDecl::protocol_iterator begin, ObjCProtocolDecl::protocol_iterator end) { std::vector<llvm::Constant*> ProtocolRefs; diff --git a/clang/lib/CodeGen/CGObjCRuntime.cpp b/clang/lib/CodeGen/CGObjCRuntime.cpp index bc739c84110..c2978039b1a 100644 --- a/clang/lib/CodeGen/CGObjCRuntime.cpp +++ b/clang/lib/CodeGen/CGObjCRuntime.cpp @@ -177,7 +177,7 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF, FinallyInfo.enter(CGF, Finally->getFinallyBody(), beginCatchFn, endCatchFn, exceptionRethrowFn); - llvm::SmallVector<CatchHandler, 8> Handlers; + SmallVector<CatchHandler, 8> Handlers; // Enter the catch, if there is one. if (S.getNumCatchStmts()) { diff --git a/clang/lib/CodeGen/CGRTTI.cpp b/clang/lib/CodeGen/CGRTTI.cpp index 1ef9a17a2c3..0b9484b7004 100644 --- a/clang/lib/CodeGen/CGRTTI.cpp +++ b/clang/lib/CodeGen/CGRTTI.cpp @@ -29,7 +29,7 @@ class RTTIBuilder { llvm::Type *Int8PtrTy; /// Fields - The fields of the RTTI descriptor currently being built. - llvm::SmallVector<llvm::Constant *, 16> Fields; + SmallVector<llvm::Constant *, 16> Fields; /// GetAddrOfTypeName - Returns the mangled type name of the given type. llvm::GlobalVariable * @@ -120,7 +120,7 @@ RTTIBuilder::GetAddrOfTypeName(QualType Ty, llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); // We know that the mangled name of the type starts at index 4 of the // mangled name of the typename, so we can just index into it in order to @@ -141,7 +141,7 @@ llvm::Constant *RTTIBuilder::GetAddrOfExternalRTTIDescriptor(QualType Ty) { llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); // Look for an existing global. llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(Name); @@ -533,7 +533,7 @@ maybeUpdateRTTILinkage(CodeGenModule &CGM, llvm::GlobalVariable *GV, llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); llvm::GlobalVariable *TypeNameGV = CGM.getModule().getNamedGlobal(Name); @@ -553,7 +553,7 @@ llvm::Constant *RTTIBuilder::BuildTypeInfo(QualType Ty, bool Force) { llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); llvm::GlobalVariable *OldGV = CGM.getModule().getNamedGlobal(Name); if (OldGV && !OldGV->isDeclaration()) { diff --git a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp index df65ba88a3e..f3b84071a1c 100644 --- a/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp +++ b/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp @@ -35,7 +35,7 @@ class CGRecordLayoutBuilder { public: /// FieldTypes - Holds the LLVM types that the struct is created from. /// - llvm::SmallVector<llvm::Type *, 16> FieldTypes; + SmallVector<llvm::Type *, 16> FieldTypes; /// BaseSubobjectType - Holds the LLVM type for the non-virtual part /// of the struct. For example, consider: @@ -1037,7 +1037,7 @@ CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D, return RL; } -void CGRecordLayout::print(llvm::raw_ostream &OS) const { +void CGRecordLayout::print(raw_ostream &OS) const { OS << "<CGRecordLayout\n"; OS << " LLVMType:" << *CompleteObjectType << "\n"; if (BaseSubobjectType) @@ -1071,7 +1071,7 @@ void CGRecordLayout::dump() const { print(llvm::errs()); } -void CGBitFieldInfo::print(llvm::raw_ostream &OS) const { +void CGBitFieldInfo::print(raw_ostream &OS) const { OS << "<CGBitFieldInfo"; OS << " Size:" << Size; OS << " IsSigned:" << IsSigned << "\n"; diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index d56c4bbe014..60db07d388a 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -961,7 +961,7 @@ enum CSFC_Result { CSFC_Failure, CSFC_FallThrough, CSFC_Success }; static CSFC_Result CollectStatementsForCase(const Stmt *S, const SwitchCase *Case, bool &FoundCase, - llvm::SmallVectorImpl<const Stmt*> &ResultStmts) { + SmallVectorImpl<const Stmt*> &ResultStmts) { // If this is a null statement, just succeed. if (S == 0) return Case ? CSFC_Success : CSFC_FallThrough; @@ -1086,7 +1086,7 @@ static CSFC_Result CollectStatementsForCase(const Stmt *S, /// for more details. static bool FindCaseStatementsForValue(const SwitchStmt &S, const llvm::APInt &ConstantCondValue, - llvm::SmallVectorImpl<const Stmt*> &ResultStmts, + SmallVectorImpl<const Stmt*> &ResultStmts, ASTContext &C) { // First step, find the switch case that is being branched to. We can do this // efficiently by scanning the SwitchCase list. @@ -1147,7 +1147,7 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { // emit the live case statement (if any) of the switch. llvm::APInt ConstantCondValue; if (ConstantFoldsToSimpleInteger(S.getCond(), ConstantCondValue)) { - llvm::SmallVector<const Stmt*, 4> CaseStmts; + SmallVector<const Stmt*, 4> CaseStmts; if (FindCaseStatementsForValue(S, ConstantCondValue, CaseStmts, getContext())) { RunCleanupsScope ExecutedScope(*this); @@ -1219,7 +1219,7 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { static std::string SimplifyConstraint(const char *Constraint, const TargetInfo &Target, - llvm::SmallVectorImpl<TargetInfo::ConstraintInfo> *OutCons=0) { + SmallVectorImpl<TargetInfo::ConstraintInfo> *OutCons=0) { std::string Result; while (*Constraint) { @@ -1276,7 +1276,7 @@ AddVariableConstraints(const std::string &Constraint, const Expr &AsmExpr, AsmLabelAttr *Attr = Variable->getAttr<AsmLabelAttr>(); if (!Attr) return Constraint; - llvm::StringRef Register = Attr->getLabel(); + StringRef Register = Attr->getLabel(); assert(Target.isValidGCCRegisterName(Register)); // We're using validateOutputConstraint here because we only care if // this is a register constraint. @@ -1341,11 +1341,11 @@ llvm::Value* CodeGenFunction::EmitAsmInput(const AsmStmt &S, /// asm. static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, CodeGenFunction &CGF) { - llvm::SmallVector<llvm::Value *, 8> Locs; + SmallVector<llvm::Value *, 8> Locs; // Add the location of the first line to the MDNode. Locs.push_back(llvm::ConstantInt::get(CGF.Int32Ty, Str->getLocStart().getRawEncoding())); - llvm::StringRef StrVal = Str->getString(); + StringRef StrVal = Str->getString(); if (!StrVal.empty()) { const SourceManager &SM = CGF.CGM.getContext().getSourceManager(); const LangOptions &LangOpts = CGF.CGM.getLangOptions(); @@ -1367,7 +1367,7 @@ static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str, void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { // Analyze the asm string to decompose it into its pieces. We know that Sema // has already done this, so it is guaranteed to be successful. - llvm::SmallVector<AsmStmt::AsmStringPiece, 4> Pieces; + SmallVector<AsmStmt::AsmStringPiece, 4> Pieces; unsigned DiagOffs; S.AnalyzeAsmString(Pieces, getContext(), DiagOffs); @@ -1384,8 +1384,8 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { } // Get all the output and input constraints together. - llvm::SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos; - llvm::SmallVector<TargetInfo::ConstraintInfo, 4> InputConstraintInfos; + SmallVector<TargetInfo::ConstraintInfo, 4> OutputConstraintInfos; + SmallVector<TargetInfo::ConstraintInfo, 4> InputConstraintInfos; for (unsigned i = 0, e = S.getNumOutputs(); i != e; i++) { TargetInfo::ConstraintInfo Info(S.getOutputConstraint(i), @@ -1556,7 +1556,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { // Clobbers for (unsigned i = 0, e = S.getNumClobbers(); i != e; i++) { - llvm::StringRef Clobber = S.getClobber(i)->getString(); + StringRef Clobber = S.getClobber(i)->getString(); if (Clobber != "memory" && Clobber != "cc") Clobber = Target.getNormalizedGCCRegisterName(Clobber); diff --git a/clang/lib/CodeGen/CGVTT.cpp b/clang/lib/CodeGen/CGVTT.cpp index 49d0938e537..c8a65fd1c17 100644 --- a/clang/lib/CodeGen/CGVTT.cpp +++ b/clang/lib/CodeGen/CGVTT.cpp @@ -30,7 +30,7 @@ class VTTBuilder { /// vtable. const CXXRecordDecl *MostDerivedClass; - typedef llvm::SmallVector<llvm::Constant *, 64> VTTComponentsVectorTy; + typedef SmallVector<llvm::Constant *, 64> VTTComponentsVectorTy; /// VTTComponents - The VTT components. VTTComponentsVectorTy VTTComponents; @@ -408,7 +408,7 @@ llvm::GlobalVariable *CodeGenVTables::GetAddrOfVTT(const CXXRecordDecl *RD) { llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXVTT(RD, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); ComputeVTableRelatedInformation(RD, /*VTableRequired=*/true); diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index 1e5c56f7fc5..b71145fbedc 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -122,7 +122,7 @@ private: /// dump - dump the final overriders for a base subobject, and all its direct /// and indirect base subobjects. - void dump(llvm::raw_ostream &Out, BaseSubobject Base, + void dump(raw_ostream &Out, BaseSubobject Base, VisitedVirtualBasesSetTy& VisitedVirtualBases); public: @@ -380,7 +380,7 @@ FinalOverriders::ComputeBaseOffsets(BaseSubobject Base, bool IsVirtual, } } -void FinalOverriders::dump(llvm::raw_ostream &Out, BaseSubobject Base, +void FinalOverriders::dump(raw_ostream &Out, BaseSubobject Base, VisitedVirtualBasesSetTy &VisitedVirtualBases) { const CXXRecordDecl *RD = Base.getBase(); const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD); @@ -616,7 +616,7 @@ struct VCallOffsetMap { /// Offsets - Keeps track of methods and their offsets. // FIXME: This should be a real map and not a vector. - llvm::SmallVector<MethodAndOffsetPairTy, 16> Offsets; + SmallVector<MethodAndOffsetPairTy, 16> Offsets; /// MethodsCanShareVCallOffset - Returns whether two virtual member functions /// can share the same vcall offset. @@ -724,7 +724,7 @@ private: ASTContext &Context; /// Components - vcall and vbase offset components - typedef llvm::SmallVector<VTableComponent, 64> VTableComponentVectorTy; + typedef SmallVector<VTableComponent, 64> VTableComponentVectorTy; VTableComponentVectorTy Components; /// VisitedVirtualBases - Visited virtual bases. @@ -999,7 +999,7 @@ private: VBaseOffsetOffsetsMapTy VBaseOffsetOffsets; /// Components - The components of the vtable being built. - llvm::SmallVector<VTableComponent, 64> Components; + SmallVector<VTableComponent, 64> Components; /// AddressPoints - Address points for the vtable being built. AddressPointsMapTy AddressPoints; @@ -1042,7 +1042,7 @@ private: /// built. VTableThunksMapTy VTableThunks; - typedef llvm::SmallVector<ThunkInfo, 1> ThunkInfoVectorTy; + typedef SmallVector<ThunkInfo, 1> ThunkInfoVectorTy; typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> ThunksMapTy; /// Thunks - A map that contains all the thunks needed for all methods in the @@ -1214,14 +1214,14 @@ public: } /// dumpLayout - Dump the vtable layout. - void dumpLayout(llvm::raw_ostream&); + void dumpLayout(raw_ostream&); }; void VTableBuilder::AddThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk) { assert(!isBuildingConstructorVTable() && "Can't add thunks for construction vtable"); - llvm::SmallVector<ThunkInfo, 1> &ThunksVector = Thunks[MD]; + SmallVector<ThunkInfo, 1> &ThunksVector = Thunks[MD]; // Check if we have this thunk already. if (std::find(ThunksVector.begin(), ThunksVector.end(), Thunk) != @@ -1981,7 +1981,7 @@ VTableBuilder::LayoutVTablesForVirtualBases(const CXXRecordDecl *RD, } /// dumpLayout - Dump the vtable layout. -void VTableBuilder::dumpLayout(llvm::raw_ostream& Out) { +void VTableBuilder::dumpLayout(raw_ostream& Out) { if (isBuildingConstructorVTable()) { Out << "Construction vtable for ('"; @@ -2881,7 +2881,7 @@ void CodeGenVTables::EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk, "Shouldn't replace non-declaration"); // Remove the name from the old thunk function and get a new thunk. - OldThunkFn->setName(llvm::StringRef()); + OldThunkFn->setName(StringRef()); Entry = CGM.GetAddrOfThunk(GD, Thunk); // If needed, replace the old thunk with a bitcast. @@ -3064,7 +3064,7 @@ CodeGenVTables::CreateVTableInitializer(const CXXRecordDecl *RD, const uint64_t *Components, unsigned NumComponents, const VTableThunksTy &VTableThunks) { - llvm::SmallVector<llvm::Constant *, 64> Inits; + SmallVector<llvm::Constant *, 64> Inits; llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext()); @@ -3174,7 +3174,7 @@ llvm::GlobalVariable *CodeGenVTables::GetAddrOfVTable(const CXXRecordDecl *RD) { llvm::raw_svector_ostream Out(OutName); CGM.getCXXABI().getMangleContext().mangleCXXVTable(RD, Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); ComputeVTableRelatedInformation(RD, /*VTableRequired=*/true); @@ -3244,7 +3244,7 @@ CodeGenVTables::GenerateConstructionVTable(const CXXRecordDecl *RD, mangleCXXCtorVTable(RD, Base.getBaseOffset().getQuantity(), Base.getBase(), Out); Out.flush(); - llvm::StringRef Name = OutName.str(); + StringRef Name = OutName.str(); llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext()); llvm::ArrayType *ArrayType = diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index 263e01e4f18..fc1bd5ee2fb 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -35,7 +35,7 @@ namespace clang { const CodeGenOptions &CodeGenOpts; const TargetOptions &TargetOpts; const LangOptions &LangOpts; - llvm::raw_ostream *AsmOutStream; + raw_ostream *AsmOutStream; ASTContext *Context; Timer LLVMIRGeneration; @@ -50,7 +50,7 @@ namespace clang { const TargetOptions &targetopts, const LangOptions &langopts, bool TimePasses, - const std::string &infile, llvm::raw_ostream *OS, + const std::string &infile, raw_ostream *OS, LLVMContext &C) : Diags(_Diags), Action(action), @@ -199,7 +199,7 @@ void BackendConsumer::InlineAsmDiagHandler2(const llvm::SMDiagnostic &D, // we re-format the SMDiagnostic in terms of a clang diagnostic. // Strip "error: " off the start of the message string. - llvm::StringRef Message = D.getMessage(); + StringRef Message = D.getMessage(); if (Message.startswith("error: ")) Message = Message.substr(7); @@ -259,7 +259,7 @@ llvm::LLVMContext *CodeGenAction::takeLLVMContext() { } static raw_ostream *GetOutputStream(CompilerInstance &CI, - llvm::StringRef InFile, + StringRef InFile, BackendAction Action) { switch (Action) { case Backend_EmitAssembly: @@ -280,9 +280,9 @@ static raw_ostream *GetOutputStream(CompilerInstance &CI, } ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI, - llvm::StringRef InFile) { + StringRef InFile) { BackendAction BA = static_cast<BackendAction>(Act); - llvm::OwningPtr<llvm::raw_ostream> OS(GetOutputStream(CI, InFile, BA)); + llvm::OwningPtr<raw_ostream> OS(GetOutputStream(CI, InFile, BA)); if (BA != Backend_EmitNothing && !OS) return 0; @@ -326,7 +326,7 @@ void CodeGenAction::ExecuteAction() { // Get a custom diagnostic for the error. We strip off a leading // diagnostic code if there is one. - llvm::StringRef Msg = Err.getMessage(); + StringRef Msg = Err.getMessage(); if (Msg.startswith("error: ")) Msg = Msg.substr(7); unsigned DiagID = CI.getDiagnostics().getCustomDiagID(Diagnostic::Error, diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 173994aa853..bdad01344a5 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -740,7 +740,7 @@ CodeGenFunction::EmitNullInitialization(llvm::Value *DestPtr, QualType Ty) { new llvm::GlobalVariable(CGM.getModule(), NullConstant->getType(), /*isConstant=*/true, llvm::GlobalVariable::PrivateLinkage, - NullConstant, llvm::Twine()); + NullConstant, Twine()); llvm::Value *SrcPtr = Builder.CreateBitCast(NullVariable, Builder.getInt8PtrTy()); @@ -818,7 +818,7 @@ llvm::Value *CodeGenFunction::emitArrayLength(const ArrayType *origArrayType, // We have some number of constant-length arrays, so addr should // have LLVM type [M x [N x [...]]]*. Build a GEP that walks // down to the first element of addr. - llvm::SmallVector<llvm::Value*, 8> gepIndices; + SmallVector<llvm::Value*, 8> gepIndices; // GEP down to the array type. llvm::ConstantInt *zero = Builder.getInt32(0); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index fd7128ed03d..d22c0efef11 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -166,7 +166,7 @@ bool CodeGenModule::isTargetDarwin() const { return getContext().Target.getTriple().isOSDarwin(); } -void CodeGenModule::Error(SourceLocation loc, llvm::StringRef error) { +void CodeGenModule::Error(SourceLocation loc, StringRef error) { unsigned diagID = getDiags().getCustomDiagID(Diagnostic::Error, error); getDiags().Report(Context.getFullLoc(loc), diagID); } @@ -281,10 +281,10 @@ void CodeGenModule::setTypeVisibility(llvm::GlobalValue *GV, GV->setUnnamedAddr(true); } -llvm::StringRef CodeGenModule::getMangledName(GlobalDecl GD) { +StringRef CodeGenModule::getMangledName(GlobalDecl GD) { const NamedDecl *ND = cast<NamedDecl>(GD.getDecl()); - llvm::StringRef &Str = MangledDeclNames[GD.getCanonicalDecl()]; + StringRef &Str = MangledDeclNames[GD.getCanonicalDecl()]; if (!Str.empty()) return Str; @@ -313,7 +313,7 @@ llvm::StringRef CodeGenModule::getMangledName(GlobalDecl GD) { char *Name = MangledNamesAllocator.Allocate<char>(Length); std::copy(Buffer.begin(), Buffer.end(), Name); - Str = llvm::StringRef(Name, Length); + Str = StringRef(Name, Length); return Str; } @@ -333,7 +333,7 @@ void CodeGenModule::getBlockMangledName(GlobalDecl GD, MangleBuffer &Buffer, MangleCtx.mangleBlock(cast<DeclContext>(D), BD, Out); } -llvm::GlobalValue *CodeGenModule::GetGlobalValue(llvm::StringRef Name) { +llvm::GlobalValue *CodeGenModule::GetGlobalValue(StringRef Name) { return getModule().getNamedValue(Name); } @@ -618,7 +618,7 @@ void CodeGenModule::EmitDeferred() { // ignore these cases. // // TODO: That said, looking this up multiple times is very wasteful. - llvm::StringRef Name = getMangledName(D); + StringRef Name = getMangledName(D); llvm::GlobalValue *CGRef = GetGlobalValue(Name); assert(CGRef && "Deferred decl wasn't referenced?"); @@ -731,7 +731,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { // Ignore declarations, they will be emitted on their first use. if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(Global)) { if (FD->getIdentifier()) { - llvm::StringRef Name = FD->getName(); + StringRef Name = FD->getName(); if (Name == "_Block_object_assign") { BlockObjectAssignDecl = FD; } else if (Name == "_Block_object_dispose") { @@ -747,7 +747,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { const FunctionDecl *InlineDefinition = 0; FD->getBody(InlineDefinition); - llvm::StringRef MangledName = getMangledName(GD); + StringRef MangledName = getMangledName(GD); llvm::StringMap<GlobalDecl>::iterator DDI = DeferredDecls.find(MangledName); if (DDI != DeferredDecls.end()) @@ -760,7 +760,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { assert(VD->isFileVarDecl() && "Cannot emit local var decl as global."); if (VD->getIdentifier()) { - llvm::StringRef Name = VD->getName(); + StringRef Name = VD->getName(); if (Name == "_NSConcreteGlobalBlock") { NSConcreteGlobalBlockDecl = VD; } else if (Name == "_NSConcreteStackBlock") { @@ -791,7 +791,7 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { // If the value has already been used, add it directly to the // DeferredDeclsToEmit list. - llvm::StringRef MangledName = getMangledName(GD); + StringRef MangledName = getMangledName(GD); if (GetGlobalValue(MangledName)) DeferredDeclsToEmit.push_back(GD); else { @@ -851,7 +851,7 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) { /// If D is non-null, it specifies a decl that correspond to this. This is used /// to set the attributes on the function when it is first created. llvm::Constant * -CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef MangledName, +CodeGenModule::GetOrCreateLLVMFunction(StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable, llvm::Attributes ExtraAttrs) { @@ -954,7 +954,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(GlobalDecl GD, if (!Ty) Ty = getTypes().ConvertType(cast<ValueDecl>(GD.getDecl())->getType()); - llvm::StringRef MangledName = getMangledName(GD); + StringRef MangledName = getMangledName(GD); return GetOrCreateLLVMFunction(MangledName, Ty, GD, ForVTable); } @@ -962,7 +962,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(GlobalDecl GD, /// type and name. llvm::Constant * CodeGenModule::CreateRuntimeFunction(llvm::FunctionType *FTy, - llvm::StringRef Name, + StringRef Name, llvm::Attributes ExtraAttrs) { return GetOrCreateLLVMFunction(Name, FTy, GlobalDecl(), /*ForVTable=*/false, ExtraAttrs); @@ -992,7 +992,7 @@ static bool DeclIsConstantGlobal(ASTContext &Context, const VarDecl *D, /// If D is non-null, it specifies a decl that correspond to this. This is used /// to set the attributes on the global when it is first created. llvm::Constant * -CodeGenModule::GetOrCreateLLVMGlobal(llvm::StringRef MangledName, +CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, llvm::PointerType *Ty, const VarDecl *D, bool UnnamedAddr) { @@ -1062,7 +1062,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(llvm::StringRef MangledName, llvm::GlobalVariable * -CodeGenModule::CreateOrReplaceCXXRuntimeVariable(llvm::StringRef Name, +CodeGenModule::CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage) { llvm::GlobalVariable *GV = getModule().getNamedGlobal(Name); @@ -1114,7 +1114,7 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, llvm::PointerType *PTy = llvm::PointerType::get(Ty, getContext().getTargetAddressSpace(ASTTy)); - llvm::StringRef MangledName = getMangledName(D); + StringRef MangledName = getMangledName(D); return GetOrCreateLLVMGlobal(MangledName, PTy, D); } @@ -1122,7 +1122,7 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, /// specified type and name. llvm::Constant * CodeGenModule::CreateRuntimeVariable(llvm::Type *Ty, - llvm::StringRef Name) { + StringRef Name) { return GetOrCreateLLVMGlobal(Name, llvm::PointerType::getUnqual(Ty), 0, true); } @@ -1134,7 +1134,7 @@ void CodeGenModule::EmitTentativeDefinition(const VarDecl *D) { // If we have not seen a reference to this variable yet, place it // into the deferred declarations table to be emitted if needed // later. - llvm::StringRef MangledName = getMangledName(D); + StringRef MangledName = getMangledName(D); if (!GetGlobalValue(MangledName)) { DeferredDecls[MangledName] = D; return; @@ -1295,7 +1295,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { getContext().getTargetAddressSpace(ASTTy)) { // Move the old entry aside so that we'll create a new one. - Entry->setName(llvm::StringRef()); + Entry->setName(StringRef()); // Make a new global with the correct type, this is now guaranteed to work. GV = cast<llvm::GlobalVariable>(GetAddrOfGlobalVar(D, InitType)); @@ -1391,7 +1391,7 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old, if (OldFn == 0) return; llvm::Type *NewRetTy = NewFn->getReturnType(); - llvm::SmallVector<llvm::Value*, 4> ArgList; + SmallVector<llvm::Value*, 4> ArgList; for (llvm::Value::use_iterator UI = OldFn->use_begin(), E = OldFn->use_end(); UI != E; ) { @@ -1480,7 +1480,7 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) { // (e.g. "int f()") and then a definition of a different type // (e.g. "int f(int x)"). Move the old function aside so that it // doesn't interfere with GetAddrOfFunction. - OldFn->setName(llvm::StringRef()); + OldFn->setName(StringRef()); llvm::Function *NewFn = cast<llvm::Function>(GetAddrOfFunction(GD, Ty)); // If this is an implementation of a function without a prototype, try to @@ -1530,7 +1530,7 @@ void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) { const AliasAttr *AA = D->getAttr<AliasAttr>(); assert(AA && "Not an alias?"); - llvm::StringRef MangledName = getMangledName(GD); + StringRef MangledName = getMangledName(GD); // If there is a definition in the module, then it wins over the alias. // This is dubious, but allow it to be safe. Just ignore the alias. @@ -1604,7 +1604,7 @@ llvm::Value *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD, "isn't a lib fn"); // Get the name, skip over the __builtin_ prefix (if necessary). - llvm::StringRef Name; + StringRef Name; GlobalDecl D(FD); // If the builtin has been declared explicitly with an assembler label, @@ -1636,7 +1636,7 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, bool TargetIsLSB, bool &IsUTF16, unsigned &StringLength) { - llvm::StringRef String = Literal->getString(); + StringRef String = Literal->getString(); unsigned NumBytes = String.size(); // Check for simple case. @@ -1646,7 +1646,7 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, } // Otherwise, convert the UTF8 literals into a byte string. - llvm::SmallVector<UTF16, 128> ToBuf(NumBytes); + SmallVector<UTF16, 128> ToBuf(NumBytes); const UTF8 *FromPtr = (UTF8 *)String.data(); UTF16 *ToPtr = &ToBuf[0]; @@ -1678,7 +1678,7 @@ GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, AsBytes.push_back(0); IsUTF16 = true; - return Map.GetOrCreateValue(llvm::StringRef(AsBytes.data(), AsBytes.size())); + return Map.GetOrCreateValue(StringRef(AsBytes.data(), AsBytes.size())); } static llvm::StringMapEntry<llvm::Constant*> & @@ -1686,7 +1686,7 @@ GetConstantStringEntry(llvm::StringMap<llvm::Constant*> &Map, const StringLiteral *Literal, unsigned &StringLength) { - llvm::StringRef String = Literal->getString(); + StringRef String = Literal->getString(); StringLength = String.size(); return Map.GetOrCreateValue(String); } @@ -1913,7 +1913,7 @@ CodeGenModule::GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *E) { /// GenerateWritableString -- Creates storage for a string literal. -static llvm::Constant *GenerateStringLiteral(llvm::StringRef str, +static llvm::Constant *GenerateStringLiteral(StringRef str, bool constant, CodeGenModule &CGM, const char *GlobalName) { @@ -1939,7 +1939,7 @@ static llvm::Constant *GenerateStringLiteral(llvm::StringRef str, /// Feature.WriteableStrings. /// /// The result has pointer to array type. -llvm::Constant *CodeGenModule::GetAddrOfConstantString(llvm::StringRef Str, +llvm::Constant *CodeGenModule::GetAddrOfConstantString(StringRef Str, const char *GlobalName) { bool IsConstant = !Features.WritableStrings; @@ -1968,7 +1968,7 @@ llvm::Constant *CodeGenModule::GetAddrOfConstantString(llvm::StringRef Str, /// character. The result has pointer to array type. llvm::Constant *CodeGenModule::GetAddrOfConstantCString(const std::string &Str, const char *GlobalName){ - llvm::StringRef StrWithNull(Str.c_str(), Str.size() + 1); + StringRef StrWithNull(Str.c_str(), Str.size() + 1); return GetAddrOfConstantString(StrWithNull, GlobalName); } @@ -2181,7 +2181,7 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { case Decl::FileScopeAsm: { FileScopeAsmDecl *AD = cast<FileScopeAsmDecl>(D); - llvm::StringRef AsmString = AD->getAsmString()->getString(); + StringRef AsmString = AD->getAsmString()->getString(); const std::string &S = getModule().getModuleInlineAsm(); if (S.empty()) @@ -2234,7 +2234,7 @@ void CodeGenModule::EmitDeclMetadata() { llvm::NamedMDNode *GlobalMetadata = 0; // StaticLocalDeclMap - for (llvm::DenseMap<GlobalDecl,llvm::StringRef>::iterator + for (llvm::DenseMap<GlobalDecl,StringRef>::iterator I = MangledDeclNames.begin(), E = MangledDeclNames.end(); I != E; ++I) { llvm::GlobalValue *Addr = getModule().getNamedValue(I->second); diff --git a/clang/lib/CodeGen/CodeGenTBAA.cpp b/clang/lib/CodeGen/CodeGenTBAA.cpp index 8d206cf3a1d..887c1eabb0c 100644 --- a/clang/lib/CodeGen/CodeGenTBAA.cpp +++ b/clang/lib/CodeGen/CodeGenTBAA.cpp @@ -58,7 +58,7 @@ llvm::MDNode *CodeGenTBAA::getChar() { /// getTBAAInfoForNamedType - Create a TBAA tree node with the given string /// as its identifier, and the given Parent node as its tree parent. -llvm::MDNode *CodeGenTBAA::getTBAAInfoForNamedType(llvm::StringRef NameStr, +llvm::MDNode *CodeGenTBAA::getTBAAInfoForNamedType(StringRef NameStr, llvm::MDNode *Parent, bool Readonly) { // Currently there is only one flag defined - the readonly flag. diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 87b3da50005..856b1f9dc27 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -47,7 +47,7 @@ CodeGenTypes::~CodeGenTypes() { void CodeGenTypes::addRecordTypeName(const RecordDecl *RD, llvm::StructType *Ty, - llvm::StringRef suffix) { + StringRef suffix) { llvm::SmallString<256> TypeName; llvm::raw_svector_ostream OS(TypeName); OS << RD->getKindName() << '.'; diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index 2832168eb36..db891db22b5 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -96,12 +96,12 @@ public: void BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType T, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys); + SmallVectorImpl<CanQualType> &ArgTys); void BuildDestructorSignature(const CXXDestructorDecl *Dtor, CXXDtorType T, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys); + SmallVectorImpl<CanQualType> &ArgTys); void BuildInstanceFunctionParams(CodeGenFunction &CGF, QualType &ResTy, @@ -131,12 +131,12 @@ public: void BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType T, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys); + SmallVectorImpl<CanQualType> &ArgTys); void BuildDestructorSignature(const CXXDestructorDecl *Dtor, CXXDtorType T, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys); + SmallVectorImpl<CanQualType> &ArgTys); void BuildInstanceFunctionParams(CodeGenFunction &CGF, QualType &ResTy, @@ -678,7 +678,7 @@ bool ItaniumCXXABI::isZeroInitializable(const MemberPointerType *MPT) { void ItaniumCXXABI::BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { ASTContext &Context = getContext(); // 'this' is already there. @@ -692,7 +692,7 @@ void ItaniumCXXABI::BuildConstructorSignature(const CXXConstructorDecl *Ctor, void ARMCXXABI::BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { ItaniumCXXABI::BuildConstructorSignature(Ctor, Type, ResTy, ArgTys); ResTy = ArgTys[0]; } @@ -702,7 +702,7 @@ void ARMCXXABI::BuildConstructorSignature(const CXXConstructorDecl *Ctor, void ItaniumCXXABI::BuildDestructorSignature(const CXXDestructorDecl *Dtor, CXXDtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { ASTContext &Context = getContext(); // 'this' is already there. @@ -717,7 +717,7 @@ void ItaniumCXXABI::BuildDestructorSignature(const CXXDestructorDecl *Dtor, void ARMCXXABI::BuildDestructorSignature(const CXXDestructorDecl *Dtor, CXXDtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { ItaniumCXXABI::BuildDestructorSignature(Dtor, Type, ResTy, ArgTys); if (Type != Dtor_Deleting) diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index 747e5e3222c..e200e796170 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -31,7 +31,7 @@ public: void BuildConstructorSignature(const CXXConstructorDecl *Ctor, CXXCtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { // 'this' is already in place // TODO: 'for base' flag } @@ -39,7 +39,7 @@ public: void BuildDestructorSignature(const CXXDestructorDecl *Ctor, CXXDtorType Type, CanQualType &ResTy, - llvm::SmallVectorImpl<CanQualType> &ArgTys) { + SmallVectorImpl<CanQualType> &ArgTys) { // 'this' is already in place // TODO: 'for base' flag } diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 58efe179e45..ea0cec3d919 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -57,7 +57,7 @@ const llvm::TargetData &ABIInfo::getTargetData() const { void ABIArgInfo::dump() const { - llvm::raw_ostream &OS = llvm::errs(); + raw_ostream &OS = llvm::errs(); OS << "(ABIArgInfo Kind="; switch (TheKind) { case Direct: @@ -357,7 +357,7 @@ bool UseX86_MMXType(llvm::Type *IRType) { } static llvm::Type* X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, + StringRef Constraint, llvm::Type* Ty) { if ((Constraint == "y" || Constraint == "&y") && Ty->isVectorTy()) return llvm::Type::getX86_MMXTy(CGF.getLLVMContext()); @@ -428,7 +428,7 @@ public: llvm::Value *Address) const; llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, + StringRef Constraint, llvm::Type* Ty) const { return X86AdjustInlineAsmType(CGF, Constraint, Ty); } @@ -943,7 +943,7 @@ public: } llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, - llvm::StringRef Constraint, + StringRef Constraint, llvm::Type* Ty) const { return X86AdjustInlineAsmType(CGF, Constraint, Ty); } @@ -2321,7 +2321,7 @@ public: return 13; } - llvm::StringRef getARCRetainAutoreleasedReturnValueMarker() const { + StringRef getARCRetainAutoreleasedReturnValueMarker() const { return "mov\tr7, r7\t\t@ marker for objc_retainAutoreleaseReturnValue"; } @@ -2354,7 +2354,7 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const { // Calling convention as default by an ABI. llvm::CallingConv::ID DefaultCC; - llvm::StringRef Env = getContext().Target.getTriple().getEnvironmentName(); + StringRef Env = getContext().Target.getTriple().getEnvironmentName(); if (Env == "gnueabi" || Env == "eabi") DefaultCC = llvm::CallingConv::ARM_AAPCS; else @@ -2652,7 +2652,7 @@ void PTXABIInfo::computeInfo(CGFunctionInfo &FI) const { // Calling convention as default by an ABI. llvm::CallingConv::ID DefaultCC; - llvm::StringRef Env = getContext().Target.getTriple().getEnvironmentName(); + StringRef Env = getContext().Target.getTriple().getEnvironmentName(); if (Env == "device") DefaultCC = llvm::CallingConv::PTX_Device; else @@ -2891,7 +2891,7 @@ void MSP430TargetCodeGenInfo::SetTargetAttributes(const Decl *D, // Step 3: Emit ISR vector alias. unsigned Num = attr->getNumber() + 0xffe0; new llvm::GlobalAlias(GV->getType(), llvm::Function::ExternalLinkage, - "vector_" + llvm::Twine::utohexstr(Num), + "vector_" + Twine::utohexstr(Num), GV, &M.getModule()); } } |