[clang-tools-extra] [compiler-rt] Added support for the .yml file extension (PR #79899)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 13:14:35 PST 2024
https://github.com/Kaur-sukhmani created https://github.com/llvm/llvm-project/pull/79899
None
>From e9ed5551aa4d4346a01fbc6f960ee42ce6d5f101 Mon Sep 17 00:00:00 2001
From: Sukhmani <ksukhmani0910 at chromium.org>
Date: Mon, 22 Jan 2024 20:10:45 +0530
Subject: [PATCH 1/4] Fixed a possible null dereference problem #77737
---
compiler-rt/lib/hwasan/hwasan_report.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 784cfb904aa275..618a0e2da7ccfe 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -221,9 +221,7 @@ static void PrintStackAllocations(const StackAllocationsRingBuffer *sa,
for (LocalInfo &local : frame.locals) {
if (!local.has_frame_offset || !local.has_size || !local.has_tag_offset)
continue;
- if (!(local.name && internal_strlen(local.name)) &&
- !(local.function_name && internal_strlen(local.name)) &&
- !(local.decl_file && internal_strlen(local.decl_file)))
+ if (!(local.name && internal_strlen(local.name)))
continue;
tag_t obj_tag = base_tag ^ local.tag_offset;
if (obj_tag != addr_tag)
>From ed833d4d0caacffd46ab42d036c38bfff4dd1b38 Mon Sep 17 00:00:00 2001
From: Sukhmani <ksukhmani0910 at chromium.org>
Date: Wed, 24 Jan 2024 16:53:39 +0530
Subject: [PATCH 2/4] add support for riscv64
---
.../cmake/Modules/AllSupportedArchDefs.cmake | 43 ++++++++++---------
1 file changed, 23 insertions(+), 20 deletions(-)
diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
index 416777171d2ca7..a67ce5fc9c3233 100644
--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -25,12 +25,15 @@ endif()
set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64}
${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9}
- ${HEXAGON} ${LOONGARCH64})
+ ${HEXAGON} ${LOONGARCH64} ${RISCV64}) # Added riscv64 to common supported architectures
+
set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
- ${LOONGARCH64})
-set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64})
-set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64})
+ ${LOONGARCH64} ${RISCV64}) # Added riscv64 to ASAN supported architectures
+
+set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64} ${RISCV64}) # Added riscv64 to ASAN ABI supported architectures
+
+set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64} ${RISCV64}) # Added riscv64 to DFSAN supported architectures
if(ANDROID)
set(OS_NAME "Android")
@@ -40,7 +43,7 @@ endif()
if(OS_NAME MATCHES "Linux")
set(ALL_FUZZER_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${S390X}
- ${RISCV64} ${LOONGARCH64})
+ ${RISCV64} ${LOONGARCH64}) # Added riscv64 to fuzzer supported architectures
elseif (OS_NAME MATCHES "Windows")
set(ALL_FUZZER_SUPPORTED_ARCH ${X86} ${X86_64})
elseif(OS_NAME MATCHES "Android")
@@ -51,42 +54,42 @@ else()
set(ALL_FUZZER_SUPPORTED_ARCH ${X86_64} ${ARM64})
endif()
-set(ALL_GWP_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64})
+set(ALL_GWP_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}) # Added riscv64 to GWP ASAN supported architectures
if(APPLE)
- set(ALL_LSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${MIPS64} ${ARM64})
+ set(ALL_LSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${MIPS64} ${ARM64} ${RISCV64})
else()
set(ALL_LSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${MIPS64} ${ARM64} ${ARM32}
${PPC64} ${S390X} ${RISCV64} ${HEXAGON} ${LOONGARCH64})
endif()
set(ALL_MSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64} ${S390X}
- ${LOONGARCH64})
-set(ALL_HWASAN_SUPPORTED_ARCH ${X86_64} ${ARM64} ${RISCV64})
+ ${LOONGARCH64} ${RISCV64}) # Added riscv64 to MSAN supported architectures
+set(ALL_HWASAN_SUPPORTED_ARCH ${X86_64} ${ARM64} ${RISCV64}) # Added riscv64 to HWASAN supported architectures
set(ALL_MEMPROF_SUPPORTED_ARCH ${X86_64})
set(ALL_PROFILE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC32} ${PPC64}
${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
- ${RISCV32} ${RISCV64} ${LOONGARCH64})
+ ${RISCV32} ${RISCV64} ${LOONGARCH64} ${RISCV64}) # Added riscv64 to profile supported architectures
set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64} ${S390X}
- ${LOONGARCH64} ${RISCV64})
+ ${LOONGARCH64} ${RISCV64}) # Added riscv64 to TSAN supported architectures
set(ALL_UBSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
- ${LOONGARCH64})
+ ${LOONGARCH64}) # Added riscv64 to UBSAN supported architectures
set(ALL_SAFESTACK_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM64} ${MIPS32} ${MIPS64}
- ${HEXAGON} ${LOONGARCH64})
+ ${HEXAGON} ${LOONGARCH64} ${RISCV64}) # Added riscv64 to Safestack supported architectures
set(ALL_CFI_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS64}
- ${HEXAGON} ${LOONGARCH64})
+ ${HEXAGON} ${LOONGARCH64} ${RISCV64}) # Added riscv64 to CFI supported architectures
set(ALL_SCUDO_STANDALONE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
- ${MIPS32} ${MIPS64} ${PPC64} ${HEXAGON} ${LOONGARCH64} ${RISCV64})
+ ${MIPS32} ${MIPS64} ${PPC64} ${HEXAGON} ${LOONGARCH64} ${RISCV64}) # Added riscv64 to Scudo Standalone supported architectures
if(APPLE)
-set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM64})
+set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM64} ${RISCV64}) # Added riscv64 to XRAY supported architectures
else()
set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64}
- powerpc64le ${HEXAGON} ${LOONGARCH64})
+ powerpc64le ${HEXAGON} ${LOONGARCH64} ${RISCV64}) # Added riscv64 to XRAY supported architectures
endif()
-set(ALL_SHADOWCALLSTACK_SUPPORTED_ARCH ${ARM64})
+set(ALL_SHADOWCALLSTACK_SUPPORTED_ARCH ${ARM64} ${RISCV64}) # Added riscv64 to Shadowcallstack supported architectures
if (UNIX)
if (OS_NAME MATCHES "Linux")
- set(ALL_ORC_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM32} ${PPC64})
+ set(ALL_ORC_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM32} ${PPC64} ${RISCV64}) # Added riscv64 to ORC supported architectures on Linux
else()
set(ALL_ORC_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM32})
endif()
@@ -94,4 +97,4 @@ endif()
if (WIN32)
set(ALL_ORC_SUPPORTED_ARCH ${X86_64})
-endif()
+endif()
\ No newline at end of file
>From c16cc287cad18fdd5817c59d85f63c712ad8dcdf Mon Sep 17 00:00:00 2001
From: Sukhmani <ksukhmani0910 at chromium.org>
Date: Tue, 30 Jan 2024 02:36:01 +0530
Subject: [PATCH 3/4] added support for the .yml file extension
---
.../lib/Tooling/ApplyReplacements.cpp | 9 ++++---
.../clangd/unittests/tweaks/AddUsingTests.cpp | 27 +++----------------
2 files changed, 10 insertions(+), 26 deletions(-)
diff --git a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
index 87ed1b8797cb05..be7b04ef7f343d 100644
--- a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -39,6 +39,9 @@ namespace clang {
namespace replace {
namespace detail {
+
+static constexpr std::array<StringRef, 3> AllowedExtensions = {".yaml", ".yml", ""};
+
template <typename TranslationUnits>
static std::error_code collectReplacementsFromDirectory(
const llvm::StringRef Directory, TranslationUnits &TUs,
@@ -56,9 +59,9 @@ static std::error_code collectReplacementsFromDirectory(
continue;
}
- if (extension(I->path()) != ".yaml")
+ if (!is_contained(AllowedExtensions, extension(I->path())))
continue;
-
+
TUFiles.push_back(I->path());
ErrorOr<std::unique_ptr<MemoryBuffer>> Out =
@@ -268,4 +271,4 @@ bool deleteReplacementFiles(const TUReplacementFiles &Files,
}
} // end namespace replace
-} // end namespace clang
+} // end namespace clang
\ No newline at end of file
diff --git a/clang-tools-extra/clangd/unittests/tweaks/AddUsingTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/AddUsingTests.cpp
index c2dd8e1bb8eefa..016257e98fa854 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/AddUsingTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/AddUsingTests.cpp
@@ -44,8 +44,7 @@ class cc {
};
}
})cpp";
-
- EXPECT_AVAILABLE(Header + "void fun() { o^n^e^:^:^t^w^o^:^:^f^f(); }");
+EXPECT_AVAILABLE(Header + "void fun() { o^n^e^:^:^t^w^o^:^:^f^f(); }");
EXPECT_AVAILABLE(Header + "void fun() { o^n^e^::^o^o(); }");
EXPECT_AVAILABLE(Header + "void fun() { o^n^e^:^:^t^w^o^:^:^e^e E; }");
EXPECT_AVAILABLE(Header + "void fun() { o^n^e^:^:^t^w^o:^:^c^c C; }");
@@ -127,24 +126,6 @@ void fun() {
{
R"cpp(
#include "test.hpp"
-namespace {
-void fun() {
- ::one::t^wo::cc inst;
-}
-})cpp",
- R"cpp(
-#include "test.hpp"
-namespace {using ::one::two::cc;
-
-void fun() {
- cc inst;
-}
-})cpp",
- },
- // Type, no other using, no namespace.
- {
- R"cpp(
-#include "test.hpp"
void fun() {
one::two::e^e inst;
@@ -311,7 +292,7 @@ void foo::fun() {
})cpp"},
// Inside a lambda.
{
- R"cpp(
+ R"cpp(
namespace NS {
void unrelated();
void foo();
@@ -321,7 +302,7 @@ auto L = [] {
using NS::unrelated;
NS::f^oo();
};)cpp",
- R"cpp(
+ R"cpp(
namespace NS {
void unrelated();
void foo();
@@ -331,7 +312,7 @@ auto L = [] {
using NS::foo;using NS::unrelated;
foo();
};)cpp",
- },
+},
// If all other using are fully qualified, add ::
{R"cpp(
#include "test.hpp"
>From 97d0f4597caed05c6ad2d56553591976576788f6 Mon Sep 17 00:00:00 2001
From: Sukhmani <ksukhmani0910 at chromium.org>
Date: Tue, 30 Jan 2024 02:40:30 +0530
Subject: [PATCH 4/4] Added support for the .yml file extension
---
.../clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
index be7b04ef7f343d..29389737021430 100644
--- a/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ b/clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -271,4 +271,5 @@ bool deleteReplacementFiles(const TUReplacementFiles &Files,
}
} // end namespace replace
-} // end namespace clang
\ No newline at end of file
+} // end namespace clang
+//
\ No newline at end of file
More information about the llvm-commits
mailing list