[Lldb-commits] [PATCH] D42277: Use test-specific module caches to avoid stale header conflicts

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 18 19:05:30 PST 2018


vsk created this revision.
vsk added reviewers: aprantl, davide, jasonmolenda, labath.
Herald added a subscriber: eraman.

Stale global module caches cause problems for the bots. The modules
become invalid when clang headers are updated by version control, and
tests which use these modules fail to compile, e.g:

  fatal error: file '.../__stddef_max_align_t.h' has been modified since the module file '/var/.../Darwin.pcm' was built
  note: please rebuild precompiled header '/var/.../Darwin.pcm'

Eventually we should transition to having just a single module cache to speed
tests up. This patch should be just enough to fix the spurious bot failures due
to stale caches.

rdar://36479805


https://reviews.llvm.org/D42277

Files:
  packages/Python/lldbsuite/test/lang/objc/modules-auto-import/Makefile
  packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
  packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/Makefile
  packages/Python/lldbsuite/test/make/Makefile.rules


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===================================================================
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -237,13 +237,15 @@
 	CFLAGS += -gsplit-dwarf
 endif
 
+CLANG_MODULE_CACHE_DIR := module-cache
+
+MANDATORY_MODULE_BUILD_CFLAGS := -fmodules -fmodules-cache-path=$(CLANG_MODULE_CACHE_DIR)
+
 ifeq "$(MAKE_GMODULES)" "YES"
-	CFLAGS += -fmodules -gmodules
+	CFLAGS += -gmodules $(MANDATORY_MODULE_BUILD_CFLAGS)
 endif
 
-CXXFLAGS += -std=c++11
-# FIXME: C++ modules aren't supported on all platforms.
-CXXFLAGS += $(subst -fmodules,, $(CFLAGS))
+CXXFLAGS += -std=c++11 $(CFLAGS)
 LD = $(CC)
 LDFLAGS ?= $(CFLAGS)
 LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)
@@ -636,7 +638,7 @@
 dsym:	$(DSYM)
 all:	$(EXE) $(DSYM)
 clean::
-	$(RM) $(OBJECTS) $(PREREQS) $(PREREQS:.d=.d.tmp) $(DWOS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS)
+	$(RM) -rf $(OBJECTS) $(PREREQS) $(PREREQS:.d=.d.tmp) $(DWOS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) $(CLANG_MODULE_CACHE_DIR)
 ifneq "$(DYLIB_NAME)" ""
 	$(RM) -r $(DYLIB_FILENAME).dSYM
 	$(RM) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_PREREQS:.d=.d.tmp) $(DYLIB_DWOS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).debug
Index: packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/Makefile
===================================================================
--- packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/Makefile
+++ packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/Makefile
@@ -6,4 +6,4 @@
 
 include $(LEVEL)/Makefile.rules
 
-CFLAGS += -fmodules -I$(PWD)
+CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(PWD)
Index: packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
===================================================================
--- packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
+++ packages/Python/lldbsuite/test/lang/objc/modules-incomplete/Makefile
@@ -4,5 +4,5 @@
 
 include $(LEVEL)/Makefile.rules
 
-CFLAGS += -fmodules -I$(PWD)
+CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(PWD)
 LDFLAGS += -framework Foundation
Index: packages/Python/lldbsuite/test/lang/objc/modules-auto-import/Makefile
===================================================================
--- packages/Python/lldbsuite/test/lang/objc/modules-auto-import/Makefile
+++ packages/Python/lldbsuite/test/lang/objc/modules-auto-import/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 OBJC_SOURCES := main.m
 
-CFLAGS += -fmodules -gmodules -g
+CFLAGS += -gmodules $(MANDATORY_MODULE_BUILD_CFLAGS)
 
 include $(LEVEL)/Makefile.rules


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42277.130538.patch
Type: text/x-patch
Size: 2642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180119/68c1deb4/attachment-0001.bin>


More information about the lldb-commits mailing list