[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 01/12] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 02/12] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f7..eb26bfade47b7a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 03/12] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..fd75ad033c4dca 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:44:11 +0800 Subject: [PATCH 04/12] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c4dca..3e2c07399387d5 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 14:07:41 +0800 Subject: [PATCH 05/12] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 3e2c07399387d5..e67adf3d6616e6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const
[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)
https://github.com/jcsxky edited https://github.com/llvm/llvm-project/pull/74813 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 01/11] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 02/11] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f7..eb26bfade47b7a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 03/11] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..fd75ad033c4dca 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:44:11 +0800 Subject: [PATCH 04/11] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c4dca..3e2c07399387d5 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 14:07:41 +0800 Subject: [PATCH 05/11] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 3e2c07399387d5..e67adf3d6616e6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const
[clang] [llvm] [lld] [lldb] [clang-tools-extra] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (PR #74916)
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/74916 >From ab33bda7fd31fbfc28344bb6f81ce08394e7c3fd Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 7 Dec 2023 23:20:42 -0800 Subject: [PATCH 1/3] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with This patch renames {starts,ends}with to {starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. Since there are only a handful of occurrences, this patch skips the deprecation phase and simply renames them. --- clang-tools-extra/clang-doc/Mapper.cpp| 2 +- clang-tools-extra/modularize/ModuleAssistant.cpp | 2 +- clang/lib/AST/MicrosoftMangle.cpp | 8 clang/lib/Basic/Module.cpp| 2 +- clang/lib/CrossTU/CrossTranslationUnit.cpp| 2 +- clang/lib/Driver/Driver.cpp | 2 +- clang/lib/Driver/ToolChains/Darwin.cpp| 2 +- clang/lib/Lex/ModuleMap.cpp | 2 +- clang/lib/Sema/SemaCodeComplete.cpp | 2 +- lld/COFF/PDB.cpp | 2 +- lld/MachO/InputFiles.cpp | 2 +- lldb/source/Commands/CommandCompletions.cpp | 2 +- llvm/include/llvm/ADT/SmallString.h | 12 llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 2 +- llvm/tools/dsymutil/DebugMap.cpp | 2 +- llvm/tools/llvm-cov/CodeCoverage.cpp | 2 +- llvm/tools/llvm-cov/CoverageReport.cpp| 2 +- llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp| 2 +- llvm/tools/llvm-ml/llvm-ml.cpp| 2 +- llvm/unittests/Support/Path.cpp | 4 ++-- 20 files changed, 27 insertions(+), 31 deletions(-) diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp index 5264417748a12b..bb8b7952980ac6 100644 --- a/clang-tools-extra/clang-doc/Mapper.cpp +++ b/clang-tools-extra/clang-doc/Mapper.cpp @@ -103,7 +103,7 @@ llvm::SmallString<128> MapASTVisitor::getFile(const NamedDecl *D, .getPresumedLoc(D->getBeginLoc()) .getFilename()); IsFileInRootDir = false; - if (RootDir.empty() || !File.startswith(RootDir)) + if (RootDir.empty() || !File.starts_with(RootDir)) return File; IsFileInRootDir = true; llvm::SmallString<128> Prefix(RootDir); diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp b/clang-tools-extra/modularize/ModuleAssistant.cpp index 0d4c09987eb1cf..5c11ffdb8589d5 100644 --- a/clang-tools-extra/modularize/ModuleAssistant.cpp +++ b/clang-tools-extra/modularize/ModuleAssistant.cpp @@ -175,7 +175,7 @@ static bool addModuleDescription(Module *RootModule, llvm::SmallString<256> NativePath, NativePrefix; llvm::sys::path::native(HeaderFilePath, NativePath); llvm::sys::path::native(HeaderPrefix, NativePrefix); - if (NativePath.startswith(NativePrefix)) + if (NativePath.starts_with(NativePrefix)) FilePath = std::string(NativePath.substr(NativePrefix.size() + 1)); else FilePath = std::string(HeaderFilePath); diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 50ab6ea59be9d0..c59a66e103a6e3 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -3809,14 +3809,14 @@ void MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator( llvm::raw_svector_ostream Stream(VFTableMangling); mangleCXXVFTable(Derived, BasePath, Stream); - if (VFTableMangling.startswith("??@")) { -assert(VFTableMangling.endswith("@")); + if (VFTableMangling.starts_with("??@")) { +assert(VFTableMangling.ends_with("@")); Out << VFTableMangling << "??_R4@"; return; } - assert(VFTableMangling.startswith("??_7") || - VFTableMangling.startswith("??_S")); + assert(VFTableMangling.starts_with("??_7") || + VFTableMangling.starts_with("??_S")); Out << "??_R4" << VFTableMangling.str().drop_front(4); } diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index e4ac1abf12a7f8..7523e509a47108 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -89,7 +89,7 @@ static bool isPlatformEnvironment(const TargetInfo , StringRef Feature) { // where both are valid examples of the same platform+environment but in the // variant (2) the simulator is hardcoded as part of the platform name. Both // forms above should match for "iossimulator" requirement. - if (Target.getTriple().isOSDarwin() && PlatformEnv.endswith("simulator")) + if (Target.getTriple().isOSDarwin() && PlatformEnv.ends_with("simulator")) return PlatformEnv == Feature || CmpPlatformEnv(PlatformEnv, Feature); return PlatformEnv == Feature; diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp index 540c22d078654c..94c10e50d7d064
[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Qizhi Hu (jcsxky) Changes Skip checking `TemplateTypeParmDecl ` in `VisitTypeAliasTemplateDecl`. [Fix this crash](https://github.com/llvm/llvm-project/issues/74765) --- Full diff: https://github.com/llvm/llvm-project/pull/74919.diff 2 Files Affected: - (modified) clang/lib/AST/ASTImporter.cpp (+2-1) - (modified) clang/unittests/AST/ASTImporterTest.cpp (+23) ``diff diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index f1f335118f37a4..bfe9af648e603b 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -2769,7 +2769,8 @@ ASTNodeImporter::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) { unsigned IDNS = Decl::IDNS_Ordinary; auto FoundDecls = Importer.findDeclsInToCtx(DC, Name); for (auto *FoundDecl : FoundDecls) { - if (!FoundDecl->isInIdentifierNamespace(IDNS)) + if (!FoundDecl->isInIdentifierNamespace(IDNS) || + isa_and_nonnull(FoundDecl)) continue; if (auto *FoundAlias = dyn_cast(FoundDecl)) return Importer.MapImported(D, FoundAlias); diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 4dd7510bf8ddf8..6f9aba2c867eea 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -9284,6 +9284,29 @@ TEST_P(ASTImporterOptionSpecificTestBase, // EXPECT_EQ(ToF1Imported->getPreviousDecl(), ToF1); } +TEST_P(ASTImporterOptionSpecificTestBase, XXX) { + const char *Code = + R"( + struct S; + template + using Callable = S; + template + int bindingFunctionVTable; + )"; + Decl *FromTU = getTuDecl(Code, Lang_CXX17); + + auto *FromCallable1 = FirstDeclMatcher().match( + FromTU, typeAliasTemplateDecl(hasName("Callable"))); + + auto *FromCallable2 = FirstDeclMatcher().match( + FromTU, templateTypeParmDecl(hasName("Callable"))); + + auto *ToCallable2 = Import(FromCallable2, Lang_CXX17); + auto *ToCallable1 = Import(FromCallable1, Lang_CXX17); + EXPECT_TRUE(ToCallable1); + EXPECT_TRUE(ToCallable2); +} + INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ASTImporterLookupTableTest, DefaultTestValuesForRunOptions); `` https://github.com/llvm/llvm-project/pull/74919 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl (PR #74919)
https://github.com/jcsxky created https://github.com/llvm/llvm-project/pull/74919 Skip checking `TemplateTypeParmDecl ` in `VisitTypeAliasTemplateDecl`. [Fix this crash](https://github.com/llvm/llvm-project/issues/74765) >From b3c28d66efb98dff8b8f879bda92341bf62f45d3 Mon Sep 17 00:00:00 2001 From: huqizhi Date: Sat, 9 Dec 2023 12:00:02 +0800 Subject: [PATCH] [clang][ASTImporter] skip TemplateTypeParmDecl in VisitTypeAliasTemplateDecl --- clang/lib/AST/ASTImporter.cpp | 3 ++- clang/unittests/AST/ASTImporterTest.cpp | 23 +++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index f1f335118f37a4..bfe9af648e603b 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -2769,7 +2769,8 @@ ASTNodeImporter::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) { unsigned IDNS = Decl::IDNS_Ordinary; auto FoundDecls = Importer.findDeclsInToCtx(DC, Name); for (auto *FoundDecl : FoundDecls) { - if (!FoundDecl->isInIdentifierNamespace(IDNS)) + if (!FoundDecl->isInIdentifierNamespace(IDNS) || + isa_and_nonnull(FoundDecl)) continue; if (auto *FoundAlias = dyn_cast(FoundDecl)) return Importer.MapImported(D, FoundAlias); diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp index 4dd7510bf8ddf8..6f9aba2c867eea 100644 --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -9284,6 +9284,29 @@ TEST_P(ASTImporterOptionSpecificTestBase, // EXPECT_EQ(ToF1Imported->getPreviousDecl(), ToF1); } +TEST_P(ASTImporterOptionSpecificTestBase, XXX) { + const char *Code = + R"( + struct S; + template + using Callable = S; + template + int bindingFunctionVTable; + )"; + Decl *FromTU = getTuDecl(Code, Lang_CXX17); + + auto *FromCallable1 = FirstDeclMatcher().match( + FromTU, typeAliasTemplateDecl(hasName("Callable"))); + + auto *FromCallable2 = FirstDeclMatcher().match( + FromTU, templateTypeParmDecl(hasName("Callable"))); + + auto *ToCallable2 = Import(FromCallable2, Lang_CXX17); + auto *ToCallable1 = Import(FromCallable1, Lang_CXX17); + EXPECT_TRUE(ToCallable1); + EXPECT_TRUE(ToCallable2); +} + INSTANTIATE_TEST_SUITE_P(ParameterizedTests, ASTImporterLookupTableTest, DefaultTestValuesForRunOptions); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [lld] [lldb] [clang-tools-extra] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (PR #74916)
kazutakahirata wrote: > flang and bolt are not changed? Right. Somehow, `SmallString::{startswith,endswith}` do not occur there. By the way, they are not to be confused with `StringRef::{startswith,endswith}, which is everywhere. https://github.com/llvm/llvm-project/pull/74916 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 01/10] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 02/10] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f7..eb26bfade47b7a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 03/10] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..fd75ad033c4dca 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:44:11 +0800 Subject: [PATCH 04/10] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c4dca..3e2c07399387d5 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 14:07:41 +0800 Subject: [PATCH 05/10] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 3e2c07399387d5..e67adf3d6616e6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const
[clang] [RISCV] Remove Name and OverloadedName from RVVIntrinsicDef. NFC (PR #74907)
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/74907 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [lld] [clang-tools-extra] [lldb] [clang] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (PR #74916)
MaskRay wrote: flang and bolt are not changed? https://github.com/llvm/llvm-project/pull/74916 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 1/9] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 2/9] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f7..eb26bfade47b7a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 3/9] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..fd75ad033c4dca 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:44:11 +0800 Subject: [PATCH 4/9] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c4dca..3e2c07399387d5 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 14:07:41 +0800 Subject: [PATCH 5/9] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 3e2c07399387d5..e67adf3d6616e6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 1/8] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7..df062ccc9021f 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 2/8] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f..eb26bfade47b7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 3/8] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7..fd75ad033c4dc 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:44:11 +0800 Subject: [PATCH 4/8] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c4dc..3e2c07399387d 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 14:07:41 +0800 Subject: [PATCH 5/8] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 3e2c07399387d..e67adf3d6616e 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction ,
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 1/7] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 2/7] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f7..eb26bfade47b7a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 3/7] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..fd75ad033c4dca 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:44:11 +0800 Subject: [PATCH 4/7] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c4dca..3e2c07399387d5 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 14:07:41 +0800 Subject: [PATCH 5/7] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 3e2c07399387d5..e67adf3d6616e6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 1/6] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 2/6] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f7..eb26bfade47b7a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 3/6] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..fd75ad033c4dca 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:44:11 +0800 Subject: [PATCH 4/6] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c4dca..3e2c07399387d5 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 14:07:41 +0800 Subject: [PATCH 5/6] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 3e2c07399387d5..e67adf3d6616e6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction
[llvm] [lldb] [clang-tools-extra] [clang] [lld] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (PR #74916)
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/74916 >From ab33bda7fd31fbfc28344bb6f81ce08394e7c3fd Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 7 Dec 2023 23:20:42 -0800 Subject: [PATCH 1/2] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with This patch renames {starts,ends}with to {starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. Since there are only a handful of occurrences, this patch skips the deprecation phase and simply renames them. --- clang-tools-extra/clang-doc/Mapper.cpp| 2 +- clang-tools-extra/modularize/ModuleAssistant.cpp | 2 +- clang/lib/AST/MicrosoftMangle.cpp | 8 clang/lib/Basic/Module.cpp| 2 +- clang/lib/CrossTU/CrossTranslationUnit.cpp| 2 +- clang/lib/Driver/Driver.cpp | 2 +- clang/lib/Driver/ToolChains/Darwin.cpp| 2 +- clang/lib/Lex/ModuleMap.cpp | 2 +- clang/lib/Sema/SemaCodeComplete.cpp | 2 +- lld/COFF/PDB.cpp | 2 +- lld/MachO/InputFiles.cpp | 2 +- lldb/source/Commands/CommandCompletions.cpp | 2 +- llvm/include/llvm/ADT/SmallString.h | 12 llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 2 +- llvm/tools/dsymutil/DebugMap.cpp | 2 +- llvm/tools/llvm-cov/CodeCoverage.cpp | 2 +- llvm/tools/llvm-cov/CoverageReport.cpp| 2 +- llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp| 2 +- llvm/tools/llvm-ml/llvm-ml.cpp| 2 +- llvm/unittests/Support/Path.cpp | 4 ++-- 20 files changed, 27 insertions(+), 31 deletions(-) diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp index 5264417748a12..bb8b7952980ac 100644 --- a/clang-tools-extra/clang-doc/Mapper.cpp +++ b/clang-tools-extra/clang-doc/Mapper.cpp @@ -103,7 +103,7 @@ llvm::SmallString<128> MapASTVisitor::getFile(const NamedDecl *D, .getPresumedLoc(D->getBeginLoc()) .getFilename()); IsFileInRootDir = false; - if (RootDir.empty() || !File.startswith(RootDir)) + if (RootDir.empty() || !File.starts_with(RootDir)) return File; IsFileInRootDir = true; llvm::SmallString<128> Prefix(RootDir); diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp b/clang-tools-extra/modularize/ModuleAssistant.cpp index 0d4c09987eb1c..5c11ffdb8589d 100644 --- a/clang-tools-extra/modularize/ModuleAssistant.cpp +++ b/clang-tools-extra/modularize/ModuleAssistant.cpp @@ -175,7 +175,7 @@ static bool addModuleDescription(Module *RootModule, llvm::SmallString<256> NativePath, NativePrefix; llvm::sys::path::native(HeaderFilePath, NativePath); llvm::sys::path::native(HeaderPrefix, NativePrefix); - if (NativePath.startswith(NativePrefix)) + if (NativePath.starts_with(NativePrefix)) FilePath = std::string(NativePath.substr(NativePrefix.size() + 1)); else FilePath = std::string(HeaderFilePath); diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 50ab6ea59be9d..c59a66e103a6e 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -3809,14 +3809,14 @@ void MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator( llvm::raw_svector_ostream Stream(VFTableMangling); mangleCXXVFTable(Derived, BasePath, Stream); - if (VFTableMangling.startswith("??@")) { -assert(VFTableMangling.endswith("@")); + if (VFTableMangling.starts_with("??@")) { +assert(VFTableMangling.ends_with("@")); Out << VFTableMangling << "??_R4@"; return; } - assert(VFTableMangling.startswith("??_7") || - VFTableMangling.startswith("??_S")); + assert(VFTableMangling.starts_with("??_7") || + VFTableMangling.starts_with("??_S")); Out << "??_R4" << VFTableMangling.str().drop_front(4); } diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index e4ac1abf12a7f..7523e509a4710 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -89,7 +89,7 @@ static bool isPlatformEnvironment(const TargetInfo , StringRef Feature) { // where both are valid examples of the same platform+environment but in the // variant (2) the simulator is hardcoded as part of the platform name. Both // forms above should match for "iossimulator" requirement. - if (Target.getTriple().isOSDarwin() && PlatformEnv.endswith("simulator")) + if (Target.getTriple().isOSDarwin() && PlatformEnv.ends_with("simulator")) return PlatformEnv == Feature || CmpPlatformEnv(PlatformEnv, Feature); return PlatformEnv == Feature; diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp index 540c22d078654..94c10e50d7d06 100644 ---
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 1/5] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 2/5] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f7..eb26bfade47b7a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 3/5] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..fd75ad033c4dca 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:44:11 +0800 Subject: [PATCH 4/5] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c4dca..3e2c07399387d5 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 14:07:41 +0800 Subject: [PATCH 5/5] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 3e2c07399387d5..e67adf3d6616e6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction
[llvm] [lldb] [lld] [clang-tools-extra] [clang] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (PR #74916)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) Changes This patch renames {starts,ends}with to {starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. Since there are only a handful of occurrences, this patch skips the deprecation phase and simply renames them. --- Full diff: https://github.com/llvm/llvm-project/pull/74916.diff 20 Files Affected: - (modified) clang-tools-extra/clang-doc/Mapper.cpp (+1-1) - (modified) clang-tools-extra/modularize/ModuleAssistant.cpp (+1-1) - (modified) clang/lib/AST/MicrosoftMangle.cpp (+4-4) - (modified) clang/lib/Basic/Module.cpp (+1-1) - (modified) clang/lib/CrossTU/CrossTranslationUnit.cpp (+1-1) - (modified) clang/lib/Driver/Driver.cpp (+1-1) - (modified) clang/lib/Driver/ToolChains/Darwin.cpp (+1-1) - (modified) clang/lib/Lex/ModuleMap.cpp (+1-1) - (modified) clang/lib/Sema/SemaCodeComplete.cpp (+1-1) - (modified) lld/COFF/PDB.cpp (+1-1) - (modified) lld/MachO/InputFiles.cpp (+1-1) - (modified) lldb/source/Commands/CommandCompletions.cpp (+1-1) - (modified) llvm/include/llvm/ADT/SmallString.h (+4-8) - (modified) llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (+1-1) - (modified) llvm/tools/dsymutil/DebugMap.cpp (+1-1) - (modified) llvm/tools/llvm-cov/CodeCoverage.cpp (+1-1) - (modified) llvm/tools/llvm-cov/CoverageReport.cpp (+1-1) - (modified) llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp (+1-1) - (modified) llvm/tools/llvm-ml/llvm-ml.cpp (+1-1) - (modified) llvm/unittests/Support/Path.cpp (+2-2) ``diff diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp index 5264417748a12b..bb8b7952980ac6 100644 --- a/clang-tools-extra/clang-doc/Mapper.cpp +++ b/clang-tools-extra/clang-doc/Mapper.cpp @@ -103,7 +103,7 @@ llvm::SmallString<128> MapASTVisitor::getFile(const NamedDecl *D, .getPresumedLoc(D->getBeginLoc()) .getFilename()); IsFileInRootDir = false; - if (RootDir.empty() || !File.startswith(RootDir)) + if (RootDir.empty() || !File.starts_with(RootDir)) return File; IsFileInRootDir = true; llvm::SmallString<128> Prefix(RootDir); diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp b/clang-tools-extra/modularize/ModuleAssistant.cpp index 0d4c09987eb1cf..5c11ffdb8589d5 100644 --- a/clang-tools-extra/modularize/ModuleAssistant.cpp +++ b/clang-tools-extra/modularize/ModuleAssistant.cpp @@ -175,7 +175,7 @@ static bool addModuleDescription(Module *RootModule, llvm::SmallString<256> NativePath, NativePrefix; llvm::sys::path::native(HeaderFilePath, NativePath); llvm::sys::path::native(HeaderPrefix, NativePrefix); - if (NativePath.startswith(NativePrefix)) + if (NativePath.starts_with(NativePrefix)) FilePath = std::string(NativePath.substr(NativePrefix.size() + 1)); else FilePath = std::string(HeaderFilePath); diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 50ab6ea59be9d0..c59a66e103a6e3 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -3809,14 +3809,14 @@ void MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator( llvm::raw_svector_ostream Stream(VFTableMangling); mangleCXXVFTable(Derived, BasePath, Stream); - if (VFTableMangling.startswith("??@")) { -assert(VFTableMangling.endswith("@")); + if (VFTableMangling.starts_with("??@")) { +assert(VFTableMangling.ends_with("@")); Out << VFTableMangling << "??_R4@"; return; } - assert(VFTableMangling.startswith("??_7") || - VFTableMangling.startswith("??_S")); + assert(VFTableMangling.starts_with("??_7") || + VFTableMangling.starts_with("??_S")); Out << "??_R4" << VFTableMangling.str().drop_front(4); } diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index e4ac1abf12a7f8..7523e509a47108 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -89,7 +89,7 @@ static bool isPlatformEnvironment(const TargetInfo , StringRef Feature) { // where both are valid examples of the same platform+environment but in the // variant (2) the simulator is hardcoded as part of the platform name. Both // forms above should match for "iossimulator" requirement. - if (Target.getTriple().isOSDarwin() && PlatformEnv.endswith("simulator")) + if (Target.getTriple().isOSDarwin() && PlatformEnv.ends_with("simulator")) return PlatformEnv == Feature || CmpPlatformEnv(PlatformEnv, Feature); return PlatformEnv == Feature; diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp index 540c22d078654c..94c10e50d7d064 100644 --- a/clang/lib/CrossTU/CrossTranslationUnit.cpp +++ b/clang/lib/CrossTU/CrossTranslationUnit.cpp @@ -551,7 +551,7 @@ CrossTranslationUnitContext::ASTLoader::load(StringRef Identifier) { // Normalize by removing relative
[lldb] [llvm] [clang-tools-extra] [clang] [lld] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (PR #74916)
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/74916 This patch renames {starts,ends}with to {starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. Since there are only a handful of occurrences, this patch skips the deprecation phase and simply renames them. >From ab33bda7fd31fbfc28344bb6f81ce08394e7c3fd Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 7 Dec 2023 23:20:42 -0800 Subject: [PATCH] [ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with This patch renames {starts,ends}with to {starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. Since there are only a handful of occurrences, this patch skips the deprecation phase and simply renames them. --- clang-tools-extra/clang-doc/Mapper.cpp| 2 +- clang-tools-extra/modularize/ModuleAssistant.cpp | 2 +- clang/lib/AST/MicrosoftMangle.cpp | 8 clang/lib/Basic/Module.cpp| 2 +- clang/lib/CrossTU/CrossTranslationUnit.cpp| 2 +- clang/lib/Driver/Driver.cpp | 2 +- clang/lib/Driver/ToolChains/Darwin.cpp| 2 +- clang/lib/Lex/ModuleMap.cpp | 2 +- clang/lib/Sema/SemaCodeComplete.cpp | 2 +- lld/COFF/PDB.cpp | 2 +- lld/MachO/InputFiles.cpp | 2 +- lldb/source/Commands/CommandCompletions.cpp | 2 +- llvm/include/llvm/ADT/SmallString.h | 12 llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 2 +- llvm/tools/dsymutil/DebugMap.cpp | 2 +- llvm/tools/llvm-cov/CodeCoverage.cpp | 2 +- llvm/tools/llvm-cov/CoverageReport.cpp| 2 +- llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp| 2 +- llvm/tools/llvm-ml/llvm-ml.cpp| 2 +- llvm/unittests/Support/Path.cpp | 4 ++-- 20 files changed, 27 insertions(+), 31 deletions(-) diff --git a/clang-tools-extra/clang-doc/Mapper.cpp b/clang-tools-extra/clang-doc/Mapper.cpp index 5264417748a12b..bb8b7952980ac6 100644 --- a/clang-tools-extra/clang-doc/Mapper.cpp +++ b/clang-tools-extra/clang-doc/Mapper.cpp @@ -103,7 +103,7 @@ llvm::SmallString<128> MapASTVisitor::getFile(const NamedDecl *D, .getPresumedLoc(D->getBeginLoc()) .getFilename()); IsFileInRootDir = false; - if (RootDir.empty() || !File.startswith(RootDir)) + if (RootDir.empty() || !File.starts_with(RootDir)) return File; IsFileInRootDir = true; llvm::SmallString<128> Prefix(RootDir); diff --git a/clang-tools-extra/modularize/ModuleAssistant.cpp b/clang-tools-extra/modularize/ModuleAssistant.cpp index 0d4c09987eb1cf..5c11ffdb8589d5 100644 --- a/clang-tools-extra/modularize/ModuleAssistant.cpp +++ b/clang-tools-extra/modularize/ModuleAssistant.cpp @@ -175,7 +175,7 @@ static bool addModuleDescription(Module *RootModule, llvm::SmallString<256> NativePath, NativePrefix; llvm::sys::path::native(HeaderFilePath, NativePath); llvm::sys::path::native(HeaderPrefix, NativePrefix); - if (NativePath.startswith(NativePrefix)) + if (NativePath.starts_with(NativePrefix)) FilePath = std::string(NativePath.substr(NativePrefix.size() + 1)); else FilePath = std::string(HeaderFilePath); diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 50ab6ea59be9d0..c59a66e103a6e3 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -3809,14 +3809,14 @@ void MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator( llvm::raw_svector_ostream Stream(VFTableMangling); mangleCXXVFTable(Derived, BasePath, Stream); - if (VFTableMangling.startswith("??@")) { -assert(VFTableMangling.endswith("@")); + if (VFTableMangling.starts_with("??@")) { +assert(VFTableMangling.ends_with("@")); Out << VFTableMangling << "??_R4@"; return; } - assert(VFTableMangling.startswith("??_7") || - VFTableMangling.startswith("??_S")); + assert(VFTableMangling.starts_with("??_7") || + VFTableMangling.starts_with("??_S")); Out << "??_R4" << VFTableMangling.str().drop_front(4); } diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index e4ac1abf12a7f8..7523e509a47108 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -89,7 +89,7 @@ static bool isPlatformEnvironment(const TargetInfo , StringRef Feature) { // where both are valid examples of the same platform+environment but in the // variant (2) the simulator is hardcoded as part of the platform name. Both // forms above should match for "iossimulator" requirement. - if (Target.getTriple().isOSDarwin() && PlatformEnv.endswith("simulator")) + if (Target.getTriple().isOSDarwin() && PlatformEnv.ends_with("simulator"))
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 1/4] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7..df062ccc9021f 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 2/4] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f..eb26bfade47b7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 3/4] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7..fd75ad033c4dc 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:44:11 +0800 Subject: [PATCH 4/4] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c4dc..3e2c07399387d 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng,=?utf-8?b?5b6Q5oyB5oGS?= Xu Chiheng Message-ID: In-Reply-To: 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 b88b480640f173582ffbfd2faae690f2bc895d14 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 -- clang/lib/Driver/ToolChains/Clang.cpp `` View the diff from clang-format here. ``diff diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index fd75ad033c..3e2c073993 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && + !RawTriple.isOSAIX() && + !(RawTriple.isOSWindows() && +!RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) `` https://github.com/llvm/llvm-project/pull/74913 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 1/3] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7..df062ccc9021f 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 2/3] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f..eb26bfade47b7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:39:22 +0800 Subject: [PATCH 3/3] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7..fd75ad033c4dc 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && !RawTriple.isWindowsCygwinEnvironment()) && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74913 From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH 1/2] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:24:01 +0800 Subject: [PATCH 2/2] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f7..eb26bfade47b7a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [llvm] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)
MaskRay wrote: Trying to summarize the issue. `__llvm_prf_nm` contains an entry `getIRPGONameForGlobalObject() == "lib.cc;_ZL7callee0v"`. The hash in the "VP" metadata uses `md5("lib.cc;_ZL7callee0v")`: `!31 = !{!"VP", i32 0, i64 1, i64 8947761083887884635, i64 1}` Without this patch, when invoking `opt -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -module-summary %tdir/lib.ll -o %t2.bc`, in `llvm/lib/Analysis/ModuleSummaryAnalysis.cpp:computeFunctionSummary`, the local linkage `_ZL7callee0v`'s GUID is incorrectly computed as `md5("lib.cc:_ZL7callee0v")` and therefore is not associated with the global variable summary `_Z7callee1v` (displayed as a stray `^2 = gv: (guid: 8947761083887884635)`). This patch fixes `_ZL7callee0v`'s GUID to be `md5("lib.cc;_ZL7callee0v")`, correctly associating it with the global variable summary `_Z7callee1v`. --- Mach-O (and 32-bit Windows) mangle global symbols with a leading `_`. `llvm/lib/Analysis/ModuleSummaryAnalysis.cpp:computeFunctionSummary` uses `getGlobalIdentifier`, which does not have `GlobalObject` information for the mangling scheme. The identifier can be different from the producer, causing missed import of functions for indirect-call-promotion (#74565). https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: 徐持恒 Xu Chiheng (xu-chiheng) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/74913.diff 1 Files Affected: - (modified) clang/lib/Driver/ToolChains/Clang.cpp (+2-1) ``diff diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) `` https://github.com/llvm/llvm-project/pull/74913 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)
https://github.com/xu-chiheng created https://github.com/llvm/llvm-project/pull/74913 None From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 13:04:02 +0800 Subject: [PATCH] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Cygwin] Cygwin basic support (PR #74868)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74868 From 680b2b48925d52c006eee5f26b1173856dfcf376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 00:59:00 +0800 Subject: [PATCH 1/3] [Cygwin] Cygwin basic support --- clang/lib/Basic/Targets/X86.h | 5 - clang/lib/Driver/ToolChains/Clang.cpp | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index 0ab1c10833db26..e77e1e690cfc0c 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -905,7 +905,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo { CygwinX86_64TargetInfo(const llvm::Triple , const TargetOptions ) : X86_64TargetInfo(Triple, Opts) { this->WCharType = TargetInfo::UnsignedShort; -TLSSupported = false; } void getTargetDefines(const LangOptions , @@ -919,6 +918,10 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo { if (Opts.CPlusPlus) Builder.defineMacro("_GNU_SOURCE"); } + + BuiltinVaListKind getBuiltinVaListKind() const override { +return TargetInfo::CharPtrBuiltinVaList; + } }; class LLVM_LIBRARY_VISIBILITY DarwinX86_64TargetInfo diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb26bfade47b7a..8b38c9e386d76e 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && + !RawTriple.isOSAIX() + && !RawTriple.isWindowsGNUEnvironment() + && !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From cf424f825752c1f33e5d83f872e94e43a1a35e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 01:08:20 +0800 Subject: [PATCH 2/3] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 8b38c9e386d76e..df062ccc9021f7 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,9 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() - && !RawTriple.isWindowsGNUEnvironment() - && !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && + !RawTriple.isWindowsMSVCEnvironment() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) From b2b68ffe0e22c14335378e1c06fce4781158268a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sat, 9 Dec 2023 12:37:05 +0800 Subject: [PATCH 3/3] 1 --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df062ccc9021f7..eb26bfade47b7a 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction , // -fuse-cxa-atexit is default. if (!Args.hasFlag( options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit, - !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() && - !RawTriple.isWindowsMSVCEnvironment() && + !RawTriple.isOSAIX() && !RawTriple.isOSWindows() && ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) || RawTriple.hasEnvironment())) || KernelOrKext) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
https://github.com/jhuber6 approved this pull request. https://github.com/llvm/llvm-project/pull/74895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][Interp] Reject static lambdas with captures (PR #74718)
shafik wrote: Can you please add more details to the description so folks reading the git log know what the change is without having to do more digging. https://github.com/llvm/llvm-project/pull/74718 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)
@@ -7820,6 +7820,18 @@ ExpectedStmt ASTNodeImporter::VisitExplicitCastExpr(ExplicitCastExpr *E) { *ToLParenLocOrErr, OCE->getBridgeKind(), E->getCastKind(), *ToBridgeKeywordLocOrErr, ToTypeInfoAsWritten, ToSubExpr); } + case Stmt::BuiltinBitCastExprClass: { +auto *BBC = cast(E); +ExpectedSLoc ToLParenLocOrErr = import(BBC->getBeginLoc()); shafik wrote: So it looks like this returns `KWLoc` so perhaps `ToKwLocOrErr` makes more sense? https://github.com/llvm/llvm-project/pull/74813 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][ASTImporter] Support Importer of BuiltinBitCastExpr (PR #74813)
shafik wrote: Can you please update the description to explain the problem in more details and why these changes fixes the problem. The description is what ends up in the git log and it is important that those logs provide enough information to understand the changes without having to view the details. https://github.com/llvm/llvm-project/pull/74813 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Sema] Print more static_assert exprs (PR #74852)
https://github.com/shafik commented: I don't feel like the changes are an improvement to the diagnostic but I would like to hear from others who focus on clang front-end reviews. https://github.com/llvm/llvm-project/pull/74852 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][Sema] Check the number of lambda non-concept tempate parameters (PR #74885)
https://github.com/shafik commented: This needs at least one test and a Release note. I expect the code form the issue to be well-formed: https://godbolt.org/z/bhdfG34xc So I am curious why you are adding the diagnostic for? https://github.com/llvm/llvm-project/pull/74885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)
topperc wrote: > Can we reverse this patch? Keep isRVVSizelessBuiltinType and remove > isRVVType. The implementation of isRVVSizelessBuiltinType is more efficient > according to some profiling. At least on Release+Asserts build I went ahead and committed that change. https://github.com/llvm/llvm-project/pull/67089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][dataflow] Convert `SpecialBoolAnalysis` to synthetic fields. (PR #74706)
https://github.com/Xazax-hun approved this pull request. https://github.com/llvm/llvm-project/pull/74706 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [llvm] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)
@@ -1,39 +1,45 @@ -; Do setup work for all below tests: generate bitcode and combined index -; RUN: opt -module-summary %s -o %t.bc -; RUN: opt -module-summary %p/Inputs/thinlto_indirect_call_promotion.ll -o %t2.bc +; The raw profiles and reduced IR inputs are generated from Inputs/update_icall_promotion_inputs.sh + +; Do setup work for all below tests: annotate value profiles, generate bitcode and combined index. +; Explicitly turn off ICP pass in Inputs/thinlto_indirect_call_promotion.ll. +; This way ICP happens in %t.bc after _Z11global_funcv and two indirect callees are imported. +; RUN: opt -passes=pgo-instr-use -pgo-test-profile-file=%p/Inputs/thinlto_icall_prom.profdata -module-summary %s -o %t.bc MaskRay wrote: A common pattern is `rm -rf %t && split-file %s %t`. When dealing with multiple files, it is useful to ensure the temporary directory is cleared. If specifying `%t/out.bc` is too inconvenient, you can run `rm -rf %t && split-file %s %t && cd %t` and then forget about `%t`. https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [clang] NFC: Remove `{File, Directory}Entry::getName()` (PR #74910)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Jan Svoboda (jansvoboda11) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/74910.diff 7 Files Affected: - (modified) clang/include/clang/Basic/DirectoryEntry.h (-7) - (modified) clang/include/clang/Basic/FileEntry.h (-10) - (modified) clang/lib/Basic/FileManager.cpp (-26) - (modified) clang/unittests/Basic/FileManagerTest.cpp (-6) - (modified) llvm/include/llvm/Support/VirtualFileSystem.h (-3) - (modified) llvm/lib/Support/VirtualFileSystem.cpp (-1) - (modified) llvm/unittests/Support/VirtualFileSystemTest.cpp (-18) ``diff diff --git a/clang/include/clang/Basic/DirectoryEntry.h b/clang/include/clang/Basic/DirectoryEntry.h index 906c2e9af23b31..35fe529ba79dff 100644 --- a/clang/include/clang/Basic/DirectoryEntry.h +++ b/clang/include/clang/Basic/DirectoryEntry.h @@ -41,13 +41,6 @@ class DirectoryEntry { DirectoryEntry =(const DirectoryEntry &) = delete; friend class FileManager; friend class FileEntryTestHelper; - - // FIXME: We should not be storing a directory entry name here. - StringRef Name; // Name of the directory. - -public: - LLVM_DEPRECATED("Use DirectoryEntryRef::getName() instead.", "") - StringRef getName() const { return Name; } }; /// A reference to a \c DirectoryEntry that includes the name of the directory diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index 35efa147950f06..68d4bf60930037 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -318,18 +318,8 @@ class FileEntry { /// The file content, if it is owned by the \p FileEntry. std::unique_ptr Content; - // First access name for this FileEntry. - // - // This is Optional only to allow delayed construction (FileEntryRef has no - // default constructor). It should always have a value in practice. - // - // TODO: remove this once everyone that needs a name uses FileEntryRef. - OptionalFileEntryRef LastRef; - public: ~FileEntry(); - LLVM_DEPRECATED("Use FileEntryRef::getName() instead.", "") - StringRef getName() const { return LastRef->getName(); } StringRef tryGetRealPathName() const { return RealPathName; } off_t getSize() const { return Size; } diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index d16626b1065213..e715e69f7bdbb0 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -107,7 +107,6 @@ void FileManager::addAncestorsAsVirtualDirs(StringRef Path) { // Add the virtual directory to the cache. auto *UDE = new (DirsAlloc.Allocate()) DirectoryEntry(); - UDE->Name = NamedDirEnt.first(); NamedDirEnt.second = *UDE; VirtualDirectoryEntries.push_back(UDE); @@ -179,7 +178,6 @@ FileManager::getDirectoryRef(StringRef DirName, bool CacheFailure) { // We don't have this directory yet, add it. We use the string // key from the SeenDirEntries map as the string. UDE = new (DirsAlloc.Allocate()) DirectoryEntry(); -UDE->Name = InterndDirName; } NamedDirEnt.second = *UDE; @@ -324,32 +322,10 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) { FileEntryRef ReturnedRef(*NamedFileEnt); if (ReusingEntry) { // Already have an entry with this inode, return it. - -// FIXME: This hack ensures that `getDir()` will use the path that was -// used to lookup this file, even if we found a file by different path -// first. This is required in order to find a module's structure when its -// headers/module map are mapped in the VFS. -// -// See above for how this will eventually be removed. `IsVFSMapped` -// *cannot* be narrowed to `ExposesExternalVFSPath` as crash reproducers -// also depend on this logic and they have `use-external-paths: false`. -if (() != UFE->Dir && Status.IsVFSMapped) - UFE->Dir = (); - -// Always update LastRef to the last name by which a file was accessed. -// FIXME: Neither this nor always using the first reference is correct; we -// want to switch towards a design where we return a FileName object that -// encapsulates both the name by which the file was accessed and the -// corresponding FileEntry. -// FIXME: LastRef should be removed from FileEntry once all clients adopt -// FileEntryRef. -UFE->LastRef = ReturnedRef; - return ReturnedRef; } // Otherwise, we don't have this file yet, add it. - UFE->LastRef = ReturnedRef; UFE->Size = Status.getSize(); UFE->ModTime = llvm::sys::toTimeT(Status.getLastModificationTime()); UFE->Dir = (); @@ -461,7 +437,6 @@ FileEntryRef FileManager::getVirtualFileRef(StringRef Filename, off_t Size, } NamedFileEnt.second = FileEntryRef::MapValue(*UFE, *DirInfo); - UFE->LastRef = FileEntryRef(NamedFileEnt); UFE->Size= Size; UFE->ModTime = ModificationTime; UFE->Dir = >getDirEntry(); @@ -490,7 +465,6 @@
[clang] [llvm] [clang] NFC: Remove `{File, Directory}Entry::getName()` (PR #74910)
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/74910 None >From f1a4ff8dc30b755e95fcd4871eb59b0d49f86c7b Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 7 Dec 2023 09:29:14 -0800 Subject: [PATCH] [clang] NFC: Remove `{File,Directory}Entry::getName()` --- clang/include/clang/Basic/DirectoryEntry.h| 7 - clang/include/clang/Basic/FileEntry.h | 10 --- clang/lib/Basic/FileManager.cpp | 26 --- clang/unittests/Basic/FileManagerTest.cpp | 6 - llvm/include/llvm/Support/VirtualFileSystem.h | 3 --- llvm/lib/Support/VirtualFileSystem.cpp| 1 - .../Support/VirtualFileSystemTest.cpp | 18 - 7 files changed, 71 deletions(-) diff --git a/clang/include/clang/Basic/DirectoryEntry.h b/clang/include/clang/Basic/DirectoryEntry.h index 906c2e9af23b3..35fe529ba79df 100644 --- a/clang/include/clang/Basic/DirectoryEntry.h +++ b/clang/include/clang/Basic/DirectoryEntry.h @@ -41,13 +41,6 @@ class DirectoryEntry { DirectoryEntry =(const DirectoryEntry &) = delete; friend class FileManager; friend class FileEntryTestHelper; - - // FIXME: We should not be storing a directory entry name here. - StringRef Name; // Name of the directory. - -public: - LLVM_DEPRECATED("Use DirectoryEntryRef::getName() instead.", "") - StringRef getName() const { return Name; } }; /// A reference to a \c DirectoryEntry that includes the name of the directory diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index 35efa147950f0..68d4bf6093003 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -318,18 +318,8 @@ class FileEntry { /// The file content, if it is owned by the \p FileEntry. std::unique_ptr Content; - // First access name for this FileEntry. - // - // This is Optional only to allow delayed construction (FileEntryRef has no - // default constructor). It should always have a value in practice. - // - // TODO: remove this once everyone that needs a name uses FileEntryRef. - OptionalFileEntryRef LastRef; - public: ~FileEntry(); - LLVM_DEPRECATED("Use FileEntryRef::getName() instead.", "") - StringRef getName() const { return LastRef->getName(); } StringRef tryGetRealPathName() const { return RealPathName; } off_t getSize() const { return Size; } diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index d16626b106521..e715e69f7bdbb 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -107,7 +107,6 @@ void FileManager::addAncestorsAsVirtualDirs(StringRef Path) { // Add the virtual directory to the cache. auto *UDE = new (DirsAlloc.Allocate()) DirectoryEntry(); - UDE->Name = NamedDirEnt.first(); NamedDirEnt.second = *UDE; VirtualDirectoryEntries.push_back(UDE); @@ -179,7 +178,6 @@ FileManager::getDirectoryRef(StringRef DirName, bool CacheFailure) { // We don't have this directory yet, add it. We use the string // key from the SeenDirEntries map as the string. UDE = new (DirsAlloc.Allocate()) DirectoryEntry(); -UDE->Name = InterndDirName; } NamedDirEnt.second = *UDE; @@ -324,32 +322,10 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) { FileEntryRef ReturnedRef(*NamedFileEnt); if (ReusingEntry) { // Already have an entry with this inode, return it. - -// FIXME: This hack ensures that `getDir()` will use the path that was -// used to lookup this file, even if we found a file by different path -// first. This is required in order to find a module's structure when its -// headers/module map are mapped in the VFS. -// -// See above for how this will eventually be removed. `IsVFSMapped` -// *cannot* be narrowed to `ExposesExternalVFSPath` as crash reproducers -// also depend on this logic and they have `use-external-paths: false`. -if (() != UFE->Dir && Status.IsVFSMapped) - UFE->Dir = (); - -// Always update LastRef to the last name by which a file was accessed. -// FIXME: Neither this nor always using the first reference is correct; we -// want to switch towards a design where we return a FileName object that -// encapsulates both the name by which the file was accessed and the -// corresponding FileEntry. -// FIXME: LastRef should be removed from FileEntry once all clients adopt -// FileEntryRef. -UFE->LastRef = ReturnedRef; - return ReturnedRef; } // Otherwise, we don't have this file yet, add it. - UFE->LastRef = ReturnedRef; UFE->Size = Status.getSize(); UFE->ModTime = llvm::sys::toTimeT(Status.getLastModificationTime()); UFE->Dir = (); @@ -461,7 +437,6 @@ FileEntryRef FileManager::getVirtualFileRef(StringRef Filename, off_t Size, } NamedFileEnt.second = FileEntryRef::MapValue(*UFE, *DirInfo); - UFE->LastRef =
[clang] b88b480 - [RISCV] Remove Type::isRVVType() and replace with isRVVSizelessBuiltinType(). NFC
Author: Craig Topper Date: 2023-12-08T18:44:26-08:00 New Revision: b88b480640f173582ffbfd2faae690f2bc895d14 URL: https://github.com/llvm/llvm-project/commit/b88b480640f173582ffbfd2faae690f2bc895d14 DIFF: https://github.com/llvm/llvm-project/commit/b88b480640f173582ffbfd2faae690f2bc895d14.diff LOG: [RISCV] Remove Type::isRVVType() and replace with isRVVSizelessBuiltinType(). NFC These both do the same thing, but some profiling on a Releast+Asserts build suggests isRVVSizelessBuiltinType() is the more efficient version so lets keep that one. Added: Modified: clang/include/clang/AST/Type.h clang/lib/Analysis/UninitializedValues.cpp clang/lib/Sema/Sema.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaDecl.cpp Removed: diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index 6c147eb8f6406..b14184afe5840 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -2384,8 +2384,6 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { bool isRVVType(unsigned ElementCount) const; - bool isRVVType() const; - bool isRVVType(unsigned Bitwidth, bool IsFloat, bool IsBFloat = false) const; /// Return the implicit lifetime for this type, which must not be dependent. @@ -7284,14 +7282,6 @@ inline bool Type::isOpenCLSpecificType() const { isQueueT() || isReserveIDT() || isPipeType() || isOCLExtOpaqueType(); } -inline bool Type::isRVVType() const { -#define RVV_TYPE(Name, Id, SingletonId) \ - isSpecificBuiltinType(BuiltinType::Id) || - return -#include "clang/Basic/RISCVVTypes.def" -false; // end of boolean or operation. -} - inline bool Type::isRVVType(unsigned ElementCount) const { bool Ret = false; #define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \ diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp index b796f7674cc1d..e9111ded64eb1 100644 --- a/clang/lib/Analysis/UninitializedValues.cpp +++ b/clang/lib/Analysis/UninitializedValues.cpp @@ -64,7 +64,7 @@ static bool isTrackedVar(const VarDecl *vd, const DeclContext *dc) { QualType ty = vd->getType(); if (const auto *RD = ty->getAsRecordDecl()) return recordIsNotEmpty(RD); -return ty->isScalarType() || ty->isVectorType() || ty->isRVVType(); +return ty->isScalarType() || ty->isVectorType() || ty->isRVVSizelessBuiltinType(); } return false; } diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 2c7ecf4610de0..22929aa6316d7 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -2077,7 +2077,7 @@ void Sema::checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) { targetDiag(D->getLocation(), diag::note_defined_here, FD) << D; } -if (TI.hasRISCVVTypes() && Ty->isRVVType()) +if (TI.hasRISCVVTypes() && Ty->isRVVSizelessBuiltinType()) checkRVVTypeSupport(Ty, Loc, D); // Don't allow SVE types in functions without a SVE target. diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index a729cff53fc11..5c97346184470 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -5983,7 +5983,7 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo , ValType = ValType.getUnqualifiedType(); if (!ValType->isIntegerType() && !ValType->isAnyPointerType() && !ValType->isBlockPointerType() && !ValType->isFloatingType() && -!ValType->isVectorType() && !ValType->isRVVType()) { +!ValType->isVectorType() && !ValType->isRVVSizelessBuiltinType()) { Diag(DRE->getBeginLoc(), diag::err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector) << PointerArg->getType() << PointerArg->getSourceRange(); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e3c122de39dfe..7650589608c5f 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -8914,7 +8914,7 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { } } - if (T->isRVVType()) + if (T->isRVVSizelessBuiltinType()) checkRVVTypeSupport(T, NewVD->getLocation(), cast(CurContext)); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [RISCV] Enable target attribute when invoked through clang driver (PR #74889)
https://github.com/topperc approved this pull request. LGTM Related question. If there is an -mcpu on the command line and target attribute changes the march, do we keep the original CPU in the -target-cpu attribute or drop it. The reason for all those negative features from the driver was to make the backend not infer any features from the CPU that weren't in the provided march. So I'm wondering if we have that issue with the target attribute now. https://github.com/llvm/llvm-project/pull/74889 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang] [clang] NFC: Remove `OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr` (PR #74900)
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/74900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] cb92511 - [clang] NFC: Remove `OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr` (#74900)
Author: Jan Svoboda Date: 2023-12-08T18:22:53-08:00 New Revision: cb92511c4d967df758819a21a7d5cf83e5ce65ae URL: https://github.com/llvm/llvm-project/commit/cb92511c4d967df758819a21a7d5cf83e5ce65ae DIFF: https://github.com/llvm/llvm-project/commit/cb92511c4d967df758819a21a7d5cf83e5ce65ae.diff LOG: [clang] NFC: Remove `OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr` (#74900) Added: Modified: clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp clang-tools-extra/clangd/IncludeCleaner.cpp clang-tools-extra/include-cleaner/lib/Analysis.cpp clang/include/clang/Basic/DirectoryEntry.h clang/include/clang/Basic/Module.h clang/include/clang/Lex/ModuleMap.h clang/lib/Serialization/ASTReader.cpp Removed: diff --git a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp index e336ba1ee1fa72..5ae6caedb7f4c0 100644 --- a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp @@ -124,7 +124,7 @@ void IncludeCleanerCheck::check(const MatchFinder::MatchResult ) { MainFileDecls.push_back(D); } llvm::DenseSet SeenSymbols; - const DirectoryEntry *ResourceDir = + OptionalDirectoryEntryRef ResourceDir = PP->getHeaderSearchInfo().getModuleMap().getBuiltinDir(); // FIXME: Find a way to have less code duplication between include-cleaner // analysis implementation and the below code. diff --git a/clang-tools-extra/clangd/IncludeCleaner.cpp b/clang-tools-extra/clangd/IncludeCleaner.cpp index b0a3c290bad660..dda7c9f581f69c 100644 --- a/clang-tools-extra/clangd/IncludeCleaner.cpp +++ b/clang-tools-extra/clangd/IncludeCleaner.cpp @@ -397,10 +397,10 @@ IncludeCleanerFindings computeIncludeCleanerFindings(ParsedAST ) { std::vector MissingIncludes; llvm::DenseSet Used; trace::Span Tracer("include_cleaner::walkUsed"); - const DirectoryEntry *ResourceDir = AST.getPreprocessor() -.getHeaderSearchInfo() -.getModuleMap() -.getBuiltinDir(); + OptionalDirectoryEntryRef ResourceDir = AST.getPreprocessor() + .getHeaderSearchInfo() + .getModuleMap() + .getBuiltinDir(); include_cleaner::walkUsed( AST.getLocalTopLevelDecls(), /*MacroRefs=*/Macros, AST.getPragmaIncludes().get(), AST.getPreprocessor(), diff --git a/clang-tools-extra/include-cleaner/lib/Analysis.cpp b/clang-tools-extra/include-cleaner/lib/Analysis.cpp index 09365c36f9f2c5..450c4c796c1415 100644 --- a/clang-tools-extra/include-cleaner/lib/Analysis.cpp +++ b/clang-tools-extra/include-cleaner/lib/Analysis.cpp @@ -87,7 +87,7 @@ analyze(llvm::ArrayRef ASTRoots, llvm::StringSet<> Missing; if (!HeaderFilter) HeaderFilter = [](llvm::StringRef) { return false; }; - const DirectoryEntry *ResourceDir = + OptionalDirectoryEntryRef ResourceDir = PP.getHeaderSearchInfo().getModuleMap().getBuiltinDir(); walkUsed(ASTRoots, MacroRefs, PI, PP, [&](const SymbolReference , llvm::ArrayRef Providers) { @@ -95,7 +95,7 @@ analyze(llvm::ArrayRef ASTRoots, for (const Header : Providers) { if (H.kind() == Header::Physical && (H.physical() == MainFile || -H.physical().getDir() == ResourceDir)) { +(ResourceDir && H.physical().getDir() == *ResourceDir))) { Satisfied = true; } for (const Include *I : Inc.match(H)) { @@ -114,7 +114,7 @@ analyze(llvm::ArrayRef ASTRoots, for (const Include : Inc.all()) { if (Used.contains() || !I.Resolved || HeaderFilter(I.Resolved->getFileEntry().tryGetRealPathName()) || -I.Resolved->getFileEntry().getDir() == ResourceDir) +(ResourceDir && I.Resolved->getFileEntry().getDir() == *ResourceDir)) continue; if (PI) { if (PI->shouldKeep(*I.Resolved)) diff --git a/clang/include/clang/Basic/DirectoryEntry.h b/clang/include/clang/Basic/DirectoryEntry.h index 5d083e68facd7a..906c2e9af23b31 100644 --- a/clang/include/clang/Basic/DirectoryEntry.h +++ b/clang/include/clang/Basic/DirectoryEntry.h @@ -245,78 +245,4 @@ template <> struct DenseMapInfo { } // end namespace llvm -namespace clang { - -/// Wrapper around OptionalDirectoryEntryRef that degrades to 'const -/// DirectoryEntry*', facilitating incremental patches to propagate -/// DirectoryEntryRef. -/// -/// This class can be used as return value or field where it's convenient for -/// an OptionalDirectoryEntryRef to degrade to a 'const DirectoryEntry*'. The -/// purpose is to avoid code churn due to dances like the following: -/// \code -/// // Old
[clang-tools-extra] [clang] [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (PR #74899)
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/74899 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 0cb0a48 - [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (#74899)
Author: Jan Svoboda Date: 2023-12-08T18:22:41-08:00 New Revision: 0cb0a48cdea730e885e8c955ba1687a8191f824c URL: https://github.com/llvm/llvm-project/commit/0cb0a48cdea730e885e8c955ba1687a8191f824c DIFF: https://github.com/llvm/llvm-project/commit/0cb0a48cdea730e885e8c955ba1687a8191f824c.diff LOG: [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (#74899) Added: Modified: clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp clang/include/clang/Basic/FileEntry.h clang/include/clang/Basic/Module.h clang/include/clang/Basic/SourceManager.h clang/include/clang/Lex/PreprocessorLexer.h clang/include/clang/Serialization/ModuleFile.h clang/lib/Frontend/CompilerInstance.cpp clang/lib/Lex/ModuleMap.cpp clang/lib/Lex/PPDirectives.cpp clang/lib/Lex/Pragma.cpp clang/lib/Lex/PreprocessorLexer.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/ModuleManager.cpp clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp clang/tools/libclang/CXIndexDataConsumer.cpp clang/tools/libclang/CXIndexDataConsumer.h clang/unittests/Basic/FileEntryTest.cpp Removed: diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp index 52cc2e6569b052..0b1e9f59e1a70c 100644 --- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp +++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp @@ -171,7 +171,7 @@ void ExpandModularHeadersPPCallbacks::InclusionDirective( if (Imported) { serialization::ModuleFile *MF = Compiler.getASTReader()->getModuleManager().lookup( -Imported->getASTFile()); +*Imported->getASTFile()); handleModuleFile(MF); } parseToLocation(DirectiveLoc); diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index 6351aeae92e2c4..35efa147950f06 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -279,72 +279,6 @@ template <> struct DenseMapInfo { namespace clang { -/// Wrapper around OptionalFileEntryRef that degrades to 'const FileEntry*', -/// facilitating incremental patches to propagate FileEntryRef. -/// -/// This class can be used as return value or field where it's convenient for -/// an OptionalFileEntryRef to degrade to a 'const FileEntry*'. The purpose -/// is to avoid code churn due to dances like the following: -/// \code -/// // Old code. -/// lvalue = rvalue; -/// -/// // Temporary code from an incremental patch. -/// OptionalFileEntryRef MaybeF = rvalue; -/// lvalue = MaybeF ? () : nullptr; -/// -/// // Final code. -/// lvalue = rvalue; -/// \endcode -/// -/// FIXME: Once FileEntryRef is "everywhere" and FileEntry::LastRef and -/// FileEntry::getName have been deleted, delete this class and replace -/// instances with OptionalFileEntryRef. -class OptionalFileEntryRefDegradesToFileEntryPtr : public OptionalFileEntryRef { -public: - OptionalFileEntryRefDegradesToFileEntryPtr() = default; - OptionalFileEntryRefDegradesToFileEntryPtr( - OptionalFileEntryRefDegradesToFileEntryPtr &&) = default; - OptionalFileEntryRefDegradesToFileEntryPtr( - const OptionalFileEntryRefDegradesToFileEntryPtr &) = default; - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(OptionalFileEntryRefDegradesToFileEntryPtr &&) = default; - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(const OptionalFileEntryRefDegradesToFileEntryPtr &) = default; - - OptionalFileEntryRefDegradesToFileEntryPtr(std::nullopt_t) {} - OptionalFileEntryRefDegradesToFileEntryPtr(FileEntryRef Ref) - : OptionalFileEntryRef(Ref) {} - OptionalFileEntryRefDegradesToFileEntryPtr(OptionalFileEntryRef MaybeRef) - : OptionalFileEntryRef(MaybeRef) {} - - OptionalFileEntryRefDegradesToFileEntryPtr =(std::nullopt_t) { -OptionalFileEntryRef::operator=(std::nullopt); -return *this; - } - OptionalFileEntryRefDegradesToFileEntryPtr =(FileEntryRef Ref) { -OptionalFileEntryRef::operator=(Ref); -return *this; - } - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(OptionalFileEntryRef MaybeRef) { -OptionalFileEntryRef::operator=(MaybeRef); -return *this; - } - - /// Degrade to 'const FileEntry *' to allow FileEntry::LastRef and - /// FileEntry::getName have been deleted, delete this class and replace - /// instances with OptionalFileEntryRef - operator const FileEntry *() const { -return has_value() ? &(*this)->getFileEntry() : nullptr; - } -}; - -static_assert( -std::is_trivially_copyable< -OptionalFileEntryRefDegradesToFileEntryPtr>::value, -"OptionalFileEntryRefDegradesToFileEntryPtr should be trivially copyable"); - inline bool operator==(const FileEntry *LHS, const
[clang] [Clang][RISCV] Remove duplicate functions isRVVSizelessBuiltinType. NFC (PR #67089)
topperc wrote: Can we reverse this patch? Keep isRVVSizelessBuiltinType and remove isRVVType. The implementation of isRVVSizelessBuiltinType is more efficient according to some profiling. At least on Release+Asserts build https://github.com/llvm/llvm-project/pull/67089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [clang][RISCV] Change default abi with f extension but without d extension (PR #73489)
jacquesguan wrote: > > > I think the conclusion from the LLVM sync-up call was that everyone happy > > > to move in this direction, so please add the release note and we can do a > > > final review. Thanks! > > > > > > Done, added release note. > > > > Thanks! Sorry I wasn't specific about this, but we need a Clang release note > as well. Done, added Clang release note too. https://github.com/llvm/llvm-project/pull/73489 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [clang][RISCV] Change default abi with f extension but without d extension (PR #73489)
https://github.com/jacquesguan updated https://github.com/llvm/llvm-project/pull/73489 >From 4e5442531d5412e83399eb918ba405dcd580b227 Mon Sep 17 00:00:00 2001 From: Jianjian GUAN Date: Mon, 27 Nov 2023 16:14:04 +0800 Subject: [PATCH] [clang][RISCV] Change default abi with f extension but without d extension Now we have default abi lp64 for rv64if and ilp32 for rv32if, which is different with riscv-gnu-toolchain. In https://github.com/riscv-collab/riscv-gnu-toolchain/blob/8e9fb09a0c4b1e566492ee6f42e8c1fa5ef7e0c2/configure#L3385 when have f but not, it prefers lp64f/ilp32f but no soft float. This patch tries to make their behaviors consistent. --- clang/docs/ReleaseNotes.rst| 3 +++ clang/test/Driver/riscv-abi.c | 14 +- clang/test/Driver/riscv-cpus.c | 6 +++--- llvm/docs/ReleaseNotes.rst | 1 + llvm/lib/Support/RISCVISAInfo.cpp | 4 llvm/test/CodeGen/RISCV/callee-saved-fpr32s.ll | 4 ++-- llvm/test/CodeGen/RISCV/calling-conv-half.ll | 4 ++-- .../CodeGen/RISCV/calling-conv-rv32f-ilp32.ll | 2 +- .../CodeGen/RISCV/calling-conv-vector-float.ll | 2 +- .../RISCV/float-bitmanip-dagcombines.ll| 8 llvm/test/CodeGen/RISCV/float-frem.ll | 7 +-- llvm/test/CodeGen/RISCV/float-select-verify.ll | 2 +- .../CodeGen/RISCV/half-bitmanip-dagcombines.ll | 18 +- llvm/test/CodeGen/RISCV/half-fcmp.ll | 8 14 files changed, 45 insertions(+), 38 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 28f9393e28437..317b1f7fdeca9 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -954,6 +954,9 @@ RISC-V Support - Unaligned memory accesses can be toggled by ``-m[no-]unaligned-access`` or the aliases ``-m[no-]strict-align``. +- Default ABI with F but without D was changed to ilp32f for RV32 and to lp64f + for RV64. + CUDA/HIP Language Changes ^ diff --git a/clang/test/Driver/riscv-abi.c b/clang/test/Driver/riscv-abi.c index e67f790e0de0e..16568271564c7 100644 --- a/clang/test/Driver/riscv-abi.c +++ b/clang/test/Driver/riscv-abi.c @@ -4,8 +4,6 @@ // RUN: | FileCheck -check-prefix=CHECK-ILP32 %s // RUN: %clang --target=riscv32-unknown-elf %s -### -march=rv32imc 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ILP32 %s -// RUN: %clang --target=riscv32-unknown-elf %s -### -march=rv32imf 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-ILP32 %s // RUN: %clang --target=riscv32-unknown-elf -x assembler %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ILP32 %s // RUN: %clang --target=riscv32-unknown-elf -x assembler %s -### \ @@ -24,6 +22,10 @@ // RUN: %clang --target=riscv32-unknown-elf %s -### -march=rv32if -mabi=ilp32f 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ILP32F %s +// RUN: %clang --target=riscv32-unknown-elf %s -### -mabi=ilp32f 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ILP32F %s +// RUN: %clang --target=riscv32-unknown-elf %s -### -march=rv32if 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ILP32F %s // CHECK-ILP32F: "-target-abi" "ilp32f" @@ -51,8 +53,6 @@ // RUN: | FileCheck -check-prefix=CHECK-LP64 %s // RUN: %clang --target=riscv64-unknown-elf %s -### -march=rv64imc 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-LP64 %s -// RUN: %clang --target=riscv64-unknown-elf %s -### -march=rv64imf 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-LP64 %s // RUN: %clang --target=riscv64-unknown-elf -x assembler %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-LP64 %s // RUN: %clang --target=riscv64-unknown-elf -x assembler %s -### \ @@ -60,7 +60,11 @@ // CHECK-LP64: "-target-abi" "lp64" -// RUN: not %clang --target=riscv64-unknown-elf %s -### -march=rv64f -mabi=lp64f 2>&1 \ +// RUN: %clang --target=riscv64-unknown-elf %s -### -march=rv64if -mabi=lp64f 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-LP64F %s +// RUN: %clang --target=riscv64-unknown-elf %s -### -mabi=lp64f 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-LP64F %s +// RUN: %clang --target=riscv64-unknown-elf %s -### -march=rv64if 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-LP64F %s // CHECK-LP64F: "-target-abi" "lp64f" diff --git a/clang/test/Driver/riscv-cpus.c b/clang/test/Driver/riscv-cpus.c index 6c31282d0c8d4..d7fa7c9854a48 100644 --- a/clang/test/Driver/riscv-cpus.c +++ b/clang/test/Driver/riscv-cpus.c @@ -113,7 +113,7 @@ // MCPU-SIFIVE-E24: "-target-feature" "+m" "-target-feature" "+a" "-target-feature" "+f" // MCPU-SIFIVE-E24: "-target-feature" "+c" // MCPU-SIFIVE-E24: "-target-feature" "+zicsr" "-target-feature" "+zifencei" -// MCPU-SIFIVE-E24: "-target-abi" "ilp32" +// MCPU-SIFIVE-E24: "-target-abi" "ilp32f" // mcpu with default march // RUN: %clang --target=riscv64 -### -c %s 2>&1 -mcpu=sifive-e34 | FileCheck -check-prefix=MCPU-SIFIVE-E34 %s @@ -121,7 +121,7 @@ //
[clang] [RISCV] Remove Name and OverloadedName from RVVIntrinsicDef. NFC (PR #74907)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Craig Topper (topperc) Changes These names are never used so just waste a lot of memory. If do need them ever, it would be better to store pointers to the StringMapEntry objects that store the same strings. --- Full diff: https://github.com/llvm/llvm-project/pull/74907.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaRISCVVectorLookup.cpp (+1-7) ``diff diff --git a/clang/lib/Sema/SemaRISCVVectorLookup.cpp b/clang/lib/Sema/SemaRISCVVectorLookup.cpp index 9a5aecf669a07d..0d411fca0f9c82 100644 --- a/clang/lib/Sema/SemaRISCVVectorLookup.cpp +++ b/clang/lib/Sema/SemaRISCVVectorLookup.cpp @@ -34,12 +34,6 @@ namespace { // Function definition of a RVV intrinsic. struct RVVIntrinsicDef { - /// Full function name with suffix, e.g. vadd_vv_i32m1. - std::string Name; - - /// Overloaded function name, e.g. vadd. - std::string OverloadName; - /// Mapping to which clang built-in function, e.g. __builtin_rvv_vadd. std::string BuiltinName; @@ -393,7 +387,7 @@ void RISCVIntrinsicManagerImpl::InitRVVIntrinsic( // Put into IntrinsicList. size_t Index = IntrinsicList.size(); - IntrinsicList.push_back({Name, OverloadedName, BuiltinName, Signature}); + IntrinsicList.push_back({BuiltinName, Signature}); // Creating mapping to Intrinsics. Intrinsics.insert({Name, Index}); `` https://github.com/llvm/llvm-project/pull/74907 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [RISCV] Remove Name and OverloadedName from RVVIntrinsicDef. NFC (PR #74907)
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/74907 These names are never used so just waste a lot of memory. If do need them ever, it would be better to store pointers to the StringMapEntry objects that store the same strings. >From 776adf52c610904938e966503eb02bc84b7b5e18 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 8 Dec 2023 17:18:54 -0800 Subject: [PATCH] [RISCV] Remove Name and OverloadedName from RVVIntrinsicDef. NFC These names are never used so just waste a lot of memory. If do need them ever, it would be better to store pointers to the StringMapEntry objects that store the same strings. --- clang/lib/Sema/SemaRISCVVectorLookup.cpp | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/clang/lib/Sema/SemaRISCVVectorLookup.cpp b/clang/lib/Sema/SemaRISCVVectorLookup.cpp index 9a5aecf669a07d..0d411fca0f9c82 100644 --- a/clang/lib/Sema/SemaRISCVVectorLookup.cpp +++ b/clang/lib/Sema/SemaRISCVVectorLookup.cpp @@ -34,12 +34,6 @@ namespace { // Function definition of a RVV intrinsic. struct RVVIntrinsicDef { - /// Full function name with suffix, e.g. vadd_vv_i32m1. - std::string Name; - - /// Overloaded function name, e.g. vadd. - std::string OverloadName; - /// Mapping to which clang built-in function, e.g. __builtin_rvv_vadd. std::string BuiltinName; @@ -393,7 +387,7 @@ void RISCVIntrinsicManagerImpl::InitRVVIntrinsic( // Put into IntrinsicList. size_t Index = IntrinsicList.size(); - IntrinsicList.push_back({Name, OverloadedName, BuiltinName, Signature}); + IntrinsicList.push_back({BuiltinName, Signature}); // Creating mapping to Intrinsics. Intrinsics.insert({Name, Index}); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [RISCV] Reduce the size of the index used for RVV intrinsics. NFC (PR #74906)
llvmbot wrote: @llvm/pr-subscribers-backend-risc-v @llvm/pr-subscribers-clang Author: Craig Topper (topperc) Changes Rather than using size_t, use unsigned. We don't have more than 4 billion intrinsics. --- Full diff: https://github.com/llvm/llvm-project/pull/74906.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaRISCVVectorLookup.cpp (+3-3) ``diff diff --git a/clang/lib/Sema/SemaRISCVVectorLookup.cpp b/clang/lib/Sema/SemaRISCVVectorLookup.cpp index 9a5aecf669a07..b7add334c7f37 100644 --- a/clang/lib/Sema/SemaRISCVVectorLookup.cpp +++ b/clang/lib/Sema/SemaRISCVVectorLookup.cpp @@ -49,7 +49,7 @@ struct RVVIntrinsicDef { struct RVVOverloadIntrinsicDef { // Indexes of RISCVIntrinsicManagerImpl::IntrinsicList. - SmallVector Indexes; + SmallVector Indexes; }; } // namespace @@ -168,7 +168,7 @@ class RISCVIntrinsicManagerImpl : public sema::RISCVIntrinsicManager { // List of all RVV intrinsic. std::vector IntrinsicList; // Mapping function name to index of IntrinsicList. - StringMap Intrinsics; + StringMap Intrinsics; // Mapping function name to RVVOverloadIntrinsicDef. StringMap OverloadIntrinsics; @@ -392,7 +392,7 @@ void RISCVIntrinsicManagerImpl::InitRVVIntrinsic( Record.HasFRMRoundModeOp); // Put into IntrinsicList. - size_t Index = IntrinsicList.size(); + unsigned Index = IntrinsicList.size(); IntrinsicList.push_back({Name, OverloadedName, BuiltinName, Signature}); // Creating mapping to Intrinsics. `` https://github.com/llvm/llvm-project/pull/74906 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [RISCV] Reduce the size of the index used for RVV intrinsics. NFC (PR #74906)
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/74906 Rather than using size_t, use unsigned. We don't have more than 4 billion intrinsics. >From 0067a9c7260591904578c3f6648bb925630dcfa7 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 8 Dec 2023 17:06:36 -0800 Subject: [PATCH] [RISCV] Reduce the size of the index used for RVV intrinsics. NFC Rather than using size_t, use unsigned. We don't have more than 4 billion intrinsics. --- clang/lib/Sema/SemaRISCVVectorLookup.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Sema/SemaRISCVVectorLookup.cpp b/clang/lib/Sema/SemaRISCVVectorLookup.cpp index 9a5aecf669a07..b7add334c7f37 100644 --- a/clang/lib/Sema/SemaRISCVVectorLookup.cpp +++ b/clang/lib/Sema/SemaRISCVVectorLookup.cpp @@ -49,7 +49,7 @@ struct RVVIntrinsicDef { struct RVVOverloadIntrinsicDef { // Indexes of RISCVIntrinsicManagerImpl::IntrinsicList. - SmallVector Indexes; + SmallVector Indexes; }; } // namespace @@ -168,7 +168,7 @@ class RISCVIntrinsicManagerImpl : public sema::RISCVIntrinsicManager { // List of all RVV intrinsic. std::vector IntrinsicList; // Mapping function name to index of IntrinsicList. - StringMap Intrinsics; + StringMap Intrinsics; // Mapping function name to RVVOverloadIntrinsicDef. StringMap OverloadIntrinsics; @@ -392,7 +392,7 @@ void RISCVIntrinsicManagerImpl::InitRVVIntrinsic( Record.HasFRMRoundModeOp); // Put into IntrinsicList. - size_t Index = IntrinsicList.size(); + unsigned Index = IntrinsicList.size(); IntrinsicList.push_back({Name, OverloadedName, BuiltinName, Signature}); // Creating mapping to Intrinsics. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (PR #74899)
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/74899 >From de1d9c6808271ea802813daa71e6d94bce8a9894 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 7 Dec 2023 11:38:49 -0800 Subject: [PATCH 1/2] [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` --- .../ExpandModularHeadersPPCallbacks.cpp | 2 +- clang/include/clang/Basic/FileEntry.h | 66 --- clang/include/clang/Basic/Module.h| 2 +- clang/include/clang/Basic/SourceManager.h | 14 ++-- clang/include/clang/Lex/PreprocessorLexer.h | 2 +- .../include/clang/Serialization/ModuleFile.h | 2 +- clang/lib/Frontend/CompilerInstance.cpp | 2 +- clang/lib/Lex/ModuleMap.cpp | 4 +- clang/lib/Lex/PPDirectives.cpp| 3 +- clang/lib/Lex/Pragma.cpp | 2 +- clang/lib/Lex/PreprocessorLexer.cpp | 3 +- clang/lib/Serialization/ASTReader.cpp | 6 +- clang/lib/Serialization/ASTWriter.cpp | 6 +- clang/lib/Serialization/ModuleManager.cpp | 4 +- .../DependencyScanning/ModuleDepCollector.cpp | 2 +- clang/tools/libclang/CXIndexDataConsumer.cpp | 6 +- clang/tools/libclang/CXIndexDataConsumer.h| 2 +- clang/unittests/Basic/FileEntryTest.cpp | 25 --- 18 files changed, 31 insertions(+), 122 deletions(-) diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp index 52cc2e6569b05..0b1e9f59e1a70 100644 --- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp +++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp @@ -171,7 +171,7 @@ void ExpandModularHeadersPPCallbacks::InclusionDirective( if (Imported) { serialization::ModuleFile *MF = Compiler.getASTReader()->getModuleManager().lookup( -Imported->getASTFile()); +*Imported->getASTFile()); handleModuleFile(MF); } parseToLocation(DirectiveLoc); diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index 6351aeae92e2c..35efa147950f0 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -279,72 +279,6 @@ template <> struct DenseMapInfo { namespace clang { -/// Wrapper around OptionalFileEntryRef that degrades to 'const FileEntry*', -/// facilitating incremental patches to propagate FileEntryRef. -/// -/// This class can be used as return value or field where it's convenient for -/// an OptionalFileEntryRef to degrade to a 'const FileEntry*'. The purpose -/// is to avoid code churn due to dances like the following: -/// \code -/// // Old code. -/// lvalue = rvalue; -/// -/// // Temporary code from an incremental patch. -/// OptionalFileEntryRef MaybeF = rvalue; -/// lvalue = MaybeF ? () : nullptr; -/// -/// // Final code. -/// lvalue = rvalue; -/// \endcode -/// -/// FIXME: Once FileEntryRef is "everywhere" and FileEntry::LastRef and -/// FileEntry::getName have been deleted, delete this class and replace -/// instances with OptionalFileEntryRef. -class OptionalFileEntryRefDegradesToFileEntryPtr : public OptionalFileEntryRef { -public: - OptionalFileEntryRefDegradesToFileEntryPtr() = default; - OptionalFileEntryRefDegradesToFileEntryPtr( - OptionalFileEntryRefDegradesToFileEntryPtr &&) = default; - OptionalFileEntryRefDegradesToFileEntryPtr( - const OptionalFileEntryRefDegradesToFileEntryPtr &) = default; - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(OptionalFileEntryRefDegradesToFileEntryPtr &&) = default; - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(const OptionalFileEntryRefDegradesToFileEntryPtr &) = default; - - OptionalFileEntryRefDegradesToFileEntryPtr(std::nullopt_t) {} - OptionalFileEntryRefDegradesToFileEntryPtr(FileEntryRef Ref) - : OptionalFileEntryRef(Ref) {} - OptionalFileEntryRefDegradesToFileEntryPtr(OptionalFileEntryRef MaybeRef) - : OptionalFileEntryRef(MaybeRef) {} - - OptionalFileEntryRefDegradesToFileEntryPtr =(std::nullopt_t) { -OptionalFileEntryRef::operator=(std::nullopt); -return *this; - } - OptionalFileEntryRefDegradesToFileEntryPtr =(FileEntryRef Ref) { -OptionalFileEntryRef::operator=(Ref); -return *this; - } - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(OptionalFileEntryRef MaybeRef) { -OptionalFileEntryRef::operator=(MaybeRef); -return *this; - } - - /// Degrade to 'const FileEntry *' to allow FileEntry::LastRef and - /// FileEntry::getName have been deleted, delete this class and replace - /// instances with OptionalFileEntryRef - operator const FileEntry *() const { -return has_value() ? &(*this)->getFileEntry() : nullptr; - } -}; - -static_assert( -std::is_trivially_copyable< -OptionalFileEntryRefDegradesToFileEntryPtr>::value, -"OptionalFileEntryRefDegradesToFileEntryPtr should be trivially
[clang] [Clang][Sema] Check the number of lambda non-concept tempate parameters (PR #74885)
https://github.com/knightXun updated https://github.com/llvm/llvm-project/pull/74885 >From 12cc1fe332fbab94c1368ea95374d5a1289a22f8 Mon Sep 17 00:00:00 2001 From: knightXun Date: Sat, 9 Dec 2023 04:57:15 +0800 Subject: [PATCH 1/2] [Clang][Sema] Check the number of lambda non-concept tempate parameters Check that the number of non-concept template parameters is greater than zero during lambda template instantiation to aviod panic Fix issue: https://github.com/llvm/llvm-project/issues/70601 --- .../include/clang/Basic/DiagnosticParseKinds.td | 2 ++ clang/lib/Sema/TreeTransform.h | 16 2 files changed, 18 insertions(+) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 6150fc36430ab1..e46fa69d013b61 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -851,6 +851,8 @@ def err_friend_explicit_instantiation : Error< def err_explicit_instantiation_enum : Error< "enumerations cannot be explicitly instantiated">; def err_expected_template_parameter : Error<"expected template parameter">; +def err_expected_non_concept_template_parameter : Error< + "expected non-concept template parameter">; def err_empty_requires_expr : Error< "a requires expression must contain at least one requirement">; def err_requires_expr_parameter_list_ellipsis : Error< diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 1ad843d0bf4e0c..a140bbbc0c43d5 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -13662,6 +13662,22 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { return ExprError(); } + // Check the number of the Concept template parameters + size_t conceptParams = 0; + for (auto P : *E->getTemplateParameterList()) { +const TemplateTypeParmDecl *CD = dyn_cast(P); +if (CD && CD->hasTypeConstraint()) { + conceptParams++; +} + } + + if (conceptParams > 0 && + conceptParams == E->getTemplateParameterList()->size()) { +getSema().Diag(E->getTemplateParameterList()->getLAngleLoc(), + diag::err_expected_non_concept_template_parameter); +return ExprError(); + } + // Copy the LSI before ActOnFinishFunctionBody removes it. // FIXME: This is dumb. Store the lambda information somewhere that outlives // the call operator. >From e53ed4531d6918384be40de2b76bea558eac06ea Mon Sep 17 00:00:00 2001 From: knightXun Date: Sat, 9 Dec 2023 08:38:23 +0800 Subject: [PATCH 2/2] fix ut --- clang/lib/Sema/TreeTransform.h | 34 ++ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index a140bbbc0c43d5..9fb426c1a044b9 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -13594,6 +13594,24 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { getSema().AddTemplateParametersToLambdaCallOperator(NewCallOperator, Class, TPL); + if (E->getTemplateParameterList()) { +// Check the number of the Concept template parameters +size_t conceptParams = 0; +for (auto P : *E->getTemplateParameterList()) { + const TemplateTypeParmDecl *CD = dyn_cast(P); + if (CD && CD->hasTypeConstraint()) { +conceptParams++; + } +} + +if (conceptParams > 0 && +conceptParams == E->getTemplateParameterList()->size()) { + getSema().Diag(E->getTemplateParameterList()->getLAngleLoc(), + diag::err_expected_non_concept_template_parameter); + return ExprError(); +} + } + // Transform the type of the original lambda's call operator. // The transformation MUST be done in the CurrentInstantiationScope since // it introduces a mapping of the original to the newly created @@ -13662,22 +13680,6 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { return ExprError(); } - // Check the number of the Concept template parameters - size_t conceptParams = 0; - for (auto P : *E->getTemplateParameterList()) { -const TemplateTypeParmDecl *CD = dyn_cast(P); -if (CD && CD->hasTypeConstraint()) { - conceptParams++; -} - } - - if (conceptParams > 0 && - conceptParams == E->getTemplateParameterList()->size()) { -getSema().Diag(E->getTemplateParameterList()->getLAngleLoc(), - diag::err_expected_non_concept_template_parameter); -return ExprError(); - } - // Copy the LSI before ActOnFinishFunctionBody removes it. // FIXME: This is dumb. Store the lambda information somewhere that outlives // the call operator. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)
@@ -219,7 +221,7 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, "ResourceMD must have been set by the switch above."); llvm::hlsl::FrontendResource Res( - GV, TyName, RK, Binding.Reg.value_or(UINT_MAX), Binding.Space); + GV, TyName, RK, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space); dmpots wrote: Ok, sounds good to me. Thanks! https://github.com/llvm/llvm-project/pull/74896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)
https://github.com/dmpots approved this pull request. https://github.com/llvm/llvm-project/pull/74896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)
https://github.com/dmpots edited https://github.com/llvm/llvm-project/pull/74896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)
@@ -219,7 +221,7 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, "ResourceMD must have been set by the switch above."); llvm::hlsl::FrontendResource Res( - GV, TyName, RK, Binding.Reg.value_or(UINT_MAX), Binding.Space); + GV, TyName, RK, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space); bogner wrote: I considered flags (and a few other ways of trying to represent this), but I'm reasonably confident that we're not going to be adding a lot of flags here and that the bool is clearer if that's the case. Append and Consume buffers don't need any extra information passed along to the middle/backend, because they only differ from StructuredBuffer in what methods are legal. I'm picturing this going in a direction sort of like this: https://github.com/bogner/llvm-project/commit/45c49457c38ad4b89e6e308100fa8266e4ceff6f Note that I haven't really dealt with Textures yet, so some things may need to change, but I think this design makes sense to make incremental progress on. https://github.com/llvm/llvm-project/pull/74896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang-tools-extra] [libcxx] [flang] [lld] [openmp] [lldb] [libcxxabi] [compiler-rt] [mlir] [clang] [libc] [llvm] Support IFuncs on Darwin platforms (PR #73686)
https://github.com/jroelofs updated https://github.com/llvm/llvm-project/pull/73686 >From bc152095691b32d1ad8539dfd60f5089df5eed8d Mon Sep 17 00:00:00 2001 From: Jon Roelofs Date: Tue, 28 Nov 2023 10:39:44 -0800 Subject: [PATCH 01/11] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20?= =?UTF-8?q?initial=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.4 --- llvm/docs/LangRef.rst | 7 +- llvm/include/llvm/CodeGen/AsmPrinter.h| 6 +- llvm/lib/CodeGen/GlobalISel/CallLowering.cpp | 7 +- llvm/lib/IR/Verifier.cpp | 12 +- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 308 ++ llvm/lib/Target/X86/X86AsmPrinter.cpp | 28 ++ llvm/lib/Target/X86/X86AsmPrinter.h | 1 + .../AArch64/GlobalISel/call-lowering-ifunc.ll | 37 +++ llvm/test/CodeGen/AArch64/addrsig-macho.ll| 4 +- llvm/test/CodeGen/AArch64/ifunc-asm.ll| 82 + llvm/test/CodeGen/X86/ifunc-asm.ll| 28 +- llvm/test/Verifier/ifunc-macho.ll | 42 +++ 12 files changed, 539 insertions(+), 23 deletions(-) create mode 100644 llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll create mode 100644 llvm/test/CodeGen/AArch64/ifunc-asm.ll create mode 100644 llvm/test/Verifier/ifunc-macho.ll diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index e448c5ed5c5d94..cb222e979db29d 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -934,10 +934,11 @@ IFuncs --- IFuncs, like as aliases, don't create any new data or func. They are just a new -symbol that dynamic linker resolves at runtime by calling a resolver function. +symbol that is resolved at runtime by calling a resolver function. -IFuncs have a name and a resolver that is a function called by dynamic linker -that returns address of another function associated with the name. +On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On +MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which +lazily resolve the callee the first time they are called. IFunc may have an optional :ref:`linkage type ` and an optional :ref:`visibility style `. diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h index 2731ef452c79cb..48fa6c478464c7 100644 --- a/llvm/include/llvm/CodeGen/AsmPrinter.h +++ b/llvm/include/llvm/CodeGen/AsmPrinter.h @@ -882,7 +882,11 @@ class AsmPrinter : public MachineFunctionPass { GCMetadataPrinter *getOrCreateGCPrinter(GCStrategy ); void emitGlobalAlias(Module , const GlobalAlias ); - void emitGlobalIFunc(Module , const GlobalIFunc ); + +protected: + virtual void emitGlobalIFunc(Module , const GlobalIFunc ); + +private: /// This method decides whether the specified basic block requires a label. bool shouldEmitLabelForBasicBlock(const MachineBasicBlock ) const; diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp index 2527b143128967..e0080b145d4f99 100644 --- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp +++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp @@ -144,7 +144,12 @@ bool CallLowering::lowerCall(MachineIRBuilder , const CallBase , // Try looking through a bitcast from one function type to another. // Commonly happens with calls to objc_msgSend(). const Value *CalleeV = CB.getCalledOperand()->stripPointerCasts(); - if (const Function *F = dyn_cast(CalleeV)) + if (const GlobalIFunc *IF = dyn_cast(CalleeV); + IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) { +// ld64 requires that .symbol_resolvers to be called via a stub, so these +// must always be a diret call. +Info.Callee = MachineOperand::CreateGA(IF, 0); + } else if (const Function *F = dyn_cast(CalleeV)) Info.Callee = MachineOperand::CreateGA(F, 0); else Info.Callee = MachineOperand::CreateReg(GetCalleeReg(), false); diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 5560c037aa3ee6..94e76a43bf38d6 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -959,6 +959,7 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc ) { GlobalIFunc::getResolverFunctionType(GI.getValueType()); Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()), "IFunc resolver has incorrect type", ); + } void Verifier::visitNamedMDNode(const NamedMDNode ) { @@ -2239,13 +2240,10 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs, } // Check EVEX512 feature. - if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features")) { -Triple T(M.getTargetTriple()); -if (T.isX86()) { - StringRef TF = Attrs.getFnAttr("target-features").getValueAsString(); - Check(!TF.contains("+avx512f") || !TF.contains("-evex512"), -"512-bit vector arguments require 'evex512' for AVX512", V); -
[clang] [llvm] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
https://github.com/Artem-B updated https://github.com/llvm/llvm-project/pull/74895 >From 3ce8e08b94e33480139e13ca9f0fd7b719ff2c3d Mon Sep 17 00:00:00 2001 From: Artem Belevich Date: Wed, 6 Dec 2023 12:11:38 -0800 Subject: [PATCH 1/3] [CUDA] Add support for CUDA-12.3 and sm_90a --- clang/docs/ReleaseNotes.rst | 3 +++ clang/include/clang/Basic/BuiltinsNVPTX.def | 13 +++-- clang/include/clang/Basic/Cuda.h| 7 +-- clang/lib/Basic/Cuda.cpp| 5 + clang/lib/Basic/Targets/NVPTX.cpp | 3 +++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp| 1 + clang/lib/Driver/ToolChains/Cuda.cpp| 6 ++ clang/test/Misc/target-invalid-cpu-note.c | 2 +- llvm/lib/Target/NVPTX/NVPTX.td | 19 ++- llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp| 7 ++- llvm/lib/Target/NVPTX/NVPTXSubtarget.h | 11 +-- 11 files changed, 60 insertions(+), 17 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 89ea2f0930ceca..1bf68a46a64dac 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -937,6 +937,9 @@ CUDA/HIP Language Changes CUDA Support +- Clang now supports CUDA SDK up to 12.3 +- Added support for sm_90a + AIX Support ^^^ diff --git a/clang/include/clang/Basic/BuiltinsNVPTX.def b/clang/include/clang/Basic/BuiltinsNVPTX.def index d74a7d1e55dd28..0f2e8260143be7 100644 --- a/clang/include/clang/Basic/BuiltinsNVPTX.def +++ b/clang/include/clang/Basic/BuiltinsNVPTX.def @@ -26,7 +26,9 @@ #pragma push_macro("SM_87") #pragma push_macro("SM_89") #pragma push_macro("SM_90") -#define SM_90 "sm_90" +#pragma push_macro("SM_90a") +#define SM_90a "sm_90a" +#define SM_90 "sm_90|" SM_90a #define SM_89 "sm_89|" SM_90 #define SM_87 "sm_87|" SM_89 #define SM_86 "sm_86|" SM_87 @@ -56,7 +58,11 @@ #pragma push_macro("PTX78") #pragma push_macro("PTX80") #pragma push_macro("PTX81") -#define PTX81 "ptx81" +#pragma push_macro("PTX82") +#pragma push_macro("PTX83") +#define PTX83 "ptx83" +#define PTX82 "ptx82|" PTX83 +#define PTX81 "ptx81|" PTX82 #define PTX80 "ptx80|" PTX81 #define PTX78 "ptx78|" PTX80 #define PTX77 "ptx77|" PTX78 @@ -1055,6 +1061,7 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("SM_87") #pragma pop_macro("SM_89") #pragma pop_macro("SM_90") +#pragma pop_macro("SM_90a") #pragma pop_macro("PTX42") #pragma pop_macro("PTX60") #pragma pop_macro("PTX61") @@ -1072,3 +1079,5 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("PTX78") #pragma pop_macro("PTX80") #pragma pop_macro("PTX81") +#pragma pop_macro("PTX82") +#pragma pop_macro("PTX83") diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h index 2d912bdbbd1bc5..916cb4b7ef34a7 100644 --- a/clang/include/clang/Basic/Cuda.h +++ b/clang/include/clang/Basic/Cuda.h @@ -39,9 +39,11 @@ enum class CudaVersion { CUDA_118, CUDA_120, CUDA_121, - FULLY_SUPPORTED = CUDA_118, + CUDA_122, + CUDA_123, + FULLY_SUPPORTED = CUDA_123, PARTIALLY_SUPPORTED = - CUDA_121, // Partially supported. Proceed with a warning. + CUDA_123, // Partially supported. Proceed with a warning. NEW = 1, // Too new. Issue a warning, but allow using it. }; const char *CudaVersionToString(CudaVersion V); @@ -71,6 +73,7 @@ enum class CudaArch { SM_87, SM_89, SM_90, + SM_90a, GFX600, GFX601, GFX602, diff --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp index 65840b9f20252b..1b1da6a1356f2c 100644 --- a/clang/lib/Basic/Cuda.cpp +++ b/clang/lib/Basic/Cuda.cpp @@ -39,6 +39,8 @@ static const CudaVersionMapEntry CudaNameVersionMap[] = { CUDA_ENTRY(11, 8), CUDA_ENTRY(12, 0), CUDA_ENTRY(12, 1), +CUDA_ENTRY(12, 2), +CUDA_ENTRY(12, 3), {"", CudaVersion::NEW, llvm::VersionTuple(std::numeric_limits::max())}, {"unknown", CudaVersion::UNKNOWN, {}} // End of list tombstone. }; @@ -93,6 +95,7 @@ static const CudaArchToStringMap arch_names[] = { SM(87), // Jetson/Drive AGX Orin SM(89), // Ada Lovelace SM(90), // Hopper +SM(90a), // Hopper GFX(600), // gfx600 GFX(601), // gfx601 GFX(602), // gfx602 @@ -209,6 +212,8 @@ CudaVersion MinVersionForCudaArch(CudaArch A) { case CudaArch::SM_89: case CudaArch::SM_90: return CudaVersion::CUDA_118; + case CudaArch::SM_90a: +return CudaVersion::CUDA_120; default: llvm_unreachable("invalid enum"); } diff --git a/clang/lib/Basic/Targets/NVPTX.cpp b/clang/lib/Basic/Targets/NVPTX.cpp index 3a4a75b0348f20..5c601812f61759 100644 --- a/clang/lib/Basic/Targets/NVPTX.cpp +++ b/clang/lib/Basic/Targets/NVPTX.cpp @@ -262,11 +262,14 @@ void NVPTXTargetInfo::getTargetDefines(const LangOptions ,
[clang-tools-extra] [compiler-rt] [clang] [llvm] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
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 9810fe1a91eb9ce18246fb1528232a539dbd37fc c4e89c6fbb421ae511d555efddb7befe63b30d05 -- clang/include/clang/Basic/Cuda.h clang/lib/Basic/Cuda.cpp clang/lib/Basic/Targets/NVPTX.cpp clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp clang/lib/Driver/ToolChains/Cuda.cpp clang/test/Misc/target-invalid-cpu-note.c llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp llvm/lib/Target/NVPTX/NVPTXSubtarget.h `` View the diff from clang-format here. ``diff diff --git a/llvm/lib/Target/NVPTX/NVPTXSubtarget.h b/llvm/lib/Target/NVPTX/NVPTXSubtarget.h index a5bbf032bd..3ca4c1a24c 100644 --- a/llvm/lib/Target/NVPTX/NVPTXSubtarget.h +++ b/llvm/lib/Target/NVPTX/NVPTXSubtarget.h @@ -96,7 +96,6 @@ public: bool hasAAFeatures() const { return getFullSmVersion() % 10; } std::string getTargetName() const { return TargetName; } - // Get maximum value of required alignments among the supported data types. // From the PTX ISA doc, section 8.2.3: // The memory consistency model relates operations executed on memory `` https://github.com/llvm/llvm-project/pull/74895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [clang-tools-extra] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [clang-tools-extra] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)
@@ -0,0 +1,60 @@ +#!/bin/bash + +if [ $# -lt 1 ]; then + echo "Path to clang required!" + echo "Usage: update_thinlto_indirect_call_promotion_inputs.sh /path/to/updated/clang" + exit 1 +else + CLANG=$1 +fi + +# Allows the script to be invoked from other directories. +OUTDIR=$(dirname $(realpath -s $0)) MaskRay wrote: Nice script! The clean up commands may be simplified using this scheme ``` #!/bin/bash OUTDIR=$(dirname $(realpath -s $0)) dir=$(mktemp -d) trap "rm -r $dir" EXIT cd $dir cat > lib.h
[llvm] [clang] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
https://github.com/Artem-B updated https://github.com/llvm/llvm-project/pull/74895 >From 3ce8e08b94e33480139e13ca9f0fd7b719ff2c3d Mon Sep 17 00:00:00 2001 From: Artem Belevich Date: Wed, 6 Dec 2023 12:11:38 -0800 Subject: [PATCH 1/3] [CUDA] Add support for CUDA-12.3 and sm_90a --- clang/docs/ReleaseNotes.rst | 3 +++ clang/include/clang/Basic/BuiltinsNVPTX.def | 13 +++-- clang/include/clang/Basic/Cuda.h| 7 +-- clang/lib/Basic/Cuda.cpp| 5 + clang/lib/Basic/Targets/NVPTX.cpp | 3 +++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp| 1 + clang/lib/Driver/ToolChains/Cuda.cpp| 6 ++ clang/test/Misc/target-invalid-cpu-note.c | 2 +- llvm/lib/Target/NVPTX/NVPTX.td | 19 ++- llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp| 7 ++- llvm/lib/Target/NVPTX/NVPTXSubtarget.h | 11 +-- 11 files changed, 60 insertions(+), 17 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 89ea2f0930ceca..1bf68a46a64dac 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -937,6 +937,9 @@ CUDA/HIP Language Changes CUDA Support +- Clang now supports CUDA SDK up to 12.3 +- Added support for sm_90a + AIX Support ^^^ diff --git a/clang/include/clang/Basic/BuiltinsNVPTX.def b/clang/include/clang/Basic/BuiltinsNVPTX.def index d74a7d1e55dd28..0f2e8260143be7 100644 --- a/clang/include/clang/Basic/BuiltinsNVPTX.def +++ b/clang/include/clang/Basic/BuiltinsNVPTX.def @@ -26,7 +26,9 @@ #pragma push_macro("SM_87") #pragma push_macro("SM_89") #pragma push_macro("SM_90") -#define SM_90 "sm_90" +#pragma push_macro("SM_90a") +#define SM_90a "sm_90a" +#define SM_90 "sm_90|" SM_90a #define SM_89 "sm_89|" SM_90 #define SM_87 "sm_87|" SM_89 #define SM_86 "sm_86|" SM_87 @@ -56,7 +58,11 @@ #pragma push_macro("PTX78") #pragma push_macro("PTX80") #pragma push_macro("PTX81") -#define PTX81 "ptx81" +#pragma push_macro("PTX82") +#pragma push_macro("PTX83") +#define PTX83 "ptx83" +#define PTX82 "ptx82|" PTX83 +#define PTX81 "ptx81|" PTX82 #define PTX80 "ptx80|" PTX81 #define PTX78 "ptx78|" PTX80 #define PTX77 "ptx77|" PTX78 @@ -1055,6 +1061,7 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("SM_87") #pragma pop_macro("SM_89") #pragma pop_macro("SM_90") +#pragma pop_macro("SM_90a") #pragma pop_macro("PTX42") #pragma pop_macro("PTX60") #pragma pop_macro("PTX61") @@ -1072,3 +1079,5 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("PTX78") #pragma pop_macro("PTX80") #pragma pop_macro("PTX81") +#pragma pop_macro("PTX82") +#pragma pop_macro("PTX83") diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h index 2d912bdbbd1bc5..916cb4b7ef34a7 100644 --- a/clang/include/clang/Basic/Cuda.h +++ b/clang/include/clang/Basic/Cuda.h @@ -39,9 +39,11 @@ enum class CudaVersion { CUDA_118, CUDA_120, CUDA_121, - FULLY_SUPPORTED = CUDA_118, + CUDA_122, + CUDA_123, + FULLY_SUPPORTED = CUDA_123, PARTIALLY_SUPPORTED = - CUDA_121, // Partially supported. Proceed with a warning. + CUDA_123, // Partially supported. Proceed with a warning. NEW = 1, // Too new. Issue a warning, but allow using it. }; const char *CudaVersionToString(CudaVersion V); @@ -71,6 +73,7 @@ enum class CudaArch { SM_87, SM_89, SM_90, + SM_90a, GFX600, GFX601, GFX602, diff --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp index 65840b9f20252b..1b1da6a1356f2c 100644 --- a/clang/lib/Basic/Cuda.cpp +++ b/clang/lib/Basic/Cuda.cpp @@ -39,6 +39,8 @@ static const CudaVersionMapEntry CudaNameVersionMap[] = { CUDA_ENTRY(11, 8), CUDA_ENTRY(12, 0), CUDA_ENTRY(12, 1), +CUDA_ENTRY(12, 2), +CUDA_ENTRY(12, 3), {"", CudaVersion::NEW, llvm::VersionTuple(std::numeric_limits::max())}, {"unknown", CudaVersion::UNKNOWN, {}} // End of list tombstone. }; @@ -93,6 +95,7 @@ static const CudaArchToStringMap arch_names[] = { SM(87), // Jetson/Drive AGX Orin SM(89), // Ada Lovelace SM(90), // Hopper +SM(90a), // Hopper GFX(600), // gfx600 GFX(601), // gfx601 GFX(602), // gfx602 @@ -209,6 +212,8 @@ CudaVersion MinVersionForCudaArch(CudaArch A) { case CudaArch::SM_89: case CudaArch::SM_90: return CudaVersion::CUDA_118; + case CudaArch::SM_90a: +return CudaVersion::CUDA_120; default: llvm_unreachable("invalid enum"); } diff --git a/clang/lib/Basic/Targets/NVPTX.cpp b/clang/lib/Basic/Targets/NVPTX.cpp index 3a4a75b0348f20..5c601812f61759 100644 --- a/clang/lib/Basic/Targets/NVPTX.cpp +++ b/clang/lib/Basic/Targets/NVPTX.cpp @@ -262,11 +262,14 @@ void NVPTXTargetInfo::getTargetDefines(const LangOptions ,
[clang-tools-extra] [clang] [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (PR #74899)
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/74899 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang] [clang] NFC: Remove `OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr` (PR #74900)
https://github.com/benlangmuir approved this pull request. Nice simplification https://github.com/llvm/llvm-project/pull/74900 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)
@@ -219,7 +221,7 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, "ResourceMD must have been set by the switch above."); llvm::hlsl::FrontendResource Res( - GV, TyName, RK, Binding.Reg.value_or(UINT_MAX), Binding.Space); + GV, TyName, RK, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space); dmpots wrote: Instead of a single `bool` here it might make sense to have some kind of `flags` field that we can extend as needed. I'm wondering what is special about ROV that we specifically need to flag them and if that is going to happen to other "weird" resource types (like Append/Consume buffers). https://github.com/llvm/llvm-project/pull/74896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [clang] [clang] NFC: Remove `OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr` (PR #74900)
llvmbot wrote: @llvm/pr-subscribers-clangd Author: Jan Svoboda (jansvoboda11) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/74900.diff 7 Files Affected: - (modified) clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp (+1-1) - (modified) clang-tools-extra/clangd/IncludeCleaner.cpp (+4-4) - (modified) clang-tools-extra/include-cleaner/lib/Analysis.cpp (+3-3) - (modified) clang/include/clang/Basic/DirectoryEntry.h (-74) - (modified) clang/include/clang/Basic/Module.h (+1-1) - (modified) clang/include/clang/Lex/ModuleMap.h (+5-9) - (modified) clang/lib/Serialization/ASTReader.cpp (+1-1) ``diff diff --git a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp index e336ba1ee1fa72..5ae6caedb7f4c0 100644 --- a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp @@ -124,7 +124,7 @@ void IncludeCleanerCheck::check(const MatchFinder::MatchResult ) { MainFileDecls.push_back(D); } llvm::DenseSet SeenSymbols; - const DirectoryEntry *ResourceDir = + OptionalDirectoryEntryRef ResourceDir = PP->getHeaderSearchInfo().getModuleMap().getBuiltinDir(); // FIXME: Find a way to have less code duplication between include-cleaner // analysis implementation and the below code. diff --git a/clang-tools-extra/clangd/IncludeCleaner.cpp b/clang-tools-extra/clangd/IncludeCleaner.cpp index b0a3c290bad660..dda7c9f581f69c 100644 --- a/clang-tools-extra/clangd/IncludeCleaner.cpp +++ b/clang-tools-extra/clangd/IncludeCleaner.cpp @@ -397,10 +397,10 @@ IncludeCleanerFindings computeIncludeCleanerFindings(ParsedAST ) { std::vector MissingIncludes; llvm::DenseSet Used; trace::Span Tracer("include_cleaner::walkUsed"); - const DirectoryEntry *ResourceDir = AST.getPreprocessor() -.getHeaderSearchInfo() -.getModuleMap() -.getBuiltinDir(); + OptionalDirectoryEntryRef ResourceDir = AST.getPreprocessor() + .getHeaderSearchInfo() + .getModuleMap() + .getBuiltinDir(); include_cleaner::walkUsed( AST.getLocalTopLevelDecls(), /*MacroRefs=*/Macros, AST.getPragmaIncludes().get(), AST.getPreprocessor(), diff --git a/clang-tools-extra/include-cleaner/lib/Analysis.cpp b/clang-tools-extra/include-cleaner/lib/Analysis.cpp index 09365c36f9f2c5..450c4c796c1415 100644 --- a/clang-tools-extra/include-cleaner/lib/Analysis.cpp +++ b/clang-tools-extra/include-cleaner/lib/Analysis.cpp @@ -87,7 +87,7 @@ analyze(llvm::ArrayRef ASTRoots, llvm::StringSet<> Missing; if (!HeaderFilter) HeaderFilter = [](llvm::StringRef) { return false; }; - const DirectoryEntry *ResourceDir = + OptionalDirectoryEntryRef ResourceDir = PP.getHeaderSearchInfo().getModuleMap().getBuiltinDir(); walkUsed(ASTRoots, MacroRefs, PI, PP, [&](const SymbolReference , llvm::ArrayRef Providers) { @@ -95,7 +95,7 @@ analyze(llvm::ArrayRef ASTRoots, for (const Header : Providers) { if (H.kind() == Header::Physical && (H.physical() == MainFile || -H.physical().getDir() == ResourceDir)) { +(ResourceDir && H.physical().getDir() == *ResourceDir))) { Satisfied = true; } for (const Include *I : Inc.match(H)) { @@ -114,7 +114,7 @@ analyze(llvm::ArrayRef ASTRoots, for (const Include : Inc.all()) { if (Used.contains() || !I.Resolved || HeaderFilter(I.Resolved->getFileEntry().tryGetRealPathName()) || -I.Resolved->getFileEntry().getDir() == ResourceDir) +(ResourceDir && I.Resolved->getFileEntry().getDir() == *ResourceDir)) continue; if (PI) { if (PI->shouldKeep(*I.Resolved)) diff --git a/clang/include/clang/Basic/DirectoryEntry.h b/clang/include/clang/Basic/DirectoryEntry.h index 5d083e68facd7a..906c2e9af23b31 100644 --- a/clang/include/clang/Basic/DirectoryEntry.h +++ b/clang/include/clang/Basic/DirectoryEntry.h @@ -245,78 +245,4 @@ template <> struct DenseMapInfo { } // end namespace llvm -namespace clang { - -/// Wrapper around OptionalDirectoryEntryRef that degrades to 'const -/// DirectoryEntry*', facilitating incremental patches to propagate -/// DirectoryEntryRef. -/// -/// This class can be used as return value or field where it's convenient for -/// an OptionalDirectoryEntryRef to degrade to a 'const DirectoryEntry*'. The -/// purpose is to avoid code churn due to dances like the following: -/// \code -/// // Old code. -/// lvalue = rvalue; -/// -/// // Temporary code from an incremental patch. -/// OptionalDirectoryEntryRef MaybeF = rvalue; -/// lvalue = MaybeF ? () : nullptr; -/// -/// // Final code. -///
[clang] [clang-tools-extra] [clang] NFC: Remove `OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr` (PR #74900)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Jan Svoboda (jansvoboda11) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/74900.diff 7 Files Affected: - (modified) clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp (+1-1) - (modified) clang-tools-extra/clangd/IncludeCleaner.cpp (+4-4) - (modified) clang-tools-extra/include-cleaner/lib/Analysis.cpp (+3-3) - (modified) clang/include/clang/Basic/DirectoryEntry.h (-74) - (modified) clang/include/clang/Basic/Module.h (+1-1) - (modified) clang/include/clang/Lex/ModuleMap.h (+5-9) - (modified) clang/lib/Serialization/ASTReader.cpp (+1-1) ``diff diff --git a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp index e336ba1ee1fa72..5ae6caedb7f4c0 100644 --- a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp @@ -124,7 +124,7 @@ void IncludeCleanerCheck::check(const MatchFinder::MatchResult ) { MainFileDecls.push_back(D); } llvm::DenseSet SeenSymbols; - const DirectoryEntry *ResourceDir = + OptionalDirectoryEntryRef ResourceDir = PP->getHeaderSearchInfo().getModuleMap().getBuiltinDir(); // FIXME: Find a way to have less code duplication between include-cleaner // analysis implementation and the below code. diff --git a/clang-tools-extra/clangd/IncludeCleaner.cpp b/clang-tools-extra/clangd/IncludeCleaner.cpp index b0a3c290bad660..dda7c9f581f69c 100644 --- a/clang-tools-extra/clangd/IncludeCleaner.cpp +++ b/clang-tools-extra/clangd/IncludeCleaner.cpp @@ -397,10 +397,10 @@ IncludeCleanerFindings computeIncludeCleanerFindings(ParsedAST ) { std::vector MissingIncludes; llvm::DenseSet Used; trace::Span Tracer("include_cleaner::walkUsed"); - const DirectoryEntry *ResourceDir = AST.getPreprocessor() -.getHeaderSearchInfo() -.getModuleMap() -.getBuiltinDir(); + OptionalDirectoryEntryRef ResourceDir = AST.getPreprocessor() + .getHeaderSearchInfo() + .getModuleMap() + .getBuiltinDir(); include_cleaner::walkUsed( AST.getLocalTopLevelDecls(), /*MacroRefs=*/Macros, AST.getPragmaIncludes().get(), AST.getPreprocessor(), diff --git a/clang-tools-extra/include-cleaner/lib/Analysis.cpp b/clang-tools-extra/include-cleaner/lib/Analysis.cpp index 09365c36f9f2c5..450c4c796c1415 100644 --- a/clang-tools-extra/include-cleaner/lib/Analysis.cpp +++ b/clang-tools-extra/include-cleaner/lib/Analysis.cpp @@ -87,7 +87,7 @@ analyze(llvm::ArrayRef ASTRoots, llvm::StringSet<> Missing; if (!HeaderFilter) HeaderFilter = [](llvm::StringRef) { return false; }; - const DirectoryEntry *ResourceDir = + OptionalDirectoryEntryRef ResourceDir = PP.getHeaderSearchInfo().getModuleMap().getBuiltinDir(); walkUsed(ASTRoots, MacroRefs, PI, PP, [&](const SymbolReference , llvm::ArrayRef Providers) { @@ -95,7 +95,7 @@ analyze(llvm::ArrayRef ASTRoots, for (const Header : Providers) { if (H.kind() == Header::Physical && (H.physical() == MainFile || -H.physical().getDir() == ResourceDir)) { +(ResourceDir && H.physical().getDir() == *ResourceDir))) { Satisfied = true; } for (const Include *I : Inc.match(H)) { @@ -114,7 +114,7 @@ analyze(llvm::ArrayRef ASTRoots, for (const Include : Inc.all()) { if (Used.contains() || !I.Resolved || HeaderFilter(I.Resolved->getFileEntry().tryGetRealPathName()) || -I.Resolved->getFileEntry().getDir() == ResourceDir) +(ResourceDir && I.Resolved->getFileEntry().getDir() == *ResourceDir)) continue; if (PI) { if (PI->shouldKeep(*I.Resolved)) diff --git a/clang/include/clang/Basic/DirectoryEntry.h b/clang/include/clang/Basic/DirectoryEntry.h index 5d083e68facd7a..906c2e9af23b31 100644 --- a/clang/include/clang/Basic/DirectoryEntry.h +++ b/clang/include/clang/Basic/DirectoryEntry.h @@ -245,78 +245,4 @@ template <> struct DenseMapInfo { } // end namespace llvm -namespace clang { - -/// Wrapper around OptionalDirectoryEntryRef that degrades to 'const -/// DirectoryEntry*', facilitating incremental patches to propagate -/// DirectoryEntryRef. -/// -/// This class can be used as return value or field where it's convenient for -/// an OptionalDirectoryEntryRef to degrade to a 'const DirectoryEntry*'. The -/// purpose is to avoid code churn due to dances like the following: -/// \code -/// // Old code. -/// lvalue = rvalue; -/// -/// // Temporary code from an incremental patch. -/// OptionalDirectoryEntryRef MaybeF = rvalue; -/// lvalue = MaybeF ? () : nullptr; -/// -/// // Final code. -///
[clang] [clang-tools-extra] [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (PR #74899)
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 8615ead9a6d37e6353df1b652aadebe71ec6c242 de1d9c6808271ea802813daa71e6d94bce8a9894 -- clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp clang/include/clang/Basic/FileEntry.h clang/include/clang/Basic/Module.h clang/include/clang/Basic/SourceManager.h clang/include/clang/Lex/PreprocessorLexer.h clang/include/clang/Serialization/ModuleFile.h clang/lib/Frontend/CompilerInstance.cpp clang/lib/Lex/ModuleMap.cpp clang/lib/Lex/PPDirectives.cpp clang/lib/Lex/Pragma.cpp clang/lib/Lex/PreprocessorLexer.cpp clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/ModuleManager.cpp clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp clang/tools/libclang/CXIndexDataConsumer.cpp clang/tools/libclang/CXIndexDataConsumer.h clang/unittests/Basic/FileEntryTest.cpp `` View the diff from clang-format here. ``diff diff --git a/clang/tools/libclang/CXIndexDataConsumer.cpp b/clang/tools/libclang/CXIndexDataConsumer.cpp index a327d39ee0..c1022263a5 100644 --- a/clang/tools/libclang/CXIndexDataConsumer.cpp +++ b/clang/tools/libclang/CXIndexDataConsumer.cpp @@ -1104,7 +1104,7 @@ void CXIndexDataConsumer::translateLoc(SourceLocation Loc, if (FID.isInvalid()) return; - + OptionalFileEntryRef FE = SM.getFileEntryRefForID(FID); if (indexFile) *indexFile = getIndexFile(FE); diff --git a/clang/tools/libclang/CXIndexDataConsumer.h b/clang/tools/libclang/CXIndexDataConsumer.h index eb9b2eaae2..54a3add3a9 100644 --- a/clang/tools/libclang/CXIndexDataConsumer.h +++ b/clang/tools/libclang/CXIndexDataConsumer.h @@ -461,7 +461,7 @@ private: const DeclContext *getEntityContainer(const Decl *D) const; CXIdxClientFile getIndexFile(OptionalFileEntryRef File); - + CXIdxLoc getIndexLoc(SourceLocation Loc) const; void getEntityInfo(const NamedDecl *D, `` https://github.com/llvm/llvm-project/pull/74899 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-tools-extra] [clang] NFC: Remove `OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr` (PR #74900)
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/74900 None >From 999dcc9b5237af4cca7460042edb709af6ccdf05 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 7 Dec 2023 14:22:04 -0800 Subject: [PATCH] [clang] NFC: Remove 'OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr' --- .../clang-tidy/misc/IncludeCleanerCheck.cpp | 2 +- clang-tools-extra/clangd/IncludeCleaner.cpp | 8 +- .../include-cleaner/lib/Analysis.cpp | 6 +- clang/include/clang/Basic/DirectoryEntry.h| 74 --- clang/include/clang/Basic/Module.h| 2 +- clang/include/clang/Lex/ModuleMap.h | 14 ++-- clang/lib/Serialization/ASTReader.cpp | 2 +- 7 files changed, 15 insertions(+), 93 deletions(-) diff --git a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp index e336ba1ee1fa72..5ae6caedb7f4c0 100644 --- a/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp @@ -124,7 +124,7 @@ void IncludeCleanerCheck::check(const MatchFinder::MatchResult ) { MainFileDecls.push_back(D); } llvm::DenseSet SeenSymbols; - const DirectoryEntry *ResourceDir = + OptionalDirectoryEntryRef ResourceDir = PP->getHeaderSearchInfo().getModuleMap().getBuiltinDir(); // FIXME: Find a way to have less code duplication between include-cleaner // analysis implementation and the below code. diff --git a/clang-tools-extra/clangd/IncludeCleaner.cpp b/clang-tools-extra/clangd/IncludeCleaner.cpp index b0a3c290bad660..dda7c9f581f69c 100644 --- a/clang-tools-extra/clangd/IncludeCleaner.cpp +++ b/clang-tools-extra/clangd/IncludeCleaner.cpp @@ -397,10 +397,10 @@ IncludeCleanerFindings computeIncludeCleanerFindings(ParsedAST ) { std::vector MissingIncludes; llvm::DenseSet Used; trace::Span Tracer("include_cleaner::walkUsed"); - const DirectoryEntry *ResourceDir = AST.getPreprocessor() -.getHeaderSearchInfo() -.getModuleMap() -.getBuiltinDir(); + OptionalDirectoryEntryRef ResourceDir = AST.getPreprocessor() + .getHeaderSearchInfo() + .getModuleMap() + .getBuiltinDir(); include_cleaner::walkUsed( AST.getLocalTopLevelDecls(), /*MacroRefs=*/Macros, AST.getPragmaIncludes().get(), AST.getPreprocessor(), diff --git a/clang-tools-extra/include-cleaner/lib/Analysis.cpp b/clang-tools-extra/include-cleaner/lib/Analysis.cpp index 09365c36f9f2c5..450c4c796c1415 100644 --- a/clang-tools-extra/include-cleaner/lib/Analysis.cpp +++ b/clang-tools-extra/include-cleaner/lib/Analysis.cpp @@ -87,7 +87,7 @@ analyze(llvm::ArrayRef ASTRoots, llvm::StringSet<> Missing; if (!HeaderFilter) HeaderFilter = [](llvm::StringRef) { return false; }; - const DirectoryEntry *ResourceDir = + OptionalDirectoryEntryRef ResourceDir = PP.getHeaderSearchInfo().getModuleMap().getBuiltinDir(); walkUsed(ASTRoots, MacroRefs, PI, PP, [&](const SymbolReference , llvm::ArrayRef Providers) { @@ -95,7 +95,7 @@ analyze(llvm::ArrayRef ASTRoots, for (const Header : Providers) { if (H.kind() == Header::Physical && (H.physical() == MainFile || -H.physical().getDir() == ResourceDir)) { +(ResourceDir && H.physical().getDir() == *ResourceDir))) { Satisfied = true; } for (const Include *I : Inc.match(H)) { @@ -114,7 +114,7 @@ analyze(llvm::ArrayRef ASTRoots, for (const Include : Inc.all()) { if (Used.contains() || !I.Resolved || HeaderFilter(I.Resolved->getFileEntry().tryGetRealPathName()) || -I.Resolved->getFileEntry().getDir() == ResourceDir) +(ResourceDir && I.Resolved->getFileEntry().getDir() == *ResourceDir)) continue; if (PI) { if (PI->shouldKeep(*I.Resolved)) diff --git a/clang/include/clang/Basic/DirectoryEntry.h b/clang/include/clang/Basic/DirectoryEntry.h index 5d083e68facd7a..906c2e9af23b31 100644 --- a/clang/include/clang/Basic/DirectoryEntry.h +++ b/clang/include/clang/Basic/DirectoryEntry.h @@ -245,78 +245,4 @@ template <> struct DenseMapInfo { } // end namespace llvm -namespace clang { - -/// Wrapper around OptionalDirectoryEntryRef that degrades to 'const -/// DirectoryEntry*', facilitating incremental patches to propagate -/// DirectoryEntryRef. -/// -/// This class can be used as return value or field where it's convenient for -/// an OptionalDirectoryEntryRef to degrade to a 'const DirectoryEntry*'. The -/// purpose is to avoid code churn due to dances like the following: -/// \code -/// // Old code. -/// lvalue = rvalue; -/// -/// // Temporary code from an
[llvm] [clang] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
@@ -80,8 +85,10 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo { bool allowFP16Math() const; bool hasMaskOperator() const { return PTXVersion >= 71; } bool hasNoReturn() const { return SmVersion >= 30 && PTXVersion >= 64; } - unsigned int getSmVersion() const { return SmVersion; } + unsigned int getSmVersion() const { return FullSmVersion / 10; } + unsigned int getFullSmVersion() const { return FullSmVersion; } std::string getTargetName() const { return TargetName; } + bool isSm90a() const { return getFullSmVersion() == 901; } Artem-B wrote: Done. https://github.com/llvm/llvm-project/pull/74895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
https://github.com/Artem-B updated https://github.com/llvm/llvm-project/pull/74895 >From 3ce8e08b94e33480139e13ca9f0fd7b719ff2c3d Mon Sep 17 00:00:00 2001 From: Artem Belevich Date: Wed, 6 Dec 2023 12:11:38 -0800 Subject: [PATCH 1/2] [CUDA] Add support for CUDA-12.3 and sm_90a --- clang/docs/ReleaseNotes.rst | 3 +++ clang/include/clang/Basic/BuiltinsNVPTX.def | 13 +++-- clang/include/clang/Basic/Cuda.h| 7 +-- clang/lib/Basic/Cuda.cpp| 5 + clang/lib/Basic/Targets/NVPTX.cpp | 3 +++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp| 1 + clang/lib/Driver/ToolChains/Cuda.cpp| 6 ++ clang/test/Misc/target-invalid-cpu-note.c | 2 +- llvm/lib/Target/NVPTX/NVPTX.td | 19 ++- llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp| 7 ++- llvm/lib/Target/NVPTX/NVPTXSubtarget.h | 11 +-- 11 files changed, 60 insertions(+), 17 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 89ea2f0930cec..1bf68a46a64da 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -937,6 +937,9 @@ CUDA/HIP Language Changes CUDA Support +- Clang now supports CUDA SDK up to 12.3 +- Added support for sm_90a + AIX Support ^^^ diff --git a/clang/include/clang/Basic/BuiltinsNVPTX.def b/clang/include/clang/Basic/BuiltinsNVPTX.def index d74a7d1e55dd2..0f2e8260143be 100644 --- a/clang/include/clang/Basic/BuiltinsNVPTX.def +++ b/clang/include/clang/Basic/BuiltinsNVPTX.def @@ -26,7 +26,9 @@ #pragma push_macro("SM_87") #pragma push_macro("SM_89") #pragma push_macro("SM_90") -#define SM_90 "sm_90" +#pragma push_macro("SM_90a") +#define SM_90a "sm_90a" +#define SM_90 "sm_90|" SM_90a #define SM_89 "sm_89|" SM_90 #define SM_87 "sm_87|" SM_89 #define SM_86 "sm_86|" SM_87 @@ -56,7 +58,11 @@ #pragma push_macro("PTX78") #pragma push_macro("PTX80") #pragma push_macro("PTX81") -#define PTX81 "ptx81" +#pragma push_macro("PTX82") +#pragma push_macro("PTX83") +#define PTX83 "ptx83" +#define PTX82 "ptx82|" PTX83 +#define PTX81 "ptx81|" PTX82 #define PTX80 "ptx80|" PTX81 #define PTX78 "ptx78|" PTX80 #define PTX77 "ptx77|" PTX78 @@ -1055,6 +1061,7 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("SM_87") #pragma pop_macro("SM_89") #pragma pop_macro("SM_90") +#pragma pop_macro("SM_90a") #pragma pop_macro("PTX42") #pragma pop_macro("PTX60") #pragma pop_macro("PTX61") @@ -1072,3 +1079,5 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("PTX78") #pragma pop_macro("PTX80") #pragma pop_macro("PTX81") +#pragma pop_macro("PTX82") +#pragma pop_macro("PTX83") diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h index 2d912bdbbd1bc..916cb4b7ef34a 100644 --- a/clang/include/clang/Basic/Cuda.h +++ b/clang/include/clang/Basic/Cuda.h @@ -39,9 +39,11 @@ enum class CudaVersion { CUDA_118, CUDA_120, CUDA_121, - FULLY_SUPPORTED = CUDA_118, + CUDA_122, + CUDA_123, + FULLY_SUPPORTED = CUDA_123, PARTIALLY_SUPPORTED = - CUDA_121, // Partially supported. Proceed with a warning. + CUDA_123, // Partially supported. Proceed with a warning. NEW = 1, // Too new. Issue a warning, but allow using it. }; const char *CudaVersionToString(CudaVersion V); @@ -71,6 +73,7 @@ enum class CudaArch { SM_87, SM_89, SM_90, + SM_90a, GFX600, GFX601, GFX602, diff --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp index 65840b9f20252..1b1da6a1356f2 100644 --- a/clang/lib/Basic/Cuda.cpp +++ b/clang/lib/Basic/Cuda.cpp @@ -39,6 +39,8 @@ static const CudaVersionMapEntry CudaNameVersionMap[] = { CUDA_ENTRY(11, 8), CUDA_ENTRY(12, 0), CUDA_ENTRY(12, 1), +CUDA_ENTRY(12, 2), +CUDA_ENTRY(12, 3), {"", CudaVersion::NEW, llvm::VersionTuple(std::numeric_limits::max())}, {"unknown", CudaVersion::UNKNOWN, {}} // End of list tombstone. }; @@ -93,6 +95,7 @@ static const CudaArchToStringMap arch_names[] = { SM(87), // Jetson/Drive AGX Orin SM(89), // Ada Lovelace SM(90), // Hopper +SM(90a), // Hopper GFX(600), // gfx600 GFX(601), // gfx601 GFX(602), // gfx602 @@ -209,6 +212,8 @@ CudaVersion MinVersionForCudaArch(CudaArch A) { case CudaArch::SM_89: case CudaArch::SM_90: return CudaVersion::CUDA_118; + case CudaArch::SM_90a: +return CudaVersion::CUDA_120; default: llvm_unreachable("invalid enum"); } diff --git a/clang/lib/Basic/Targets/NVPTX.cpp b/clang/lib/Basic/Targets/NVPTX.cpp index 3a4a75b0348f2..5c601812f6175 100644 --- a/clang/lib/Basic/Targets/NVPTX.cpp +++ b/clang/lib/Basic/Targets/NVPTX.cpp @@ -262,11 +262,14 @@ void NVPTXTargetInfo::getTargetDefines(const LangOptions , case
[clang] [clang-tools-extra] [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (PR #74899)
llvmbot wrote: @llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-tidy Author: Jan Svoboda (jansvoboda11) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/74899.diff 18 Files Affected: - (modified) clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp (+1-1) - (modified) clang/include/clang/Basic/FileEntry.h (-66) - (modified) clang/include/clang/Basic/Module.h (+1-1) - (modified) clang/include/clang/Basic/SourceManager.h (+8-6) - (modified) clang/include/clang/Lex/PreprocessorLexer.h (+1-1) - (modified) clang/include/clang/Serialization/ModuleFile.h (+1-1) - (modified) clang/lib/Frontend/CompilerInstance.cpp (+1-1) - (modified) clang/lib/Lex/ModuleMap.cpp (+1-3) - (modified) clang/lib/Lex/PPDirectives.cpp (+2-1) - (modified) clang/lib/Lex/Pragma.cpp (+1-1) - (modified) clang/lib/Lex/PreprocessorLexer.cpp (+1-2) - (modified) clang/lib/Serialization/ASTReader.cpp (+3-3) - (modified) clang/lib/Serialization/ASTWriter.cpp (+3-3) - (modified) clang/lib/Serialization/ModuleManager.cpp (+2-2) - (modified) clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp (+1-1) - (modified) clang/tools/libclang/CXIndexDataConsumer.cpp (+3-3) - (modified) clang/tools/libclang/CXIndexDataConsumer.h (+1-1) - (modified) clang/unittests/Basic/FileEntryTest.cpp (-25) ``diff diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp index 52cc2e6569b052..0b1e9f59e1a70c 100644 --- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp +++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp @@ -171,7 +171,7 @@ void ExpandModularHeadersPPCallbacks::InclusionDirective( if (Imported) { serialization::ModuleFile *MF = Compiler.getASTReader()->getModuleManager().lookup( -Imported->getASTFile()); +*Imported->getASTFile()); handleModuleFile(MF); } parseToLocation(DirectiveLoc); diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index 6351aeae92e2c4..35efa147950f06 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -279,72 +279,6 @@ template <> struct DenseMapInfo { namespace clang { -/// Wrapper around OptionalFileEntryRef that degrades to 'const FileEntry*', -/// facilitating incremental patches to propagate FileEntryRef. -/// -/// This class can be used as return value or field where it's convenient for -/// an OptionalFileEntryRef to degrade to a 'const FileEntry*'. The purpose -/// is to avoid code churn due to dances like the following: -/// \code -/// // Old code. -/// lvalue = rvalue; -/// -/// // Temporary code from an incremental patch. -/// OptionalFileEntryRef MaybeF = rvalue; -/// lvalue = MaybeF ? () : nullptr; -/// -/// // Final code. -/// lvalue = rvalue; -/// \endcode -/// -/// FIXME: Once FileEntryRef is "everywhere" and FileEntry::LastRef and -/// FileEntry::getName have been deleted, delete this class and replace -/// instances with OptionalFileEntryRef. -class OptionalFileEntryRefDegradesToFileEntryPtr : public OptionalFileEntryRef { -public: - OptionalFileEntryRefDegradesToFileEntryPtr() = default; - OptionalFileEntryRefDegradesToFileEntryPtr( - OptionalFileEntryRefDegradesToFileEntryPtr &&) = default; - OptionalFileEntryRefDegradesToFileEntryPtr( - const OptionalFileEntryRefDegradesToFileEntryPtr &) = default; - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(OptionalFileEntryRefDegradesToFileEntryPtr &&) = default; - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(const OptionalFileEntryRefDegradesToFileEntryPtr &) = default; - - OptionalFileEntryRefDegradesToFileEntryPtr(std::nullopt_t) {} - OptionalFileEntryRefDegradesToFileEntryPtr(FileEntryRef Ref) - : OptionalFileEntryRef(Ref) {} - OptionalFileEntryRefDegradesToFileEntryPtr(OptionalFileEntryRef MaybeRef) - : OptionalFileEntryRef(MaybeRef) {} - - OptionalFileEntryRefDegradesToFileEntryPtr =(std::nullopt_t) { -OptionalFileEntryRef::operator=(std::nullopt); -return *this; - } - OptionalFileEntryRefDegradesToFileEntryPtr =(FileEntryRef Ref) { -OptionalFileEntryRef::operator=(Ref); -return *this; - } - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(OptionalFileEntryRef MaybeRef) { -OptionalFileEntryRef::operator=(MaybeRef); -return *this; - } - - /// Degrade to 'const FileEntry *' to allow FileEntry::LastRef and - /// FileEntry::getName have been deleted, delete this class and replace - /// instances with OptionalFileEntryRef - operator const FileEntry *() const { -return has_value() ? &(*this)->getFileEntry() : nullptr; - } -}; - -static_assert( -std::is_trivially_copyable< -OptionalFileEntryRefDegradesToFileEntryPtr>::value, -"OptionalFileEntryRefDegradesToFileEntryPtr should be trivially copyable"); - inline bool
[clang] [clang-tools-extra] [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` (PR #74899)
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/74899 None >From de1d9c6808271ea802813daa71e6d94bce8a9894 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 7 Dec 2023 11:38:49 -0800 Subject: [PATCH] [clang] NFC: Remove `OptionalFileEntryRefDegradesToFileEntryPtr` --- .../ExpandModularHeadersPPCallbacks.cpp | 2 +- clang/include/clang/Basic/FileEntry.h | 66 --- clang/include/clang/Basic/Module.h| 2 +- clang/include/clang/Basic/SourceManager.h | 14 ++-- clang/include/clang/Lex/PreprocessorLexer.h | 2 +- .../include/clang/Serialization/ModuleFile.h | 2 +- clang/lib/Frontend/CompilerInstance.cpp | 2 +- clang/lib/Lex/ModuleMap.cpp | 4 +- clang/lib/Lex/PPDirectives.cpp| 3 +- clang/lib/Lex/Pragma.cpp | 2 +- clang/lib/Lex/PreprocessorLexer.cpp | 3 +- clang/lib/Serialization/ASTReader.cpp | 6 +- clang/lib/Serialization/ASTWriter.cpp | 6 +- clang/lib/Serialization/ModuleManager.cpp | 4 +- .../DependencyScanning/ModuleDepCollector.cpp | 2 +- clang/tools/libclang/CXIndexDataConsumer.cpp | 6 +- clang/tools/libclang/CXIndexDataConsumer.h| 2 +- clang/unittests/Basic/FileEntryTest.cpp | 25 --- 18 files changed, 31 insertions(+), 122 deletions(-) diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp index 52cc2e6569b052..0b1e9f59e1a70c 100644 --- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp +++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp @@ -171,7 +171,7 @@ void ExpandModularHeadersPPCallbacks::InclusionDirective( if (Imported) { serialization::ModuleFile *MF = Compiler.getASTReader()->getModuleManager().lookup( -Imported->getASTFile()); +*Imported->getASTFile()); handleModuleFile(MF); } parseToLocation(DirectiveLoc); diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index 6351aeae92e2c4..35efa147950f06 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -279,72 +279,6 @@ template <> struct DenseMapInfo { namespace clang { -/// Wrapper around OptionalFileEntryRef that degrades to 'const FileEntry*', -/// facilitating incremental patches to propagate FileEntryRef. -/// -/// This class can be used as return value or field where it's convenient for -/// an OptionalFileEntryRef to degrade to a 'const FileEntry*'. The purpose -/// is to avoid code churn due to dances like the following: -/// \code -/// // Old code. -/// lvalue = rvalue; -/// -/// // Temporary code from an incremental patch. -/// OptionalFileEntryRef MaybeF = rvalue; -/// lvalue = MaybeF ? () : nullptr; -/// -/// // Final code. -/// lvalue = rvalue; -/// \endcode -/// -/// FIXME: Once FileEntryRef is "everywhere" and FileEntry::LastRef and -/// FileEntry::getName have been deleted, delete this class and replace -/// instances with OptionalFileEntryRef. -class OptionalFileEntryRefDegradesToFileEntryPtr : public OptionalFileEntryRef { -public: - OptionalFileEntryRefDegradesToFileEntryPtr() = default; - OptionalFileEntryRefDegradesToFileEntryPtr( - OptionalFileEntryRefDegradesToFileEntryPtr &&) = default; - OptionalFileEntryRefDegradesToFileEntryPtr( - const OptionalFileEntryRefDegradesToFileEntryPtr &) = default; - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(OptionalFileEntryRefDegradesToFileEntryPtr &&) = default; - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(const OptionalFileEntryRefDegradesToFileEntryPtr &) = default; - - OptionalFileEntryRefDegradesToFileEntryPtr(std::nullopt_t) {} - OptionalFileEntryRefDegradesToFileEntryPtr(FileEntryRef Ref) - : OptionalFileEntryRef(Ref) {} - OptionalFileEntryRefDegradesToFileEntryPtr(OptionalFileEntryRef MaybeRef) - : OptionalFileEntryRef(MaybeRef) {} - - OptionalFileEntryRefDegradesToFileEntryPtr =(std::nullopt_t) { -OptionalFileEntryRef::operator=(std::nullopt); -return *this; - } - OptionalFileEntryRefDegradesToFileEntryPtr =(FileEntryRef Ref) { -OptionalFileEntryRef::operator=(Ref); -return *this; - } - OptionalFileEntryRefDegradesToFileEntryPtr & - operator=(OptionalFileEntryRef MaybeRef) { -OptionalFileEntryRef::operator=(MaybeRef); -return *this; - } - - /// Degrade to 'const FileEntry *' to allow FileEntry::LastRef and - /// FileEntry::getName have been deleted, delete this class and replace - /// instances with OptionalFileEntryRef - operator const FileEntry *() const { -return has_value() ? &(*this)->getFileEntry() : nullptr; - } -}; - -static_assert( -std::is_trivially_copyable< -OptionalFileEntryRefDegradesToFileEntryPtr>::value, -"OptionalFileEntryRefDegradesToFileEntryPtr should be
[llvm] [clang] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
https://github.com/Artem-B edited https://github.com/llvm/llvm-project/pull/74895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
@@ -80,8 +85,10 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo { bool allowFP16Math() const; bool hasMaskOperator() const { return PTXVersion >= 71; } bool hasNoReturn() const { return SmVersion >= 30 && PTXVersion >= 64; } - unsigned int getSmVersion() const { return SmVersion; } + unsigned int getSmVersion() const { return FullSmVersion / 10; } + unsigned int getFullSmVersion() const { return FullSmVersion; } std::string getTargetName() const { return TargetName; } + bool isSm90a() const { return getFullSmVersion() == 901; } jhuber6 wrote: Yeah, I was thinking that the internal representation would just be what "FullSMVersion" is now, but `getSMVersion` would return `/ 10` and `getFeatures` or something would be `% 10`. https://github.com/llvm/llvm-project/pull/74895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[llvm] [clang] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)
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 18f0da26b292341f84f91d4ce731b046315cd0a1 133bdc09eed41545794a369d3fa4d2afb720815e -- clang/lib/CodeGen/CGHLSLRuntime.cpp clang/lib/CodeGen/CGHLSLRuntime.h llvm/include/llvm/Frontend/HLSL/HLSLResource.h llvm/lib/Frontend/HLSL/HLSLResource.cpp llvm/lib/Target/DirectX/DXILResource.cpp `` View the diff from clang-format here. ``diff diff --git a/clang/lib/CodeGen/CGHLSLRuntime.h b/clang/lib/CodeGen/CGHLSLRuntime.h index 0979a0c5eb..bb500cb5c9 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.h +++ b/clang/lib/CodeGen/CGHLSLRuntime.h @@ -92,8 +92,7 @@ private: void addBufferResourceAnnotation(llvm::GlobalVariable *GV, llvm::StringRef TyName, llvm::hlsl::ResourceClass RC, - llvm::hlsl::ResourceKind RK, - bool IsROV, + llvm::hlsl::ResourceKind RK, bool IsROV, BufferResBinding ); void addConstant(VarDecl *D, Buffer ); void addBufferDecls(const DeclContext *DC, Buffer ); `` https://github.com/llvm/llvm-project/pull/74896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] NFCI: Make `ModuleFile::File` non-optional (PR #74892)
https://github.com/jansvoboda11 closed https://github.com/llvm/llvm-project/pull/74892 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8615ead - [clang] NFCI: Make `ModuleFile::File` non-optional (#74892)
Author: Jan Svoboda Date: 2023-12-08T15:43:00-08:00 New Revision: 8615ead9a6d37e6353df1b652aadebe71ec6c242 URL: https://github.com/llvm/llvm-project/commit/8615ead9a6d37e6353df1b652aadebe71ec6c242 DIFF: https://github.com/llvm/llvm-project/commit/8615ead9a6d37e6353df1b652aadebe71ec6c242.diff LOG: [clang] NFCI: Make `ModuleFile::File` non-optional (#74892) AFAICT, `ModuleFile::File` can be `std::nullopt` only for PCM files loaded from the standard input. This patch starts setting that variable to `FileManager::getSTDIN()` in that case, which makes it possible to remove the optionality, and also simplifies code that actually reads the file. This is part of an effort to get rid of `Optional{File,Directory}EntryRefDegradesTo{File,Directory}EntryPtr`. Added: Modified: clang/include/clang/Serialization/ModuleFile.h clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/GlobalModuleIndex.cpp clang/lib/Serialization/ModuleManager.cpp Removed: diff --git a/clang/include/clang/Serialization/ModuleFile.h b/clang/include/clang/Serialization/ModuleFile.h index 48be8676cc26a4..70ab61dec8b6bf 100644 --- a/clang/include/clang/Serialization/ModuleFile.h +++ b/clang/include/clang/Serialization/ModuleFile.h @@ -123,8 +123,8 @@ class InputFile { /// other modules. class ModuleFile { public: - ModuleFile(ModuleKind Kind, unsigned Generation) - : Kind(Kind), Generation(Generation) {} + ModuleFile(ModuleKind Kind, FileEntryRef File, unsigned Generation) + : Kind(Kind), File(File), Generation(Generation) {} ~ModuleFile(); // === General information === @@ -176,7 +176,7 @@ class ModuleFile { bool DidReadTopLevelSubmodule = false; /// The file entry for the module file. - OptionalFileEntryRefDegradesToFileEntryPtr File; + FileEntryRef File; /// The signature of the module file, which may be used instead of the size /// and modification time to identify this particular file. diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index f22da838424b41..49f25d6648c801 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -5786,7 +5786,7 @@ llvm::Error ASTReader::ReadSubmoduleBlock(ModuleFile , PartialDiagnostic(diag::err_module_file_conflict, ContextObj->DiagAllocator) << CurrentModule->getTopLevelModuleName() << CurFile->getName() -<< F.File->getName(); +<< F.File.getName(); return DiagnosticError::create(CurrentImportLoc, ConflictError); } } diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 6df815234e235f..38e8b8ccbe058d 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1413,7 +1413,7 @@ void ASTWriter::WriteControlBlock(Preprocessor , ASTContext , // If we have calculated signature, there is no need to store // the size or timestamp. - Record.push_back(M.Signature ? 0 : M.File->getSize()); + Record.push_back(M.Signature ? 0 : M.File.getSize()); Record.push_back(M.Signature ? 0 : getTimestampForOutput(M.File)); llvm::append_range(Record, M.Signature); diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index fb80a1998d0efe..dd4fc3e009050f 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -342,8 +342,8 @@ bool GlobalModuleIndex::loadedModuleFile(ModuleFile *File) { // If the size and modification time match what we expected, record this // module file. bool Failed = true; - if (File->File->getSize() == Info.Size && - File->File->getModificationTime() == Info.ModTime) { + if (File->File.getSize() == Info.Size && + File->File.getModificationTime() == Info.ModTime) { Info.File = File; ModulesByFile[File] = Known->second; diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index de4cd3d05853ac..d1ded6cd8ee282 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -108,7 +108,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, // Look for the file entry. This only fails if the expected size or // modification time diff er. - OptionalFileEntryRefDegradesToFileEntryPtr Entry; + OptionalFileEntryRef Entry; if (Type == MK_ExplicitModule || Type == MK_PrebuiltModule) { // If we're not expecting to pull this file out of the module cache, it // might have a diff erent mtime due to being moved across filesystems in @@ -123,7 +123,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind
[llvm] [clang] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
@@ -80,8 +85,10 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo { bool allowFP16Math() const; bool hasMaskOperator() const { return PTXVersion >= 71; } bool hasNoReturn() const { return SmVersion >= 30 && PTXVersion >= 64; } - unsigned int getSmVersion() const { return SmVersion; } + unsigned int getSmVersion() const { return FullSmVersion / 10; } + unsigned int getFullSmVersion() const { return FullSmVersion; } std::string getTargetName() const { return TargetName; } + bool isSm90a() const { return getFullSmVersion() == 901; } Artem-B wrote: According to [CUDA docs](docs.nvidia.com/cuda/parallel-thread-execution/index.html?highlight=sm_90a#ptx-module-directives-target) > Target architectures with suffix “a”, such as sm_90a, include > architecture-accelerated features that are supported on the specified > architecture only, hence such targets do not follow the onion layer model. > Therefore, PTX code generated for such targets cannot be run on later > generation devices. Architecture-accelerated features can only be used with > targets that support these features. It's not clear where they are going with this approach. I can make it a more generic `int hasAAFeatures() { return FullSmVersion % 10; }` if that's what you're looking for. https://github.com/llvm/llvm-project/pull/74895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
https://github.com/Artem-B edited https://github.com/llvm/llvm-project/pull/74895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)
llvmbot wrote: @llvm/pr-subscribers-hlsl @llvm/pr-subscribers-backend-directx Author: Justin Bogner (bogner) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/74896.diff 13 Files Affected: - (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+6-3) - (modified) clang/lib/CodeGen/CGHLSLRuntime.h (+1) - (modified) clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl (+6-6) - (modified) clang/test/CodeGenHLSL/cbuf.hlsl (+2-2) - (modified) llvm/include/llvm/Frontend/HLSL/HLSLResource.h (+3-2) - (modified) llvm/lib/Frontend/HLSL/HLSLResource.cpp (+10-4) - (modified) llvm/lib/Target/DirectX/DXILResource.cpp (+1-3) - (modified) llvm/test/CodeGen/DirectX/UAVMetadata.ll (+10-10) - (modified) llvm/test/CodeGen/DirectX/cbuf.ll (+1-1) - (modified) llvm/test/CodeGen/DirectX/legacy_cb_layout_0.ll (+1-1) - (modified) llvm/test/CodeGen/DirectX/legacy_cb_layout_1.ll (+1-1) - (modified) llvm/test/CodeGen/DirectX/legacy_cb_layout_2.ll (+2-2) - (modified) llvm/test/CodeGen/DirectX/legacy_cb_layout_3.ll (+1-1) ``diff diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp index c239bc17ef267..3e8a40e7540be 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -184,7 +184,8 @@ void CGHLSLRuntime::finishCodeGen() { : llvm::hlsl::ResourceKind::TBuffer; std::string TyName = Buf.Name.str() + (Buf.IsCBuffer ? ".cb." : ".tb.") + "ty"; -addBufferResourceAnnotation(GV, TyName, RC, RK, Buf.Binding); +addBufferResourceAnnotation(GV, TyName, RC, RK, /*IsROV=*/false, +Buf.Binding); } } @@ -196,6 +197,7 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, llvm::StringRef TyName, llvm::hlsl::ResourceClass RC, llvm::hlsl::ResourceKind RK, +bool IsROV, BufferResBinding ) { llvm::Module = CGM.getModule(); @@ -219,7 +221,7 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, "ResourceMD must have been set by the switch above."); llvm::hlsl::FrontendResource Res( - GV, TyName, RK, Binding.Reg.value_or(UINT_MAX), Binding.Space); + GV, TyName, RK, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space); ResourceMD->addOperand(Res.getMetadata()); } @@ -236,10 +238,11 @@ void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) { llvm::hlsl::ResourceClass RC = Attr->getResourceClass(); llvm::hlsl::ResourceKind RK = Attr->getResourceKind(); + bool IsROV = Attr->getIsROV(); QualType QT(Ty, 0); BufferResBinding Binding(D->getAttr()); - addBufferResourceAnnotation(GV, QT.getAsString(), RC, RK, Binding); + addBufferResourceAnnotation(GV, QT.getAsString(), RC, RK, IsROV, Binding); } CGHLSLRuntime::BufferResBinding::BufferResBinding( diff --git a/clang/lib/CodeGen/CGHLSLRuntime.h b/clang/lib/CodeGen/CGHLSLRuntime.h index 67413fbd4a78e..0979a0c5eb9ad 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.h +++ b/clang/lib/CodeGen/CGHLSLRuntime.h @@ -93,6 +93,7 @@ class CGHLSLRuntime { llvm::StringRef TyName, llvm::hlsl::ResourceClass RC, llvm::hlsl::ResourceKind RK, + bool IsROV, BufferResBinding ); void addConstant(VarDecl *D, Buffer ); void addBufferDecls(const DeclContext *DC, Buffer ); diff --git a/clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl b/clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl index 77091f8390a15..a70e224b81e4b 100644 --- a/clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl +++ b/clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl @@ -16,9 +16,9 @@ void main() { } // CHECK: !hlsl.uavs = !{![[Single:[0-9]+]], ![[Array:[0-9]+]], ![[SingleAllocated:[0-9]+]], ![[ArrayAllocated:[0-9]+]], ![[SingleSpace:[0-9]+]], ![[ArraySpace:[0-9]+]]} -// CHECK-DAG: ![[Single]] = !{ptr @"?Buffer1@@3V?$RWBuffer@M@hlsl@@A", !"RWBuffer", i32 10, i32 -1, i32 0} -// CHECK-DAG: ![[Array]] = !{ptr @"?BufferArray@@3PAV?$RWBuffer@T?$__vector@M$03@__clang@@@hlsl@@A", !"RWBuffer >", i32 10, i32 -1, i32 0} -// CHECK-DAG: ![[SingleAllocated]] = !{ptr @"?Buffer2@@3V?$RWBuffer@M@hlsl@@A", !"RWBuffer", i32 10, i32 3, i32 0} -// CHECK-DAG: ![[ArrayAllocated]] = !{ptr @"?BufferArray2@@3PAV?$RWBuffer@T?$__vector@M$03@__clang@@@hlsl@@A", !"RWBuffer >", i32 10, i32 4, i32 0} -// CHECK-DAG: ![[SingleSpace]] = !{ptr @"?Buffer3@@3V?$RWBuffer@M@hlsl@@A", !"RWBuffer", i32 10, i32 3, i32 1} -// CHECK-DAG: ![[ArraySpace]] = !{ptr
[clang] [clang] NFCI: Make `ModuleFile::File` non-optional (PR #74892)
https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/74892 >From fb5c8c9fe856aaa2a314effa26486d5fbf019140 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Thu, 7 Dec 2023 14:04:35 -0800 Subject: [PATCH 1/2] [clang] NFCI: Make `ModuleFile::File` non-optional --- .../include/clang/Serialization/ModuleFile.h | 6 +-- clang/lib/Serialization/ASTReader.cpp | 2 +- clang/lib/Serialization/ASTWriter.cpp | 2 +- clang/lib/Serialization/GlobalModuleIndex.cpp | 4 +- clang/lib/Serialization/ModuleManager.cpp | 54 --- 5 files changed, 29 insertions(+), 39 deletions(-) diff --git a/clang/include/clang/Serialization/ModuleFile.h b/clang/include/clang/Serialization/ModuleFile.h index 48be8676cc26a4..70ab61dec8b6bf 100644 --- a/clang/include/clang/Serialization/ModuleFile.h +++ b/clang/include/clang/Serialization/ModuleFile.h @@ -123,8 +123,8 @@ class InputFile { /// other modules. class ModuleFile { public: - ModuleFile(ModuleKind Kind, unsigned Generation) - : Kind(Kind), Generation(Generation) {} + ModuleFile(ModuleKind Kind, FileEntryRef File, unsigned Generation) + : Kind(Kind), File(File), Generation(Generation) {} ~ModuleFile(); // === General information === @@ -176,7 +176,7 @@ class ModuleFile { bool DidReadTopLevelSubmodule = false; /// The file entry for the module file. - OptionalFileEntryRefDegradesToFileEntryPtr File; + FileEntryRef File; /// The signature of the module file, which may be used instead of the size /// and modification time to identify this particular file. diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index f22da838424b41..49f25d6648c801 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -5786,7 +5786,7 @@ llvm::Error ASTReader::ReadSubmoduleBlock(ModuleFile , PartialDiagnostic(diag::err_module_file_conflict, ContextObj->DiagAllocator) << CurrentModule->getTopLevelModuleName() << CurFile->getName() -<< F.File->getName(); +<< F.File.getName(); return DiagnosticError::create(CurrentImportLoc, ConflictError); } } diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 6df815234e235f..38e8b8ccbe058d 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1413,7 +1413,7 @@ void ASTWriter::WriteControlBlock(Preprocessor , ASTContext , // If we have calculated signature, there is no need to store // the size or timestamp. - Record.push_back(M.Signature ? 0 : M.File->getSize()); + Record.push_back(M.Signature ? 0 : M.File.getSize()); Record.push_back(M.Signature ? 0 : getTimestampForOutput(M.File)); llvm::append_range(Record, M.Signature); diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index fb80a1998d0efe..dd4fc3e009050f 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -342,8 +342,8 @@ bool GlobalModuleIndex::loadedModuleFile(ModuleFile *File) { // If the size and modification time match what we expected, record this // module file. bool Failed = true; - if (File->File->getSize() == Info.Size && - File->File->getModificationTime() == Info.ModTime) { + if (File->File.getSize() == Info.Size && + File->File.getModificationTime() == Info.ModTime) { Info.File = File; ModulesByFile[File] = Known->second; diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index de4cd3d05853ac..7cf97125b8ef03 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -108,7 +108,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, // Look for the file entry. This only fails if the expected size or // modification time differ. - OptionalFileEntryRefDegradesToFileEntryPtr Entry; + OptionalFileEntryRef Entry; if (Type == MK_ExplicitModule || Type == MK_PrebuiltModule) { // If we're not expecting to pull this file out of the module cache, it // might have a different mtime due to being moved across filesystems in @@ -123,7 +123,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, return OutOfDate; } - if (!Entry && FileName != "-") { + if (!Entry) { ErrorStr = "module file not found"; return Missing; } @@ -150,7 +150,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, }; // Check whether we already loaded this module, before - if (ModuleFile *ModuleEntry = Modules.lookup(Entry)) { + if (ModuleFile *ModuleEntry = Modules.lookup(*Entry)) { if (implicitModuleNamesMatch(Type, ModuleEntry, *Entry)) {
[llvm] [clang] [DirectX] Move ROV info into HLSL metadata. NFC (PR #74896)
https://github.com/bogner created https://github.com/llvm/llvm-project/pull/74896 None >From 133bdc09eed41545794a369d3fa4d2afb720815e Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Fri, 8 Dec 2023 15:41:14 -0800 Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?= =?UTF-8?q?l=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.5 --- clang/lib/CodeGen/CGHLSLRuntime.cpp | 9 ++--- clang/lib/CodeGen/CGHLSLRuntime.h | 1 + .../builtins/RWBuffer-annotations.hlsl| 12 +-- clang/test/CodeGenHLSL/cbuf.hlsl | 4 ++-- .../include/llvm/Frontend/HLSL/HLSLResource.h | 5 +++-- llvm/lib/Frontend/HLSL/HLSLResource.cpp | 14 + llvm/lib/Target/DirectX/DXILResource.cpp | 4 +--- llvm/test/CodeGen/DirectX/UAVMetadata.ll | 20 +-- llvm/test/CodeGen/DirectX/cbuf.ll | 2 +- .../CodeGen/DirectX/legacy_cb_layout_0.ll | 2 +- .../CodeGen/DirectX/legacy_cb_layout_1.ll | 2 +- .../CodeGen/DirectX/legacy_cb_layout_2.ll | 4 ++-- .../CodeGen/DirectX/legacy_cb_layout_3.ll | 2 +- 13 files changed, 45 insertions(+), 36 deletions(-) diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp index c239bc17ef267..3e8a40e7540be 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -184,7 +184,8 @@ void CGHLSLRuntime::finishCodeGen() { : llvm::hlsl::ResourceKind::TBuffer; std::string TyName = Buf.Name.str() + (Buf.IsCBuffer ? ".cb." : ".tb.") + "ty"; -addBufferResourceAnnotation(GV, TyName, RC, RK, Buf.Binding); +addBufferResourceAnnotation(GV, TyName, RC, RK, /*IsROV=*/false, +Buf.Binding); } } @@ -196,6 +197,7 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, llvm::StringRef TyName, llvm::hlsl::ResourceClass RC, llvm::hlsl::ResourceKind RK, +bool IsROV, BufferResBinding ) { llvm::Module = CGM.getModule(); @@ -219,7 +221,7 @@ void CGHLSLRuntime::addBufferResourceAnnotation(llvm::GlobalVariable *GV, "ResourceMD must have been set by the switch above."); llvm::hlsl::FrontendResource Res( - GV, TyName, RK, Binding.Reg.value_or(UINT_MAX), Binding.Space); + GV, TyName, RK, IsROV, Binding.Reg.value_or(UINT_MAX), Binding.Space); ResourceMD->addOperand(Res.getMetadata()); } @@ -236,10 +238,11 @@ void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) { llvm::hlsl::ResourceClass RC = Attr->getResourceClass(); llvm::hlsl::ResourceKind RK = Attr->getResourceKind(); + bool IsROV = Attr->getIsROV(); QualType QT(Ty, 0); BufferResBinding Binding(D->getAttr()); - addBufferResourceAnnotation(GV, QT.getAsString(), RC, RK, Binding); + addBufferResourceAnnotation(GV, QT.getAsString(), RC, RK, IsROV, Binding); } CGHLSLRuntime::BufferResBinding::BufferResBinding( diff --git a/clang/lib/CodeGen/CGHLSLRuntime.h b/clang/lib/CodeGen/CGHLSLRuntime.h index 67413fbd4a78e..0979a0c5eb9ad 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.h +++ b/clang/lib/CodeGen/CGHLSLRuntime.h @@ -93,6 +93,7 @@ class CGHLSLRuntime { llvm::StringRef TyName, llvm::hlsl::ResourceClass RC, llvm::hlsl::ResourceKind RK, + bool IsROV, BufferResBinding ); void addConstant(VarDecl *D, Buffer ); void addBufferDecls(const DeclContext *DC, Buffer ); diff --git a/clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl b/clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl index 77091f8390a15..a70e224b81e4b 100644 --- a/clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl +++ b/clang/test/CodeGenHLSL/builtins/RWBuffer-annotations.hlsl @@ -16,9 +16,9 @@ void main() { } // CHECK: !hlsl.uavs = !{![[Single:[0-9]+]], ![[Array:[0-9]+]], ![[SingleAllocated:[0-9]+]], ![[ArrayAllocated:[0-9]+]], ![[SingleSpace:[0-9]+]], ![[ArraySpace:[0-9]+]]} -// CHECK-DAG: ![[Single]] = !{ptr @"?Buffer1@@3V?$RWBuffer@M@hlsl@@A", !"RWBuffer", i32 10, i32 -1, i32 0} -// CHECK-DAG: ![[Array]] = !{ptr @"?BufferArray@@3PAV?$RWBuffer@T?$__vector@M$03@__clang@@@hlsl@@A", !"RWBuffer >", i32 10, i32 -1, i32 0} -// CHECK-DAG: ![[SingleAllocated]] = !{ptr @"?Buffer2@@3V?$RWBuffer@M@hlsl@@A", !"RWBuffer", i32 10, i32 3, i32 0} -// CHECK-DAG: ![[ArrayAllocated]] = !{ptr @"?BufferArray2@@3PAV?$RWBuffer@T?$__vector@M$03@__clang@@@hlsl@@A", !"RWBuffer >", i32 10, i32 4, i32 0} -//
[llvm] [clang-tools-extra] [clang] [compiler-rt] [PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delimiter for local-linkage varibles. (PR #74008)
@@ -144,25 +145,27 @@ void GlobalObject::copyAttributesFrom(const GlobalObject *Src) { std::string GlobalValue::getGlobalIdentifier(StringRef Name, GlobalValue::LinkageTypes Linkage, StringRef FileName) { - // Value names may be prefixed with a binary '1' to indicate // that the backend should not modify the symbols due to any platform // naming convention. Do not include that '1' in the PGO profile name. if (Name[0] == '\1') Name = Name.substr(1); - std::string NewName = std::string(Name); + SmallString<64> GlobalName; if (llvm::GlobalValue::isLocalLinkage(Linkage)) { // For local symbols, prepend the main file name to distinguish them. // Do not include the full path in the file name since there's no guarantee // that it will stay the same, e.g., if the files are checked out from // version control in different locations. if (FileName.empty()) - NewName = NewName.insert(0, ":"); + GlobalName.append(""); else - NewName = NewName.insert(0, FileName.str() + ":"); + GlobalName.append(FileName.str()); + +GlobalName.append({kGlobalIdentifierDelimiter}); MaskRay wrote: Nit; use `+=` or `push_back` https://github.com/llvm/llvm-project/pull/74008 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
@@ -80,8 +85,10 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo { bool allowFP16Math() const; bool hasMaskOperator() const { return PTXVersion >= 71; } bool hasNoReturn() const { return SmVersion >= 30 && PTXVersion >= 64; } - unsigned int getSmVersion() const { return SmVersion; } + unsigned int getSmVersion() const { return FullSmVersion / 10; } + unsigned int getFullSmVersion() const { return FullSmVersion; } std::string getTargetName() const { return TargetName; } + bool isSm90a() const { return getFullSmVersion() == 901; } jhuber6 wrote: Could we expose this more like `getSmVersion` and `getSmFeature`? Has CUDA even documented how they intend to further build on this? https://github.com/llvm/llvm-project/pull/74895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] NFCI: Make `ModuleFile::File` non-optional (PR #74892)
https://github.com/benlangmuir approved this pull request. https://github.com/llvm/llvm-project/pull/74892 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] NFCI: Make `ModuleFile::File` non-optional (PR #74892)
@@ -441,22 +434,19 @@ void ModuleManager::visit(llvm::function_ref Visitor, bool ModuleManager::lookupModuleFile(StringRef FileName, off_t ExpectedSize, time_t ExpectedModTime, OptionalFileEntryRef ) { - File = std::nullopt; - if (FileName == "-") + if (FileName == "-") { +File = expectedToOptional(FileMgr.getSTDIN()); return false; + } // Open the file immediately to ensure there is no race between stat'ing and // opening the file. - OptionalFileEntryRef FileOrErr = - expectedToOptional(FileMgr.getFileRef(FileName, /*OpenFile=*/true, -/*CacheFailure=*/false)); - if (!FileOrErr) -return false; - - File = *FileOrErr; + File = expectedToOptional(FileMgr.getFileRef(FileName, /*OpenFile=*/true, benlangmuir wrote: Yeah, I would recommend that. https://github.com/llvm/llvm-project/pull/74892 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] NFCI: Make `ModuleFile::File` non-optional (PR #74892)
https://github.com/benlangmuir edited https://github.com/llvm/llvm-project/pull/74892 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang-format][NFC] Clean up the driver and getStyle() in Format.cpp (PR #74794)
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/74794 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 3791b3f - [clang-format][NFC] Clean up the driver and getStyle() in Format.cpp (#74794)
Author: Owen Pan Date: 2023-12-08T15:23:01-08:00 New Revision: 3791b3fca6eac5e403b91550ed0f774866cf3ede URL: https://github.com/llvm/llvm-project/commit/3791b3fca6eac5e403b91550ed0f774866cf3ede DIFF: https://github.com/llvm/llvm-project/commit/3791b3fca6eac5e403b91550ed0f774866cf3ede.diff LOG: [clang-format][NFC] Clean up the driver and getStyle() in Format.cpp (#74794) Added: Modified: clang/lib/Format/Format.cpp clang/tools/clang-format/ClangFormat.cpp Removed: diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index b09487435adb2..8feee7457fc31 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -3955,10 +3955,7 @@ llvm::Expected getStyle(StringRef StyleName, StringRef FileName, StringRef FallbackStyleName, StringRef Code, llvm::vfs::FileSystem *FS, bool AllowUnknownOptions) { - if (!FS) -FS = llvm::vfs::getRealFileSystem().get(); FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code)); - FormatStyle FallbackStyle = getNoStyle(); if (!getPredefinedStyle(FallbackStyleName, Style.Language, )) return make_string_error("Invalid fallback style: " + FallbackStyleName); @@ -3974,14 +3971,18 @@ llvm::Expected getStyle(StringRef StyleName, StringRef FileName, AllowUnknownOptions)) { return make_string_error("Error parsing -style: " + ec.message()); } -if (Style.InheritsParentConfig) { - ChildFormatTextToApply.emplace_back( - llvm::MemoryBuffer::getMemBuffer(StyleName, Source, false)); -} else { + +if (!Style.InheritsParentConfig) return Style; -} + +ChildFormatTextToApply.emplace_back( +llvm::MemoryBuffer::getMemBuffer(StyleName, Source, false)); } + if (!FS) +FS = llvm::vfs::getRealFileSystem().get(); + assert(FS); + // User provided clang-format file using -style=file:path/to/format/file. if (!Style.InheritsParentConfig && StyleName.starts_with_insensitive("file:")) { @@ -4015,18 +4016,12 @@ llvm::Expected getStyle(StringRef StyleName, StringRef FileName, return Style; } - // Reset possible inheritance - Style.InheritsParentConfig = false; - - // Look for .clang-format/_clang-format file in the file's parent directories. - SmallString<128> UnsuitableConfigFiles; SmallString<128> Path(FileName); if (std::error_code EC = FS->makeAbsolute(Path)) return make_string_error(EC.message()); - llvm::SmallVector FilesToLookFor; - FilesToLookFor.push_back(".clang-format"); - FilesToLookFor.push_back("_clang-format"); + // Reset possible inheritance + Style.InheritsParentConfig = false; auto dropDiagnosticHandler = [](const llvm::SMDiagnostic &, void *) {}; @@ -4040,9 +4035,14 @@ llvm::Expected getStyle(StringRef StyleName, StringRef FileName, } }; + // Look for .clang-format/_clang-format file in the file's parent directories. + llvm::SmallVector FilesToLookFor; + FilesToLookFor.push_back(".clang-format"); + FilesToLookFor.push_back("_clang-format"); + + SmallString<128> UnsuitableConfigFiles; for (StringRef Directory = Path; !Directory.empty(); Directory = llvm::sys::path::parent_path(Directory)) { - auto Status = FS->status(Directory); if (!Status || Status->getType() != llvm::sys::fs::file_type::directory_file) { @@ -4055,50 +4055,51 @@ llvm::Expected getStyle(StringRef StyleName, StringRef FileName, llvm::sys::path::append(ConfigFile, F); LLVM_DEBUG(llvm::dbgs() << "Trying " << ConfigFile << "...\n"); - Status = FS->status(ConfigFile.str()); - - if (Status && - (Status->getType() == llvm::sys::fs::file_type::regular_file)) { -llvm::ErrorOr> Text = -loadAndParseConfigFile(ConfigFile, FS, , AllowUnknownOptions); -if (auto EC = Text.getError()) { - if (EC == ParseError::Unsuitable) { -if (!UnsuitableConfigFiles.empty()) - UnsuitableConfigFiles.append(", "); -UnsuitableConfigFiles.append(ConfigFile); -continue; - } + Status = FS->status(ConfigFile); + if (!Status || + Status->getType() != llvm::sys::fs::file_type::regular_file) { +continue; + } + + llvm::ErrorOr> Text = + loadAndParseConfigFile(ConfigFile, FS, , AllowUnknownOptions); + if (auto EC = Text.getError()) { +if (EC != ParseError::Unsuitable) { return make_string_error("Error reading " + ConfigFile + ": " + EC.message()); } -LLVM_DEBUG(llvm::dbgs() - << "Using configuration file " << ConfigFile << "\n"); +if (!UnsuitableConfigFiles.empty()) + UnsuitableConfigFiles.append(",
[clang] [llvm] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
Artem-B wrote: @ezhulenev FYI. https://github.com/llvm/llvm-project/pull/74895 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
llvmbot wrote: @llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang-codegen Author: Artem Belevich (Artem-B) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/74895.diff 11 Files Affected: - (modified) clang/docs/ReleaseNotes.rst (+3) - (modified) clang/include/clang/Basic/BuiltinsNVPTX.def (+11-2) - (modified) clang/include/clang/Basic/Cuda.h (+5-2) - (modified) clang/lib/Basic/Cuda.cpp (+5) - (modified) clang/lib/Basic/Targets/NVPTX.cpp (+3) - (modified) clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp (+1) - (modified) clang/lib/Driver/ToolChains/Cuda.cpp (+6) - (modified) clang/test/Misc/target-invalid-cpu-note.c (+1-1) - (modified) llvm/lib/Target/NVPTX/NVPTX.td (+10-9) - (modified) llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp (+6-1) - (modified) llvm/lib/Target/NVPTX/NVPTXSubtarget.h (+9-2) ``diff diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 89ea2f0930cec..1bf68a46a64da 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -937,6 +937,9 @@ CUDA/HIP Language Changes CUDA Support +- Clang now supports CUDA SDK up to 12.3 +- Added support for sm_90a + AIX Support ^^^ diff --git a/clang/include/clang/Basic/BuiltinsNVPTX.def b/clang/include/clang/Basic/BuiltinsNVPTX.def index d74a7d1e55dd2..0f2e8260143be 100644 --- a/clang/include/clang/Basic/BuiltinsNVPTX.def +++ b/clang/include/clang/Basic/BuiltinsNVPTX.def @@ -26,7 +26,9 @@ #pragma push_macro("SM_87") #pragma push_macro("SM_89") #pragma push_macro("SM_90") -#define SM_90 "sm_90" +#pragma push_macro("SM_90a") +#define SM_90a "sm_90a" +#define SM_90 "sm_90|" SM_90a #define SM_89 "sm_89|" SM_90 #define SM_87 "sm_87|" SM_89 #define SM_86 "sm_86|" SM_87 @@ -56,7 +58,11 @@ #pragma push_macro("PTX78") #pragma push_macro("PTX80") #pragma push_macro("PTX81") -#define PTX81 "ptx81" +#pragma push_macro("PTX82") +#pragma push_macro("PTX83") +#define PTX83 "ptx83" +#define PTX82 "ptx82|" PTX83 +#define PTX81 "ptx81|" PTX82 #define PTX80 "ptx80|" PTX81 #define PTX78 "ptx78|" PTX80 #define PTX77 "ptx77|" PTX78 @@ -1055,6 +1061,7 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("SM_87") #pragma pop_macro("SM_89") #pragma pop_macro("SM_90") +#pragma pop_macro("SM_90a") #pragma pop_macro("PTX42") #pragma pop_macro("PTX60") #pragma pop_macro("PTX61") @@ -1072,3 +1079,5 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("PTX78") #pragma pop_macro("PTX80") #pragma pop_macro("PTX81") +#pragma pop_macro("PTX82") +#pragma pop_macro("PTX83") diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h index 2d912bdbbd1bc..916cb4b7ef34a 100644 --- a/clang/include/clang/Basic/Cuda.h +++ b/clang/include/clang/Basic/Cuda.h @@ -39,9 +39,11 @@ enum class CudaVersion { CUDA_118, CUDA_120, CUDA_121, - FULLY_SUPPORTED = CUDA_118, + CUDA_122, + CUDA_123, + FULLY_SUPPORTED = CUDA_123, PARTIALLY_SUPPORTED = - CUDA_121, // Partially supported. Proceed with a warning. + CUDA_123, // Partially supported. Proceed with a warning. NEW = 1, // Too new. Issue a warning, but allow using it. }; const char *CudaVersionToString(CudaVersion V); @@ -71,6 +73,7 @@ enum class CudaArch { SM_87, SM_89, SM_90, + SM_90a, GFX600, GFX601, GFX602, diff --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp index 65840b9f20252..1b1da6a1356f2 100644 --- a/clang/lib/Basic/Cuda.cpp +++ b/clang/lib/Basic/Cuda.cpp @@ -39,6 +39,8 @@ static const CudaVersionMapEntry CudaNameVersionMap[] = { CUDA_ENTRY(11, 8), CUDA_ENTRY(12, 0), CUDA_ENTRY(12, 1), +CUDA_ENTRY(12, 2), +CUDA_ENTRY(12, 3), {"", CudaVersion::NEW, llvm::VersionTuple(std::numeric_limits::max())}, {"unknown", CudaVersion::UNKNOWN, {}} // End of list tombstone. }; @@ -93,6 +95,7 @@ static const CudaArchToStringMap arch_names[] = { SM(87), // Jetson/Drive AGX Orin SM(89), // Ada Lovelace SM(90), // Hopper +SM(90a), // Hopper GFX(600), // gfx600 GFX(601), // gfx601 GFX(602), // gfx602 @@ -209,6 +212,8 @@ CudaVersion MinVersionForCudaArch(CudaArch A) { case CudaArch::SM_89: case CudaArch::SM_90: return CudaVersion::CUDA_118; + case CudaArch::SM_90a: +return CudaVersion::CUDA_120; default: llvm_unreachable("invalid enum"); } diff --git a/clang/lib/Basic/Targets/NVPTX.cpp b/clang/lib/Basic/Targets/NVPTX.cpp index 3a4a75b0348f2..5c601812f6175 100644 --- a/clang/lib/Basic/Targets/NVPTX.cpp +++ b/clang/lib/Basic/Targets/NVPTX.cpp @@ -262,11 +262,14 @@ void NVPTXTargetInfo::getTargetDefines(const LangOptions , case CudaArch::SM_89: return "890"; case CudaArch::SM_90: + case CudaArch::SM_90a: return "900";
[clang] [llvm] [CUDA] Add support for CUDA-12.3 and sm_90a (PR #74895)
https://github.com/Artem-B created https://github.com/llvm/llvm-project/pull/74895 None >From 3ce8e08b94e33480139e13ca9f0fd7b719ff2c3d Mon Sep 17 00:00:00 2001 From: Artem Belevich Date: Wed, 6 Dec 2023 12:11:38 -0800 Subject: [PATCH] [CUDA] Add support for CUDA-12.3 and sm_90a --- clang/docs/ReleaseNotes.rst | 3 +++ clang/include/clang/Basic/BuiltinsNVPTX.def | 13 +++-- clang/include/clang/Basic/Cuda.h| 7 +-- clang/lib/Basic/Cuda.cpp| 5 + clang/lib/Basic/Targets/NVPTX.cpp | 3 +++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp| 1 + clang/lib/Driver/ToolChains/Cuda.cpp| 6 ++ clang/test/Misc/target-invalid-cpu-note.c | 2 +- llvm/lib/Target/NVPTX/NVPTX.td | 19 ++- llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp| 7 ++- llvm/lib/Target/NVPTX/NVPTXSubtarget.h | 11 +-- 11 files changed, 60 insertions(+), 17 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 89ea2f0930cec..1bf68a46a64da 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -937,6 +937,9 @@ CUDA/HIP Language Changes CUDA Support +- Clang now supports CUDA SDK up to 12.3 +- Added support for sm_90a + AIX Support ^^^ diff --git a/clang/include/clang/Basic/BuiltinsNVPTX.def b/clang/include/clang/Basic/BuiltinsNVPTX.def index d74a7d1e55dd2..0f2e8260143be 100644 --- a/clang/include/clang/Basic/BuiltinsNVPTX.def +++ b/clang/include/clang/Basic/BuiltinsNVPTX.def @@ -26,7 +26,9 @@ #pragma push_macro("SM_87") #pragma push_macro("SM_89") #pragma push_macro("SM_90") -#define SM_90 "sm_90" +#pragma push_macro("SM_90a") +#define SM_90a "sm_90a" +#define SM_90 "sm_90|" SM_90a #define SM_89 "sm_89|" SM_90 #define SM_87 "sm_87|" SM_89 #define SM_86 "sm_86|" SM_87 @@ -56,7 +58,11 @@ #pragma push_macro("PTX78") #pragma push_macro("PTX80") #pragma push_macro("PTX81") -#define PTX81 "ptx81" +#pragma push_macro("PTX82") +#pragma push_macro("PTX83") +#define PTX83 "ptx83" +#define PTX82 "ptx82|" PTX83 +#define PTX81 "ptx81|" PTX82 #define PTX80 "ptx80|" PTX81 #define PTX78 "ptx78|" PTX80 #define PTX77 "ptx77|" PTX78 @@ -1055,6 +1061,7 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("SM_87") #pragma pop_macro("SM_89") #pragma pop_macro("SM_90") +#pragma pop_macro("SM_90a") #pragma pop_macro("PTX42") #pragma pop_macro("PTX60") #pragma pop_macro("PTX61") @@ -1072,3 +1079,5 @@ TARGET_BUILTIN(__nvvm_getctarank_shared_cluster, "iv*3", "", AND(SM_90,PTX78)) #pragma pop_macro("PTX78") #pragma pop_macro("PTX80") #pragma pop_macro("PTX81") +#pragma pop_macro("PTX82") +#pragma pop_macro("PTX83") diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h index 2d912bdbbd1bc..916cb4b7ef34a 100644 --- a/clang/include/clang/Basic/Cuda.h +++ b/clang/include/clang/Basic/Cuda.h @@ -39,9 +39,11 @@ enum class CudaVersion { CUDA_118, CUDA_120, CUDA_121, - FULLY_SUPPORTED = CUDA_118, + CUDA_122, + CUDA_123, + FULLY_SUPPORTED = CUDA_123, PARTIALLY_SUPPORTED = - CUDA_121, // Partially supported. Proceed with a warning. + CUDA_123, // Partially supported. Proceed with a warning. NEW = 1, // Too new. Issue a warning, but allow using it. }; const char *CudaVersionToString(CudaVersion V); @@ -71,6 +73,7 @@ enum class CudaArch { SM_87, SM_89, SM_90, + SM_90a, GFX600, GFX601, GFX602, diff --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp index 65840b9f20252..1b1da6a1356f2 100644 --- a/clang/lib/Basic/Cuda.cpp +++ b/clang/lib/Basic/Cuda.cpp @@ -39,6 +39,8 @@ static const CudaVersionMapEntry CudaNameVersionMap[] = { CUDA_ENTRY(11, 8), CUDA_ENTRY(12, 0), CUDA_ENTRY(12, 1), +CUDA_ENTRY(12, 2), +CUDA_ENTRY(12, 3), {"", CudaVersion::NEW, llvm::VersionTuple(std::numeric_limits::max())}, {"unknown", CudaVersion::UNKNOWN, {}} // End of list tombstone. }; @@ -93,6 +95,7 @@ static const CudaArchToStringMap arch_names[] = { SM(87), // Jetson/Drive AGX Orin SM(89), // Ada Lovelace SM(90), // Hopper +SM(90a), // Hopper GFX(600), // gfx600 GFX(601), // gfx601 GFX(602), // gfx602 @@ -209,6 +212,8 @@ CudaVersion MinVersionForCudaArch(CudaArch A) { case CudaArch::SM_89: case CudaArch::SM_90: return CudaVersion::CUDA_118; + case CudaArch::SM_90a: +return CudaVersion::CUDA_120; default: llvm_unreachable("invalid enum"); } diff --git a/clang/lib/Basic/Targets/NVPTX.cpp b/clang/lib/Basic/Targets/NVPTX.cpp index 3a4a75b0348f2..5c601812f6175 100644 --- a/clang/lib/Basic/Targets/NVPTX.cpp +++ b/clang/lib/Basic/Targets/NVPTX.cpp @@ -262,11 +262,14 @@ void NVPTXTargetInfo::getTargetDefines(const LangOptions , case
[mlir] [llvm] [openmp] [clang] [flang] [clang-tools-extra] [libcxx] [clang-tidy] Replace memcpy with std::copy (PR #74663)
llvmbot wrote: @llvm/pr-subscribers-clang-tidy Author: Giovanni Martins (giovannism20) Changes #22583 --- Full diff: https://github.com/llvm/llvm-project/pull/74663.diff 7 Files Affected: - (modified) clang-tools-extra/clang-tidy/modernize/CMakeLists.txt (+1) - (modified) clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp (+3) - (added) clang-tools-extra/clang-tidy/modernize/ReplaceMemcpyWithStdCopy.cpp (+119) - (added) clang-tools-extra/clang-tidy/modernize/ReplaceMemcpyWithStdCopy.h (+49) - (modified) clang-tools-extra/docs/ReleaseNotes.rst (+5) - (modified) clang-tools-extra/docs/clang-tidy/checks/list.rst (+1) - (added) clang-tools-extra/docs/clang-tidy/checks/modernize/modernize-replace-memcpy-with-stdcopy.rst (+47) ``diff diff --git a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt index c40065358d2dc3..d0a996d3be7292 100644 --- a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt @@ -22,6 +22,7 @@ add_clang_library(clangTidyModernizeModule RedundantVoidArgCheck.cpp ReplaceAutoPtrCheck.cpp ReplaceDisallowCopyAndAssignMacroCheck.cpp + ReplaceMemcpyWithStdCopy.cpp ReplaceRandomShuffleCheck.cpp ReturnBracedInitListCheck.cpp ShrinkToFitCheck.cpp diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp index e994ffd2a75c85..6bb9efa694eb2f 100644 --- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp @@ -23,6 +23,7 @@ #include "RedundantVoidArgCheck.h" #include "ReplaceAutoPtrCheck.h" #include "ReplaceDisallowCopyAndAssignMacroCheck.h" +#include "ReplaceMemcpyWithStdCopy.h" #include "ReplaceRandomShuffleCheck.h" #include "ReturnBracedInitListCheck.h" #include "ShrinkToFitCheck.h" @@ -78,6 +79,8 @@ class ModernizeModule : public ClangTidyModule { "modernize-replace-auto-ptr"); CheckFactories.registerCheck( "modernize-replace-disallow-copy-and-assign-macro"); +CheckFactories.registerCheck( +"modernize-replace-memcpy-by-stdcopy"); CheckFactories.registerCheck( "modernize-replace-random-shuffle"); CheckFactories.registerCheck( diff --git a/clang-tools-extra/clang-tidy/modernize/ReplaceMemcpyWithStdCopy.cpp b/clang-tools-extra/clang-tidy/modernize/ReplaceMemcpyWithStdCopy.cpp new file mode 100644 index 00..af6b365c162517 --- /dev/null +++ b/clang-tools-extra/clang-tidy/modernize/ReplaceMemcpyWithStdCopy.cpp @@ -0,0 +1,119 @@ +//===--- ReplaceMemcpyWithStdCopy.cpp - clang-tidy*- 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: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "ReplaceMemcpyWithStdCopy.h" +#include "../utils/OptionsUtils.h" +#include + +using namespace clang; +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace modernize { + +ReplaceMemcpyWithStdCopy::ReplaceMemcpyWithStdCopy(StringRef Name, + ClangTidyContext *Context) +: ClangTidyCheck(Name, Context), + IncludeInserter(Options.getLocalOrGlobal("IncludeStyle", + utils::IncludeSorter::IS_LLVM)) { +} + +void ReplaceMemcpyWithStdCopy::registerMatchers(MatchFinder *Finder) { + assert(Finder != nullptr); + + if (!getLangOpts().CPlusPlus) +return; + + auto MemcpyMatcher = + callExpr(hasDeclaration(functionDecl(hasName("memcpy"), + isExpansionInSystemHeader())), + isExpansionInMainFile()) + .bind("memcpy_function"); + + Finder->addMatcher(MemcpyMatcher, this); +} + +void ReplaceMemcpyWithStdCopy::registerPPCallbacks( +const SourceManager , Preprocessor *PP, Preprocessor *ModuleExpanderPP) { + if (!getLangOpts().CPlusPlus) +return; + + Inserter = + std::make_unique(SM, getLangOpts(), + IncludeStyle); + PP->addPPCallbacks(Inserter->CreatePPCallbacks()); +} + +void ReplaceMemcpyWithStdCopy::check(const MatchFinder::MatchResult ) { + const auto *MemcpyNode = Result.Nodes.getNodeAs("memcpy_function"); + assert(MemcpyNode != nullptr); + + DiagnosticBuilder Diag = + diag(MemcpyNode->getExprLoc(), "use std::copy instead of memcpy"); + + renameFunction(Diag, MemcpyNode); + reorderArgs(Diag, MemcpyNode); + insertHeader(Diag, MemcpyNode, Result.SourceManager); +} + +void ReplaceMemcpyWithStdCopy::storeOptions(ClangTidyOptions::OptionMap ) { + Options.store(Opts, "IncludeStyle", +
[mlir] [llvm] [openmp] [clang] [flang] [clang-tools-extra] [libcxx] [clang-tidy] Replace memcpy with std::copy (PR #74663)
https://github.com/giovannism20 ready_for_review https://github.com/llvm/llvm-project/pull/74663 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[lldb] [polly] [mlir] [llvm] [openmp] [clang] [flang] [lld] [compiler-rt] [VPlan] Compute scalable VF in preheader for induction increment. (PR #74762)
https://github.com/ayalz commented: post-commit nit https://github.com/llvm/llvm-project/pull/74762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[lld] [flang] [lldb] [compiler-rt] [mlir] [polly] [clang] [llvm] [openmp] [VPlan] Compute scalable VF in preheader for induction increment. (PR #74762)
@@ -340,8 +340,14 @@ Value *VPInstruction::generateInstruction(VPTransformState , auto *Phi = State.get(getOperand(0), 0); // The loop step is equal to the vectorization factor (num of SIMD // elements) times the unroll factor (num of SIMD instructions). - Value *Step = - createStepForVF(Builder, Phi->getType(), State.VF, State.UF); + Value *Step; + { +BasicBlock *VectorPH = State.CFG.getPreheaderBBFor(this); +IRBuilder<> PHBuilder(VectorPH->getTerminator()); +// Step is loop-invariant, calls to vscale will be placed in the +// preheader. +Step = createStepForVF(PHBuilder, Phi->getType(), State.VF, State.UF); + } ayalz wrote: ```suggestion // Step is loop-invariant, calls to vscale will be placed in the preheader. BasicBlock *VectorPH = State.CFG.getPreheaderBBFor(this); IRBuilder<> PHBuilder(VectorPH->getTerminator()); Value *Step = createStepForVF(PHBuilder, Phi->getType(), State.VF, State.UF); ``` (no need for the bracketed block, which was needed for the point guard.) https://github.com/llvm/llvm-project/pull/74762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[compiler-rt] [mlir] [clang] [lldb] [llvm] [flang] [openmp] [polly] [lld] [VPlan] Compute scalable VF in preheader for induction increment. (PR #74762)
https://github.com/ayalz edited https://github.com/llvm/llvm-project/pull/74762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[compiler-rt] [libc] [clang] [llvm] [clang-tools-extra] [flang] [libcxx] [openmp] [clang-tidy] Add bugprone-move-shared-pointer-contents check. (PR #67467)
@@ -0,0 +1,49 @@ +//===--- MoveSharedPointerContentsCheck.cpp - clang-tidy --===// +// +// 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: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "MoveSharedPointerContentsCheck.h" +#include "../ClangTidyCheck.h" +#include "../utils/Matchers.h" +#include "../utils/OptionsUtils.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang::tidy::bugprone { + +MoveSharedPointerContentsCheck::MoveSharedPointerContentsCheck( +StringRef Name, ClangTidyContext *Context) +: ClangTidyCheck(Name, Context), + SharedPointerClasses(utils::options::parseStringList( + Options.get("SharedPointerClasses", "::std::shared_ptr"))) {} + +void MoveSharedPointerContentsCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher( + callExpr(anyOf(callee(functionDecl(hasName("::std::move"))), + callee(unresolvedLookupExpr(hasAnyDeclaration(namedDecl( + hasUnderlyingDecl(hasName("::std::move"))), + hasArgument(0, anyOf(cxxOperatorCallExpr( +hasOverloadedOperatorName("*"), +callee(cxxMethodDecl(ofClass( +matchers::matchesAnyListedName( +SharedPointerClasses), +unaryOperator(hasOperatorName("*") pizzud wrote: Took me a bit to get a handle on it, but I think I have these cases handled. Thanks for the pointers (pun very much intended!). https://github.com/llvm/llvm-project/pull/67467 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits