mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
build: Add support for a SHOW_DIAGNOSTICS build variable.
If enabled, this will attempt to use the CC_LOG_DIAGNOSTICS feature I dropped into Clang to print a log of all the diagnostics generated during an individual build (from the top-level). Not sure if this will actually be useful, but for now it is handy for testing the option. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129312 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3d820baf19
commit
58194307c1
15
Makefile
15
Makefile
@ -168,6 +168,15 @@ install-clang: install
|
|||||||
install-clang-c: install
|
install-clang-c: install
|
||||||
install-libs: install
|
install-libs: install
|
||||||
|
|
||||||
|
# If SHOW_DIAGNOSTICS is enabled, clear the diagnostics file first.
|
||||||
|
ifeq ($(SHOW_DIAGNOSTICS),1)
|
||||||
|
clean-diagnostics:
|
||||||
|
$(Verb) rm -f $(LLVM_OBJ_ROOT)/$(BuildMode)/diags
|
||||||
|
.PHONY: clean-diagnostics
|
||||||
|
|
||||||
|
all-local:: clean-diagnostics
|
||||||
|
endif
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
# Make sure the generated headers are up-to-date. This must be kept in
|
# Make sure the generated headers are up-to-date. This must be kept in
|
||||||
# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
|
# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
|
||||||
@ -198,6 +207,12 @@ ifneq ($(ENABLE_OPTIMIZED),1)
|
|||||||
$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
|
$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
|
||||||
$(Echo) '*****' make an optimized build. Alternatively you can
|
$(Echo) '*****' make an optimized build. Alternatively you can
|
||||||
$(Echo) '*****' configure with --enable-optimized.
|
$(Echo) '*****' configure with --enable-optimized.
|
||||||
|
ifeq ($(SHOW_DIAGNOSTICS),1)
|
||||||
|
$(Verb) if test -s $(LLVM_OBJ_ROOT)/$(BuildMode)/diags; then \
|
||||||
|
$(LLVM_SRC_ROOT)/utils/show-diagnostics \
|
||||||
|
$(LLVM_OBJ_ROOT)/$(BuildMode)/diags; \
|
||||||
|
fi
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -646,25 +646,41 @@ CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
|
|||||||
$(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
|
$(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
|
||||||
$(CPP.BaseFlags)
|
$(CPP.BaseFlags)
|
||||||
|
|
||||||
|
# SHOW_DIAGNOSTICS support.
|
||||||
|
ifeq ($(SHOW_DIAGNOSTICS),1)
|
||||||
|
Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
|
||||||
|
CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
|
||||||
|
else
|
||||||
|
Compile.Wrapper :=
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(BUILD_COMPONENT), 1)
|
ifeq ($(BUILD_COMPONENT), 1)
|
||||||
Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
|
Compile.C = $(Compile.Wrapper) \
|
||||||
|
$(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
|
||||||
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
||||||
Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
|
Compile.CXX = $(Compile.Wrapper) \
|
||||||
|
$(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
|
||||||
$(CPPFLAGS) \
|
$(CPPFLAGS) \
|
||||||
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
||||||
Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
|
Preprocess.CXX= $(Compile.Wrapper) \
|
||||||
|
$(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
|
||||||
$(CompileCommonOpts) $(CXX.Flags) -E
|
$(CompileCommonOpts) $(CXX.Flags) -E
|
||||||
Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
|
Link = $(Compile.Wrapper) \
|
||||||
|
$(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
|
||||||
$(LD.Flags) $(LDFLAGS) \
|
$(LD.Flags) $(LDFLAGS) \
|
||||||
$(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
|
$(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
|
||||||
else
|
else
|
||||||
Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
|
Compile.C = $(Compile.Wrapper) \
|
||||||
|
$(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
|
||||||
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
||||||
Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
|
Compile.CXX = $(Compile.Wrapper) \
|
||||||
|
$(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
|
||||||
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
$(TargetCommonOpts) $(CompileCommonOpts) -c
|
||||||
Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
|
Preprocess.CXX= $(Compile.Wrapper) \
|
||||||
|
$(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
|
||||||
$(CompileCommonOpts) $(CXX.Flags) -E
|
$(CompileCommonOpts) $(CXX.Flags) -E
|
||||||
Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
|
Link = $(Compile.Wrapper) \
|
||||||
|
$(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
|
||||||
$(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
|
$(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
52
utils/show-diagnostics
Executable file
52
utils/show-diagnostics
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import plistlib
|
||||||
|
|
||||||
|
def main():
|
||||||
|
from optparse import OptionParser, OptionGroup
|
||||||
|
parser = OptionParser("""\
|
||||||
|
usage: %prog [options] <path>
|
||||||
|
|
||||||
|
Utility for dumping Clang-style logged diagnostics.\
|
||||||
|
""")
|
||||||
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
|
if len(args) != 1:
|
||||||
|
parser.error("invalid number of arguments")
|
||||||
|
|
||||||
|
path, = args
|
||||||
|
|
||||||
|
# Read the diagnostics log.
|
||||||
|
f = open(path)
|
||||||
|
try:
|
||||||
|
data = f.read()
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
# Complete the plist (the log itself is just the chunks).
|
||||||
|
data = """\
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
|
||||||
|
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<array>
|
||||||
|
%s
|
||||||
|
</array>
|
||||||
|
</plist>""" % data
|
||||||
|
|
||||||
|
# Load the diagnostics.
|
||||||
|
diags = plistlib.readPlistFromString(data)
|
||||||
|
|
||||||
|
# Print out the diagnostics.
|
||||||
|
print
|
||||||
|
print "**** BUILD DIAGNOSTICS ****"
|
||||||
|
for i, file_diags in enumerate(diags):
|
||||||
|
file = file_diags.get('main-file')
|
||||||
|
print "*** %s ***" % file
|
||||||
|
for d in file_diags.get('diagnostics', ()):
|
||||||
|
print "%s:%s:%s: %s: %s" % (
|
||||||
|
d.get('filename'), d.get('line'), d.get('column'),
|
||||||
|
d.get('level'), d.get('message'))
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user