Use v.data() instead of &v[0] when SmallVector v might be empty.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReaderStmt.cpp b/lib/Frontend/PCHReaderStmt.cpp
index d4ff6ad..03c5d25 100644
--- a/lib/Frontend/PCHReaderStmt.cpp
+++ b/lib/Frontend/PCHReaderStmt.cpp
@@ -129,7 +129,7 @@
VisitStmt(S);
unsigned NumStmts = Record[Idx++];
S->setStmts(*Reader.getContext(),
- &StmtStack[StmtStack.size() - NumStmts], NumStmts);
+ StmtStack.data() + StmtStack.size() - NumStmts, NumStmts);
S->setLBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
S->setRBracLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
return NumStmts;
@@ -303,13 +303,13 @@
Exprs.push_back(StmtStack[StackIdx++]);
}
S->setOutputsAndInputs(NumOutputs, NumInputs,
- &Names[0], &Constraints[0], &Exprs[0]);
+ Names.data(), Constraints.data(), Exprs.data());
// Constraints
llvm::SmallVector<StringLiteral*, 16> Clobbers;
for (unsigned I = 0; I != NumClobbers; ++I)
Clobbers.push_back(cast_or_null<StringLiteral>(StmtStack[StackIdx++]));
- S->setClobbers(&Clobbers[0], NumClobbers);
+ S->setClobbers(Clobbers.data(), NumClobbers);
assert(StackIdx == StmtStack.size() && "Error deserializing AsmStmt");
return NumOutputs*2 + NumInputs*2 + NumClobbers + 1;