[clang] [Clang] Handle instantiating captures in addInstantiatedCapturesToScope() (PR #128478)

2025-02-23 Thread Younan Zhang via cfe-commits
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/128478 `addInstantiatedCapturesToScope()` might be called when transforming a lambda body. In this situation, it would look into all the lambda's parents and figure out all the instantiated captures. However, the inst

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-23 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: Gentle ping :smile: @vsapsai, @vgvassilev, I think I have responded to your inquiries and added a few related questions. Could you have a look? https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailin

[clang] [analyzer] Refine TimeTrace name for dispatchWorkItem (PR #128352)

2025-02-23 Thread Balazs Benics via cfe-commits
https://github.com/steakhal closed https://github.com/llvm/llvm-project/pull/128352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 6b5bde6 - [analyzer] Refine TimeTrace name for dispatchWorkItem (#128352)

2025-02-23 Thread via cfe-commits
Author: Balazs Benics Date: 2025-02-24T08:36:05+01:00 New Revision: 6b5bde697bb6f2ec8564c9b35bbf9f2d5b703f13 URL: https://github.com/llvm/llvm-project/commit/6b5bde697bb6f2ec8564c9b35bbf9f2d5b703f13 DIFF: https://github.com/llvm/llvm-project/commit/6b5bde697bb6f2ec8564c9b35bbf9f2d5b703f13.diff

[clang] [analyzer] Refine TimeTrace name for dispatchWorkItem (PR #128352)

2025-02-23 Thread Arseniy Zaostrovnykh via cfe-commits
https://github.com/necto approved this pull request. https://github.com/llvm/llvm-project/pull/128352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WIP][clang]: Implement a conditional lifetimebound_if builtin. (PR #125520)

2025-02-23 Thread Haojian Wu via cfe-commits
hokein wrote: > A moved from object could be reinitalized: > > ``` > void test() { > std::vector abc; > std::string b; > add(abc, std::move(b)); > b = std::string(); // now b can be used again. > } > ``` > > That being said, maybe this is rare enough that we could have

[libclc] [libclc] Fix int<->float conversion builtins (PR #126905)

2025-02-23 Thread Romaric Jodin via cfe-commits
https://github.com/rjodinchr approved this pull request. https://github.com/llvm/llvm-project/pull/126905 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libclc] [libclc] Move fma to the CLC library (PR #126052)

2025-02-23 Thread Romaric Jodin via cfe-commits
rjodinchr wrote: > FYI @rjodinchr this breaks downstream clspv testing. > > ``` > # | declare !kernel_arg_name !7 float @llvm.fma.f32(float, float, float) #2 > # | Unsupported llvm intrinsic > # | UNREACHABLE executed at /clspv/lib/SPIRVProducerPass.cpp:2390! > ``` > > I was wondering if clspv

[clang] [llvm] [RISCV] Add Qualcomm uC Xqcilia (Large Immediate Arithmetic) extension (PR #124706)

2025-02-23 Thread Sam Elliott via cfe-commits
https://github.com/lenary approved this pull request. https://github.com/llvm/llvm-project/pull/124706 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [RISCV] Add Qualcomm uC Xqcilia (Large Immediate Arithmetic) extension (PR #124706)

2025-02-23 Thread via cfe-commits
https://github.com/hchandel updated https://github.com/llvm/llvm-project/pull/124706 >From 81d1b6240cfaedb521d4f0efd54744114577f455 Mon Sep 17 00:00:00 2001 From: Harsh Chandel Date: Fri, 24 Jan 2025 16:43:12 +0530 Subject: [PATCH 1/5] [RISCV] Add Qualcomm uC Xqcilia (Large Immediate Arithmeti

[clang] [llvm] [RISCV] Add Qualcomm uC Xqcilia (Large Immediate Arithmetic) extension (PR #124706)

2025-02-23 Thread via cfe-commits
@@ -1056,6 +1056,15 @@ struct RISCVOperand final : public MCParsedAsmOperand { isInt<26>(fixImmediateForRV32(Imm, isRV64Imm())); } + bool isSImm32() const { +int64_t Imm; +RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None; +if (!isImm()) +

[clang] [llvm] [RISCV] Add Qualcomm uC Xqcilia (Large Immediate Arithmetic) extension (PR #124706)

2025-02-23 Thread Craig Topper via cfe-commits
https://github.com/topperc approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/124706 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Teach Barmetal toolchain about GCC installation(1/3) (PR #121829)

2025-02-23 Thread Fangrui Song via cfe-commits
@@ -110,20 +111,93 @@ static std::string computeBaseSysRoot(const Driver &D, bool IncludeTriple) { return std::string(SysRootDir); } +// GCC sysroot here means form sysroot from either --gcc-install-dir, or from +// --gcc-toolchain or if the toolchain is installed alongside

[clang] [Driver] Teach Barmetal toolchain about GCC installation(1/3) (PR #121829)

2025-02-23 Thread Garvit Gupta via cfe-commits
@@ -110,20 +111,93 @@ static std::string computeBaseSysRoot(const Driver &D, bool IncludeTriple) { return std::string(SysRootDir); } +// GCC sysroot here means form sysroot from either --gcc-install-dir, or from +// --gcc-toolchain or if the toolchain is installed alongside

[clang] [Driver] Teach Barmetal toolchain about GCC installation(1/3) (PR #121829)

2025-02-23 Thread Garvit Gupta via cfe-commits
quic-garvgupt wrote: It's been a few weeks since this patch was last reviewed. If everything looks good, could someone please provide an LGTM? I'd like to merge this patch soon. https://github.com/llvm/llvm-project/pull/121829 ___ cfe-commits mailin

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-02-23 Thread Congcong Cai via cfe-commits
@@ -110,6 +110,12 @@ Changes in existing checks ` check by providing additional examples and fixing some macro related false positives. +- Improved :doc:`performance-noexcept-move-constructor + ` check by adding + a new (off-by-default) option `AllowFalseEvaluated`, whic

[clang-tools-extra] [clang-tidy] Add AllowFalseEvaluated flag to clang-tidy noexcept-move-constructor check (PR #126897)

2025-02-23 Thread Congcong Cai via cfe-commits
@@ -22,7 +22,8 @@ namespace clang::tidy::performance { class NoexceptFunctionBaseCheck : public ClangTidyCheck { public: NoexceptFunctionBaseCheck(StringRef Name, ClangTidyContext *Context) - : ClangTidyCheck(Name, Context) {} + : ClangTidyCheck(Name, Context) +

[clang-tools-extra] [clang-tidy]improve performance-unnecessary-value-param performance (PR #128383)

2025-02-23 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/128383 >From 721393e8f1a464931884be95fef48518f8c351f1 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sun, 23 Feb 2025 08:36:53 +0800 Subject: [PATCH 1/2] [clang-tidy]improve performance-unnecessary-value-param

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-23 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/127720 >From b69bb465a24f2175f2f9f91f220252d3bcb27bde Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Wed, 19 Feb 2025 07:38:37 +0800 Subject: [PATCH 1/9] [clang-tidy]add new check bugprone-unintended-char-ostre

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-23 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/127720 >From b69bb465a24f2175f2f9f91f220252d3bcb27bde Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Wed, 19 Feb 2025 07:38:37 +0800 Subject: [PATCH 1/9] [clang-tidy]add new check bugprone-unintended-char-ostre

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-23 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,69 @@ +//===--- UnintendedCharOstreamOutputCheck.cpp - clang-tidy ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for local variables to NS and CF types. (PR #127554)

2025-02-23 Thread Ryosuke Niwa via cfe-commits
@@ -332,6 +345,14 @@ class UncheckedCallArgsChecker final : public RawPtrRefCallArgsChecker { return isUncheckedPtr(QT); } + bool isSafePtr(const CXXRecordDecl *Record) const final { +return isRefCounted(Record) || isCheckedPtr(Record); + } + + bool isSafePtrType

[clang] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for local variables to NS and CF types. (PR #127554)

2025-02-23 Thread Rashmi Mudduluru via cfe-commits
@@ -332,6 +345,14 @@ class UncheckedCallArgsChecker final : public RawPtrRefCallArgsChecker { return isUncheckedPtr(QT); } + bool isSafePtr(const CXXRecordDecl *Record) const final { +return isRefCounted(Record) || isCheckedPtr(Record); + } + + bool isSafePtrType

[clang] [llvm] [Coroutines] Mark parameter allocas with coro.outside.frame metadata (PR #127653)

2025-02-23 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > In the issue (#127499) you pointed out that this issue applies to the MSVC > > ABI where all parameters are destroyed in the callee. Is it reasonable to > > construct the analogous test case in that environment? > > Yes, in fact the reproducer on that issue will trigger u

[clang-tools-extra] [clang-tidy] Fix invalid fixit from modernize-use-ranges for nullptr used with std::unique_ptr (PR #127162)

2025-02-23 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 commented: LGTM. since it is just a patch instead of ideal solution for `std::equality_comparable_with` stuff, could you add some FIXME in code? https://github.com/llvm/llvm-project/pull/127162 ___ cfe-commits mailing li

[clang-tools-extra] [clang-tidy] Fix false positive for cppcoreguidelines-pro-bounds-pointer-arithmetic (PR #127394)

2025-02-23 Thread via cfe-commits
flovent wrote: ping https://github.com/llvm/llvm-project/pull/127394 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-23 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/126654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -1299,8 +1299,8 @@ ProgramStateRef CStringChecker::invalidateBufferAux( RegionAndSymbolInvalidationTraits ITraits; bool CausesPointerEscape = InvalidationTraitOperations(ITraits, R); -return State->invalidateRegions(R, E, C.blockCount(), LCtx, i

[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)

2025-02-23 Thread via cfe-commits
isuckatcs wrote: @PiotrZSL > What about 'false' ? In both cases if `false` is a keyword or an undefined macro, it evaluates to `false`, so I don't find that misleading or the source of a hard-to debug issue, so I don't see a reason to emit a warning for that. > This issue is detected by -Wu

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -166,57 +166,47 @@ DefinedOrUnknownSVal SValBuilder::conjureSymbolVal(const void *SymbolTag, if (Ex->isGLValue()) T = LCtx->getAnalysisDeclContext()->getASTContext().getPointerType(ExType); - return conjureSymbolVal(SymbolTag, Ex, LCtx, T, Count); + return conjureS

[clang] [ubsan] Remove -fsanitizer=vptr from -fsanitizer=undefined (PR #121115)

2025-02-23 Thread Vitaly Buka via cfe-commits
vitalybuka wrote: @AaronBallman @zygoloid Looks like we agree on https://discourse.llvm.org/t/rfc-remove-vptr-from-undefined/83830 So I'd like to merge this patch this week. https://github.com/llvm/llvm-project/pull/121115 ___ cfe-commits mailing lis

[clang] [ubsan] Remove -fsanitizer=vptr from -fsanitizer=undefined (PR #121115)

2025-02-23 Thread Vitaly Buka via cfe-commits
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/121115 >From bca319184733b4bad1eb6b83aaac18a75be40b8c Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Wed, 25 Dec 2024 14:22:10 -0800 Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?= =?

[clang] [clang] Improve module out of date error message (PR #128103)

2025-02-23 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 approved this pull request. https://github.com/llvm/llvm-project/pull/128103 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -151,10 +151,10 @@ SValBuilder::getRegionValueSymbolVal(const TypedValueRegion *region) { return nonloc::SymbolVal(sym); } -DefinedOrUnknownSVal SValBuilder::conjureSymbolVal(const void *SymbolTag, fangyi-zhou wrote: This overload would have been remove

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -198,32 +191,24 @@ class SValBuilder { /// The advantage of symbols derived/built from other symbols is that we /// preserve the relation between related(or even equivalent) expressions, so /// conjured symbols should be used sparingly. - DefinedOrUnknownSVal conjureS

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -1376,8 +1379,8 @@ StoreRef RegionStoreManager::invalidateRegions( } RegionBindingsRef B = getRegionBindings(store); - InvalidateRegionsWorker W(*this, StateMgr, B, S, Count, LCtx, IS, ITraits, -Invalidated, GlobalsFilter); + InvalidateRegi

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -1515,7 +1515,8 @@ void CStringChecker::evalCopyCommon(CheckerContext &C, const CallEvent &Call, // conjure a return value for later. if (lastElement.isUnknown()) lastElement = C.getSValBuilder().conjureSymbolVal( -nullptr, Call.getOriginExpr

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -533,18 +538,12 @@ class SymbolManager { template const SymExprT *acquire(Args &&...args); - const SymbolConjured *conjureSymbol(const Stmt *E, - const LocationContext *LCtx, QualType T, - unsig

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -198,32 +191,24 @@ class SValBuilder { /// The advantage of symbols derived/built from other symbols is that we /// preserve the relation between related(or even equivalent) expressions, so /// conjured symbols should be used sparingly. - DefinedOrUnknownSVal conjureS

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -1770,7 +1772,8 @@ void CStringChecker::evalstrLengthCommon(CheckerContext &C, // All we know is the return value is the min of the string length // and the limit. This is better than nothing. result = C.getSValBuilder().conjureSymbolVal( - nullpt

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread Fangyi Zhou via cfe-commits
@@ -171,19 +172,11 @@ class SValBuilder { // Forwarding methods to SymbolManager. - const SymbolConjured* conjureSymbol(const Stmt *stmt, - const LocationContext *LCtx, - QualType type, -

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -198,32 +191,24 @@ class SValBuilder { /// The advantage of symbols derived/built from other symbols is that we /// preserve the relation between related(or even equivalent) expressions, so /// conjured symbols should be used sparingly. - DefinedOrUnknownSVal conjureS

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
https://github.com/isuckatcs requested changes to this pull request. I didn't have enough time to check the whole patch, I'll get back to it later. The general patterns seems to be that when a conjured symbol is created, it's always the reference to the current CFG element that is passed as the

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -533,18 +538,12 @@ class SymbolManager { template const SymExprT *acquire(Args &&...args); - const SymbolConjured *conjureSymbol(const Stmt *E, - const LocationContext *LCtx, QualType T, - unsig

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -1515,7 +1515,8 @@ void CStringChecker::evalCopyCommon(CheckerContext &C, const CallEvent &Call, // conjure a return value for later. if (lastElement.isUnknown()) lastElement = C.getSValBuilder().conjureSymbolVal( -nullptr, Call.getOriginExpr

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -111,8 +111,13 @@ class SValExplainer : public FullSValVisitor { } std::string VisitSymbolConjured(const SymbolConjured *S) { -return "symbol of type '" + S->getType().getAsString() + - "' conjured at statement '" + printStmt(S->getStmt()) + "'"; +std

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -113,8 +113,18 @@ class SValExplainer : public FullSValVisitor { } std::string VisitSymbolConjured(const SymbolConjured *S) { -return "symbol of type '" + S->getType().getAsString() + - "' conjured at statement '" + printStmt(S->getStmt()) + "'"; +std

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -229,7 +230,7 @@ DefinedSVal makeRetVal(CheckerContext &C, const CallExpr *CE) { const LocationContext *LCtx = C.getLocationContext(); return C.getSValBuilder() - .conjureSymbolVal(nullptr, CE, LCtx, C.blockCount()) isuckatcs wrote: `CE` in unuse

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2469,14 +2475,14 @@ void CStringChecker::evalStrsep(CheckerContext &C, // further along in the same string, or NULL if there are no more tokens. State = State->bindLoc(*SearchStrLoc, - SVB.conjureSymbolVal(getTag(), Call.getOriginExpr()

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -1665,8 +1666,9 @@ void CStringChecker::evalMemcmp(CheckerContext &C, const CallEvent &Call, State = CheckBufferAccess(C, State, Left, Size, AccessKind::read, CK); if (State) { // The return value is the comparison result, which we don't know. - SVal CmpV

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -695,6 +695,18 @@ class CFGBlock { void dump() const { dumpToStream(llvm::errs()); } + +void Profile(llvm::FoldingSetNodeID &ID) const { + ID.AddPointer(Parent); + ID.AddInteger(Index); +} + +int64_t getID() const { + return Parent->g

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -171,19 +172,11 @@ class SValBuilder { // Forwarding methods to SymbolManager. - const SymbolConjured* conjureSymbol(const Stmt *stmt, - const LocationContext *LCtx, - QualType type, -

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2469,14 +2475,14 @@ void CStringChecker::evalStrsep(CheckerContext &C, // further along in the same string, or NULL if there are no more tokens. State = State->bindLoc(*SearchStrLoc, - SVB.conjureSymbolVal(getTag(), Call.getOriginExpr()

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -1794,7 +1797,8 @@ void CStringChecker::evalstrLengthCommon(CheckerContext &C, // value, so it can be used in constraints, at least. if (result.isUnknown()) { result = C.getSValBuilder().conjureSymbolVal( - nullptr, Call.getOriginExpr(), LCtx, C.block

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -130,8 +130,9 @@ void ErrnoTesterChecker::evalSetErrnoIfErrorRange(CheckerContext &C, ProgramStateRef StateFailure = State->BindExpr( Call.getOriginExpr(), C.getLocationContext(), SVB.makeIntVal(1, true)); - DefinedOrUnknownSVal ErrnoVal = SVB.conjureSymbolVal( -

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2261,7 +2265,8 @@ void CStringChecker::evalStrcpyCommon(CheckerContext &C, const CallEvent &Call, // If this is a stpcpy-style copy, but we were unable to check for a buffer // overflow, we still need a result. Conjure a return value. if (ReturnEnd && Result.is

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
https://github.com/isuckatcs edited https://github.com/llvm/llvm-project/pull/128251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -467,7 +467,7 @@ void IteratorModeling::handleComparison(CheckerContext &C, const Expr *CE, SymbolRef Sym; if (!LPos || !RPos) { auto &SymMgr = C.getSymbolManager(); -Sym = SymMgr.conjureSymbol(CE, C.getLocationContext(), isuckatcs wrote: `CE`

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -494,7 +494,7 @@ void IteratorModeling::handleComparison(CheckerContext &C, const Expr *CE, auto &SymMgr = C.getSymbolManager(); auto *LCtx = C.getLocationContext(); RetVal = nonloc::SymbolVal(SymMgr.conjureSymbol( -CE, LCtx, C.getASTContext().BoolTy, C.

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -113,8 +113,18 @@ class SValExplainer : public FullSValVisitor { } std::string VisitSymbolConjured(const SymbolConjured *S) { -return "symbol of type '" + S->getType().getAsString() + - "' conjured at statement '" + printStmt(S->getStmt()) + "'"; +std

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -80,17 +81,18 @@ class SymbolRegionValue : public SymbolData { /// A symbol representing the result of an expression in the case when we do /// not know anything about what the expression is. class SymbolConjured : public SymbolData { - const Stmt *S; + const CFGBlock::Con

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2361,8 +2366,9 @@ void CStringChecker::evalStrcmpCommon(CheckerContext &C, const CallEvent &Call, const StringLiteral *RightStrLiteral = getCStringLiteral(C, state, Right.Expression, RightVal); bool canComputeResult = false; - SVal resultVal = svalBuilder.conjur

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -151,6 +151,11 @@ class CheckerContext { return Pred->getSVal(S); } + /// Get the CFG Element Ref from the ExprEngine isuckatcs wrote: I think you can remove this comment. It's obvious what the function does even without it. https://github.com/llv

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -326,7 +330,7 @@ void ContainerModeling::handleAssignment(CheckerContext &C, SVal Cont, auto &SVB = C.getSValBuilder(); // Then generate and assign a new "end" symbol for the new container. auto NewEndSym = - SymMgr.conjureSymbol(C

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -2520,7 +2526,8 @@ void CStringChecker::evalStdCopyCommon(CheckerContext &C, SValBuilder &SVB = C.getSValBuilder(); SVal ResultVal = - SVB.conjureSymbolVal(nullptr, Call.getOriginExpr(), LCtx, C.blockCount()); + SVB.conjureSymbolVal(nullptr, Call.getOriginExp

[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

2025-02-23 Thread via cfe-commits
@@ -260,7 +260,7 @@ ProgramStateRef setErrnoStdMustBeChecked(ProgramStateRef State, const MemRegion *ErrnoR = State->get(); if (!ErrnoR) return State; - State = State->invalidateRegions(ErrnoR, InvalE, C.blockCount(), isuckatcs wrote: `InvalE` is an

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -1101,6 +1107,187 @@ inline void FPOptions::applyChanges(FPOptionsOverride FPO) { *this = FPO.applyOverrides(*this); } +// The three atomic code-generation options. +// The canonical (positive) names are: +// "remote_memory", "fine_grained_memory", and "ignore_denormal

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -4979,3 +4979,16 @@ def NoTrivialAutoVarInit: InheritableAttr { let Documentation = [NoTrivialAutoVarInitDocs]; let SimpleHandler = 1; } + +def Atomic : StmtAttr { + let Spellings = [Clang<"atomic">]; + let Args = [VariadicStringArgument<"Options">]; y

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -1101,6 +1107,187 @@ inline void FPOptions::applyChanges(FPOptionsOverride FPO) { *this = FPO.applyOverrides(*this); } +// The three atomic code-generation options. +// The canonical (positive) names are: +// "remote_memory", "fine_grained_memory", and "ignore_denormal

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -625,6 +625,43 @@ static Attr *handleHLSLControlFlowHint(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) HLSLControlFlowHintAttr(S.Context, A); } +static Attr *handleAtomicAttr(Sema &S, Stmt *St, const ParsedAttr &A, + Source

[clang] [clang modules] Setting `DebugCompilationDir` when it is safe to ignore current working directory (PR #128446)

2025-02-23 Thread Qiongsi Wu via cfe-commits
qiongsiwu wrote: Note to reviewers: This fixes rdar://145249881, but I'd like to get some input on two things. 1. I am not sure if it is a good idea to always set `DebugCompilationDir` to root. I chose it because I think it is safe and all systems should have the root directory. I am all ear

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -625,6 +625,43 @@ static Attr *handleHLSLControlFlowHint(Sema &S, Stmt *St, const ParsedAttr &A, return ::new (S.Context) HLSLControlFlowHintAttr(S.Context, A); } +static Attr *handleAtomicAttr(Sema &S, Stmt *St, const ParsedAttr &A, + Source

[clang] Add clang atomic control options and attribute (PR #114841)

2025-02-23 Thread Yaxun Liu via cfe-commits
@@ -3101,6 +3101,11 @@ class Parser : public CodeCompletionHandler { std::optional ParseAvailabilitySpec(); ExprResult ParseAvailabilityCheckExpr(SourceLocation StartLoc); + void ParseAtomicAttribute(IdentifierInfo &AttrName, yxsamliu wrote: will use Var

[clang] [clang modules] Setting `DebugCompilationDir` when it is safe to ignore current working directory (PR #128446)

2025-02-23 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Qiongsi Wu (qiongsiwu) Changes This PR explicitly sets `DebugCompilationDir` to the system's root directory if it is safe to ignore the current working directory. This fixes a problem where a PCM file's embedded debug information can lea

[clang] [clang modules] Setting `DebugCompilationDir` when it is safe to ignore current working directory (PR #128446)

2025-02-23 Thread Qiongsi Wu via cfe-commits
https://github.com/qiongsiwu converted_to_draft https://github.com/llvm/llvm-project/pull/128446 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang modules] Setting `DebugCompilationDir` when it is safe to ignore current working directory (PR #128446)

2025-02-23 Thread Qiongsi Wu via cfe-commits
https://github.com/qiongsiwu created https://github.com/llvm/llvm-project/pull/128446 This PR explicitly sets `DebugCompilationDir` to the system's root directory if it is safe to ignore the current working directory. This fixes a problem where a PCM file's embedded debug information can lead

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-23 Thread Fangrui Song via cfe-commits
@@ -2142,3 +2190,326 @@ std::vector lto::generateModulesOrdering(ArrayRef R) { }); return ModulesOrdering; } + +namespace { +// For this out-of-process backend no codegen is done when invoked for each +// task. Instead we generate the required information (e.g. the summary

[clang] [clang] Updating to include gcc-toolsets 13 and 14 (PR #128438)

2025-02-23 Thread Fangrui Song via cfe-commits
MaskRay wrote: I think redhat gcc-toolset support should move to Clang configuration files https://reviews.llvm.org/D136435 @tbaederr https://github.com/llvm/llvm-project/pull/128438 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-23 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,60 @@ +Distributed ThinLTO (DTLTO) +=== + +DTLTO allows for the distribution of backend ThinLTO compilations via external +distribution systems, e.g. Incredibuild. There is existing support for +distributing ThinLTO compilations by using separate

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-23 Thread Fangrui Song via cfe-commits
@@ -2142,3 +2190,326 @@ std::vector lto::generateModulesOrdering(ArrayRef R) { }); return ModulesOrdering; } + +namespace { +// For this out-of-process backend no codegen is done when invoked for each +// task. Instead we generate the required information (e.g. the summary

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-23 Thread Fangrui Song via cfe-commits
@@ -535,6 +535,21 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, D.getLTOMode() == LTOK_Thin); } + // Forward the DTLTO options to the linker. We add these unconditionally, + // rather than in addLTOOptions() as it is

[clang] [lld] [llvm] Integrated Distributed ThinLTO (DTLTO): Initial support (PR #126654)

2025-02-23 Thread Fangrui Song via cfe-commits
@@ -1702,6 +1703,37 @@ static uint8_t getOsAbi(const Triple &t) { } } +// Check if an archive file is a thin archive. +static bool isThinArchive(Ctx &ctx, StringRef archiveFilePath) { + const size_t thinArchiveMagicLen = sizeof(ThinArchiveMagic) - 1; + + ErrorOr> memBuffer

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-23 Thread Yutong Zhu via cfe-commits
@@ -10069,6 +10069,17 @@ static std::optional TryGetExprRange(ASTContext &C, const Expr *E, case UO_AddrOf: // should be impossible return IntRange::forValueOfType(C, GetExprType(E)); +case UO_Not: { + std::optional SubRange = TryGetExprRange( + C,

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-23 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/126846 >From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sun, 23 Feb 2025 18:16:06 -0500 Subject: [PATCH] Fix no warning for comparison of integers of different signs --

[clang] [HLSL] Allow arrays to be returned by value in HLSL (PR #127896)

2025-02-23 Thread Sarah Spall via cfe-commits
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/127896 >From 362b64d31e5f70e4a26ea04c99a58fd5f5ca50ca Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Fri, 14 Feb 2025 12:59:56 -0800 Subject: [PATCH 1/2] Allow arrays to be returned by value in HLSL + test --- clang/

[clang] [clang] Updating to include gcc-toolsets 13 and 14 (PR #128438)

2025-02-23 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Bill Blum (roadswitcher) Changes Updating clang/lib/Driver to detect the newer gcc-toolchain versions. ( submitted to llvm-commits mailing list ) --- Full diff: https://github.com/llvm/llvm-project/pull/1

[clang] [clang] Updating to include gcc-toolsets 13 and 14 (PR #128438)

2025-02-23 Thread via cfe-commits
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it

[clang] [clang] Updating to include gcc-toolsets 13 and 14 (PR #128438)

2025-02-23 Thread Bill Blum via cfe-commits
https://github.com/roadswitcher created https://github.com/llvm/llvm-project/pull/128438 Updating clang/lib/Driver to detect the newer gcc-toolchain versions. ( submitted to llvm-commits mailing list ) >From a0eb0bcc139d23294f8013da2dcc15adcaa8ef55 Mon Sep 17 00:00:00 2001 From: Bill Blum Dat

[clang] [clang-tidy] [dataflow] Cache reference accessors for `bugprone-unchecked-optional-access` (PR #128437)

2025-02-23 Thread Valentyn Yukhymenko via cfe-commits
@@ -3863,6 +3863,192 @@ TEST_P(UncheckedOptionalAccessTest, ConstBoolAccessorWithModInBetween) { )cc"); } +TEST_P(UncheckedOptionalAccessTest, + ConstRefAccessorToOptionalViaConstRefAccessorToHoldingObject) { + ExpectDiagnosticsFor(R"cc( +#include "unchecked_opti

[clang] [clang-tidy] [dataflow] Cache reference accessors for `bugprone-unchecked-optional-access` (PR #128437)

2025-02-23 Thread Valentyn Yukhymenko via cfe-commits
@@ -580,6 +580,26 @@ void handleConstMemberCall(const CallExpr *CE, return; } + // Cache if the const method returns a reference + if (RecordLoc != nullptr && CE->isGLValue()) { +const FunctionDecl *DirectCallee = CE->getDirectCallee(); +if (DirectCallee == nul

[clang] [clang-tidy] [dataflow] Cache reference accessors for `bugprone-unchecked-optional-access` (PR #128437)

2025-02-23 Thread Valentyn Yukhymenko via cfe-commits
@@ -580,6 +580,26 @@ void handleConstMemberCall(const CallExpr *CE, return; } + // Cache if the const method returns a reference + if (RecordLoc != nullptr && CE->isGLValue()) { +const FunctionDecl *DirectCallee = CE->getDirectCallee(); +if (DirectCallee == nul

[clang] [clang-tidy] [dataflow] Cache reference accessors for `bugprone-unchecked-optional-access` (PR #128437)

2025-02-23 Thread Valentyn Yukhymenko via cfe-commits
BaLiKfromUA wrote: TODO: update release notes and `clang-tools-extra/docs/clang-tidy/checks/bugprone/unchecked-optional-access.rst` if needed https://github.com/llvm/llvm-project/pull/128437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [clang-tidy] [dataflow] Cache reference accessors for `bugprone-unchecked-optional-access` (PR #128437)

2025-02-23 Thread Valentyn Yukhymenko via cfe-commits
https://github.com/BaLiKfromUA created https://github.com/llvm/llvm-project/pull/128437 Fixes https://github.com/llvm/llvm-project/issues/126283 Extending https://github.com/llvm/llvm-project/pull/112605 to cache const getters which return references. This should fix false positive cases when

[clang] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for local variables to NS and CF types. (PR #127554)

2025-02-23 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/127554 >From d6c4e1a23dc0cc6850c5cfdceecc2e1be8943592 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 17 Feb 2025 18:18:09 -0800 Subject: [PATCH 1/7] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for lo

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-23 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,30 @@ +.. title:: clang-tidy - bugprone-unintended-char-ostream-output + +bugprone-unintended-char-ostream-output +=== + +Finds unintended character output from ``unsigned char`` and ``signed char`` to an +``ostream``. + +Normally, w

[clang-tools-extra] [clangd] Reduce superfluous rename conflicts (PR #121515)

2025-02-23 Thread Ujan RoyBandyopadhyay via cfe-commits
ujan-r wrote: No worries, thanks for the review! I don't have commit access, so you'll have to merge the changes on my behalf. https://github.com/llvm/llvm-project/pull/121515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang-tools-extra] [clangd] Reduce superfluous rename conflicts (PR #121515)

2025-02-23 Thread Ujan RoyBandyopadhyay via cfe-commits
https://github.com/ujan-r updated https://github.com/llvm/llvm-project/pull/121515 >From e2d63656b94c2a1f9071397abc64d1cdcdb62c75 Mon Sep 17 00:00:00 2001 From: Ujan RoyBandyopadhyay <116058173+uja...@users.noreply.github.com> Date: Thu, 2 Jan 2025 00:20:52 -0600 Subject: [PATCH] [clangd] Reduce

[clang-tools-extra] [clangd] Reduce superfluous rename conflicts (PR #121515)

2025-02-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. Looks reasonable to me, sorry for the review delay. https://github.com/llvm/llvm-project/pull/121515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [FatLTO] Detect LLD linker more reliably (PR #128285)

2025-02-23 Thread Vincent Lee via cfe-commits
https://github.com/thevinster closed https://github.com/llvm/llvm-project/pull/128285 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] 40b0619 - [FatLTO] Detect LLD linker more reliably (#128285)

2025-02-23 Thread via cfe-commits
Author: Vincent Lee Date: 2025-02-23T12:03:37-08:00 New Revision: 40b0619a53231eafaa879d085b7a7a10441c7f34 URL: https://github.com/llvm/llvm-project/commit/40b0619a53231eafaa879d085b7a7a10441c7f34 DIFF: https://github.com/llvm/llvm-project/commit/40b0619a53231eafaa879d085b7a7a10441c7f34.diff L

  1   2   >