https://github.com/smanna12 updated https://github.com/llvm/llvm-project/pull/75060
>From bd008b0d67bb08ef9414d93720bcb2f024997c0f Mon Sep 17 00:00:00 2001 From: "Manna, Soumi" <soumi.ma...@intel.com> Date: Mon, 11 Dec 2023 07:26:40 -0800 Subject: [PATCH 1/2] [NFC][CLANG] Fix static analyzer bugs about large copy by values Reported by Static Analyzer tool: 1. 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 2. In makeCommonInvocationForModuleBuild(clang::CompilerInvocation): A large function call parameter exceeding the low threshold is passed by value. pass_by_value: Passing parameter CI of type clang::CompilerInvocation (size 176 bytes) by value, which exceeds the low threshold of 128 bytes --- clang/lib/Analysis/UnsafeBufferUsage.cpp | 2 +- clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp index e332a3609290aa..bc23c83f77aea2 100644 --- a/clang/lib/Analysis/UnsafeBufferUsage.cpp +++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp @@ -1488,7 +1488,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 diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp index f65da413bb87c3..598486932563d0 100644 --- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp +++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp @@ -110,7 +110,7 @@ void ModuleDepCollector::addOutputPaths(CowCompilerInvocation &CI, } static CowCompilerInvocation -makeCommonInvocationForModuleBuild(CompilerInvocation CI) { +makeCommonInvocationForModuleBuild(const CompilerInvocation &CI) { CI.resetNonModularOptions(); CI.clearImplicitModuleBuildOptions(); >From 10330ae5a27342546b34e93628415d00eed6b914 Mon Sep 17 00:00:00 2001 From: "Manna, Soumi" <soumi.ma...@intel.com> Date: Mon, 11 Dec 2023 12:31:04 -0800 Subject: [PATCH 2/2] Update patch and address review comment --- clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp index 598486932563d0..f65da413bb87c3 100644 --- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp +++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp @@ -110,7 +110,7 @@ void ModuleDepCollector::addOutputPaths(CowCompilerInvocation &CI, } static CowCompilerInvocation -makeCommonInvocationForModuleBuild(const CompilerInvocation &CI) { +makeCommonInvocationForModuleBuild(CompilerInvocation CI) { CI.resetNonModularOptions(); CI.clearImplicitModuleBuildOptions(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits