[Lldb-commits] [lldb] c95a0c9 - [lldb] Fix the way we set up the lldb modules infrastructure.

Vassil Vassilev via lldb-commits lldb-commits at lists.llvm.org
Sun Dec 4 23:39:26 PST 2022


Author: Vassil Vassilev
Date: 2022-12-05T07:39:19Z
New Revision: c95a0c91c0de66eb1066f23c69332522656f188e

URL: https://github.com/llvm/llvm-project/commit/c95a0c91c0de66eb1066f23c69332522656f188e
DIFF: https://github.com/llvm/llvm-project/commit/c95a0c91c0de66eb1066f23c69332522656f188e.diff

LOG: [lldb] Fix the way we set up the lldb modules infrastructure.

D127284 introduced a new language option which is not benign from modules
perspective. Before this patch lldb would set up the compiler invocation and
later enable incremental processing. Post-D127284 this does not work because
the option causes a module hash mismatch for implicit modules.

In addition, D127284 enables parsing statements on the global scope if
incremental processing is on and thus `syntax_error_for_lldb_to_find` was
rightfully not recognized as a declaration and is considered a statement
which produces a slightly different diagnostic.

Thanks to Michael Buch for the help in understanding this issue. This patch
should appease the lldb bots.

More discussion available at: https://reviews.llvm.org/D127284

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
    lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index ec4e9f12fc974..eea21f3f05fc9 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -609,7 +609,8 @@ ClangModulesDeclVendor::Create(Target &target) {
       "-target",
       arch.GetTriple().str(),
       "-fmodules-validate-system-headers",
-      "-Werror=non-modular-include-in-framework-module"};
+      "-Werror=non-modular-include-in-framework-module",
+      "-Xclang=-fincremental-extensions"};
 
   target.GetPlatform()->AddClangModuleCompilationOptions(
       &target, compiler_invocation_arguments);
@@ -701,8 +702,6 @@ 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 9a5cb257601da..45296ab4bf035 100644
--- a/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
+++ b/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py
@@ -16,6 +16,6 @@ def test(self):
         # Check that the error message shows file/line/column, prints the relevant
         # line from the source code and mentions the module that failed to build.
         self.expect("expr @import LLDBTestModule", error=True,
-                    substrs=["module.h:4:1: error: unknown type name 'syntax_error_for_lldb_to_find'",
+                    substrs=["module.h:4:1: error: undeclared identifier 'syntax_error_for_lldb_to_find'",
                              "syntax_error_for_lldb_to_find // comment that tests source printing",
                              "could not build module 'LLDBTestModule'"])


        


More information about the lldb-commits mailing list