SValExplainer.h - get APSInt values by const reference instead of value. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 13 Jun 2021 12:05:17 +0000 (13:05 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 13 Jun 2021 12:05:17 +0000 (13:05 +0100)
Avoid unnecessary copies.

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

index 0f33909..31a4ed5 100644 (file)
@@ -65,7 +65,7 @@ public:
   }
 
   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 @@ public:
   }
 
   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()