don't just identify first #define as header guard anymore. Use #ifndef
#define to tell if a #define belongs to header guard.
Details
- Reviewers
djasper
Diff Detail
Event Timeline
lib/Format/Format.cpp | ||
---|---|---|
1472 | I think there is too much in the regex group here. If there are trailing comments on the #ifndef or #define lines, this should still work. Also, there might actually be empty lines or comment lines in-between the two. I would for now just check that there:
We can refine more if necessary. I think we should be conservative here as this should only really ever affect .cc files (or else the header guard would be there and identified correctly) that don't have any #includes (or put them after unrelated #defines). So, we have to weigh this case being so rare against incorrectly identifying weird header guards in headers (which IMO might be more common). |
lib/Format/Format.cpp | ||
---|---|---|
1472 | Okay. I guess I should've work on the comment skipping FIXME first. I'll work on skipping comments first and then continue with this patch, |
I think there is too much in the regex group here. If there are trailing comments on the #ifndef or #define lines, this should still work. Also, there might actually be empty lines or comment lines in-between the two. I would for now just check that there:
We can refine more if necessary.
I think we should be conservative here as this should only really ever affect .cc files (or else the header guard would be there and identified correctly) that don't have any #includes (or put them after unrelated #defines). So, we have to weigh this case being so rare against incorrectly identifying weird header guards in headers (which IMO might be more common).