[clang] [clang] Fix sorting module headers (PR #73146)
https://github.com/tuliom created https://github.com/llvm/llvm-project/pull/73146 Struct Module::Header is not a POD type. As such, qsort() and llvm::array_pod_sort() must not be used to sort it. This became an issue with the new implementation of qsort() in glibc 2.39 that is not guaranteed to be a stable sort, causing Headers to be re-ordered and corrupted. Replace the usage of llvm::array_pod_sort() with std::stable_sort() in order to fix this issue. The signature of compareModuleHeaders() has to be modified. This commit also fixes commit d3676d4b666ead794fc58bbc7e07aa406dcf487a that caused all headers to have NameAsWritten set to a 0-length string without adapting compareModuleHeaders() to the new field. Fixes #73145. >From d0a86b80256a45bfdee790a7aec5a48d2d71e6bb Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 22 Nov 2023 14:01:24 -0300 Subject: [PATCH] [clang] Fix sorting module headers Struct Module::Header is not a POD type. As such, qsort() and llvm::array_pod_sort() must not be used to sort it. This became an issue with the new implementation of qsort() in glibc 2.39 that is not guaranteed to be a stable sort, causing Headers to be re-ordered and corrupted. Replace the usage of llvm::array_pod_sort() with std::stable_sort() in order to fix this issue. The signature of compareModuleHeaders() has to be modified. This commit also fixes commit d3676d4b666ead794fc58bbc7e07aa406dcf487a that caused all headers to have NameAsWritten set to a 0-length string without adapting compareModuleHeaders() to the new field. Fixes #73145. --- clang/lib/Lex/ModuleMap.cpp | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 00e13c9be4a7d73..7ba5a5f8cbf973d 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -2509,9 +2509,11 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, << FixItHint::CreateReplacement(CurrModuleDeclLoc, "framework module"); } -static int compareModuleHeaders(const Module::Header *A, -const Module::Header *B) { - return A->NameAsWritten.compare(B->NameAsWritten); +static bool compareModuleHeaders(const Module::Header &A, +const Module::Header &B) { + return A.NameAsWritten < B.NameAsWritten || +(A.NameAsWritten == B.NameAsWritten && + A.PathRelativeToRootModuleDirectory < B.PathRelativeToRootModuleDirectory); } /// Parse an umbrella directory declaration. @@ -2574,7 +2576,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { } // Sort header paths so that the pcm doesn't depend on iteration order. -llvm::array_pod_sort(Headers.begin(), Headers.end(), compareModuleHeaders); +std::stable_sort(Headers.begin(), Headers.end(), compareModuleHeaders); for (auto &Header : Headers) Map.addHeader(ActiveModule, std::move(Header), ModuleMap::TextualHeader); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting module headers (PR #73146)
https://github.com/tuliom updated https://github.com/llvm/llvm-project/pull/73146 >From d0a86b80256a45bfdee790a7aec5a48d2d71e6bb Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 22 Nov 2023 14:01:24 -0300 Subject: [PATCH 1/2] [clang] Fix sorting module headers Struct Module::Header is not a POD type. As such, qsort() and llvm::array_pod_sort() must not be used to sort it. This became an issue with the new implementation of qsort() in glibc 2.39 that is not guaranteed to be a stable sort, causing Headers to be re-ordered and corrupted. Replace the usage of llvm::array_pod_sort() with std::stable_sort() in order to fix this issue. The signature of compareModuleHeaders() has to be modified. This commit also fixes commit d3676d4b666ead794fc58bbc7e07aa406dcf487a that caused all headers to have NameAsWritten set to a 0-length string without adapting compareModuleHeaders() to the new field. Fixes #73145. --- clang/lib/Lex/ModuleMap.cpp | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 00e13c9be4a7d73..7ba5a5f8cbf973d 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -2509,9 +2509,11 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, << FixItHint::CreateReplacement(CurrModuleDeclLoc, "framework module"); } -static int compareModuleHeaders(const Module::Header *A, -const Module::Header *B) { - return A->NameAsWritten.compare(B->NameAsWritten); +static bool compareModuleHeaders(const Module::Header &A, +const Module::Header &B) { + return A.NameAsWritten < B.NameAsWritten || +(A.NameAsWritten == B.NameAsWritten && + A.PathRelativeToRootModuleDirectory < B.PathRelativeToRootModuleDirectory); } /// Parse an umbrella directory declaration. @@ -2574,7 +2576,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { } // Sort header paths so that the pcm doesn't depend on iteration order. -llvm::array_pod_sort(Headers.begin(), Headers.end(), compareModuleHeaders); +std::stable_sort(Headers.begin(), Headers.end(), compareModuleHeaders); for (auto &Header : Headers) Map.addHeader(ActiveModule, std::move(Header), ModuleMap::TextualHeader); >From 6e2e45c2bfcd3846d91184a57bb2fe39fe745b25 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 22 Nov 2023 14:32:52 -0300 Subject: [PATCH 2/2] fixup! [clang] Fix sorting module headers --- clang/lib/Lex/ModuleMap.cpp | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 7ba5a5f8cbf973d..591bd97075b87a9 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -2510,10 +2510,11 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, } static bool compareModuleHeaders(const Module::Header &A, -const Module::Header &B) { + const Module::Header &B) { return A.NameAsWritten < B.NameAsWritten || -(A.NameAsWritten == B.NameAsWritten && - A.PathRelativeToRootModuleDirectory < B.PathRelativeToRootModuleDirectory); + (A.NameAsWritten == B.NameAsWritten && + A.PathRelativeToRootModuleDirectory < + B.PathRelativeToRootModuleDirectory); } /// Parse an umbrella directory declaration. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting module headers (PR #73146)
tuliom wrote: I've just fixed the code format. https://github.com/llvm/llvm-project/pull/73146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting module headers (PR #73146)
tuliom wrote: > Sorry, I don't quite understand tnhis @dwblaikie Would you have any questions? I'd be glad to answer them. https://github.com/llvm/llvm-project/pull/73146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting module headers (PR #73146)
tuliom wrote: > Sorry, I don't quite understand tnhis - but I guess the second field ( > PathRelativeToRootModuleDirectory ) comparison was to address this bug? @dwblaikie Yes. > It'd probably be good to fix that separately, so it can be discussed in more > detail, etc. The commit is already very small. Splitting it wouldn't help with bisect, as we would continue having a broken commit. After the both issues are understood, it becomes easy to understand why they're being made. If you have more questions that would help you understand this commit, I'd be glad to answer them. https://github.com/llvm/llvm-project/pull/73146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting module headers (PR #73146)
https://github.com/tuliom updated https://github.com/llvm/llvm-project/pull/73146 >From d0a86b80256a45bfdee790a7aec5a48d2d71e6bb Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 22 Nov 2023 14:01:24 -0300 Subject: [PATCH 1/3] [clang] Fix sorting module headers Struct Module::Header is not a POD type. As such, qsort() and llvm::array_pod_sort() must not be used to sort it. This became an issue with the new implementation of qsort() in glibc 2.39 that is not guaranteed to be a stable sort, causing Headers to be re-ordered and corrupted. Replace the usage of llvm::array_pod_sort() with std::stable_sort() in order to fix this issue. The signature of compareModuleHeaders() has to be modified. This commit also fixes commit d3676d4b666ead794fc58bbc7e07aa406dcf487a that caused all headers to have NameAsWritten set to a 0-length string without adapting compareModuleHeaders() to the new field. Fixes #73145. --- clang/lib/Lex/ModuleMap.cpp | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 00e13c9be4a7d73..7ba5a5f8cbf973d 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -2509,9 +2509,11 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, << FixItHint::CreateReplacement(CurrModuleDeclLoc, "framework module"); } -static int compareModuleHeaders(const Module::Header *A, -const Module::Header *B) { - return A->NameAsWritten.compare(B->NameAsWritten); +static bool compareModuleHeaders(const Module::Header &A, +const Module::Header &B) { + return A.NameAsWritten < B.NameAsWritten || +(A.NameAsWritten == B.NameAsWritten && + A.PathRelativeToRootModuleDirectory < B.PathRelativeToRootModuleDirectory); } /// Parse an umbrella directory declaration. @@ -2574,7 +2576,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { } // Sort header paths so that the pcm doesn't depend on iteration order. -llvm::array_pod_sort(Headers.begin(), Headers.end(), compareModuleHeaders); +std::stable_sort(Headers.begin(), Headers.end(), compareModuleHeaders); for (auto &Header : Headers) Map.addHeader(ActiveModule, std::move(Header), ModuleMap::TextualHeader); >From 6e2e45c2bfcd3846d91184a57bb2fe39fe745b25 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 22 Nov 2023 14:32:52 -0300 Subject: [PATCH 2/3] fixup! [clang] Fix sorting module headers --- clang/lib/Lex/ModuleMap.cpp | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 7ba5a5f8cbf973d..591bd97075b87a9 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -2510,10 +2510,11 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, } static bool compareModuleHeaders(const Module::Header &A, -const Module::Header &B) { + const Module::Header &B) { return A.NameAsWritten < B.NameAsWritten || -(A.NameAsWritten == B.NameAsWritten && - A.PathRelativeToRootModuleDirectory < B.PathRelativeToRootModuleDirectory); + (A.NameAsWritten == B.NameAsWritten && + A.PathRelativeToRootModuleDirectory < + B.PathRelativeToRootModuleDirectory); } /// Parse an umbrella directory declaration. >From d8c2a15b74adcea94f76ccc7e1bff507bb2b799e Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Thu, 23 Nov 2023 10:09:16 -0300 Subject: [PATCH 3/3] fixup! [clang] Fix sorting module headers --- clang/lib/Lex/ModuleMap.cpp | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 591bd97075b87a9..1d67e275cb4775a 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -2511,10 +2511,7 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, static bool compareModuleHeaders(const Module::Header &A, const Module::Header &B) { - return A.NameAsWritten < B.NameAsWritten || - (A.NameAsWritten == B.NameAsWritten && - A.PathRelativeToRootModuleDirectory < - B.PathRelativeToRootModuleDirectory); + return A.NameAsWritten < B.NameAsWritten; } /// Parse an umbrella directory declaration. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting module headers (PR #73146)
https://github.com/tuliom edited https://github.com/llvm/llvm-project/pull/73146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting module headers (PR #73146)
tuliom wrote: OK. I modified this PR in order to only make the changes that fix #73145 . Sorting will remain broken as it has been since 2021. I will provide another PR after this one gets merged. https://github.com/llvm/llvm-project/pull/73146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting module headers (PR #73146)
https://github.com/tuliom closed https://github.com/llvm/llvm-project/pull/73146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting header paths (PR #73323)
https://github.com/tuliom created https://github.com/llvm/llvm-project/pull/73323 This code was initially written in commit 7ff29148ac7883881e62dc9e1714057c68ad4436 with the intention of sorting headers according to their path. At the time, the path was saved in field NameAsWritten of Module::Header. Later, commit e6830b6028ec5434ccf8dbebdd992918f67b1751 added field PathRelativeToRootModuleDirectory to Module::Header and modified ModuleMapParser::parseUmbrellaDirDecl() so that it started to save the header path in the new field and started setting NameAsWritten = "". It didn't modify compareModuleHeaders() in order to adapt it to the new field. After this commit, the sorting stopped working because it continued comparing only NameAsWritten. This commit fixes it by treating NameAsWritten and PathRelativeToRootModuleDirectory as a tuple when comparing Module::Header. >From 772d51724dda39baa7347f2c33af5c65786964a2 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Fri, 24 Nov 2023 09:26:12 -0300 Subject: [PATCH] [clang] Fix sorting header paths This code was initially written in commit 7ff29148ac7883881e62dc9e1714057c68ad4436 with the intention of sorting headers according to their path. At the time, the path was saved in field NameAsWritten of Module::Header. Later, commit e6830b6028ec5434ccf8dbebdd992918f67b1751 added field PathRelativeToRootModuleDirectory to Module::Header and modified ModuleMapParser::parseUmbrellaDirDecl() so that it started to save the header path in the new field and started setting NameAsWritten = "". It didn't modify compareModuleHeaders() in order to adapt it to the new field. After this commit, the sorting stopped working because it continued comparing only NameAsWritten. This commit fixes it by treating NameAsWritten and PathRelativeToRootModuleDirectory as a tuple when comparing Module::Header. --- clang/lib/Lex/ModuleMap.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 1d67e275cb4775a..7bc89b2fed36bf2 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include using namespace clang; @@ -2511,7 +2512,8 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, static bool compareModuleHeaders(const Module::Header &A, const Module::Header &B) { - return A.NameAsWritten < B.NameAsWritten; + return std::tie(A.NameAsWritten, A.PathRelativeToRootModuleDirectory) < + std::tie(B.NameAsWritten, B.PathRelativeToRootModuleDirectory); } /// Parse an umbrella directory declaration. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix sorting header paths (PR #73323)
tuliom wrote: > So what breakage is caused by the sorting failure? @dwblaikie This is not causing a breakage. It is just not working as designed because the sort function has been comparing `""` against `""` since commit https://github.com/llvm/llvm-project/commit/e6830b6028ec5434ccf8dbebdd992918f67b1751 . I found this while investigating issue #73145. The way the code is behaving now, the sort function is acting as a NOP and could be removed. However, I don't think that was the intention of the author of https://github.com/llvm/llvm-project/commit/7ff29148ac7883881e62dc9e1714057c68ad4436. > Can that behavior be tested in some way to validate this change and ensure it > doesn't regress in the future? Possibly. Let me think on this. https://github.com/llvm/llvm-project/pull/73323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix standalone execution in TableGen/target-builtins-prototype-parser.td (PR #84186)
https://github.com/tuliom created https://github.com/llvm/llvm-project/pull/84186 Use a path that works for both standalone as well as full repository builds. Fixes: 9b672de99760 ("[clang][Builtins] Parse clang extended vectors types. (#83584)") >From 46e044a7c97fe1891a9109e423c66ff75c9c4a14 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Wed, 6 Mar 2024 12:00:45 -0300 Subject: [PATCH] [clang] Fix standalone execution in TableGen/target-builtins-prototype-parser.td Use a path that works for both standalone as well as full repository builds. Fixes: 9b672de99760 ("[clang][Builtins] Parse clang extended vectors types. (#83584)") --- .../TableGen/target-builtins-prototype-parser.td | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/clang/test/TableGen/target-builtins-prototype-parser.td b/clang/test/TableGen/target-builtins-prototype-parser.td index 3d6c92341ac43f..555aebb3ccfb1f 100644 --- a/clang/test/TableGen/target-builtins-prototype-parser.td +++ b/clang/test/TableGen/target-builtins-prototype-parser.td @@ -1,11 +1,11 @@ -// RUN: clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins | FileCheck %s -// RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_LANES 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_LANES -// RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_COMMA 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_COMMA -// RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_TYPE 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_TYPE -// RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_A 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_A -// RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_B 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_B -// RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_C 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_C -// RUN: not clang-tblgen -I %p/../../../clang/include/ %s --gen-clang-builtins -DERROR_EXPECTED_D 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_D +// RUN: clang-tblgen -I %p/../../include/ %s --gen-clang-builtins | FileCheck %s +// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_LANES 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_LANES +// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_COMMA 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_COMMA +// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_TYPE 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_TYPE +// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_A 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_A +// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_B 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_B +// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_C 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_C +// RUN: not clang-tblgen -I %p/../../include/ %s --gen-clang-builtins -DERROR_EXPECTED_D 2>&1 | FileCheck %s --check-prefix=ERROR_EXPECTED_D include "clang/Basic/BuiltinsBase.td" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][Builtins] Parse clang extended vectors types. (PR #83584)
tuliom wrote: @fpetrogalli I found a small issue with this PR. Could you take a look at PR #84186 and review it, please? https://github.com/llvm/llvm-project/pull/83584 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Fix standalone execution in TableGen/target-builtins-prototype-parser.td (PR #84186)
https://github.com/tuliom closed https://github.com/llvm/llvm-project/pull/84186 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 1be4db7 - [clang] scan-view: Remove unused python import
Author: Tulio Magno Quites Machado Filho Date: 2023-07-18T16:12:07-03:00 New Revision: 1be4db73642fa0658d3b1e1dad7ec95259d1d261 URL: https://github.com/llvm/llvm-project/commit/1be4db73642fa0658d3b1e1dad7ec95259d1d261 DIFF: https://github.com/llvm/llvm-project/commit/1be4db73642fa0658d3b1e1dad7ec95259d1d261.diff LOG: [clang] scan-view: Remove unused python import Python's module imp is not being used and is not available on Python 3.12 anymore. Reviewed By: tbaeder Differential Revision: https://reviews.llvm.org/D155192 Added: Modified: clang/tools/scan-view/bin/scan-view Removed: diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view index 6165432e7af845..d01aebb4029a75 100755 --- a/clang/tools/scan-view/bin/scan-view +++ b/clang/tools/scan-view/bin/scan-view @@ -6,7 +6,6 @@ from __future__ import print_function """ import sys -import imp import os import posixpath import threading ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] RFC: [cmake] Export CLANG_RESOURCE_DIR in ClangConfig (PR #97197)
tuliom wrote: > `clang::Driver` has this method which allows you to specify the starting path > for the clang installation to use for the resource lookup. > > ```c++ > /// Takes the path to a binary that's either in bin/ or lib/ and returns > /// the path to clang's resource directory. > static std::string GetResourcesPath(StringRef BinaryPath, > StringRef CustomResourceDir = ""); > ``` I don't think an implementation based on `GetResourcesPath()` will work outside of Clang. In order for this function to return the correct PATH for all scenarios, we need that `CustomResourceDir=CLANG_RESOURCE_DIR`. That forces us back to the original discussion about exporting `CLANG_RESOURCE_DIR`. Here is an example on how this function is used in Clang: https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/Driver.cpp#L242 https://github.com/llvm/llvm-project/pull/97197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] RFC: [cmake] Export CLANG_RESOURCE_DIR in ClangConfig (PR #97197)
tuliom wrote: > I wonder if that last one is a bug...? Agreed. > If so, it seems it would be better to just fold `CLANG_RESOURCE_DIR` into > `Driver::GetResourcesPath` and remove the optional argument. Or making `CustomResourceDir = CLANG_RESOURCE_DIR` by default instead of `""`. This would allow users to continue setting a different resource directory than `CLANG_RESOURCE_DIR`, although I still don't understand in which case that would be used. https://github.com/llvm/llvm-project/pull/97197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] RFC: [cmake] Export CLANG_RESOURCE_DIR in ClangConfig (PR #97197)
tuliom wrote: @kimgr Good points. I agree with you. https://github.com/llvm/llvm-project/pull/97197 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lldb] Use CLANG_RESOURCE_DIR more consistently (PR #103388)
tuliom wrote: > Is there an out-of-tree scenario where CLANG_RESOURCE_DIR needs to be > replaced with something else at runtime, i.e. a real use-case for the > optional CustomResourceDir optional argument I removed? @kimgr I have also looked for this and I haven't found an use-case where this would be appropriate. In fact, I think it's wrong to not take `CLANG_RESOURCE_DIR` as part of the output from `driver::Driver::GetResourcesPath()` because that would generate wrong results for builds that do set `CLANG_RESOURCE_DIR`, e.g. Fedora's builds. https://github.com/llvm/llvm-project/pull/103388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lldb] Use CLANG_RESOURCE_DIR more consistently (PR #103388)
tuliom wrote: > Do we need anything more to make progress with this PR? @kimgr Do you have committer permission? Would you like some help to get this merged? https://github.com/llvm/llvm-project/pull/103388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lldb] Use CLANG_RESOURCE_DIR more consistently (PR #103388)
tuliom wrote: Agreed. Let me merge this. https://github.com/llvm/llvm-project/pull/103388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lldb] Use CLANG_RESOURCE_DIR more consistently (PR #103388)
https://github.com/tuliom closed https://github.com/llvm/llvm-project/pull/103388 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [AArch64][SME] Fix bug on SMELd1St1 (PR #118109)
tuliom wrote: @wwwatermiao I noticed the author name in the commit is `unknown`. Is that intentional? Would you like to change it? https://github.com/llvm/llvm-project/pull/118109 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [AArch64][SME] Fix bug on SMELd1St1 (PR #118109)
https://github.com/tuliom closed https://github.com/llvm/llvm-project/pull/118109 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits