[clang] a9b3054 - [NFC][CLANG] Fix static analyzer bugs about large copy by values (#75060)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 12 06:08:00 PST 2023


Author: smanna12
Date: 2023-12-12T08:07:55-06:00
New Revision: a9b30545448695c76ddb25a16fae613d641cfeb7

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

LOG: [NFC][CLANG] Fix static analyzer bugs about large copy by values (#75060)

Reported by Static Analyzer tool:

In getSourceRangeToTokenEnd(clang::Decl const *, clang::SourceManager
const &, clang::LangOptions): A very large function call parameter
exceeding the high threshold is passed by value

pass_by_value: Passing parameter LangOpts of type clang::LangOptions
(size 1784 bytes) by value, which exceeds the high threshold of 512
bytes

Added: 
    

Modified: 
    clang/lib/Analysis/UnsafeBufferUsage.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index a1efb76be68b7d..70eec1cee57f8e 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -1534,7 +1534,7 @@ static bool hasUnsupportedSpecifiers(const VarDecl *VD,
 // returned by this function is the last location of the last token.
 static SourceRange getSourceRangeToTokenEnd(const Decl *D,
                                             const SourceManager &SM,
-                                            LangOptions LangOpts) {
+                                            const LangOptions &LangOpts) {
   SourceLocation Begin = D->getBeginLoc();
   SourceLocation
     End = // `D->getEndLoc` should always return the starting location of the


        


More information about the cfe-commits mailing list