Commit Graph

26 Commits

Author SHA1 Message Date
Kim Grasman 7c2ec8f05b Rename port.h -> iwyu_port.h 2019-12-26 16:12:02 +01:00
Kim Grasman bb9f17cff6 Use LLVM streams instead of iostream for asserts 2019-12-26 16:12:01 +01:00
Kim Grasman 3538843036 Expand glob matching on POSIX
Previously, GlobMatchesPath would always use FNM_PATHNAME, which does
not let '*' match path separators.

Loosen this so GlobMatchesPath can be used to match "any path name
ending with 'xyz'" using "*xyz".

This is a change in behavior for POSIX systems, but it seems like the
Windows GlobMatchesPath always worked like this (being based on
PathMatchSpec), so it creates a unified behavior across platforms.
2019-12-21 10:02:52 +01:00
Orgad Shaneh 5de96e9005 Fix warning on MinGW
In file included from F:/Projects/include-what-you-use/iwyu_string_util.h:21:0,
                 from F:/Projects/include-what-you-use/iwyu_path_util.h:18,
                 from F:/Projects/include-what-you-use/iwyu_path_util.cc:10:
F:/Projects/include-what-you-use/port.h:68:0: warning: "NOMINMAX" redefined
 #define NOMINMAX  // Prevent Windows headers from redefining min/max.

In file included from F:/git-sdk-64/mingw64/include/c++/7.3.0/x86_64-w64-mingw32/bits/c++config.h:533:0,
                 from F:/git-sdk-64/mingw64/include/c++/7.3.0/string:38,
                 from F:/Projects/include-what-you-use/iwyu_path_util.h:15,
                 from F:/Projects/include-what-you-use/iwyu_path_util.cc:10:
F:/git-sdk-64/mingw64/include/c++/7.3.0/x86_64-w64-mingw32/bits/os_defines.h:45:0: note: this is the location of the previous definition
 #define NOMINMAX 1
2018-02-15 19:06:38 +01:00
Kim Grasman c316bc66c7 Explicitly use ASCII version of PathMatchSpec
Clang r273599 switched the UNICODE define on by default, which makes the
entire Windows API default to its wide-char functions.

At first glance, we won't be handling Unicode paths anyway, so use
PathMatchSpecA explicitly.
2016-07-10 16:20:48 +02:00
EugeneZelenko e05d81f32d Fix some Clang-tidy warnings
NULL/0 -> nullptr
C standard library include -> C++ counterparts
Occasional use of auto
Explicit strcmp return value check
Remove unused usings
Closing comments for anonymous namespaces
2016-06-07 21:49:33 +02:00
Kim Grasman e58967a2ec Make header guards consistent
- Remove DEVTOOLS_MAINTENANCE_ from header guards, that was a
  now-unnecessary Googleism

- Fix header guard to match filename in all production code

- Fix header guard to match path in all tests
2016-05-25 22:17:31 +02:00
Kim Grasman ecf25e0e6e Assume override keyword support. 2015-07-14 22:19:13 +02:00
Volodymyr Sapsai d5b7c12e68 Introduce CHECK_UNREACHABLE_("message") instead of CHECK_(false && "message").
Some discussion regarding this change can be found in issue #117.
2013-12-31 15:38:47 +00:00
Kim Gräsman 49b0d89ba0 Remove unused function GetCWD
- No longer necessary to define _POSIX_ for MSVC builds
- Remove some cruft from port.h
- Remove unused direct.h/unistd.h includes
- Clean up includes in iwyu_path_util.h
- No functionality change intended
- Tested on Win32/MSVC + Linux/GCC
2013-03-19 20:53:26 +00:00
Kim Gräsman b46124b1d1 Fix issue #93. Restore default mappings for GCC
- iwyu.gcc.imp is no longer added automatically if no mapping file is specified
- Instead, the defaults are hard-coded in iwyu_include_picker.cc
- Fix some 80-column overruns
2013-02-15 06:04:44 +00:00
Volodymyr Sapsai e729b2333b Add IWYU_OVERRIDE macro. Patch by Kim Gräsman. 2012-12-09 14:07:18 +00:00
Volodymyr Sapsai 52c3ef5b22 Fixed build under MinGW (issue #71).
Don't use Visual Studio-specific linking by #pragma, replaced some
#ifdef _MSC_VER with #ifdef _WIN32. Patch by Chris Glover.
2012-07-15 08:54:54 +00:00
csilvers+iwyu 0edc7cb382 Oops, forgot to commit the code that actually defines CHECK_()
R=dsturtevant
DELTA=10  (0 added, 10 deleted, 0 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=3299
2011-09-20 22:12:17 +00:00
csilvers+iwyu d10829b281 Introduces GlobMatchesPath() to clean up the uses of fnmatch()
in IWYU.  Now we no longer #define a standard macro in IWYU's
header.

R=csilvers
DELTA=12  (4 added, 3 deleted, 5 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=2002
2011-05-24 23:12:28 +00:00
csilvers+iwyu 2a33a0af49 (Copy of svn r232)
Revision created by MOE tool push_codebase.
MOE_MIGRATION=1986
2011-05-23 23:59:57 +00:00
csilvers+iwyu 33c7208a98 Avoid a couple of warnings found in opensource iwyu: class ->
struct, and an unused var in non-debug mode.

R=wan
DELTA=3  (0 added, 0 deleted, 3 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1977
2011-05-23 23:03:57 +00:00
paul.holden e081bb6e5d Fix a MSVC compilation error, as described at http://code.google.com/p/include-what-you-use/issues/detail?id=39. REviewed by csilvers. 2011-05-18 06:48:16 +00:00
csilvers+iwyu e154bd898c Changes IWYU's friend pragma to accept a regex instead of a glob.
Also makes it port.h's responsibility to export fnmatch
(before, it was the responsibility of either port.h or
iwyu_include_picker.cc, depending on the platform).

R=dsturtevant,csilvers
DELTA=152  (45 added, 4 deleted, 103 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1852
2011-05-12 23:10:38 +00:00
csilvers+iwyu 5ca17d139e Include-what-you-use fixit -- fix #includes on iwyu itself.
R=csilvers
DELTA=123  (22 added, 5 deleted, 96 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1732
2011-05-04 18:30:53 +00:00
csilvers+iwyu ed381497a3 Add a test to protect against syntax errors in main(). Also
test some main()-invariant logic while I'm at it.

DELTA=19  (16 added, 0 deleted, 3 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1409
2011-04-13 03:11:35 +00:00
csilvers+iwyu 37c67ac363 I was not correctly getting the location for member-exprs. I
thought I was saying the location is where the . (or ->) is,
which is what I want, but clang doesn't actually expose that.
So I have go through some hoops to try to figure it out.

We were actually seeing a problem with this when running:

blaze build --host_cpu=k8 --compile_only -k --crosstool_top=//third_party/llvm/crosstool --plugin=//devtools/maintenance/include_what_you_use:run_iwyu //gws/plugins/local/src:enhanced_listing_ad

It has 'msg_->MSG_foo' in it, where MSG_foo is a macro.  We
were attributing this use to the file defining MSG_foo, rather
than to us.  With this change, we properly attribute it to us.

R=dsturtevant
DELTA=150  (125 added, 6 deleted, 19 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1347
2011-04-12 05:00:17 +00:00
csilvers+iwyu 97d04c4a90 Replace assert() by CHECK_, which is always executed, even in
opt mode.

R=wan
DELTA=131  (16 added, 15 deleted, 100 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=738
2011-03-04 00:29:56 +00:00
csilvers 77fe0b2a05 Fix the top-of-file comment. 2011-02-16 01:40:07 +00:00
csilvers 4f7a60acbd Fix an #undef that's in the wrong place:
http://code.google.com/p/include-what-you-use/issues/detail?id=8
2011-02-08 19:43:58 +00:00
csilvers 000a1fff6d Fixes to get code to compile under MSVC 10. Submitted by pichet2...:
http://code.google.com/p/include-what-you-use/issues/detail?id=7
with small changes by csilvers to encapsulate all arch-specific
information in one file, port.h.

Reviewed by csilvers
2011-02-08 06:12:32 +00:00