Title: [239567] trunk/Tools
- Revision
- 239567
- Author
- [email protected]
- Date
- 2018-12-31 07:31:15 -0800 (Mon, 31 Dec 2018)
Log Message
.ycm_extra_conf.py should handle XXXInlines.h
https://bugs.webkit.org/show_bug.cgi?id=193055
Reviewed by Carlos Garcia Campos.
compile_commands.json database only records flags and options for cpp source files.
So, when we open headers, this database does not have any information for that.
Our .ycm_extra_conf.py alleviates this by using XXX.cpp's configuration for XXX.h.
But this mitigation does not handle XXXInlines.h well since we do not have XXXInlines.cpp.
This patch adds support for XXXInlines.h in .ycm_extra_conf.py. When XXXInlines.h is queried,
we attempt to find XXX.cpp and use the configuration if it exists.
* gtk/ycm_extra_conf.py:
(getImplementationFilename):
(FlagsForFile):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (239566 => 239567)
--- trunk/Tools/ChangeLog 2018-12-31 14:53:38 UTC (rev 239566)
+++ trunk/Tools/ChangeLog 2018-12-31 15:31:15 UTC (rev 239567)
@@ -1,3 +1,21 @@
+2018-12-29 Yusuke Suzuki <[email protected]>
+
+ .ycm_extra_conf.py should handle XXXInlines.h
+ https://bugs.webkit.org/show_bug.cgi?id=193055
+
+ Reviewed by Carlos Garcia Campos.
+
+ compile_commands.json database only records flags and options for cpp source files.
+ So, when we open headers, this database does not have any information for that.
+ Our .ycm_extra_conf.py alleviates this by using XXX.cpp's configuration for XXX.h.
+ But this mitigation does not handle XXXInlines.h well since we do not have XXXInlines.cpp.
+ This patch adds support for XXXInlines.h in .ycm_extra_conf.py. When XXXInlines.h is queried,
+ we attempt to find XXX.cpp and use the configuration if it exists.
+
+ * gtk/ycm_extra_conf.py:
+ (getImplementationFilename):
+ (FlagsForFile):
+
2018-12-31 Carlos Garcia Campos <[email protected]>
Unreviewed. Support PHP 7.3 in Debian.
Modified: trunk/Tools/gtk/ycm_extra_conf.py (239566 => 239567)
--- trunk/Tools/gtk/ycm_extra_conf.py 2018-12-31 14:53:38 UTC (rev 239566)
+++ trunk/Tools/gtk/ycm_extra_conf.py 2018-12-31 15:31:15 UTC (rev 239567)
@@ -81,6 +81,15 @@
return release_build_path if release_mtime >= debug_mtime else debug_build_path
+def getImplementationFilename(filename):
+ alternative_extensions = ['.cpp', '.c']
+ for alternative_extension in alternative_extensions:
+ alternative_filename = filename[:-2] + alternative_extension
+ if os.path.exists(alternative_filename):
+ return alternative_filename
+ return None
+
+
def FlagsForFile(filename, **kwargs):
"""This is the main entry point for YCM. Its interface is fixed.
@@ -97,14 +106,16 @@
# Headers can't be built, so we get the source file flags instead.
if filename.endswith('.h'):
- alternative_extensions = ['.cpp', '.c']
- for alternative_extension in alternative_extensions:
- alternative_filename = filename[:-2] + alternative_extension
- if os.path.exists(alternative_filename):
- filename = alternative_filename
- break
+ implementationFilename = getImplementationFilename(filename)
+ if implementationFilename:
+ filename = implementationFilename
else:
- return result
+ if not filename.endswith('Inlines.h'):
+ return result
+ implementationFilename = getImplementationFilename(filename[:-len('Inlines.h')] + '.h')
+ if not implementationFilename:
+ return result
+ filename = implementationFilename
# Force config.h file inclusion, for GLib macros.
result['flags'].append("-includeconfig.h")
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes