[clang-tools-extra] Add note for base class to bugprone-throw-keyword-missing (PR #160751)

2025-09-26 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. LG, thanks! https://github.com/llvm/llvm-project/pull/160751 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Don't look into base class aliases in bugprone-throw-keyword-missing (PR #160725)

2025-09-25 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/160725 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [ImmutableSet] Optimize add/remove operations to avoid redundant tree modifications (PR #159845)

2025-09-22 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: cc., @steakhal , @necto , @NagyDonat , you might want to run some benchmarks with this patch applied to see if there is a measurable impact on the Clang Static Analyzer. https://github.com/llvm/llvm-project/pull/159845 ___ cfe-commi

[clang] [llvm] [ImmutableSet] Optimize add/remove operations to avoid redundant tree modifications (PR #159845)

2025-09-22 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: Did we only have this issue with the sets? Are the maps fine? https://github.com/llvm/llvm-project/pull/159845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [ImmutableSet] Optimize add/remove operations to avoid redundant tree modifications (PR #159845)

2025-09-22 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. LG, thanks! https://github.com/llvm/llvm-project/pull/159845 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Rename LivenessValues::equals to LivenessValues::operator== (PR #157657)

2025-09-20 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/157657 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Remove dead LiveVariables::Observer::observerKill (PR #157661)

2025-09-20 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/157661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-20 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun created https://github.com/llvm/llvm-project/pull/157506 Swift supports a strictly memory safe mode where every expressions using an unsafe feature or API need to be annotatated with the unsafe effect. This sometimes requires adding safety annotations to the foreig

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-18 Thread Gábor Horváth via cfe-commits
@@ -291,6 +292,13 @@ static void ProcessAPINotes(Sema &S, Decl *D, }); } + // swift_safety + if (auto SafetyKind = Info.getSwiftSafety(); + SafetyKind != api_notes::SwiftSafetyKind::None) +D->addAttr(SwiftAttrAttr::Create( +S.Context, +Safe

[clang] [clang][analyzer] Load config through the proper VFS (PR #159164)

2025-09-17 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/159164 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun closed https://github.com/llvm/llvm-project/pull/157506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Add support for GSL Pointer types (PR #154009)

2025-09-15 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: > Is there any piece specifically you have in mind. The very least, there are a list of helper functions that I believe could be shared and greatly improve the consistency between the two analysis. Including: * `shouldTrackFirstArgumentForConstructor` * `isCopyLikeConstructor`

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun updated https://github.com/llvm/llvm-project/pull/157506 From 1fd3a7966a2873ebc482a569f4ce04ffdb10ed99 Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Mon, 8 Sep 2025 17:21:45 +0100 Subject: [PATCH] [APINotes] Support annotating safety of APIs Swift supports a s

[clang] [clang] Initialize the file system explicitly (PR #158381)

2025-09-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun commented: The Clang Static Analyzer change looks good to me. https://github.com/llvm/llvm-project/pull/158381 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-13 Thread Gábor Horváth via cfe-commits
@@ -291,6 +292,13 @@ static void ProcessAPINotes(Sema &S, Decl *D, }); } + // swift_safety + if (auto SafetyKind = Info.getSwiftSafety(); + SafetyKind != api_notes::SwiftSafetyKind::None) +D->addAttr(SwiftAttrAttr::Create( +S.Context, +Safe

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-13 Thread Gábor Horváth via cfe-commits
@@ -291,6 +292,13 @@ static void ProcessAPINotes(Sema &S, Decl *D, }); } + // swift_safety + if (auto SafetyKind = Info.getSwiftSafety(); + SafetyKind != api_notes::SwiftSafetyKind::None) +D->addAttr(SwiftAttrAttr::Create( +S.Context, +Safe

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-12 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun updated https://github.com/llvm/llvm-project/pull/157506 From 1fd3a7966a2873ebc482a569f4ce04ffdb10ed99 Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Mon, 8 Sep 2025 17:21:45 +0100 Subject: [PATCH] [APINotes] Support annotating safety of APIs Swift supports a s

[clang] [analyzer][NFC] Modernize LivenessValues::isLive (PR #157800)

2025-09-12 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/157800 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-09 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun updated https://github.com/llvm/llvm-project/pull/157506 From 09a1cc08019ffc336609aa2909565baf775129bb Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Mon, 8 Sep 2025 17:21:45 +0100 Subject: [PATCH] [APINotes] Support annotating safety of APIs Swift supports a s

[clang] [analyzer][NFC] Change LiveVariablesImpl::inAssignment from DenseMap to DenseSet (PR #157685)

2025-09-09 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/157685 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-09 Thread Gábor Horváth via cfe-commits
@@ -99,6 +99,9 @@ void ReadCommonEntityInfo(const uint8_t *&Data, CommonEntityInfo &Info) { Info.UnavailableInSwift = UnavailableBits & 0x01; if ((UnavailableBits >> 2) & 0x01) Info.setSwiftPrivate(static_cast((UnavailableBits >> 3) & 0x01)); + if ((UnavailableBits >>

[clang] [APINotes] Support annotating safety of APIs (PR #157506)

2025-09-09 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun updated https://github.com/llvm/llvm-project/pull/157506 From dc0959442a82f8d449eea27ddc7ff86347221b97 Mon Sep 17 00:00:00 2001 From: Gabor Horvath Date: Mon, 8 Sep 2025 17:21:45 +0100 Subject: [PATCH] [APINotes] Support annotating safety of APIs Swift supports a s

[clang] [analyzer][NFC] Modernize loops in LiveVariables analysis (PR #157670)

2025-09-09 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/157670 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] In LivenessValues::equals also check liveBindings (PR #157645)

2025-09-09 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/157645 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer][NFC] Modernize loops in LiveVariables analysis (PR #157670)

2025-09-09 Thread Gábor Horváth via cfe-commits
@@ -90,8 +90,8 @@ namespace { if (A.isEmpty()) return B; -for (typename SET::iterator it = B.begin(), ei = B.end(); it != ei; ++it) { - A = A.add(*it); +for (const auto &element : B) { Xazax-hun wrote: We have pointers in these sets. Ma

[clang] [LifetimeSafety] Mark all DeclRefExpr as usages of the corresp. origin (PR #154316)

2025-09-04 Thread Gábor Horváth via cfe-commits
@@ -556,8 +554,47 @@ class FactGeneratorVisitor : public ConstStmtVisitor { return false; } + void handleAssignment(const Expr *LHSExpr, const Expr *RHSExpr) { +// Find the underlying variable declaration for the left-hand side. +if (const auto *DRE_LHS = +

[clang] [LifetimeSafety] Mark all DeclRefExpr as usages of the corresp. origin (PR #154316)

2025-09-04 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/154316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Fix duplicate loan generation for ImplicitCastExpr (PR #153661)

2025-09-03 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. This is very clean now, thanks! https://github.com/llvm/llvm-project/pull/153661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang] [LifetimeSafety] Refactor FactGenerator to use RecursiveASTVisitor (PR #153661)

2025-09-02 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: One last question, I am sort of wondering if working on a CFG with `AC.getCFGBuildOptions().setAllAlwaysAdd();` would make this simpler. Would that have the properties we want? https://github.com/llvm/llvm-project/pull/153661 ___ c

[clang] [LifetimeSafety] Refactor FactGenerator to use RecursiveASTVisitor (PR #153661)

2025-09-02 Thread Gábor Horváth via cfe-commits
@@ -403,29 +404,17 @@ class FactManager { llvm::BumpPtrAllocator FactAllocator; }; -class FactGenerator : public ConstStmtVisitor { - using Base = ConstStmtVisitor; +class FactGeneratorVisitor : public ConstStmtVisitor { + using Base = ConstStmtVisitor; public: - FactG

[clang] [LifetimeSafety] Refactor FactGenerator to use RecursiveASTVisitor (PR #153661)

2025-09-02 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/153661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang]: Support `analyzer_noreturn` attribute in `CFG` (PR #150952)

2025-09-01 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun closed https://github.com/llvm/llvm-project/pull/150952 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang]: Support `analyzer_noreturn` attribute in `CFG` (PR #150952)

2025-09-01 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: Feel free to merge this once the CI is green. https://github.com/llvm/llvm-project/pull/150952 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Fix uninitialized memory bug. (PR #154575)

2025-08-20 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/154575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Refactor FactGenerator to use RecursiveASTVisitor (PR #153661)

2025-08-19 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: Thanks! I have one more question. So we need the reverse post order property of the CFG to ensure that we visit everything in the right order. The only reason why I am a bit unsure here, is because I wonder if it can ever cause some trouble that the RAV visiting the subexpre

[clang] [LifetimeSafety] Refactor FactGenerator to use RecursiveASTVisitor (PR #153661)

2025-08-19 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: Thanks! I am not actually sure if this one is simpler than the original version. Sorry about that. I don't have a strong feeling which one to pick. I guess the complexity here is an inevitable consequence of our CFGs being just an overlay on top of the AST and it is not entire

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-08-18 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. LG, thanks! https://github.com/llvm/llvm-project/pull/149731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Prevent duplicate loans and statement visits (PR #153661)

2025-08-18 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: > The RAV would still need to maintain a Visited set Could you elaborate on why? > WDYT about this alternative of using a RAV driver ? Hmm, there is a change that this could be a bit simpler than the current solution. If you can give this a try to see where does that lead it

[clang] [clang-tools-extra] [clang] Improve nested name specifier AST representation (PR #147835)

2025-08-15 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: We started to see a CI failure around the time this PR landed in https://green.lab.llvm.org/job/llvm.org/job/clang-stage2-Rthinlto/1079/ The build hangs in this step (using a stage 2 compiler): ``` 12:39:17 [384/5387] : && DYLD_LIBRARY_PATH=/Users/ec2-user/jenkins/workspace/l

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-08-15 Thread Gábor Horváth via cfe-commits
@@ -723,17 +772,14 @@ join(llvm::ImmutableMap A, llvm::ImmutableMap B, // = // using OriginLoanMap = llvm::ImmutableMap; +using ExpiredLoanMap = llvm::ImmutableMap; Xazax-hun wrote: I am

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-08-15 Thread Gábor Horváth via cfe-commits
@@ -861,26 +911,29 @@ class ExpiredLoansAnalysis : public DataflowAnalysis { - LoanSet::Factory &Factory; + ExpiredLoanMap::Factory &Factory; public: ExpiredLoansAnalysis(const CFG &C, AnalysisDeclContext &AC, FactManager &F, LifetimeFactory

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-08-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun commented: Overall looks good, I only have a couple questions around determinism. https://github.com/llvm/llvm-project/pull/149731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-08-15 Thread Gábor Horváth via cfe-commits
@@ -0,0 +1,253 @@ +// RUN: %clang_cc1 -fsyntax-only -fexperimental-lifetime-safety -Wexperimental-lifetime-safety -verify %s + +struct MyObj { + int id; + ~MyObj() {} // Non-trivial destructor + MyObj operator+(MyObj); +}; + +//===-

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-08-15 Thread Gábor Horváth via cfe-commits
@@ -912,24 +965,129 @@ class ExpiredLoansAnalysis Lattice transfer(Lattice In, const IssueFact &F) { return Lattice(Factory.remove(In.Expired, F.getLoanID())); } + + ExpiredLoanMap getExpiredLoans(ProgramPoint P) { return getState(P).Expired; } }; // =

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-08-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/149731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [APINotes] Add SwiftDestroyOp API note to map to the "destroy" function (PR #153261)

2025-08-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun closed https://github.com/llvm/llvm-project/pull/153261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang-tidy] Avoid matching nodes in system headers (PR #151035)

2025-08-11 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/151035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Remove trivially true condition (PR #152850)

2025-08-11 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/152850 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Add support for serialization and deserialization. (PR #152487)

2025-08-08 Thread Gábor Horváth via cfe-commits
@@ -140,6 +140,15 @@ class DataflowAnalysisContext { /// Adds `Constraint` to the flow condition identified by `Token`. void addFlowConditionConstraint(Atom Token, const Formula &Constraint); + /// Adds `Deps` to the dependencies of the flow condition identified by + ///

[clang] [clang-tools-extra] [clang-tidy] `bugprone-unchecked-optional-access`: handle `BloombergLP::bdlb:NullableValue::makeValue` to prevent false-positives (PR #144313)

2025-08-06 Thread Gábor Horváth via cfe-commits
@@ -985,6 +985,20 @@ auto buildTransferMatchSwitch() { isOptionalMemberCallWithNameMatcher(hasName("isNull")), transferOptionalIsNullCall) + // NullableValue::makeValue, NullableValue::makeValueInplace + // Only NullableValue has these methods, bu

[clang] [analyzer] Drop assertion enforcing that assume args are known constants (PR #151908)

2025-08-04 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/151908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang-tidy] Avoid matching nodes in system headers (PR #151035)

2025-08-03 Thread Gábor Horváth via cfe-commits
Xazax-hun wrote: > The rationale being that a user typically cannot change the contents of a > system macro anyway. This is not always true, e.g., when it comes to macros with arguments. I am mostly interested in the scenario where someone has something like: ``` SYSTEM_HEADER_MACRO(UserCode)

[clang] [clang-tools-extra] [clang-tidy] Avoid matching nodes in system headers (PR #151035)

2025-08-03 Thread Gábor Horváth via cfe-commits
@@ -105,6 +105,10 @@ Improvements to clang-tidy now run checks in parallel by default using all available hardware threads. Both scripts display the number of threads being used in their output. +- :program:`clang-tidy` no longer attemps to analyze code from system headers

[clang] [clang-tools-extra] [clang-tidy] Avoid matching nodes in system headers (PR #151035)

2025-08-03 Thread Gábor Horváth via cfe-commits
@@ -1507,11 +1544,17 @@ bool MatchASTVisitor::TraverseStmt(Stmt *StmtNode, DataRecursionQueue *Queue) { } bool MatchASTVisitor::TraverseType(QualType TypeNode) { + if (shouldSkipNode(TypeNode)) Xazax-hun wrote: > b) overload the function for QualType and di

[clang] [clang-tools-extra] [clang-tidy] Avoid matching nodes in system headers (PR #151035)

2025-08-03 Thread Gábor Horváth via cfe-commits
@@ -1507,11 +1544,17 @@ bool MatchASTVisitor::TraverseStmt(Stmt *StmtNode, DataRecursionQueue *Queue) { } bool MatchASTVisitor::TraverseType(QualType TypeNode) { + if (shouldSkipNode(TypeNode)) Xazax-hun wrote: What is the point of this if we never get a lo

[clang] [clang-tools-extra] [clang-tidy] Avoid matching nodes in system headers (PR #151035)

2025-08-03 Thread Gábor Horváth via cfe-commits
@@ -105,6 +105,10 @@ Improvements to clang-tidy now run checks in parallel by default using all available hardware threads. Both scripts display the number of threads being used in their output. +- :program:`clang-tidy` no longer attemps to analyze code from system headers

[clang] [clang-tools-extra] [clang-tidy] Avoid matching nodes in system headers (PR #151035)

2025-08-03 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/151035 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang-tidy] Avoid matching nodes in system headers (PR #151035)

2025-08-03 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun commented: What is the design here around macros? Like what is the expected behavior for code expanded from macros defined in system header? https://github.com/llvm/llvm-project/pull/151035 ___ cfe-commits mailing list cfe

[clang] [Analyzer] No longer crash with VLA operands to unary type traits (PR #151719)

2025-08-01 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/151719 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Do not warn about class methods with libc function names (PR #151270)

2025-08-01 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/151270 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Do not warn about class methods with libc function names (PR #151270)

2025-07-30 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun commented: What about functions with the same name but in different namespaces? Maybe we should check that the function is either in the global scope or in the `std` namespace instead? https://github.com/llvm/llvm-project/pull/151270 ___

[clang] [API notes] Allow SwiftConformsTo on Typedefs (PR #151213)

2025-07-30 Thread Gábor Horváth via cfe-commits
@@ -26,3 +26,6 @@ Classes: - Name:scalarNewProperty PropertyKind:Instance Nullability: Scalar +Typedefs: + - Name:MyTypedef Xazax-hun wrote: Is this covered by filecheck? https://github.com/llvm/llvm-proj

[clang] [API notes] Allow SwiftConformsTo on Typedefs (PR #151213)

2025-07-30 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/151213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang]: Support `analyzer_noreturn` attribute in `CFG` (PR #150952)

2025-07-29 Thread Gábor Horváth via cfe-commits
@@ -2668,6 +2668,10 @@ class FunctionDecl : public DeclaratorDecl, /// an attribute on its declaration or its type. bool isNoReturn() const; + /// Determines whether this function is known to be 'noreturn' for analyzer, + /// through an `analyzer_noreturn` attribute on i

[clang] [clang-tools-extra] [clang]: Support `analyzer_noreturn` attribute in `CFG` (PR #150952)

2025-07-29 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. This looks reasonable to me, thanks! https://github.com/llvm/llvm-project/pull/150952 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [clang-tools-extra] [clang]: Support `analyzer_noreturn` attribute in `CFG` (PR #150952)

2025-07-29 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/150952 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-25 Thread Gábor Horváth via cfe-commits
@@ -910,24 +961,129 @@ class ExpiredLoansAnalysis Lattice transfer(Lattice In, const IssueFact &F) { return Lattice(Factory.remove(In.Expired, F.getLoanID())); } + + ExpiredLoanMap getExpiredLoans(ProgramPoint P) { return getState(P).Expired; } }; // =

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-25 Thread Gábor Horváth via cfe-commits
@@ -492,7 +522,8 @@ class FactGenerator : public ConstStmtVisitor { // Check if the loan is for a stack variable and if that variable // is the one being destructed. if (LoanPath.D == DestructedVD) -CurrentBlockFacts.push_back(FactMgr.createFact(L.ID)

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-25 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun commented: Overall looks good but will want to have another pass. Added some random comments most of which are probably not actionable at the moment. https://github.com/llvm/llvm-project/pull/149731 ___ cfe-commits mailin

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-25 Thread Gábor Horváth via cfe-commits
@@ -19,14 +19,35 @@ #define LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_H #include "clang/Analysis/AnalysisDeclContext.h" #include "clang/Analysis/CFG.h" +#include "clang/Basic/SourceLocation.h" +#include "llvm/ADT/DenseMapInfo.h" +#include "llvm/ADT/ImmutableMap.h" #include "

[clang] [LifetimeSafety] Implement a basic use-after-free diagnostic (PR #149731)

2025-07-25 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/149731 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Delay checking the ctu-dir (PR #150139)

2025-07-23 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. The change looks good to me but I have the same question/concern I raised in https://github.com/llvm/llvm-project/pull/150133 https://github.com/llvm/llvm-project/pull/150139 ___ cfe-commits mai

[clang] [clang][analyzer] Delay checking the model-path (PR #150133)

2025-07-23 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. While this change looks good to me now this file system related validations will be scattered all over the codebase. I don't have a strong opinion but wondering if having a validation step right after the command line parsing is done wou

[clang] [LifetimeSafety] Revamp test suite using unittests (PR #149158)

2025-07-22 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/149158 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [API Notes] Attach API notes to forward declarations of tags (PR #149951)

2025-07-22 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/149951 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [API Notes] Attach API notes to forward declarations of tags (PR #149951)

2025-07-22 Thread Gábor Horváth via cfe-commits
@@ -23,3 +23,8 @@ struct EscapableType { int value; }; struct RefCountedTypeWithDefaultConvention {}; inline void retain(RefCountedType *x) {} inline void release(RefCountedType *x) {} + +struct OpaqueRefCountedType; Xazax-hun wrote: Could we add multiple forw

[clang] [API Notes] Attach API notes to forward declarations of tags (PR #149951)

2025-07-22 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. Looks great, thanks! https://github.com/llvm/llvm-project/pull/149951 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [API Notes] Attach API notes to forward declarations of tags (PR #149951)

2025-07-22 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/149951 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Add language option for experimental lifetime safety (PR #149592)

2025-07-19 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/149592 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Add per-program-point lattice tracking (PR #149199)

2025-07-17 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. LG, thanks! https://github.com/llvm/llvm-project/pull/149199 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Add per-program-point lattice tracking (PR #149199)

2025-07-17 Thread Gábor Horváth via cfe-commits
@@ -524,14 +531,20 @@ template class DataflowAnalysis { public: using Lattice = LatticeType; - using Base = DataflowAnalysis; + using Base = DataflowAnalysis; private: const CFG &Cfg; AnalysisDeclContext ∾ + /// The dataflow state before a basic block is pro

[clang] [LifetimeSafety] Add per-program-point lattice tracking (PR #149199)

2025-07-17 Thread Gábor Horváth via cfe-commits
@@ -524,14 +531,20 @@ template class DataflowAnalysis { public: using Lattice = LatticeType; - using Base = DataflowAnalysis; + using Base = DataflowAnalysis; private: const CFG &Cfg; AnalysisDeclContext ∾ + /// The dataflow state before a basic block is pro

[clang] [LifetimeSafety] Add per-program-point lattice tracking (PR #149199)

2025-07-17 Thread Gábor Horváth via cfe-commits
@@ -502,6 +502,12 @@ class FactGenerator : public ConstStmtVisitor { enum class Direction { Forward, Backward }; +/// A program point is a pair of a CFGBlock and a Fact within that block. +/// +/// This is used to represent the state of the program *after* the Fact is +/// e

[clang] [LifetimeSafety] Make the dataflow analysis generic (PR #148222)

2025-07-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. Overall looks good to me. One question for the future: sometimes it might be better to run certain analyses side by side in the same worklist rather than running them sequentially after each other. Do you think there are some analysis st

[clang] [LifetimeSafety] Make the dataflow analysis generic (PR #148222)

2025-07-15 Thread Gábor Horváth via cfe-commits
@@ -596,143 +709,66 @@ struct LifetimeLattice { } }; -// = // -// The Transfer Function -// = // -clas

[clang] [LifetimeSafety] Make the dataflow analysis generic (PR #148222)

2025-07-15 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/148222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/148065 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Gábor Horváth via cfe-commits
@@ -493,7 +496,247 @@ class FactGenerator : public ConstStmtVisitor { }; // = // -// TODO: Run dataflow analysis to propagate loans, analyse and error reporting. +// The Dat

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Gábor Horváth via cfe-commits
@@ -493,7 +496,247 @@ class FactGenerator : public ConstStmtVisitor { }; // = // -// TODO: Run dataflow analysis to propagate loans, analyse and error reporting. +// The Dat

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Gábor Horváth via cfe-commits
@@ -493,7 +496,247 @@ class FactGenerator : public ConstStmtVisitor { }; // = // -// TODO: Run dataflow analysis to propagate loans, analyse and error reporting. +// The Dat

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/148065 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LifetimeSafety] Implement dataflow analysis for loan propagation (PR #148065)

2025-07-14 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. Some minor things inline, overall looks good to me. https://github.com/llvm/llvm-project/pull/148065 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [clang-tools-extra] [clang-tidy] `bugprone-unchecked-optional-access`: handle `BloombergLP::bdlb:NullableValue::makeValue` to prevent false-positives (PR #144313)

2025-07-14 Thread Gábor Horváth via cfe-commits
@@ -985,6 +985,20 @@ auto buildTransferMatchSwitch() { isOptionalMemberCallWithNameMatcher(hasName("isNull")), transferOptionalIsNullCall) + // NullableValue::makeValue, NullableValue::makeValueInplace + // Only NullableValue has these methods, bu

[clang] [LifetimeSafety] Introduce intra-procedural analysis in Clang (PR #142313)

2025-07-10 Thread Gábor Horváth via cfe-commits
@@ -0,0 +1,510 @@ +//===- LifetimeSafety.cpp - C++ Lifetime Safety Analysis -*- C++-*-===// +// +// 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: Ap

[clang] [clang-tools-extra] [clang]: Propagate `*noreturn` attributes in `CFG` (PR #146355)

2025-07-07 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/146355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang]: Propagate `*noreturn` attributes in `CFG` (PR #146355)

2025-07-07 Thread Gábor Horváth via cfe-commits
@@ -2833,8 +2834,37 @@ CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, AddStmtChoice asc) { if (!FD->isVariadic()) findConstructionContextsForArguments(C); -if (FD->isNoReturn() || C->isBuiltinAssumeFalse(*Context)) - NoReturn = true; +if (!NoReturn) +

[clang] [clang-tools-extra] [clang]: Propagate `*noreturn` attributes in `CFG` (PR #146355)

2025-07-07 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun commented: I think this is a good change in general, but I wonder what is the performance impact. Note that clang CFGs have many clients and some of them might not need this information. If there is a measurable performance cost, we might want to put this behind a

[clang] [clang-tools-extra] [clang]: Propagate `*noreturn` attributes in `CFG` (PR #146355)

2025-07-07 Thread Gábor Horváth via cfe-commits
@@ -6298,10 +6334,43 @@ static bool isImmediateSinkBlock(const CFGBlock *Blk) { // at least for now, but once we have better support for exceptions, // we'd need to carefully handle the case when the throw is being // immediately caught. - if (llvm::any_of(*Blk, [](const

[clang] [clang-tools-extra] [clang]: Propagate `*noreturn` attributes in `CFG` (PR #146355)

2025-07-07 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun edited https://github.com/llvm/llvm-project/pull/146355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add support for consteval in ConditionBRVisitor::VisitTerminator (PR #146859)

2025-07-07 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/146859 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   4   5   6   7   8   9   10   >