https://github.com/mscuttari approved this pull request.
Leftover of mine, thank you for addressing it!
https://github.com/llvm/llvm-project/pull/166904
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/list
https://github.com/ficol created
https://github.com/llvm/llvm-project/pull/166905
Currently only __builtin_elementwise_sqrt emits contrained fp intrinsic and
propagates fp options.
This commit adds this support for the rest of elementwise builtins.
>From 4e1ffa02e4493ba5c84f64e534909479a9acb3e
https://github.com/phoebewang deleted
https://github.com/llvm/llvm-project/pull/166615
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1,13 +1,15 @@
// RUN: %clang_cc1 -verify -triple x86_64-unknown-unknown -emit-llvm-only %s
+// RUN: %clang_cc1 -verify -triple x86_64-unknown-unknown -emit-llvm-only
-fopenmp %s
phoebewang wrote:
`=omp` still missing
https://github.com/llvm/llvm-project/pu
@@ -1,13 +1,13 @@
// RUN: %clang_cc1 -verify -triple x86_64-unknown-unknown -emit-llvm-only %s
+// RUN: %clang_cc1 -verify -triple x86_64-unknown-unknown -emit-llvm-only
-fopenmp %s
phoebewang wrote:
`=omp` still missing
https://github.com/llvm/llvm-project/pu
https://github.com/evelez7 updated
https://github.com/llvm/llvm-project/pull/166672
>From 9cfef46989802cafe3b62759685b427afa8588f4 Mon Sep 17 00:00:00 2001
From: Erick Velez
Date: Wed, 5 Nov 2025 16:24:22 -0800
Subject: [PATCH] [clang-doc] remove indentation for preformatted text
Text that is
llvmbot wrote:
@llvm/pr-subscribers-flang-fir-hlfir
Author: Jacques Pienaar (jpienaar)
Changes
This was marked as deprecated in 2022, but as comment. Switch to error to make
visible and stop generating. Will remove the error message in follow up, just
felt this was easier for folks to un
https://github.com/jpienaar created
https://github.com/llvm/llvm-project/pull/166904
This was marked as deprecated in 2022, but as comment. Switch to error to make
visible and stop generating. Will remove the error message in follow up, just
felt this was easier for folks to understand compila
https://github.com/ahmednoursphinx updated
https://github.com/llvm/llvm-project/pull/166615
>From 684e005c76d7db5500fb0925547b58327c993d84 Mon Sep 17 00:00:00 2001
From: ahmed
Date: Wed, 5 Nov 2025 20:52:13 +0200
Subject: [PATCH 01/13] [SelectionDAG] Fix assertion failure on inline asm
registe
@@ -1,13 +1,13 @@
// RUN: %clang_cc1 -verify -triple x86_64-unknown-unknown -emit-llvm-only %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm-only -fopenmp %s
phoebewang wrote:
`-verify` is missing.
https://github.com/llvm/llvm-project/pull/16661
https://github.com/tgymnich approved this pull request.
https://github.com/llvm/llvm-project/pull/166897
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -58,7 +58,7 @@ adopt, offering these properties that make it widely
adoptable in practice:
* It has a relatively low adoption cost.
This document discusses the key designs of ``-fbounds-safety``. The document is
-subject to be actively updated with a more detailed specific
https://github.com/hstk30-hw edited
https://github.com/llvm/llvm-project/pull/166852
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Kazu Hirata (kazutakahirata)
Changes
This patch is limited to single-word replacements to fix spelling
and/or grammar to ease the review process. Punctuation and markdown
fixes are specifically excluded.
---
Full diff: https://github.com
https://github.com/kazutakahirata created
https://github.com/llvm/llvm-project/pull/166897
This patch is limited to single-word replacements to fix spelling
and/or grammar to ease the review process. Punctuation and markdown
fixes are specifically excluded.
>From df157419dd9f5f33b062e67dead55
https://github.com/arsenm approved this pull request.
https://github.com/llvm/llvm-project/pull/166894
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang-tools-extra
Author: Kazu Hirata (kazutakahirata)
Changes
In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.
Identified with readability-redundant-declaration.
---
Full diff: https://git
https://github.com/kazutakahirata created
https://github.com/llvm/llvm-project/pull/166894
In C++17, static constexpr members are implicitly inline, so they no
longer require an out-of-line definition.
Identified with readability-redundant-declaration.
>From d1c619a075f1bfab6250c7c4716ef81c55
https://github.com/naveen-seth edited
https://github.com/llvm/llvm-project/pull/163659
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -27,7 +27,6 @@
#include "clang/Basic/XRayInstr.h"
#include "clang/Config/config.h"
#include "clang/Driver/Driver.h"
naveen-seth wrote:
That does seem like the better solution! I've moved `GetResourcesPath()` into
`clangOptions` in the follow up (#165277,
https://github.com/Susikrishna updated
https://github.com/llvm/llvm-project/pull/166332
>From 16414b96e0ca5ee44b0332bc387ecbd0046eacd4 Mon Sep 17 00:00:00 2001
From: Susikrishna
Date: Tue, 4 Nov 2025 12:49:38 +0530
Subject: [PATCH 1/7] [Clang] Use ExtWarn for static local variable in extern
in
https://github.com/Sirraide auto_merge_disabled
https://github.com/llvm/llvm-project/pull/166332
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder `llvm-clang-x86_64-darwin`
running on `doug-worker-3` while building `clang` at step 6
"test-build-unified-tree-check-all".
Full details are available at:
https://lab.llvm.org/buildbot/#/builders/23/builds/15335
Here is the
https://github.com/zeyi2 updated
https://github.com/llvm/llvm-project/pull/166889
>From 3a8721888fa09815f68f18f7fbe39f5fa68f3758 Mon Sep 17 00:00:00 2001
From: mtx
Date: Fri, 7 Nov 2025 12:27:39 +0800
Subject: [PATCH 1/2] [clang-tidy] Add missing "Check" suffix to checks
---
.../clang-tidy/ce
@@ -42,7 +42,7 @@ define amdgpu_kernel void
@addrspacecast_flat_null_to_local(ptr addrspace(1) %ou
; CHECK-NEXT:PAD
; CHECK-NEXT:ALU clause starting at 4:
; CHECK-NEXT: MOV * T0.X, literal.x,
-; CHECK-NEXT:-1(nan), 0(0.00e+00)
+; CHECK-NEXT:0(0.00e+
github-actions[bot] wrote:
:warning: C/C++ code linter clang-tidy found issues in your code. :warning:
You can test this locally with the following command:
```bash
git diff -U0 origin/main...HEAD --
clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
clang-tools-extra/clang-tidy/cppc
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder
`clang-riscv-rva23-evl-vec-2stage` running on
`rise-clang-riscv-rva23-evl-vec-2stage` while building `clang` at step 4
"annotate".
Full details are available at:
https://lab.llvm.org/buildbot/#/builders/132/builds/3341
Here
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder
`sanitizer-x86_64-linux-bootstrap-msan` running on `sanitizer-buildbot6` while
building `clang` at step 2 "annotate".
Full details are available at:
https://lab.llvm.org/buildbot/#/builders/164/builds/15348
Here is the relev
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder
`sanitizer-aarch64-linux-bootstrap-ubsan` running on `sanitizer-buildbot9`
while building `clang` at step 2 "annotate".
Full details are available at:
https://lab.llvm.org/buildbot/#/builders/85/builds/15388
Here is the rele
https://github.com/usx95 updated
https://github.com/llvm/llvm-project/pull/165963
>From 0dafeb9fad277d1ae20cb712888e4bdc1b88ca51 Mon Sep 17 00:00:00 2001
From: Utkarsh Saxena
Date: Sat, 1 Nov 2025 03:16:20 +
Subject: [PATCH] Avoid using DenseMap for CFGBlock and program points
---
.../Ana
https://github.com/usx95 updated
https://github.com/llvm/llvm-project/pull/165963
>From 2f4af6fcb2d460c487e1ecc201c71be451b9bfdb Mon Sep 17 00:00:00 2001
From: Utkarsh Saxena
Date: Sat, 1 Nov 2025 03:16:20 +
Subject: [PATCH] Avoid using DenseMap for CFGBlock and program points
---
.../Ana
Author: Kazu Hirata
Date: 2025-11-06T19:58:59-08:00
New Revision: f8e9b89ae07aebf09822b61f18966d2316e7b40e
URL:
https://github.com/llvm/llvm-project/commit/f8e9b89ae07aebf09822b61f18966d2316e7b40e
DIFF:
https://github.com/llvm/llvm-project/commit/f8e9b89ae07aebf09822b61f18966d2316e7b40e.diff
L
@@ -4052,6 +4093,44 @@ def CIR_ExpectOp : CIR_Op<"expect", [
}];
}
+//===--===//
+// IsConstantOp
siddu0660 wrote:
Thanks for mentioning the incubator ! I hadn’t come across that detail ear
https://github.com/usx95 updated
https://github.com/llvm/llvm-project/pull/165963
>From 2dd60afa4c4aeae46e55390b99d228a8583c03c9 Mon Sep 17 00:00:00 2001
From: Utkarsh Saxena
Date: Sat, 1 Nov 2025 03:16:20 +
Subject: [PATCH] Avoid using DenseMap for CFGBlock and program points
---
.../Ana
@@ -2325,13 +2328,16 @@ class Declarator {
/// This function takes attrs by R-Value reference because it takes ownership
/// of those attributes from the parameter.
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &&attrs,
- SourceLocation En
@@ -102,111 +102,83 @@ struct on_pointer_anon_count {
//==
// __sized_by_or_null on struct member pointer in type attribute position
//=
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder
`sanitizer-aarch64-linux-bootstrap-hwasan` running on `sanitizer-buildbot12`
while building `clang` at step 2 "annotate".
Full details are available at:
https://lab.llvm.org/buildbot/#/builders/55/builds/19715
Here is the re
Author: Kees Cook
Date: 2025-11-06T19:10:36-08:00
New Revision: f29955a594aedf5943d492a999b83e8c6b8fafae
URL:
https://github.com/llvm/llvm-project/commit/f29955a594aedf5943d492a999b83e8c6b8fafae
DIFF:
https://github.com/llvm/llvm-project/commit/f29955a594aedf5943d492a999b83e8c6b8fafae.diff
LOG
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder
`llvm-clang-x86_64-sie-ubuntu-fast` running on `sie-linux-worker` while
building `clang` at step 6 "test-build-unified-tree-check-all".
Full details are available at:
https://lab.llvm.org/buildbot/#/builders/144/builds/39567
Author: Utkarsh Saxena
Date: 2025-11-06T22:07:56-05:00
New Revision: c88e207bf16f3f6467c1a55dbda58070313a02e7
URL:
https://github.com/llvm/llvm-project/commit/c88e207bf16f3f6467c1a55dbda58070313a02e7
DIFF:
https://github.com/llvm/llvm-project/commit/c88e207bf16f3f6467c1a55dbda58070313a02e7.diff
https://github.com/usx95 updated
https://github.com/llvm/llvm-project/pull/165963
>From d1e459947ea54657260d010391734b81f3203981 Mon Sep 17 00:00:00 2001
From: Utkarsh Saxena
Date: Sat, 1 Nov 2025 03:16:20 +
Subject: [PATCH] Avoid using DenseMap for CFGBlock and program points
---
.../Ana
@@ -2325,13 +2328,16 @@ class Declarator {
/// This function takes attrs by R-Value reference because it takes ownership
/// of those attributes from the parameter.
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &&attrs,
- SourceLocation En
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/165963
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Utkarsh Saxena
Date: 2025-11-06T22:02:39-05:00
New Revision: 8fca65c65e3aab9bfdb1a3252335a880689a3f61
URL:
https://github.com/llvm/llvm-project/commit/8fca65c65e3aab9bfdb1a3252335a880689a3f61
DIFF:
https://github.com/llvm/llvm-project/commit/8fca65c65e3aab9bfdb1a3252335a880689a3f61.diff
https://github.com/usx95 closed https://github.com/llvm/llvm-project/pull/165789
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/usx95 updated
https://github.com/llvm/llvm-project/pull/165789
>From 11055e3d1ddb0a2b0e21c89729af380bcb8f5252 Mon Sep 17 00:00:00 2001
From: Utkarsh Saxena
Date: Thu, 30 Oct 2025 22:01:36 +
Subject: [PATCH 1/2] persistent-origin-optimisation
---
.../LifetimeSafety/LoanP
usx95 wrote:
### Merge activity
* **Nov 7, 3:00 AM UTC**: A user started a stack merge that includes this pull
request via
[Graphite](https://app.graphite.com/github/pr/llvm/llvm-project/165789).
https://github.com/llvm/llvm-project/pull/165789
___
@@ -5,36 +5,114 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===--===//
-#include "clang/Analysis/Analyses/LifetimeSafety/LoanPropagation.h"
-#include "Dataflow.h"
+#include
#include
@@ -543,7 +543,6 @@ TEST_F(LifetimeAnalysisTest, PointersInACycle) {
EXPECT_THAT(Origin("p1"), HasLoansTo({"v1", "v2", "v3"}, "after_loop"));
EXPECT_THAT(Origin("p2"), HasLoansTo({"v1", "v2", "v3"}, "after_loop"));
EXPECT_THAT(Origin("p3"), HasLoansTo({"v1", "v2", "v3"},
@@ -5,36 +5,114 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===--===//
-#include "clang/Analysis/Analyses/LifetimeSafety/LoanPropagation.h"
-#include "Dataflow.h"
+#include
#include
zuban32 wrote:
> > A function could be external before LTO stage, and become internal only
> > after LTO symbol resolution. I.e. we're linking against some older object
> > file which has the function compiled with some older definition of the
> > target feature, and the calls to that function
Author: mitchell
Date: 2025-11-06T18:49:24-08:00
New Revision: f2857c2aded10a7ce9e358f0f55d5eb1a344b9a5
URL:
https://github.com/llvm/llvm-project/commit/f2857c2aded10a7ce9e358f0f55d5eb1a344b9a5
DIFF:
https://github.com/llvm/llvm-project/commit/f2857c2aded10a7ce9e358f0f55d5eb1a344b9a5.diff
LOG:
https://github.com/localspook closed
https://github.com/llvm/llvm-project/pull/166000
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
phoebewang wrote:
> A function could be external before LTO stage, and become internal only after
> LTO symbol resolution. I.e. we're linking against some older object file
> which has the function compiled with some older definition of the target
> feature, and the calls to that function in a
https://github.com/KaiYG updated
https://github.com/llvm/llvm-project/pull/166036
>From 91c2333455265c6596411d033bb849b4b5254f01 Mon Sep 17 00:00:00 2001
From: Kai Kai-Yi Weng
Date: Sun, 2 Nov 2025 10:37:32 +0800
Subject: [PATCH 1/3] Revert "Ignore trailing NullStmts in StmtExprs for GCC
compa
https://github.com/bcardosolopes approved this pull request.
https://github.com/llvm/llvm-project/pull/166850
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
github-actions[bot] wrote:
⚠️ We detected that you are using a GitHub private e-mail address to contribute
to the repo. Please turn off [Keep my email addresses
private](https://github.com/settings/emails) setting in your account. See
[LLVM Developer
Policy](https://llvm.org/docs/DeveloperPol
https://github.com/bcardosolopes approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/166683
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/frobtech updated
https://github.com/llvm/llvm-project/pull/66698
>From aff75e8f64c8d2515f5fc152b33d5be514568269 Mon Sep 17 00:00:00 2001
From: Roland McGrath
Date: Mon, 18 Sep 2023 13:39:08 -0700
Subject: [PATCH] [clang][Driver] Obey -fuse-ld=... for -print-prog-name=ld
outp
https://github.com/AlexVlx closed
https://github.com/llvm/llvm-project/pull/166565
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Alex Voicu
Date: 2025-11-07T02:01:31+02:00
New Revision: 16ca2eb77b2cf1d129747d37f3e3da1f4b9c8365
URL:
https://github.com/llvm/llvm-project/commit/16ca2eb77b2cf1d129747d37f3e3da1f4b9c8365
DIFF:
https://github.com/llvm/llvm-project/commit/16ca2eb77b2cf1d129747d37f3e3da1f4b9c8365.diff
LO
https://github.com/kees updated https://github.com/llvm/llvm-project/pull/164737
>From 4609f8c24170d3caf5245a140d4ff1c7cabbec5a Mon Sep 17 00:00:00 2001
From: Kees Cook
Date: Wed, 22 Oct 2025 23:56:41 +
Subject: [PATCH 1/8] [Clang][Sema] Allow counted_by on void* in GNU mode
The counted_by
@@ -1211,11 +1211,13 @@ llvm::Value *CodeGenFunction::emitCountedByPointerSize(
getContext().getTypeSizeInChars(ElementTy->getPointeeType());
if (ElementSize.isZero()) {
- // This might be a __sized_by on a 'void *', which counts bytes, not
- // elements.
@@ -111,10 +118,16 @@ class CrossProcessModuleCache : public ModuleCache {
std::unique_ptr
getLock(StringRef ModuleFilename) override {
+// This is a compiler-internal input/output, let's bypass the sandbox.
+auto BypassSandbox = llvm::sys::sandbox::scopedDisable()
@@ -399,10 +422,14 @@ void RealFileSystem::printImpl(raw_ostream &OS, PrintType
Type,
IntrusiveRefCntPtr vfs::getRealFileSystem() {
static IntrusiveRefCntPtr FS =
makeIntrusiveRefCnt(true);
+ sys::sandbox::violationIfEnabled();
benlangmuir wrote:
We
@@ -110,9 +105,6 @@ class LLVM_ABI AsmPrinter : public MachineFunctionPass {
/// generating (such as the current section etc).
std::unique_ptr OutStreamer;
- /// The VFS to resolve asm include directives.
- IntrusiveRefCntPtr VFS;
benlangmuir wrote:
Wha
@@ -1447,6 +1448,8 @@ class directory_iterator {
explicit directory_iterator(const Twine &path, std::error_code &ec,
bool follow_symlinks = true)
: FollowSymlinks(follow_symlinks) {
+sandbox::violationIfEnabled();
benla
@@ -0,0 +1,41 @@
+//===- IOSandbox.h --*- 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: Apa
@@ -347,12 +348,15 @@ llvm::Expected FileManager::getSTDIN() {
if (STDIN)
return *STDIN;
- std::unique_ptr Content;
- if (auto ContentOrError = llvm::MemoryBuffer::getSTDIN())
-Content = std::move(*ContentOrError);
- else
+ auto ContentOrError = [] {
+auto By
@@ -1132,6 +1147,8 @@ bool is_other(const basic_file_status &status) {
}
std::error_code is_other(const Twine &Path, bool &Result) {
+ sandbox::violationIfEnabled();
benlangmuir wrote:
Won't we catch these via `status` being a violation? Similarly for the o
keith wrote:
cc @tstellar since this is similar to the zstd setting and I changed it in the
release cmake config here
cc @petrhosek re
https://discourse.llvm.org/t/cannot-cmake-self-hosted-clang-on-windows-for-lack-of-libxml2/58793/12?u=keith
https://github.com/llvm/llvm-project/pull/166867
__
https://github.com/andykaylor commented:
This needs a test
https://github.com/llvm/llvm-project/pull/166817
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Keith Smiley (keith)
Changes
Dynamically depending on libxml2 results in various annoyances across
different linux distros for release artifacts. Specifically on fedora
and nixos the library has a different name than on debian, and on
arch-
llvmbot wrote:
@llvm/pr-subscribers-lldb
Author: Keith Smiley (keith)
Changes
Dynamically depending on libxml2 results in various annoyances across
different linux distros for release artifacts. Specifically on fedora
and nixos the library has a different name than on debian, and on
arch-l
https://github.com/keith created
https://github.com/llvm/llvm-project/pull/166867
Dynamically depending on libxml2 results in various annoyances across
different linux distros for release artifacts. Specifically on fedora
and nixos the library has a different name than on debian, and on
arch-lin
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/166568
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/usx95 edited https://github.com/llvm/llvm-project/pull/166568
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/usx95 requested changes to this pull request.
Thanks for working on this.
I have a primary comment on . This implementation exposes many `internal::`
details of lifetime safety to `AnalysisBasedWarnings.h`.
Layering-wise I propose the following changes:
- Define `struct Life
@@ -39,11 +39,11 @@ class Fact {
/// loan set.
OriginFlow,
/// An origin escapes the function by flowing into the return value.
-ReturnOfOrigin,
-/// An origin is used (eg. appears as l-value expression like DeclRefExpr).
Use,
/// A marker for a sp
@@ -74,11 +84,25 @@ class AnalysisImpl
/// one.
Lattice join(Lattice L1, Lattice L2) const {
LivenessMap Merged = L1.LiveOrigins;
-// Take the earliest UseFact to make the join hermetic and commutative.
-auto CombineUseFact = [](const UseFact &A,
-
@@ -2808,6 +2808,17 @@ class LifetimeSafetyReporterImpl : public
LifetimeSafetyReporter {
<< UseExpr->getEndLoc();
}
+ void reportUseAfterReturn(const Expr *IssueExpr, const Expr *EscapeExpr,
+SourceLocation ExpiryLoc, Confidence C) over
@@ -166,7 +169,8 @@ void FactsGenerator::VisitReturnStmt(const ReturnStmt *RS) {
if (const Expr *RetExpr = RS->getRetValue()) {
if (hasOrigin(RetExpr)) {
OriginID OID = FactMgr.getOriginMgr().getOrCreate(*RetExpr);
- CurrentBlockFacts.push_back(FactMgr.createFa
@@ -43,7 +43,7 @@ struct LivenessInfo {
/// multiple uses along different paths, this will point to the use appearing
/// earlier in the translation unit.
/// This is 'null' when the origin is not live.
- const UseFact *CausingUseFact;
+ const Fact *CausingFact;
---
@@ -582,3 +714,28 @@ void lifetimebound_ctor() {
}
(void)v;
}
+
+View lifetimebound_return_of_local(){
+ MyObj stack;
+ return Identity(stack); // expected-warning {{returning reference to stack
allocated object}}
+ // expected-note@-1 {{returned
@@ -1202,5 +1202,242 @@ TEST_F(LifetimeAnalysisTest, LivenessOutsideLoop) {
EXPECT_THAT(Origins({"p"}), MaybeLiveAt("p1"));
}
+TEST_F(LifetimeAnalysisTest, SimpleReturnStackAddress) {
+ SetupTest(R"(
+MyObj* target() {
+ MyObj s;
+ MyObj* p = &s;
+ POINT(
@@ -93,6 +93,9 @@ class FactsGenerator : public
ConstStmtVisitor {
FactManager &FactMgr;
AnalysisDeclContext &AC;
llvm::SmallVector CurrentBlockFacts;
+ // Collect origins that escape the function in this block. These are handled
+ // at the end of the block to ensure
@@ -396,6 +396,131 @@ void loan_from_previous_iteration(MyObj safe, bool
condition) {
} // expected-note {{destroyed here}}
}
+//===--===//
+// Basic Definite Use-After-Return (Return-Stack-Addr
@@ -10728,8 +10728,19 @@ def warn_lifetime_safety_loan_expires_permissive :
Warning<
def warn_lifetime_safety_loan_expires_strict : Warning<
"object whose reference is captured may not live long enough">,
InGroup, DefaultIgnore;
+
+def warn_lifetime_safety_return_stack_a
@@ -53,6 +53,16 @@ struct Lattice {
}
};
+static SourceLocation GetFactLoc(const Fact &F) {
+ if (const auto *UF = F.getAs()) {
+return UF->getUseExpr()->getExprLoc();
+ }
+ if (const auto *OEF = F.getAs()) {
+return OEF->getEscapeExpr()->getExprLoc();
+ }
+ ret
@@ -93,6 +93,9 @@ class FactsGenerator : public
ConstStmtVisitor {
FactManager &FactMgr;
AnalysisDeclContext &AC;
llvm::SmallVector CurrentBlockFacts;
+ // Collect origins that escape the function in this block. These are handled
usx95 wrote:
nit: sugg
@@ -53,6 +53,16 @@ struct Lattice {
}
};
+static SourceLocation GetFactLoc(const Fact &F) {
+ if (const auto *UF = F.getAs()) {
+return UF->getUseExpr()->getExprLoc();
+ }
usx95 wrote:
nit: remove braces here as well.
https://github.com/llvm/llvm-pro
@@ -112,8 +114,17 @@ class LifetimeChecker {
for (const auto &[LID, Warning] : FinalWarningsMap) {
const Loan &L = FactMgr.getLoanMgr().getLoan(LID);
const Expr *IssueExpr = L.IssueExpr;
- Reporter->reportUseAfterFree(IssueExpr, Warning.UseExpr,
-
@@ -112,8 +114,17 @@ class LifetimeChecker {
for (const auto &[LID, Warning] : FinalWarningsMap) {
const Loan &L = FactMgr.getLoanMgr().getLoan(LID);
const Expr *IssueExpr = L.IssueExpr;
- Reporter->reportUseAfterFree(IssueExpr, Warning.UseExpr,
-
@@ -265,16 +258,11 @@ void bin_comma() {
// CIR: cir.func{{.*}} @_Z9bin_commav()
// CIR: %[[A_ADDR:.*]] = cir.alloca !rec_CompleteS,
!cir.ptr, ["a", init]
-// CIR: %[[TMP_ADDR:.*]] = cir.alloca !rec_CompleteS,
!cir.ptr, ["agg.tmp.ensured"]
-// CIR: %[[ZERO:.*]] = cir.c
https://github.com/AmrDeveloper edited
https://github.com/llvm/llvm-project/pull/166850
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -284,20 +272,13 @@ void bin_comma() {
void compound_literal_expr() { CompleteS a = (CompleteS){}; }
// CIR: %[[A_ADDR:.*]] = cir.alloca !rec_CompleteS, !cir.ptr,
["a", init]
-// CIR: %[[A_ELEM_0_PTR:.*]] = cir.get_member %[[A_ADDR]][0] {name = "a"} :
!cir.ptr -> !cir.ptr
@@ -107,21 +107,14 @@ void paren_expr() {
// CIR: cir.func{{.*}} @_Z10paren_exprv()
// CIR: %[[A_ADDR:.*]] = cir.alloca !rec_Point, !cir.ptr, ["a",
init]
// CIR: %[[B_ADDR:.*]] = cir.alloca !rec_Point, !cir.ptr, ["b",
init]
-// CIR: %[[X_ELEM_PTR:.*]] = cir.get_member %
@@ -312,23 +312,10 @@ void l5() {
// CIR: %[[BEGIN_ADDR:.*]] = cir.alloca {{.*}} ["__begin1", init]
// CIR: %[[END_ADDR:.*]] = cir.alloca {{.*}} ["__end1", init]
// CIR: %[[X_ADDR:.*]] = cir.alloca {{.*}} ["x", init]
-// CIR: %[[ARR_CAST:.*]] = cir.cast array_to
https://github.com/AmrDeveloper approved this pull request.
LGTM, Thanks!
https://github.com/llvm/llvm-project/pull/166850
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/zahiraam edited
https://github.com/llvm/llvm-project/pull/166810
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
1 - 100 of 429 matches
Mail list logo