r287890 - [Sema] Pass APSInts by const ref, avoiding copies.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 24 07:36:17 PST 2016
Author: d0k
Date: Thu Nov 24 09:36:17 2016
New Revision: 287890
URL: http://llvm.org/viewvc/llvm-project?rev=287890&view=rev
Log:
[Sema] Pass APSInts by const ref, avoiding copies.
No functionality change intended. Fix by clang-tidy's
performance-unnecessary-value-param check.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=287890&r1=287889&r2=287890&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Nov 24 09:36:17 2016
@@ -814,7 +814,7 @@ Sema::ActOnDecompositionDeclarator(Scope
static bool checkSimpleDecomposition(
Sema &S, ArrayRef<BindingDecl *> Bindings, ValueDecl *Src,
- QualType DecompType, llvm::APSInt NumElems, QualType ElemType,
+ QualType DecompType, const llvm::APSInt &NumElems, QualType ElemType,
llvm::function_ref<ExprResult(SourceLocation, Expr *, unsigned)> GetInit) {
if ((int64_t)Bindings.size() != NumElems) {
S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings)
@@ -841,7 +841,7 @@ static bool checkSimpleDecomposition(
static bool checkArrayLikeDecomposition(Sema &S,
ArrayRef<BindingDecl *> Bindings,
ValueDecl *Src, QualType DecompType,
- llvm::APSInt NumElems,
+ const llvm::APSInt &NumElems,
QualType ElemType) {
return checkSimpleDecomposition(
S, Bindings, Src, DecompType, NumElems, ElemType,
@@ -1064,7 +1064,7 @@ struct BindingDiagnosticTrap {
static bool checkTupleLikeDecomposition(Sema &S,
ArrayRef<BindingDecl *> Bindings,
VarDecl *Src, QualType DecompType,
- llvm::APSInt TupleSize) {
+ const llvm::APSInt &TupleSize) {
if ((int64_t)Bindings.size() != TupleSize) {
S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings)
<< DecompType << (unsigned)Bindings.size() << TupleSize.toString(10)
More information about the cfe-commits
mailing list