Closed Bug 1242004 Opened 5 years ago Closed 5 years ago

Skip -Xclang arguments when generating clang compilation database or YouCompleteMe config

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox47 fixed)

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: ehsan, Unassigned)

Details

Attachments

(1 file)

clang based tools typically choke when they encounter a lot of -XClang
arguments, and since those args are passed to the cc1 driver they're
unnecessary for such tools anyways.

This helps people who have things like --enable-clang-plugin in their
mozconfig use clang based tools without having to remove these arguments
manually.
Comment on attachment 8711137 [details] [diff] [review]
Skip -Xclang arguments when generating clang compilation database or YouCompleteMe config

Review of attachment 8711137 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the below fixed.  you++ for the commit message!

::: python/mozbuild/mozbuild/compilation/util.py
@@ +35,5 @@
>      return build_vars
> +
> +def sanitize_cflags(flags):
> +    # We filter out -Xclang arguments as clang based tools typically choke on
> +    # passing these flags down to the clang driver.

I think it is slightly clearer to say:

"We filter out -Xclang ARG sequences as clang-based tools..."

The use of |saw_xclang| below was not immediately obvious here, since the comment wording suggested to me we are only filtering -Xclang, not the argument to -Xclang.  Inept reviewer?  Possibly! ;)
Attachment #8711137 - Flags: review?(nfroyd) → review+
Will do!

(FWIW, -Xclang just tells the clang driver driver to pass whatever comes after it to clang cc1.  For example, this:

clang -cc1 -foo -bar -baz

needs to be expressed as:

clang -Xclang -foo -Xclang -bar -Xclang -baz

when invoking the driver driver.  I'll mention this in the comment to make it super clear.)
https://hg.mozilla.org/mozilla-central/rev/4d997a1ef360
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Target Milestone: mozilla46 → mozilla47
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.