llvm.org GIT mirror llvm / 5819430
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 Daniel Dunbar 8 years ago
3 changed file(s) with 91 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
167167 install-clang-c: install
168168 install-libs: install
169169
170 # If SHOW_DIAGNOSTICS is enabled, clear the diagnostics file first.
171 ifeq ($(SHOW_DIAGNOSTICS),1)
172 clean-diagnostics:
173 $(Verb) rm -f $(LLVM_OBJ_ROOT)/$(BuildMode)/diags
174 .PHONY: clean-diagnostics
175
176 all-local:: clean-diagnostics
177 endif
178
170179 #------------------------------------------------------------------------
171180 # Make sure the generated headers are up-to-date. This must be kept in
172181 # sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
197206 $(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
198207 $(Echo) '*****' make an optimized build. Alternatively you can
199208 $(Echo) '*****' configure with --enable-optimized.
209 ifeq ($(SHOW_DIAGNOSTICS),1)
210 $(Verb) if test -s $(LLVM_OBJ_ROOT)/$(BuildMode)/diags; then \
211 $(LLVM_SRC_ROOT)/utils/show-diagnostics \
212 $(LLVM_OBJ_ROOT)/$(BuildMode)/diags; \
213 fi
214 endif
200215 endif
201216 endif
202217
645645 $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \
646646 $(CPP.BaseFlags)
647647
648 # SHOW_DIAGNOSTICS support.
649 ifeq ($(SHOW_DIAGNOSTICS),1)
650 Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \
651 CC_LOG_DIAGNOSTICS_FILE="$(LLVM_OBJ_ROOT)/$(BuildMode)/diags"
652 else
653 Compile.Wrapper :=
654 endif
655
648656 ifeq ($(BUILD_COMPONENT), 1)
649 Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
657 Compile.C = $(Compile.Wrapper) \
658 $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
650659 $(TargetCommonOpts) $(CompileCommonOpts) -c
651 Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
660 Compile.CXX = $(Compile.Wrapper) \
661 $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
652662 $(CPPFLAGS) \
653663 $(TargetCommonOpts) $(CompileCommonOpts) -c
654 Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
664 Preprocess.CXX= $(Compile.Wrapper) \
665 $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \
655666 $(CompileCommonOpts) $(CXX.Flags) -E
656 Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
667 Link = $(Compile.Wrapper) \
668 $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
657669 $(LD.Flags) $(LDFLAGS) \
658670 $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
659671 else
660 Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
672 Compile.C = $(Compile.Wrapper) \
673 $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
661674 $(TargetCommonOpts) $(CompileCommonOpts) -c
662 Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
675 Compile.CXX = $(Compile.Wrapper) \
676 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
663677 $(TargetCommonOpts) $(CompileCommonOpts) -c
664 Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
678 Preprocess.CXX= $(Compile.Wrapper) \
679 $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \
665680 $(CompileCommonOpts) $(CXX.Flags) -E
666 Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
681 Link = $(Compile.Wrapper) \
682 $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \
667683 $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip)
668684 endif
669685
0 #!/usr/bin/env python
1
2 import plistlib
3
4 def main():
5 from optparse import OptionParser, OptionGroup
6 parser = OptionParser("""\
7 usage: %prog [options]
8
9 Utility for dumping Clang-style logged diagnostics.\
10 """)
11 (opts, args) = parser.parse_args()
12
13 if len(args) != 1:
14 parser.error("invalid number of arguments")
15
16 path, = args
17
18 # Read the diagnostics log.
19 f = open(path)
20 try:
21 data = f.read()
22 finally:
23 f.close()
24
25 # Complete the plist (the log itself is just the chunks).
26 data = """\
27
28
29 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
30
31
32 %s
33
34 """ % data
35
36 # Load the diagnostics.
37 diags = plistlib.readPlistFromString(data)
38
39 # Print out the diagnostics.
40 print
41 print "**** BUILD DIAGNOSTICS ****"
42 for i, file_diags in enumerate(diags):
43 file = file_diags.get('main-file')
44 print "*** %s ***" % file
45 for d in file_diags.get('diagnostics', ()):
46 print "%s:%s:%s: %s: %s" % (
47 d.get('filename'), d.get('line'), d.get('column'),
48 d.get('level'), d.get('message'))
49
50 if __name__ == "__main__":
51 main()