diff options
author | Manna, Soumi <soumi.manna@intel.com> | 2023-04-24 14:16:32 -0700 |
---|---|---|
committer | Manna, Soumi <soumi.manna@intel.com> | 2023-04-24 14:52:55 -0700 |
commit | 38ecb9767c1485abe0eb210ceeb827a884bc55c9 (patch) | |
tree | 8d3675d46fd365e45aa22c9c39ffd59e97e5a868 /clang/lib/AST/ComputeDependence.cpp | |
parent | 6dc83c156e6d7290163daeae7ac5f9b0b6fe6292 (diff) | |
download | llvm-38ecb9767c1485abe0eb210ceeb827a884bc55c9.zip llvm-38ecb9767c1485abe0eb210ceeb827a884bc55c9.tar.gz llvm-38ecb9767c1485abe0eb210ceeb827a884bc55c9.tar.bz2 |
[NFC][clang] Fix Coverity bugs with AUTO_CAUSES_COPY
Reported by Coverity:
AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.
1. Inside "ExtractAPIVisitor.h" file, in clang::extractapi::impl::ExtractAPIVisitorBase<<unnamed>::BatchExtractAPIVisitor>::VisitFunctionDecl(clang::FunctionDecl const *): Using the auto keyword without an & causes the copy of an object of type DynTypedNode.
2. Inside "NeonEmitter.cpp" file, in <unnamed>::Intrinsic::Intrinsic(llvm::Record *, llvm::StringRef, llvm::StringRef, <unnamed>::TypeSpec, <unnamed>::TypeSpec, <unnamed>::ClassKind, llvm::ListInit *, <unnamed>::NeonEmitter &, llvm::StringRef, llvm::StringRef, bool, bool): Using the auto keyword without an & causes the copy of an object of type Type.
3. Inside "MicrosoftCXXABI.cpp" file, in <unnamed>::MSRTTIBuilder::getClassHierarchyDescriptor(): Using the auto keyword without an & causes the copy of an object of type MSRTTIClass.
4. Inside "CGGPUBuiltin.cpp" file, in clang::CodeGen::CodeGenFunction::EmitAMDGPUDevicePrintfCallExpr(clang::CallExpr const *): Using the auto keyword without an & causes the copy of an object of type CallArg.
5. Inside "SemaDeclAttr.cpp" file, in threadSafetyCheckIsSmartPointer(clang::Sema &, clang::RecordType const *): Using the auto keyword without an & causes the copy of an object of type CXXBaseSpecifier.
6. Inside "ComputeDependence.cpp" file, in clang::computeDependence(clang::DesignatedInitExpr *): Using the auto keyword without an & causes the copy of an object of type Designator.
7. Inside "Format.cpp" file, In clang::format::affectsRange(llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int): Using the auto keyword without an & causes the copy of an object of type Range.
Reviewed By: tahonermann
Differential Revision: https://reviews.llvm.org/D149074
Diffstat (limited to 'clang/lib/AST/ComputeDependence.cpp')
-rw-r--r-- | clang/lib/AST/ComputeDependence.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/AST/ComputeDependence.cpp b/clang/lib/AST/ComputeDependence.cpp index c561f04..5a301c1 100644 --- a/clang/lib/AST/ComputeDependence.cpp +++ b/clang/lib/AST/ComputeDependence.cpp @@ -663,7 +663,7 @@ ExprDependence clang::computeDependence(GenericSelectionExpr *E, ExprDependence clang::computeDependence(DesignatedInitExpr *E) { auto Deps = E->getInit()->getDependence(); - for (auto D : E->designators()) { + for (const auto &D : E->designators()) { auto DesignatorDeps = ExprDependence::None; if (D.isArrayDesignator()) DesignatorDeps |= E->getArrayIndex(D)->getDependence(); |