llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.56k stars 11.81k forks source link

fix-it hints broken #7185

Open llvmbot opened 14 years ago

llvmbot commented 14 years ago
Bugzilla Link 6813
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@nlewycky

Extended Description

A few fix-it tests are failing. The problem is that 'clang -cc1 -fixit' doesn't emit any output at all when there are additional errors in the file which fixit can't fix. Because the tests are written to run clang -fixit | clang -Werror, an empty output from -fixit will pass. (I'm assuming the tests are written correctly and am working on a patch to change the behaviour of the -fixit flag.)

In the mean time, we've accumulated the 3 broken tests:

  1. test/FixIt/fixit-errors.c. The fix-it from 'get_origin->x' to 'get_origin()->x' is missing entirely. Note that this breakage would have been caught if that line had an 'expected-note' on it.

  2. test/FixIt/fixit-pmem.cpp. This test generates four errors with four fix-it hints, but one of which is diagnosed as unfixable. Why?

  3. test/FixIt/typo.m. Right in the middle, on line 61, the use of undeclared identifier error on 'NSstring' is emitted with a did you mean 'NSString', but no fix-it hint shows up. Why not? It shows up for other ones.

lattner commented 14 years ago

Yes, it's broken because of the implicit va_arg typedef we get. It's an ext-warn because empty translation units are not legal in C (but are in C++). Take it up with the C committee. :)

nlewycky commented 14 years ago

Then that needs to be fixed too:

$ echo -n | clang++ -x c++ -fsyntax-only -Werror -pedantic - $ echo | clang++ -x c++ -fsyntax-only -Werror -pedantic - $

but why would the empty file be an error anyhow?

lattner commented 14 years ago

Sounds like all the fixit tests should run with -Werror -pedantic, which should reject the empty translation unit.

Endilll commented 1 year ago

Fast-forward to 2023, fixit-pmem.cpp is still XFAIL: https://github.com/llvm/llvm-project/blob/46f366494f3ca8cc98daa6fb4f29c7c446c176b6/clang/test/FixIt/fixit-pmem.cpp#L4 Two other tests are fixed, though.