Title: [290149] trunk
Revision
290149
Author
[email protected]
Date
2022-02-18 12:06:08 -0800 (Fri, 18 Feb 2022)

Log Message

Generate compile_commands.json on macOS Builds
https://bugs.webkit.org/show_bug.cgi?id=235686

Patch by Brandon Stewart <[email protected]> on 2022-02-18
Reviewed by Saam Barati.

Add support for generating compile_commands.json file to WebKit.

compile_commands.json can be used by tools like clangd to provide code complete,
refactoring, formatting, and cross references.

Steps to generate the compile commands file:
make r EXPORT_COMPILE_COMMANDS=YES
generate-compile-commands WebKitBuild/Release

.:

* Makefile.shared:

PerformanceTests:

* DecoderTest/Configurations/DebugRelease.xcconfig:
* MediaTime/Configurations/DebugRelease.xcconfig:

Source/bmalloc:

* Configurations/DebugRelease.xcconfig:

Source/_javascript_Core:

* Configurations/DebugRelease.xcconfig:

Source/ThirdParty/ANGLE:

* Configurations/DebugRelease.xcconfig:

Source/ThirdParty/libwebrtc:

* Configurations/DebugRelease.xcconfig:

Source/WebCore:

* Configurations/DebugRelease.xcconfig:

Source/WebCore/PAL:

* Configurations/DebugRelease.xcconfig:

Source/WebGPU:

* Configurations/DebugRelease.xcconfig:

Source/WebInspectorUI:

* Configurations/DebugRelease.xcconfig:

Source/WebKit:

* Configurations/DebugRelease.xcconfig:
* UIProcess/API/C/WKPageUIClient.h:

Source/WebKitLegacy/mac:

* Configurations/DebugRelease.xcconfig:

Source/WTF:

* Configurations/DebugRelease.xcconfig:

Tools:

* ContentExtensionTester/Configurations/DebugRelease.xcconfig:
* DumpRenderTree/mac/Configurations/DebugRelease.xcconfig:
* ImageDiff/cg/Configurations/DebugRelease.xcconfig:
* MiniBrowser/Configurations/DebugRelease.xcconfig:
* Scripts/build-jsc:
* Scripts/build-webkit:
* Scripts/generate-compile-commands: Added.
* TestWebKitAPI/Configurations/DebugRelease.xcconfig:
* WebEditingTester/Configurations/DebugRelease.xcconfig:
* WebKitTestRunner/Configurations/DebugRelease.xcconfig:
* lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig:

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (290148 => 290149)


--- trunk/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Makefile.shared:
+
 2022-02-18  Adrian Perez de Castro  <[email protected]>
 
         [CMake] Cannot find OpenGL when system provides opengl.pc instead of gl.pc

Modified: trunk/Makefile.shared (290148 => 290149)


--- trunk/Makefile.shared	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Makefile.shared	2022-02-18 20:06:08 UTC (rev 290149)
@@ -47,6 +47,13 @@
 	endif
 endif
 
+ifneq (,$(EXPORT_COMPILE_COMMANDS))
+		XCODE_OPTIONS += EXPORT_COMPILE_COMMANDS=YES
+		XCODE_OPTIONS += GCC_PRECOMPILE_PREFIX_HEADER=NO
+		XCODE_OPTIONS += CLANG_ENABLE_MODULE_DEBUGGING=NO
+		XCODE_OPTIONS += COMPILER_INDEX_STORE_ENABLE=NO
+endif
+
 DEFAULT_VERBOSITY := $(shell defaults read org.webkit.BuildConfiguration BuildTranscriptVerbosity 2>/dev/null || echo "default")
 VERBOSITY ?= $(DEFAULT_VERBOSITY)
 

Modified: trunk/PerformanceTests/ChangeLog (290148 => 290149)


--- trunk/PerformanceTests/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/PerformanceTests/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,22 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * DecoderTest/Configurations/DebugRelease.xcconfig:
+        * MediaTime/Configurations/DebugRelease.xcconfig:
+
 2022-01-20  Ross Kirsling  <[email protected]>
 
         [WinCairo] Unreviewed performance test gardening.

Modified: trunk/PerformanceTests/DecoderTest/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/PerformanceTests/DecoderTest/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/PerformanceTests/DecoderTest/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -35,6 +35,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);
 
 WK_CCACHE_DIR = $(SRCROOT)/../../Tools/ccache;

Modified: trunk/PerformanceTests/MediaTime/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/PerformanceTests/MediaTime/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/PerformanceTests/MediaTime/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -32,3 +32,6 @@
 SDKROOT = $(SDKROOT_$(USE_INTERNAL_SDK));
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
+
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';

Modified: trunk/Source/_javascript_Core/ChangeLog (290148 => 290149)


--- trunk/Source/_javascript_Core/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Mark Lam  <[email protected]>
 
         Split IsoSubspace into a GCClient allocator used by VM and a backend managed by Heap.

Modified: trunk/Source/_javascript_Core/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/_javascript_Core/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/_javascript_Core/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -40,6 +40,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_RELOCATABLE_FRAMEWORKS = YES;
 
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (290148 => 290149)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Saam Barati  <[email protected]>
 
         Remove ANGLE-static.xcconfig

Modified: trunk/Source/ThirdParty/ANGLE/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/ThirdParty/ANGLE/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/ThirdParty/ANGLE/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -12,6 +12,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_RELOCATABLE_FRAMEWORKS = YES;
 
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (290148 => 290149)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Saam Barati  <[email protected]>
 
         Add LC_SOURCE_VERSION to compile targets

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -36,6 +36,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_RELOCATABLE_FRAMEWORKS = YES;
 
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);

Modified: trunk/Source/WTF/ChangeLog (290148 => 290149)


--- trunk/Source/WTF/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WTF/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Brady Eidson  <[email protected]>
 
         Add an InstallCoordination webpushd backend

Modified: trunk/Source/WTF/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/WTF/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WTF/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -34,6 +34,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);
 
 WK_CCACHE_DIR = $(SRCROOT)/../../Tools/ccache;

Modified: trunk/Source/WebCore/ChangeLog (290148 => 290149)


--- trunk/Source/WebCore/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebCore/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Adrian Perez de Castro  <[email protected]>
 
         [CMake] Cannot find OpenGL when system provides opengl.pc instead of gl.pc

Modified: trunk/Source/WebCore/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/WebCore/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebCore/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -35,6 +35,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_RELOCATABLE_FRAMEWORKS = YES;
 
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);

Modified: trunk/Source/WebCore/PAL/ChangeLog (290148 => 290149)


--- trunk/Source/WebCore/PAL/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebCore/PAL/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Brady Eidson  <[email protected]>
 
         Add an InstallCoordination webpushd backend

Modified: trunk/Source/WebCore/PAL/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/WebCore/PAL/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebCore/PAL/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -35,6 +35,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_RELOCATABLE_FRAMEWORKS = YES;
 
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);

Modified: trunk/Source/WebGPU/ChangeLog (290148 => 290149)


--- trunk/Source/WebGPU/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebGPU/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Saam Barati  <[email protected]>
 
         Add LC_SOURCE_VERSION to compile targets

Modified: trunk/Source/WebGPU/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/WebGPU/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebGPU/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -35,6 +35,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_RELOCATABLE_FRAMEWORKS = YES;
 
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);

Modified: trunk/Source/WebInspectorUI/ChangeLog (290148 => 290149)


--- trunk/Source/WebInspectorUI/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebInspectorUI/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Saam Barati  <[email protected]>
 
         Add LC_SOURCE_VERSION to compile targets

Modified: trunk/Source/WebInspectorUI/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/WebInspectorUI/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebInspectorUI/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -12,6 +12,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 COMBINE_INSPECTOR_RESOURCES = NO;
 COMBINE_TEST_RESOURCES = YES;
 

Modified: trunk/Source/WebKit/ChangeLog (290148 => 290149)


--- trunk/Source/WebKit/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebKit/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,22 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+        * UIProcess/API/C/WKPageUIClient.h:
+
 2022-02-18  Brady Eidson  <[email protected]>
 
         Add an InstallCoordination webpushd backend

Modified: trunk/Source/WebKit/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/WebKit/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebKit/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -35,6 +35,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 CODE_SIGN_IDENTITY[sdk=macosx*] = $(CODE_SIGN_IDENTITY_$(WK_USE_RESTRICTED_ENTITLEMENTS))
 CODE_SIGN_IDENTITY_ = $(CODE_SIGN_IDENTITY_NO);
 CODE_SIGN_IDENTITY_NO = -;

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h (290148 => 290149)


--- trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPageUIClient.h	2022-02-18 20:06:08 UTC (rev 290149)
@@ -135,8 +135,8 @@
 typedef void (*WKPageDidResignInputElementStrongPasswordAppearanceCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
 typedef bool (*WKPageShouldAllowDeviceOrientationAndMotionAccessCallback)(WKPageRef page, WKSecurityOriginRef securityOrigin, WKFrameInfoRef frame, const void *clientInfo);
 
-typedef void (*WKPageRunWebAuthenticationPanelCallback)();
-typedef void (*WKPageRequestWebAuthenticationNoGestureCallback)();
+typedef void (*WKPageRunWebAuthenticationPanelCallback)(void);
+typedef void (*WKPageRequestWebAuthenticationNoGestureCallback)(void);
 typedef void (*WKPageDecidePolicyForSpeechRecognitionPermissionRequestCallback)(WKPageRef page, WKSecurityOriginRef topOrigin, WKSpeechRecognitionPermissionCallbackRef callback);
 
 typedef void (*WKPageDecidePolicyForMediaKeySystemPermissionRequestCallback)(WKPageRef page, WKSecurityOriginRef topOrigin, WKStringRef keySystem, WKMediaKeySystemPermissionCallbackRef callback);

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (290148 => 290149)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Saam Barati  <[email protected]>
 
         Add LC_SOURCE_VERSION to compile targets

Modified: trunk/Source/WebKitLegacy/mac/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/WebKitLegacy/mac/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/WebKitLegacy/mac/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -35,6 +35,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_BUILD_FOR_TESTING = YES;
 
 WK_RELOCATABLE_FRAMEWORKS = YES;

Modified: trunk/Source/bmalloc/ChangeLog (290148 => 290149)


--- trunk/Source/bmalloc/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/bmalloc/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,21 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * Configurations/DebugRelease.xcconfig:
+
 2022-02-17  Yusuke Suzuki  <[email protected]>
 
         [libpas] scavenger should not call pthread_mach_thread_np after suspension

Modified: trunk/Source/bmalloc/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Source/bmalloc/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Source/bmalloc/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -34,6 +34,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);
 
 WK_CCACHE_DIR = $(SRCROOT)/../../Tools/ccache;

Modified: trunk/Tools/ChangeLog (290148 => 290149)


--- trunk/Tools/ChangeLog	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/ChangeLog	2022-02-18 20:06:08 UTC (rev 290149)
@@ -1,3 +1,31 @@
+2022-02-18  Brandon Stewart  <[email protected]>
+
+        Generate compile_commands.json on macOS Builds
+        https://bugs.webkit.org/show_bug.cgi?id=235686
+
+        Reviewed by Saam Barati.
+
+        Add support for generating compile_commands.json file to WebKit.
+        
+        compile_commands.json can be used by tools like clangd to provide code complete,
+        refactoring, formatting, and cross references.
+
+        Steps to generate the compile commands file:
+        make r EXPORT_COMPILE_COMMANDS=YES
+        generate-compile-commands WebKitBuild/Release
+
+        * ContentExtensionTester/Configurations/DebugRelease.xcconfig:
+        * DumpRenderTree/mac/Configurations/DebugRelease.xcconfig:
+        * ImageDiff/cg/Configurations/DebugRelease.xcconfig:
+        * MiniBrowser/Configurations/DebugRelease.xcconfig:
+        * Scripts/build-jsc:
+        * Scripts/build-webkit:
+        * Scripts/generate-compile-commands: Added.
+        * TestWebKitAPI/Configurations/DebugRelease.xcconfig:
+        * WebEditingTester/Configurations/DebugRelease.xcconfig:
+        * WebKitTestRunner/Configurations/DebugRelease.xcconfig:
+        * lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig:
+
 2022-02-18  Jonathan Bedard  <[email protected]>
 
         [git-webkit] Link issue to pull requests (Follow-up fix)

Modified: trunk/Tools/ContentExtensionTester/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Tools/ContentExtensionTester/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/ContentExtensionTester/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -31,3 +31,6 @@
 SDKROOT = $(SDKROOT_$(USE_INTERNAL_SDK));
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
+
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';

Modified: trunk/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/DumpRenderTree/mac/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -37,5 +37,8 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_CCACHE_DIR = $(SRCROOT)/../ccache;
 #include "../../../ccache/ccache.xcconfig"

Modified: trunk/Tools/ImageDiff/cg/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Tools/ImageDiff/cg/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/ImageDiff/cg/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -30,3 +30,6 @@
 SDKROOT = $(SDKROOT_$(USE_INTERNAL_SDK));
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
+
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';

Modified: trunk/Tools/MiniBrowser/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Tools/MiniBrowser/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/MiniBrowser/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -34,5 +34,8 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_CCACHE_DIR = $(SRCROOT)/../ccache;
 #include? "../../ccache/ccache.xcconfig"

Modified: trunk/Tools/Scripts/build-jsc (290148 => 290149)


--- trunk/Tools/Scripts/build-jsc	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/Scripts/build-jsc	2022-02-18 20:06:08 UTC (rev 290149)
@@ -61,6 +61,7 @@
 my $buildDir = "";
 my $startTime = time();
 my $useCCache = -1;
+my $exportCompileCommands = 0;
 
 my @features = getFeatureOptionList();
 
@@ -93,6 +94,7 @@
   --build-dir=<path>            Build out of tree in directory at <path>
 
   --[no-]use-ccache             Enable (or disable) CCache, if available
+  --export-compile-commands     Generate compile_commands.json (Apple platforms only)
 EOF
 
 my %options = (
@@ -105,7 +107,8 @@
     'makeargs=s' => \$makeArgs,
     'cmakeargs=s' => \@cmakeArgs,
     'build-dir=s' => \$buildDir,
-    'use-ccache!' => \$useCCache
+    'use-ccache!' => \$useCCache,
+    'export-compile-commands' => \$exportCompileCommands
 );
 
 foreach (@features) {
@@ -142,6 +145,8 @@
     $ENV{'WK_USE_CCACHE'} = "NO";
 }
 
+$ENV{'EXPORT_COMPILE_COMMANDS'} = "YES" if $exportCompileCommands;
+
 checkRequiredSystemConfig();
 setConfiguration();
 chdirWebKit();

Modified: trunk/Tools/Scripts/build-webkit (290148 => 290149)


--- trunk/Tools/Scripts/build-webkit	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/Scripts/build-webkit	2022-02-18 20:06:08 UTC (rev 290149)
@@ -80,6 +80,7 @@
 my $archs32bit = 0;
 my $skipLibraryUpdate = 0;
 my $useCCache = -1;
+my $exportCompileCommands = 0;
 
 my @features = getFeatureOptionList();
 
@@ -146,6 +147,8 @@
 
   --[no-]use-ccache                 Enable (or disable) CCache, if available
 
+  --export-compile-commands         Generate compile_commands.json (Apple platforms only)
+
 EOF
 
 my %options = (
@@ -167,6 +170,7 @@
     'use-workspace!' => \$useWorkspace,
     'skip-library-update' => \$skipLibraryUpdate,
     'use-ccache!' => \$useCCache,
+    'export-compile-commands' => \$exportCompileCommands
 );
 
 # Build usage text and options list from features
@@ -191,6 +195,7 @@
     $ENV{'WK_USE_CCACHE'} = "NO";
 }
 
+$ENV{'EXPORT_COMPILE_COMMANDS'} = "YES" if $exportCompileCommands;
 
 my $productDir = productDir();
 

Added: trunk/Tools/Scripts/generate-compile-commands (0 => 290149)


--- trunk/Tools/Scripts/generate-compile-commands	                        (rev 0)
+++ trunk/Tools/Scripts/generate-compile-commands	2022-02-18 20:06:08 UTC (rev 290149)
@@ -0,0 +1,60 @@
+#!/bin/sh -e
+
+# Copyright (C) 2022 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+# 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+#     its contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Script to generate compile_commands.json file
+
+# Change to the root of WebKit Directory
+cd "$(dirname "$0")/../../"
+
+# Check compile_commands folder exists
+if ! [ -d $1/compile_commands/ ]; then
+    echo "Please specify the build directory with compile_commands."
+    echo "Example: generate-compile-commands WebKitBuild/Release"
+    exit 1
+fi
+
+# Remove any previous compile_commands.json
+rm -f compile_commands.json
+
+# Generate compile_commands.json
+echo "[" > compile_commands.json
+awk '{print}' $1/compile_commands/*.json >> compile_commands.json
+
+# Remove last comma
+sed -i '' '$ s/,$//' compile_commands.json
+
+echo "]" >> compile_commands.json
+
+# Workaround issue where clangd fails with -gmodules flag
+sed -i '' 's/"-gmodules"/"-Xclang -fmodule-format=raw"/g' compile_commands.json
+
+# Remove ThirdParty components from indexing
+# This is quite large and probably unnecessary for most.
+sed -i '' '/Source\/ThirdParty/d' compile_commands.json
+
+echo "Generated compile_commands.json"
\ No newline at end of file
Property changes on: trunk/Tools/Scripts/generate-compile-commands
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: trunk/Tools/TestWebKitAPI/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Tools/TestWebKitAPI/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/TestWebKitAPI/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -34,6 +34,9 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 OTHER_CPLUSPLUSFLAGS = $(inherited) -ftemplate-depth=256;
 
 WK_RELOCATABLE_FRAMEWORKS = YES;

Modified: trunk/Tools/WebEditingTester/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Tools/WebEditingTester/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/WebEditingTester/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -32,3 +32,6 @@
 SDKROOT = $(SDKROOT_$(USE_INTERNAL_SDK));
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
+
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';

Modified: trunk/Tools/WebKitTestRunner/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Tools/WebKitTestRunner/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/WebKitTestRunner/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -32,5 +32,8 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_CCACHE_DIR = $(SRCROOT)/../ccache;
 #include "../../ccache/ccache.xcconfig"

Modified: trunk/Tools/lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig (290148 => 290149)


--- trunk/Tools/lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig	2022-02-18 20:04:39 UTC (rev 290148)
+++ trunk/Tools/lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig	2022-02-18 20:06:08 UTC (rev 290149)
@@ -32,5 +32,8 @@
 SDKROOT_ = macosx;
 SDKROOT_YES = macosx.internal;
 
+OTHER_CFLAGS = $(inherited) $(COMPILE_COMMANDS_$(EXPORT_COMPILE_COMMANDS));
+COMPILE_COMMANDS_YES = '-gen-cdb-fragment-path' '$(BUILT_PRODUCTS_DIR)/compile_commands';
+
 WK_CCACHE_DIR = $(SRCROOT)/../../../Tools/ccache;
 #include "../../../ccache/ccache.xcconfig"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to