llvm/clang/test/Preprocessor/empty_file_to_include.h
Richard Smith 2ce63b4246 Diagnose likely typos in #include directives.
Summary:
When someone writes

  #include "<some_file>"

or

  #include " some_file "

the compiler returns "file not fuond..." with fonts and quotes that may
make it hard to see there are excess quotes or surprising bytes in the
filename.  Assuming that files are usually logically named and start and
end with an alphanumeric character, we can check for the file's
existence by stripping the non-alphanumeric leading or trailing
characters.  If the file is found, emit a non-fatal error with a
FixItHint.

Patch by Christy Lee!

Reviewers: aaron.ballman, erikjv, rsmith

Reviewed By: rsmith

Subscribers: lebedev.ri, xbolva00, sammccall, modocache, erikjv, aaron.ballman, cfe-commits

Differential Revision: https://reviews.llvm.org/D51333

llvm-svn: 342177
2018-09-13 21:10:08 +00:00

8 lines
88 B
C

#ifndef EMPTY_FILE_TO_INCLUDE_H
#define EMPTY_FILE_TO_INCLUDE_H
// empty file
#endif