@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From a19329050600d4d89cc698b686d7aaa13e0c22c2 Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 01/20] [analyzer] Add std::any checker
---
clang/docs/analyzer/chec
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From a19329050600d4d89cc698b686d7aaa13e0c22c2 Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 01/19] [analyzer] Add std::any checker
---
clang/docs/analyzer/chec
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From a19329050600d4d89cc698b686d7aaa13e0c22c2 Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 01/18] [analyzer] Add std::any checker
---
clang/docs/analyzer/chec
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From 98b52eb390438402562de96a74771b0132fc71cb Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 01/18] [analyzer] Add std::any checker
---
clang/docs/analyzer/chec
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From 98b52eb390438402562de96a74771b0132fc71cb Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 01/16] [analyzer] Add std::any checker
---
clang/docs/analyzer/chec
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From 98b52eb390438402562de96a74771b0132fc71cb Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 01/15] [analyzer] Add std::any checker
---
clang/docs/analyzer/chec
=?utf-8?q?Gábor?= Spaits,=?utf-8?q?Gábor?= Spaits,
=?utf-8?q?Gábor?= Spaits,=?utf-8?q?Gábor?= Spaits,
=?utf-8?q?Gábor?= Spaits
Message-ID:
In-Reply-To:
@@ -87,6 +85,28 @@ bool isStdVariant(const Type *Type) {
return isStdType(Type, llvm::StringLiteral("variant"));
}
+bool
=?utf-8?q?Gábor?= Spaits,=?utf-8?q?Gábor?= Spaits,
=?utf-8?q?Gábor?= Spaits,=?utf-8?q?Gábor?= Spaits,
=?utf-8?q?Gábor?= Spaits
Message-ID:
In-Reply-To:
@@ -87,6 +85,28 @@ bool isStdVariant(const Type *Type) {
return isStdType(Type, llvm::StringLiteral("variant"));
}
+bool
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From 98b52eb390438402562de96a74771b0132fc71cb Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 01/12] [analyzer] Add std::any checker
---
clang/docs/analyzer/chec
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From 98b52eb390438402562de96a74771b0132fc71cb Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 01/11] [analyzer] Add std::any checker
---
clang/docs/analyzer/chec
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From 98b52eb390438402562de96a74771b0132fc71cb Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 01/10] [analyzer] Add std::any checker
---
clang/docs/analyzer/chec
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From 98b52eb390438402562de96a74771b0132fc71cb Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 1/9] [analyzer] Add std::any checker
---
clang/docs/analyzer/checke
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From 98b52eb390438402562de96a74771b0132fc71cb Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 1/8] [analyzer] Add std::any checker
---
clang/docs/analyzer/checke
@@ -87,6 +85,28 @@ bool isStdVariant(const Type *Type) {
return isStdType(Type, llvm::StringLiteral("variant"));
}
+bool isStdAny(const Type *Type) {
+ return isStdType(Type, llvm::StringLiteral("any"));
+}
+
+bool isVowel(char a) {
+ switch (a) {
+ case 'a':
+ case 'e':
@@ -87,6 +85,28 @@ bool isStdVariant(const Type *Type) {
return isStdType(Type, llvm::StringLiteral("variant"));
}
+bool isStdAny(const Type *Type) {
+ return isStdType(Type, llvm::StringLiteral("any"));
+}
+
+bool isVowel(char a) {
+ switch (a) {
+ case 'a':
+ case 'e':
@@ -0,0 +1,170 @@
+// RUN: %clang %s -std=c++17 -Xclang -verify --analyze \
+// RUN: -Xclang -analyzer-checker=core \
+// RUN: -Xclang -analyzer-checker=debug.ExprInspection \
+// RUN: -Xclang -analyzer-checker=core,alpha.core.StdAny
+
+#include "Inputs/system-header-simulat
@@ -87,6 +85,28 @@ bool isStdVariant(const Type *Type) {
return isStdType(Type, llvm::StringLiteral("variant"));
}
+bool isStdAny(const Type *Type) {
+ return isStdType(Type, llvm::StringLiteral("any"));
+}
+
+bool isVowel(char a) {
+ switch (a) {
+ case 'a':
+ case 'e':
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -87,6 +85,28 @@ bool isStdVariant(const Type *Type) {
return isStdType(Type, llvm::StringLiteral("variant"));
}
+bool isStdAny(const Type *Type) {
+ return isStdType(Type, llvm::StringLiteral("any"));
+}
+
+bool isVowel(char a) {
+ switch (a) {
+ case 'a':
+ case 'e':
@@ -58,6 +58,14 @@ void wontConfuseStdGets() {
////
// std::get
////
+void stdGetType2() {
spaits wrote:
O
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -2095,6 +2095,27 @@ This checker is a part of ``core.StackAddressEscape``,
but is temporarily disabl
// returned block
}
+.. _alpha-core-StdAny:
+
+alpha.core.StdAny (C++)
+"""
+Check if a value of active type is retrieved from a
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -30,6 +24,9 @@ bool isMoveAssignmentCall(const CallEvent &Call);
bool isMoveConstructorCall(const CallEvent &Call);
bool isStdType(const Type *Type, const std::string &TypeName);
bool isStdVariant(const Type *Type);
+bool isStdAny(const Type *Type);
whisperi
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -58,6 +58,14 @@ void wontConfuseStdGets() {
////
// std::get
////
+void stdGetType2() {
whisperity wrote
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -87,6 +85,28 @@ bool isStdVariant(const Type *Type) {
return isStdType(Type, llvm::StringLiteral("variant"));
}
+bool isStdAny(const Type *Type) {
+ return isStdType(Type, llvm::StringLiteral("any"));
+}
+
+bool isVowel(char a) {
+ switch (a) {
+ case 'a':
+ case 'e':
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
https://github.com/whisperity edited
https://github.com/llvm/llvm-project/pull/76580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,170 @@
+// RUN: %clang %s -std=c++17 -Xclang -verify --analyze \
+// RUN: -Xclang -analyzer-checker=core \
+// RUN: -Xclang -analyzer-checker=debug.ExprInspection \
+// RUN: -Xclang -analyzer-checker=core,alpha.core.StdAny
+
+#include "Inputs/system-header-simulat
@@ -0,0 +1,200 @@
+//===- StdAnyChecker.cpp -*- 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
https://github.com/whisperity requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/76580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/whisperity edited
https://github.com/llvm/llvm-project/pull/76580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff 90802e652db348fd3218fcbfc3e6ac9e90702acd
1a96db3c48782b0ec6f2de403ce862b9a95917bf --
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
https://github.com/spaits updated
https://github.com/llvm/llvm-project/pull/76580
From 98b52eb390438402562de96a74771b0132fc71cb Mon Sep 17 00:00:00 2001
From: Gabor Spaits
Date: Fri, 29 Dec 2023 17:54:34 +0100
Subject: [PATCH 1/7] [analyzer] Add std::any checker
---
clang/docs/analyzer/checke
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
https://github.com/steakhal edited
https://github.com/llvm/llvm-project/pull/76580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
https://github.com/steakhal requested changes to this pull request.
First batch of review.
https://github.com/llvm/llvm-project/pull/76580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi
@@ -0,0 +1,201 @@
+//===- StdAnyChecker.cpp -*- 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
https://github.com/steakhal edited
https://github.com/llvm/llvm-project/pull/76580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Gábor Spaits (spaits)
Changes
Add a checker to detect bad `std::any` type accesses.
It warns, when the active type is different from the requested type when
calling `std::any_cast`:
```cpp
void anyCast() {
std::any a = 5;
char c = std:
https://github.com/spaits created
https://github.com/llvm/llvm-project/pull/76580
Add a checker to detect bad `std::any` type accesses.
It warns, when the active type is different from the requested type when
calling `std::any_cast`:
```cpp
void anyCast() {
std::any a = 5;
char c = std::any
63 matches
Mail list logo