[Lldb-commits] [PATCH] D134572: [lldb][test] 2 - Allow multiple precompiled headers in API tests via PCH_CXX_SOURCE

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 23 16:30:02 PDT 2022


Michael137 created this revision.
Michael137 added a reviewer: aprantl.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Currently we only allow a single PCH file to be
specified in an API test since Clang's `-include`
option doesn't accept multple arguments. Instead
add a `include-pch` prefix instead.

**Drive-by change**:

- Rename `PCH_CXX_SOURCE` to `PCH_CXX_SOURCES` to make the variable's usage clearer

**Testing**:

- Confirmed that the dwarfdump with and without the patch are identical for the only API test in the test-suite that uses PCH_CXX_SOURCE


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134572

Files:
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/test/API/lang/cpp/gmodules/basic/Makefile


Index: lldb/test/API/lang/cpp/gmodules/basic/Makefile
===================================================================
--- lldb/test/API/lang/cpp/gmodules/basic/Makefile
+++ lldb/test/API/lang/cpp/gmodules/basic/Makefile
@@ -1,4 +1,4 @@
-PCH_CXX_SOURCE = pch.h
+PCH_CXX_SOURCES = pch.h
 CXX_SOURCES = main.cpp
 CFLAGS_EXTRAS := $(MODULE_DEBUG_INFO_FLAGS)
 
Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===================================================================
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -458,11 +458,11 @@
 endif
 
 #----------------------------------------------------------------------
-# Check if we have a precompiled header
+# Check if we have a precompiled headers
 #----------------------------------------------------------------------
-ifneq "$(strip $(PCH_CXX_SOURCE))" ""
-	PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch)
-	PCHFLAGS = -include $(PCH_CXX_SOURCE)
+ifneq "$(strip $(PCH_CXX_SOURCES))" ""
+	PCH_OUTPUT = $(PCH_CXX_SOURCES:.h=.h.pch)
+	PCHFLAGS = $(addprefix -include-pch , $(PCH_OUTPUT))
 endif
 
 #----------------------------------------------------------------------
@@ -600,11 +600,11 @@
 endif
 
 #----------------------------------------------------------------------
-# Make the precompiled header and compile C++ sources against it
+# Make the precompiled headers and compile C++ sources against it
 #----------------------------------------------------------------------
 
 ifneq "$(PCH_OUTPUT)" ""
-$(PCH_OUTPUT) : $(PCH_CXX_SOURCE)
+$(PCH_OUTPUT) : $(PCH_CXX_SOURCES)
 	$(CXX) $(CXXFLAGS) -x c++-header -o $@ $<
 endif
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134572.462613.patch
Type: text/x-patch
Size: 1676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220923/5bdd1757/attachment.bin>


More information about the lldb-commits mailing list