[Lldb-commits] [lldb] [WIP] [lldb][ClangExpressionParser] Set BuiltinHeadersInSystemModules depending on SDK version (PR #101778)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/101778 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)
https://github.com/mizvekov edited https://github.com/llvm/llvm-project/pull/101858 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)
https://github.com/mizvekov updated https://github.com/llvm/llvm-project/pull/101858 >From 1c6bfceea2a50b822a111996a481afe8fb8e522d Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Sun, 23 Oct 2022 16:57:12 +0200 Subject: [PATCH] [clang] Reland: Instantiate alias templates with sugar This makes use of the changes introduced in D134604, in order to instantiate alias templates witn a final sugared substitution. This comes at no additional relevant cost. Since we don't track / unique them in specializations, we wouldn't be able to resugar them later anyway. Differential Revision: https://reviews.llvm.org/D136565 --- .../clangd/unittests/HoverTests.cpp | 2 +- .../unused-local-non-trivial-variable.cpp | 2 +- clang/docs/ReleaseNotes.rst | 2 + clang/lib/Sema/SemaTemplate.cpp | 4 +- clang/test/AST/ast-dump-template-decls.cpp| 35 +++--- clang/test/CXX/temp/temp.deduct.guide/p3.cpp | 2 +- .../test/Misc/diag-template-diffing-cxx11.cpp | 21 +++--- clang/test/SemaCXX/nullability.cpp| 4 +- clang/test/SemaCXX/sizeless-1.cpp | 2 +- .../SemaHLSL/VectorOverloadResolution.hlsl| 10 +-- clang/test/SemaTemplate/deduction-guide.cpp | 70 +-- clang/test/SemaTemplate/make_integer_seq.cpp | 8 +-- clang/test/SemaTemplate/temp_arg_nontype.cpp | 2 +- .../shared_ptr/TestSharedPtrFromStdModule.py | 6 +- .../TestDbgInfoContentWeakPtrFromStdModule.py | 2 +- .../weak_ptr/TestWeakPtrFromStdModule.py | 6 +- 16 files changed, 77 insertions(+), 101 deletions(-) diff --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp b/clang-tools-extra/clangd/unittests/HoverTests.cpp index 8d6d4223d7260..69f6df46c87ce 100644 --- a/clang-tools-extra/clangd/unittests/HoverTests.cpp +++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp @@ -1325,7 +1325,7 @@ class Foo final {})cpp"; HI.LocalScope = ""; HI.Kind = index::SymbolKind::TypeAlias; HI.Definition = "template using AA = A"; - HI.Type = {"A", "type-parameter-0-0"}; // FIXME: should be 'T' + HI.Type = {"A", "T"}; HI.TemplateParameters = { {{"typename"}, std::string("T"), std::nullopt}}; }}, diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp index 3fdc24b94a6cb..721c55b1fb538 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp @@ -76,7 +76,7 @@ T qux(T Generic) { async::Future TemplateType; // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: unused local variable 'TemplateType' of type 'async::Future' [bugprone-unused-local-non-trivial-variable] a::Future AliasTemplateType; -// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: unused local variable 'AliasTemplateType' of type 'a::Future' (aka 'Future') [bugprone-unused-local-non-trivial-variable] +// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: unused local variable 'AliasTemplateType' of type 'a::Future' (aka 'Future') [bugprone-unused-local-non-trivial-variable] [[maybe_unused]] async::Future MaybeUnused; return Generic; } diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 6202597d1aaf1..dcef930b4e4ef 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -149,6 +149,8 @@ Improvements to Clang's diagnostics - -Wdangling-assignment-gsl is enabled by default. - Clang now does a better job preserving the template arguments as written when specializing concepts. +- Clang now always preserves the template arguments as written used + to specialize template type aliases. Improvements to Clang's time-trace -- diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 720862ec0bffa..1346a4a3f0012 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -3334,8 +3334,8 @@ QualType Sema::CheckTemplateIdType(TemplateName Name, // Only substitute for the innermost template argument list. MultiLevelTemplateArgumentList TemplateArgLists; -TemplateArgLists.addOuterTemplateArguments(Template, CanonicalConverted, - /*Final=*/false); +TemplateArgLists.addOuterTemplateArguments(Template, SugaredConverted, + /*Final=*/true); TemplateArgLists.addOuterRetainedLevels( AliasTemplate->getTemplateParameters()->getDepth()); diff --git a/clang/test/AST/ast-dump-template-decls.cpp b/clang/test/AST/ast-dump-template-decls.cpp index f0a6204ce3cfa..9f578e5afe561 100644 --- a/clang/test/AST/ast-dump-template-decls.cpp +++ b/clang/test/AST/ast-dump-template-decls.cpp @@ -123,8
[Lldb-commits] [lldb] New ThreadPlanSingleThreadTimeout to resolve potential deadlock in single thread stepping (PR #90930)
jeffreytan81 wrote: @jimingham, it has been a while. Any other major changes you want to see? Thanks https://github.com/llvm/llvm-project/pull/90930 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 7f78f99 - [clang] Reland: Instantiate alias templates with sugar (#101858)
Author: Matheus Izvekov Date: 2024-08-04T23:28:54-03:00 New Revision: 7f78f99fe5af82361d37adcbd2daa4d04afba13d URL: https://github.com/llvm/llvm-project/commit/7f78f99fe5af82361d37adcbd2daa4d04afba13d DIFF: https://github.com/llvm/llvm-project/commit/7f78f99fe5af82361d37adcbd2daa4d04afba13d.diff LOG: [clang] Reland: Instantiate alias templates with sugar (#101858) This makes use of the changes introduced in D134604, in order to instantiate alias templates witn a final sugared substitution. This comes at no additional relevant cost. Since we don't track / unique them in specializations, we wouldn't be able to resugar them later anyway. Differential Revision: https://reviews.llvm.org/D136565 Added: Modified: clang-tools-extra/clangd/unittests/HoverTests.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaTemplate.cpp clang/test/AST/ast-dump-template-decls.cpp clang/test/CXX/temp/temp.deduct.guide/p3.cpp clang/test/Misc/diag-template-diffing-cxx11.cpp clang/test/SemaCXX/nullability.cpp clang/test/SemaCXX/sizeless-1.cpp clang/test/SemaHLSL/VectorOverloadResolution.hlsl clang/test/SemaTemplate/deduction-guide.cpp clang/test/SemaTemplate/make_integer_seq.cpp clang/test/SemaTemplate/temp_arg_nontype.cpp lldb/test/API/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py lldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py lldb/test/API/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py Removed: diff --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp b/clang-tools-extra/clangd/unittests/HoverTests.cpp index 8d6d4223d7260..69f6df46c87ce 100644 --- a/clang-tools-extra/clangd/unittests/HoverTests.cpp +++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp @@ -1325,7 +1325,7 @@ class Foo final {})cpp"; HI.LocalScope = ""; HI.Kind = index::SymbolKind::TypeAlias; HI.Definition = "template using AA = A"; - HI.Type = {"A", "type-parameter-0-0"}; // FIXME: should be 'T' + HI.Type = {"A", "T"}; HI.TemplateParameters = { {{"typename"}, std::string("T"), std::nullopt}}; }}, diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp index 3fdc24b94a6cb..721c55b1fb538 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp @@ -76,7 +76,7 @@ T qux(T Generic) { async::Future TemplateType; // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: unused local variable 'TemplateType' of type 'async::Future' [bugprone-unused-local-non-trivial-variable] a::Future AliasTemplateType; -// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: unused local variable 'AliasTemplateType' of type 'a::Future' (aka 'Future') [bugprone-unused-local-non-trivial-variable] +// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: unused local variable 'AliasTemplateType' of type 'a::Future' (aka 'Future') [bugprone-unused-local-non-trivial-variable] [[maybe_unused]] async::Future MaybeUnused; return Generic; } diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 6202597d1aaf1..dcef930b4e4ef 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -149,6 +149,8 @@ Improvements to Clang's diagnostics - -Wdangling-assignment-gsl is enabled by default. - Clang now does a better job preserving the template arguments as written when specializing concepts. +- Clang now always preserves the template arguments as written used + to specialize template type aliases. Improvements to Clang's time-trace -- diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 720862ec0bffa..1346a4a3f0012 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -3334,8 +3334,8 @@ QualType Sema::CheckTemplateIdType(TemplateName Name, // Only substitute for the innermost template argument list. MultiLevelTemplateArgumentList TemplateArgLists; -TemplateArgLists.addOuterTemplateArguments(Template, CanonicalConverted, - /*Final=*/false); +TemplateArgLists.addOuterTemplateArguments(Template, SugaredConverted, + /*Final=*/true); TemplateArgLists.addOuterRetainedLevels( AliasTemplate->getTemplateParameters()->getDepth()); diff --git a/clang/test/AST/ast-dump-template-de
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [clang] Reland: Instantiate alias templates with sugar (PR #101858)
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/101858 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)
@@ -0,0 +1,108 @@ +""" +Test python scripted platform in lldb +""" + +import os, shutil + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil +from lldbsuite.test import lldbtest + + +class ScriptedPlatformTestCase(TestBase): +NO_DEBUG_INFO_TESTCASE = True + +@skipUnlessDarwin +def test_python_plugin_package(self): +"""Test that the lldb python module has a `plugins.scripted_platform` +package.""" +self.expect( +"script import lldb.plugins", +substrs=["ModuleNotFoundError"], +matching=False, +) + +self.expect("script dir(lldb.plugins)", substrs=["scripted_platform"]) + +self.expect( +"script import lldb.plugins.scripted_platform", +substrs=["ModuleNotFoundError"], +matching=False, +) + +self.expect( +"script dir(lldb.plugins.scripted_platform)", substrs=["ScriptedPlatform"] +) + +self.expect( +"script from lldb.plugins.scripted_platform import ScriptedPlatform", +substrs=["ImportError"], +matching=False, +) + +self.expect( +"script dir(ScriptedPlatform)", +substrs=[ +"attach_to_process", +"kill_process", +"launch_process", +"list_processes", +], +) + +@skipUnlessDarwin +def test_list_processes(self): +"""Test that we can load and select an lldb scripted platform using the +SBAPI, check its process ID, parent, name & triple. +""" +os.environ["SKIP_SCRIPTED_PLATFORM_SELECT"] = "1" + +def cleanup(): +del os.environ["SKIP_SCRIPTED_PLATFORM_SELECT"] + +self.addTearDownHook(cleanup) medismailben wrote: I understand your point of view, I actually got comments from other people (@JDevlieghere) about this and I've been doing it in other scripted extension tests (i.e. `scripted process`). Now that I'm not iterating on them anymore, I can remove these environment variables from all the tests but I prefer doing in a follow-up. https://github.com/llvm/llvm-project/pull/99814 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #99736)
rocallahan wrote: @clayborg as far as I can tell, the ball is currently in your court to respond to @jimingham ... thanks in advance https://github.com/llvm/llvm-project/pull/99736 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)
@@ -1003,6 +1010,21 @@ class Platform : public PluginInterface { FileSpec GetModuleCacheRoot(); }; +class PlatformMetadata { +public: + PlatformMetadata(Debugger &debugger, const ScriptedMetadata metadata); + ~PlatformMetadata() = default; + + Debugger &GetDebugger() const { return m_debugger; } + const ScriptedMetadata GetScriptedMetadata() const { +return m_scripted_metadata; + } + +protected: + Debugger &m_debugger; medismailben wrote: I don't see how passing the debugger vs. the script interpreter would make a difference if the scripted platform was created with one debugger and copied to another debugger platform's list. Even if I held on the script interpreter from the first debugger, once copied to the other one, the scripted platform will still interact with the script interpreter from the first one, which is basically the same as holding to the debugger. Am I understanding that correctly? I'm not sure if this is a scenario we want to support, may be @jimingham would have some opinions about this. @labath if you have some ideas how to support this scenario, I'd love to be convinced :) https://github.com/llvm/llvm-project/pull/99814 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)
@@ -180,7 +184,19 @@ class CommandObjectPlatformSelect : public CommandObjectParsed { m_interpreter, ArchSpec(), select, error, platform_arch)); if (platform_sp) { GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp); - + OptionGroupPythonClassWithDict &script_class_opts = medismailben wrote: So `Platform::SetMetadata` returns void, but `Platform::ReloadMetadata` returns an `llvm::Error` as you can see down below (line 196). When setting it from the command line, the user will see an error message and the command interpreter however from the SBAPI, since this is called from the `SBPlatform` constructor, there is no way to do error reporting (without adding an overload for the constructor), so the error is consumed and logged to the `lldb platform` channel. https://github.com/llvm/llvm-project/pull/99814 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/Plugins] Introduce Scripted Platform Plugin (PR #99814)
https://github.com/medismailben edited https://github.com/llvm/llvm-project/pull/99814 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits