Basic block sections is untested on other platforms and binary formats apart from x86,elf. This patch silently drops the flag if the platform and binary format is not compatible.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/test/Driver/fbasic-block-sections.c | ||
---|---|---|
12 | nit, ignore if you want: |
clang/test/Driver/fbasic-block-sections.c | ||
---|---|---|
1–6 | Consider dropping -linux-gnu because they are insignificant. The code applies to generic ELF. |
clang/test/Driver/fbasic-block-sections.c | ||
---|---|---|
12 | CHECK-TRIPLE should check the diagnostic instead. |
Update test based on review comments.
- Use diag::err instead of warn.
- Drop linux-gnu from the triple for the default test.
- Check for the presence of the diagnostic message.
Thanks for the quick review @MaskRay, PTAL.
clang/lib/Driver/ToolChains/Clang.cpp | ||
---|---|---|
4892 | Sure, can you provide a reference/guidance for when err vs warn is appropriate for driver checks? Most of the code in this file uses err but there are some cases of warn being used. | |
clang/test/Driver/fbasic-block-sections.c | ||
5 | What I really want to check for is the absence of the flag for the particular triple. Using -fsyntax-only means that the cc1 args are not emitted. I've added a check for the diagnostic message but retained -### so that I can keep the check for the absence of -fbasic-block-sections=all. |
clang/lib/Driver/ToolChains/Clang.cpp | ||
---|---|---|
4892 | I think a warning is suitable for some GCC specific optimization options where a clang port either does not make sense or is not very necessary. This only applies to very common options which ease porting to clang. For clang specific optimizations, especially these with complex setup, I think an error is more useful. | |
clang/test/Driver/fbasic-block-sections.c | ||
5 | Then you can switch to -c The idea of not %clang is that it makes things clear that it is an error. | |
12 | The NOT pattern is not useful when testing an error. |
Update test to use not tool and -c flag.
- Use the not tool to indicate failure is expected.
- Use -c instead of -### for failing invocations.
This should be an error