Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang-diff Ignores #defines in its outputs #34070

Open Quuxplusone opened 6 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR35097
Status NEW
Importance P normal
Reported by Jacob Gamble (gamblejr@msoe.edu)
Reported on 2017-10-26 07:34:11 -0700
Last modified on 2017-11-01 11:01:05 -0700
Version trunk
Hardware PC Linux
CC gamblejr@msoe.edu, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments diffFail.zip (887 bytes, application/x-zip-compressed)
Blocks
Blocked by
See also
Created attachment 19347
Zip file with described files

Note that I have attached a zip file with four files in it.

In summery the files work0.cpp and work1.cpp when diffed with clang-diff
produce the expected output.  But when I feed it fail0.cpp and fail1.cpp to
diff it tells me that there are no differences.

If I use clang-diff with the following arguments:

   clang-diff work0.cpp work1.cpp --

I get the following output:

   Update CompoundAssignOperator: ^=(8) to &=
   Insert UnaryOperator: ~(10) into CompoundAssignOperator: &=(8) at 1
   Insert ParenExpr(11) into UnaryOperator: ~(10) at 0
   Move BinaryOperator: <<(12) into ParenExpr(11) at 0

This is what I would expect.

When I use clang-diff on the other two files like so:

   clang-diff fail0.cpp fail1.cpp --

The only difference between the "fail" files and the "work" files is the fact
that in the work files I have a volatile variable defined:

    volatile unsigned char PORT = 12;

while in the fail files I have a macro like this:

    #define PORT (*(unsigned char volatile * )0x1000)

All four files compile fine with clang and no arguments given otherwise.
Quuxplusone commented 6 years ago

Attached diffFail.zip (887 bytes, application/x-zip-compressed): Zip file with described files

Quuxplusone commented 6 years ago
Note that I failed to mention:

When I run
    clang-diff fail0.cpp fail1.cpp --

It tells me that there are no differences.
Quuxplusone commented 6 years ago
I found this commit:
https://github.com/llvm-mirror/clang/commit/544626fd1a0364617e75c3511addbff936ce315a

It says we ignore macros..........I think this has something to do with this
issue........but why are we ignoring macros in the first place?