[clang] 7d7e913 - SValExplainer.h - get APSInt values by const reference instead of value. NFCI.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 13 05:05:45 PDT 2021


Author: Simon Pilgrim
Date: 2021-06-13T13:05:17+01:00
New Revision: 7d7e913e096a915038dd41d0bfe5dd8827da1f60

URL: https://github.com/llvm/llvm-project/commit/7d7e913e096a915038dd41d0bfe5dd8827da1f60
DIFF: https://github.com/llvm/llvm-project/commit/7d7e913e096a915038dd41d0bfe5dd8827da1f60.diff

LOG: SValExplainer.h - get APSInt values by const reference instead of value. NFCI.

Avoid unnecessary copies.

Added: 
    

Modified: 
    clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h b/clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
index 0f33909daec0d..31a4ed50a7230 100644
--- a/clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
+++ b/clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
@@ -65,7 +65,7 @@ class SValExplainer : public FullSValVisitor<SValExplainer, std::string> {
   }
 
   std::string VisitLocConcreteInt(loc::ConcreteInt V) {
-    llvm::APSInt I = V.getValue();
+    const llvm::APSInt &I = V.getValue();
     std::string Str;
     llvm::raw_string_ostream OS(Str);
     OS << "concrete memory address '" << I << "'";
@@ -77,7 +77,7 @@ class SValExplainer : public FullSValVisitor<SValExplainer, std::string> {
   }
 
   std::string VisitNonLocConcreteInt(nonloc::ConcreteInt V) {
-    llvm::APSInt I = V.getValue();
+    const llvm::APSInt &I = V.getValue();
     std::string Str;
     llvm::raw_string_ostream OS(Str);
     OS << (I.isSigned() ? "signed " : "unsigned ") << I.getBitWidth()


        


More information about the cfe-commits mailing list