Avoid some unnecessary SmallVector copies.
No functionality change. llvm-svn: 217586
This commit is contained in:
@@ -253,7 +253,7 @@ match(MatcherT Matcher, const ast_type_traits::DynTypedNode &Node,
|
||||
MatchFinder Finder;
|
||||
Finder.addMatcher(Matcher, &Callback);
|
||||
Finder.match(Node, Context);
|
||||
return Callback.Nodes;
|
||||
return std::move(Callback.Nodes);
|
||||
}
|
||||
|
||||
template <typename MatcherT, typename NodeT>
|
||||
|
||||
@@ -1162,7 +1162,7 @@ void MicrosoftCXXABI::EmitDestructorCall(CodeGenFunction &CGF,
|
||||
void MicrosoftCXXABI::emitVTableDefinitions(CodeGenVTables &CGVT,
|
||||
const CXXRecordDecl *RD) {
|
||||
MicrosoftVTableContext &VFTContext = CGM.getMicrosoftVTableContext();
|
||||
VPtrInfoVector VFPtrs = VFTContext.getVFPtrOffsets(RD);
|
||||
const VPtrInfoVector &VFPtrs = VFTContext.getVFPtrOffsets(RD);
|
||||
|
||||
for (VPtrInfo *Info : VFPtrs) {
|
||||
llvm::GlobalVariable *VTable = getAddrOfVTable(RD, Info->FullOffsetInMDC);
|
||||
|
||||
@@ -518,7 +518,7 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
|
||||
<< "\n********************\n\n"
|
||||
"PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:\n"
|
||||
"Preprocessed source(s) and associated run script(s) are located at:";
|
||||
ArgStringList Files = C.getTempFiles();
|
||||
const ArgStringList &Files = C.getTempFiles();
|
||||
for (ArgStringList::const_iterator it = Files.begin(), ie = Files.end();
|
||||
it != ie; ++it) {
|
||||
Diag(clang::diag::note_drv_command_failed_diag_msg) << *it;
|
||||
|
||||
@@ -6599,7 +6599,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
}
|
||||
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_L);
|
||||
const ToolChain::path_list Paths = ToolChain.getFilePaths();
|
||||
const ToolChain::path_list &Paths = ToolChain.getFilePaths();
|
||||
for (const auto &Path : Paths)
|
||||
CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + Path));
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
|
||||
@@ -7425,7 +7425,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_L);
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_u);
|
||||
|
||||
const ToolChain::path_list Paths = ToolChain.getFilePaths();
|
||||
const ToolChain::path_list &Paths = ToolChain.getFilePaths();
|
||||
|
||||
for (const auto &Path : Paths)
|
||||
CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + Path));
|
||||
|
||||
@@ -63,8 +63,7 @@ class SimpleStreamChecker : public Checker<check::PostCall,
|
||||
const CallEvent &Call,
|
||||
CheckerContext &C) const;
|
||||
|
||||
void reportLeaks(SymbolVector LeakedStreams,
|
||||
CheckerContext &C,
|
||||
void reportLeaks(ArrayRef<SymbolRef> LeakedStreams, CheckerContext &C,
|
||||
ExplodedNode *ErrNode) const;
|
||||
|
||||
bool guaranteedNotToCloseFile(const CallEvent &Call) const;
|
||||
@@ -222,16 +221,15 @@ void SimpleStreamChecker::reportDoubleClose(SymbolRef FileDescSym,
|
||||
C.emitReport(R);
|
||||
}
|
||||
|
||||
void SimpleStreamChecker::reportLeaks(SymbolVector LeakedStreams,
|
||||
CheckerContext &C,
|
||||
ExplodedNode *ErrNode) const {
|
||||
void SimpleStreamChecker::reportLeaks(ArrayRef<SymbolRef> LeakedStreams,
|
||||
CheckerContext &C,
|
||||
ExplodedNode *ErrNode) const {
|
||||
// Attach bug reports to the leak node.
|
||||
// TODO: Identify the leaked file descriptor.
|
||||
for (SmallVectorImpl<SymbolRef>::iterator
|
||||
I = LeakedStreams.begin(), E = LeakedStreams.end(); I != E; ++I) {
|
||||
for (SymbolRef LeakedStream : LeakedStreams) {
|
||||
BugReport *R = new BugReport(*LeakBugType,
|
||||
"Opened file is never closed; potential resource leak", ErrNode);
|
||||
R->markInteresting(*I);
|
||||
R->markInteresting(LeakedStream);
|
||||
C.emitReport(R);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user