Use the new option StatementMacros from clang-format-8
Categories
(Developer Infrastructure :: Lint and Formatting, enhancement)
Tracking
(firefox68 fixed)
Tracking | Status | |
---|---|---|
firefox68 | --- | fixed |
People
(Reporter: Sylvestre, Assigned: Sylvestre)
References
Details
Attachments
(2 files)
It helps clang-format-8 to know if they should be considered as function
https://reviews.llvm.org/D33440
StatementMacros: [MARKUPMAP, ASSERT_TRUE, ASSERT_FALSE, TEST, CHECK]
Assignee | ||
Comment 1•6 years ago
|
||
Depends on D26098
Assignee | ||
Comment 2•6 years ago
|
||
ignore-this-changeset
Depends on D26279
Comment 4•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/55ed5f885d52
https://hg.mozilla.org/mozilla-central/rev/6f723cac81dd
Comment 5•6 years ago
|
||
If you're reading this bug because you're now getting unknown key 'StatementMacros'
error messages when you try to hg commit: you need to re-run ./mach bootstrap
to get the latest clang-format.
YAML:28:19: error: unknown key 'StatementMacros'
StatementMacros: [MARKUPMAP, ASSERT_TRUE, ASSERT_FALSE, TEST, CHECK]
^
Assignee | ||
Comment 6•6 years ago
|
||
I am not sure why the new version of clang-format isn't downloaded immediately :/
Andi, any idea why? Thanks
Comment 7•6 years ago
•
|
||
Yes it's the same thing that we have with clang-tidy based analysis, we don't have a setup that detects that the artifact is newer than what we have locally in order to begin the update process.
This was one of the reasons why we've added clang-tidy
package to bootstrap
, but this is sub-optimal so I've opened bug 1542694 for this.
Comment 8•6 years ago
|
||
I ran mach bootstrap
, and ~/.mozbuild/clang/bin/clang-format --version
is still giving me 7.0.1
.
Comment 9•6 years ago
|
||
So does ~/.mozbuild/clang-tools/clang-tidy/bin/clang-format --version
. (Why is there two and which one should I be using?)
Comment 10•6 years ago
|
||
I had to comment out the StatementMacros: ...
line in .clang-format
to allow my editor's clang-format integration to continue working for the time being.
Comment 11•6 years ago
|
||
Ok, I figured this out: I had run mach bootstrap
in a different tree, which was not updated to the latest mozilla-central. I did not realize mach bootstrap
looked at in-tree files to determine what versions to download (though in retrospect that makes sense).
Comment 12•6 years ago
|
||
I feel the need to add some clarifications here:
- ~/.mozbuild/clang represents the artifact for the compiler
- ~/.mozbuild/clang-tools/clang-tidy represents the artifact for clang based static analysis, like clang-tidy and for formatting, clang-format
The artifacts that we download, ex. clang-tidy and clang are tied up with the version of the tree that we are using, so in order to get the latest artifacts you need to be on he head of the mozilla-central.
Comment 13•6 years ago
|
||
(In reply to Andi-Bogdan Postelnicu [:andi] from comment #12)
The artifacts that we download, ex. clang-tidy and clang are tied up with the version of the tree that we are using, so in order to get the latest artifacts you need to be on he head of the mozilla-central.
Apologies for starting to veer off topic, but this makes me wonder: is it then possible to get into a situation where you'd like to do development simultaneously on e.g. a central tree and a beta tree, but you can't because they share the .mozbuild
artifacts and they require different versions of them?
Comment 14•6 years ago
|
||
I am running into the same issue with editor integration since vim-clang-format seems to always look to the system clang-format (unlike clang-format.py which has g:clang_format_path
) and Ubuntu seems to be stuck on clang-format 6.0.0.
Assignee | ||
Comment 15•6 years ago
|
||
You can update to clang-format 8 by using https://apt.llvm.org/ on Ubuntu but I recommend that you update vim-clang-format to use ~/.mozbuild/clang-tools/clang-tidy/bin/clang-format
Comment 16•6 years ago
|
||
Thanks! It turns out there is an option in vim-clang-format after all:
let g:clang_format#command = $HOME . '/.mozbuild/clang-tools/clang-tidy/bin/clang-format'
Updated•2 years ago
|
Description
•