Skip to content

Revert "[lldb] Fix the way we set up the lldb modules infrastructure." #66271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

bnbarham
Copy link
Contributor

This reverts commit c95a0c9.

#65683 split -fincremental-extensions and IncrementalProcessing such that IncrementalProcessing can be used to extend the lifetime of various datastructures without parsing changes. LLDB really should not be parsing any differently to a regular compile, so switch back to using just IncrementalProcessing.

This reverts commit c95a0c9.

llvm#65683 split `-fincremental-extensions` and `IncrementalProcessing`
such that `IncrementalProcessing` can be used to extend the lifetime of
various datastructures without parsing changes. LLDB really should not
be parsing any differently to a regular compile, so switch back to using
just `IncrementalProcessing`.
@bnbarham bnbarham requested a review from a team as a code owner September 13, 2023 18:29
@llvmbot llvmbot added the lldb label Sep 13, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 13, 2023

@llvm/pr-subscribers-lldb

Changes This reverts commit c95a0c9.

#65683 split -fincremental-extensions and IncrementalProcessing such that IncrementalProcessing can be used to extend the lifetime of various datastructures without parsing changes. LLDB really should not be parsing any differently to a regular compile, so switch back to using just IncrementalProcessing.

Full diff: https://github.com/llvm/llvm-project/pull/66271.diff

2 Files Affected:

  • (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (+2-1)
  • (modified) lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py (+1-1)
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 5ce0d35378230cf..86d5ca1b125df3f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -670,7 +670,6 @@ ClangModulesDeclVendor::Create(Target &target) {
       arch.GetTriple().str(),
       "-fmodules-validate-system-headers",
       "-Werror=non-modular-include-in-framework-module",
-      "-Xclang=-fincremental-extensions",
       "-Rmodule-build"};
 
   target.GetPlatform()->AddClangModuleCompilationOptions(
@@ -765,6 +764,8 @@ ClangModulesDeclVendor::Create(Target &target) {
                                instance->getFrontendOpts().Inputs[0]))
     return nullptr;
 
+  instance->getPreprocessor().enableIncrementalProcessing();
+
   instance->createASTReader();
 
   instance->createSema(action->getTranslationUnitKind(), nullptr);
diff --git a/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py b/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
index 36e302be2525b51..db6d74bfdb540a5 100644
--- a/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
+++ b/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
@@ -21,7 +21,7 @@ def test(self):
             "expr @import LLDBTestModule",
             error=True,
             substrs=[
-                "module.h:4:1: error: use of undeclared identifier 'syntax_error_for_lldb_to_find'",
+                "module.h:4:1: error: unknown type name 'syntax_error_for_lldb_to_find'",
                 "syntax_error_for_lldb_to_find // comment that tests source printing",
                 "could not build module 'LLDBTestModule'",
             ],

@bnbarham bnbarham force-pushed the revert-lldb-incremental-extensions branch from 2f65db8 to 88cf0b4 Compare September 13, 2023 18:32
@bnbarham bnbarham requested review from a team as code owners September 13, 2023 18:32
@llvmbot llvmbot added clang Clang issues not falling into any other category compiler-rt labels Sep 13, 2023
@bnbarham bnbarham removed clang:headers Headers provided by Clang, e.g. for intrinsics clang:modules C++20 modules and Clang Header Modules clang:codegen IR generation bugs: mangling, exceptions, etc. clang:static analyzer debuginfo lld:MachO lld:ELF lld:COFF lld:wasm PGO Profile Guided Optimizations platform:windows flang Flang issues not falling into any other category coroutines C++20 coroutines clang:dataflow Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html backend:loongarch compiler-rt:sanitizer flang:fir-hlfir flang:openmp github:workflow labels Sep 13, 2023
@bnbarham
Copy link
Contributor Author

Sorry about the noise here. I accidentally pushed over the same branch name.

@bnbarham
Copy link
Contributor Author

Isn't that a better way to support the expression parsing logic where we execute statements on the global scope to evaluate their results?

This is currently enabled during module loading, where we definitely don't want any change in behavior IMO. Perhaps we could enable it after? If we think this is useful to keep I'll need to look into how #65683 broke LLDB testing:

lldb-api.commands/expression/diagnostics.TestExprDiagnostics.py
lldb-api.lang/objc/modules.TestObjCModules.py
lldb-api.lang/objc/modules-incomplete.TestIncompleteModules.py
lldb-api.lang/objc/modules-non-objc-target.TestObjCModulesNonObjCTarget.py
lldb-api.lang/objc/modules-objc-property.TestModulesObjCProperty.py

That change should effectively be NFC as far as -fincremental-extensions is concerned, so if you have any ideas that would be appreciated :)

@vgvassilev
Copy link
Contributor

@bnbarham, I think it would be useful to keep it.

If we think this is useful to keep I'll need to look into how #65683 broke LLDB testing:

Incremental processing should also enable the llvm expression parser workflows. The advantage is that now we can write tests against clang-repl which combines the clang frontend and the llvm jit. If we capture the lldb workflows in these tests we will reduce the amount of regressions that inadvertently happen because of these two components are not tested together.

That change should effectively be NFC as far as -fincremental-extensions is concerned, so if you have any ideas that would be appreciated :)

If you can provide links to the failing tests I can take a look.

@bnbarham
Copy link
Contributor Author

If you can provide links to the failing tests I can take a look.

https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/60022/

@vgvassilev
Copy link
Contributor

Does that PR fix the tests you mentioned?

@bnbarham
Copy link
Contributor Author

Sorry, which PR? #66281 is a revert of #65683 which caused the failures to begin with. The only non-NFC part of that PR is https://github.com/llvm/llvm-project/pull/65683/files#diff-5c51bae1966e0b475927bfa75751eb83db5d90f828aa825cb24f40dea653c408R714-R715. If I remove the if there, these tests start passing too.

IIRC not having that change caused failures elsewhere... Checking that now.

@bnbarham
Copy link
Contributor Author

Everything seems to work fine without it, so I'll put up that PR again without that check and close this PR.

@bnbarham bnbarham closed this Sep 14, 2023
@bnbarham bnbarham deleted the revert-lldb-incremental-extensions branch September 14, 2023 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants