Commit Graph

1277 Commits

Author SHA1 Message Date
csilvers+iwyu b852af1cc9 Change fix_includes to have an exit-code of 0 if no files
needed to be modified (or, in --dry_run mode, no files would
have been modified) and 1 otherwise.

R=dsturtevant
DELTA=61  (46 added, 1 deleted, 14 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=732
2011-03-04 00:26:29 +00:00
csilvers+iwyu fe45cabe52 Attempting to get nested class forward declarations right.
R=csilvers,wan
DELTA=145  (96 added, 2 deleted, 47 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=731
2011-03-04 00:26:01 +00:00
csilvers+iwyu 4990037004 Fix a bug where we were allowing iwyu to suggest that .h files
should add .cc files due to macros (though not other symbols).

In testing, I realized I was calling GetFilePath() on what was
possibly an invalid location, so I now check for that.

R=dsturtevant
DELTA=81  (75 added, 0 deleted, 6 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=730
2011-03-04 00:24:43 +00:00
csilvers+iwyu d9c28a9038 Move the check_also test to tests/, so it can run under the
run_iwyu_tests framework.  This is the first use of the
_iwyu_flags_map framework, which had to be fixed up a bit to
work.

To help debugging problems, I added in some more logging
information, which I've kept.

I also noticed that tests weren't running on my stock ubuntu
python.  This seems to be because the stock unittest module
doesn't run the global setUp in main.  So I renamed the global
setUp and now call it manually.

R=dsturtevant
DELTA=250  (117 added, 121 deleted, 12 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=729
2011-03-04 00:24:20 +00:00
csilvers+iwyu cab46ff2ed Rename no_such_file to be in the same directory as all the
other files.

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


Revision created by MOE tool push_codebase.
MOE_MIGRATION=728
2011-03-04 00:24:00 +00:00
csilvers+iwyu 817eacf5c3 drheld pointed out that iwyu was violating its most basic
'include what you use' mantra when it came to forward
declares: before this CL, it said, "if someone you are
#including from forward-declares a class for you, you don't
have to forward-declare that class yourself."  But that means
you can't refactor .h files to remove unnecessary
forward-declares.  If you need to forward-declare something,
you should forward-declare it yourself, not get that fwd-decl
from an #include.

(Note the story is different if you're getting the
*definition* of a class from an #include, even if you only
need a forward-declaration for that class.  In that case,
using the #include is fine.  The only thing this CL addresses
is when you try to use a .h file to forward-declare something
for you.)

R=dsturtevant
DELTA=206  (137 added, 41 deleted, 28 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=727
2011-03-04 00:23:37 +00:00
csilvers+iwyu 3f5bb7fedd Small cleanups based on wan's suggestions: introduce a new stl
convenience routine, some pointer->ref changes.

R=wan
DELTA=25  (8 added, 4 deleted, 13 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=726
2011-03-04 00:22:18 +00:00
csilvers+iwyu 18656cccd8 Fixes compiler error in iwyu_test.cc.
R=csilvers
DELTA=2  (0 added, 0 deleted, 2 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=725
2011-03-04 00:21:55 +00:00
csilvers+iwyu 1b9459749d Make sure ASTNode::ContentIs() always fails if the types don't
match.  This is necessary when the input is NULL.

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


Revision created by MOE tool push_codebase.
MOE_MIGRATION=724
2011-03-04 00:00:56 +00:00
csilvers+iwyu a14a8bca6e Resolve a TODO with storing pointers to temporaries in the
ASTFlattenerVisitor.  We now store full types instead when
needed.  A lot more machinery, alas. :-(

R=chandlerc
DELTA=134  (97 added, 3 deleted, 34 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=723
2011-03-04 00:00:38 +00:00
csilvers+iwyu 5a63e3a5ca At wan's suggestion, reorganize this code to keep the
public/private information in a separate data structure from
the mapping.  Besides being a bit clearer to follow, this
makes it easier to verify that we're consistent in declaring a
file public or private.  We now do verify this, which turned
up a few inconsistencies in the hard-coded data (not anything
major), which I've fixed.

This prompted a bit of a change in the API, to separate out
adding of mappings from adding of public/private-ness.  This
fits the iwyu preprocessor workflow better, allowing us to
resolve a TODO or two.

I've also cleaned up a comment or two.

R=wan
DELTA=186  (81 added, 60 deleted, 45 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=722
2011-03-04 00:00:14 +00:00
csilvers 0587bf76cc The attached patch provides the following improvements to GetCanonicalName:
* .cxx and .cpp extensions are handled (I'm using the same list as used in IsHeaderFile() - perhaps .inl should be considered too)
* Path separators are canonicalised on Win32. Our build system provides search paths with forward slashes as separators, but paths with backslashes creep in somewhere. So foo\bar\baz.h and foo/bar/baz.h should now be considered the same.

I've added a couple of tests for the first case to the testsuite, but the README suggests that there's no framework for the 'more_tests' tests yet. When this is available I'll add some extra tests for separator canonicalisation.

There are a few TODOs:

* CanonicalizeFilePath should probably collapse '../' sequences, i.e. a/b/../c and a/c should be considered the same (this is handled nicely by PathCanonicalize on Win32, perhaps there's a nice Unixy equivalent?) 
* We should probably ignore case on Win32.

(BTW there is a 'canonicalize()' function in llvm/Support/FileSystem.h which would do what we want, but it doesn't seem to be implemented :/ )

Resolves
   http://code.google.com/p/include-what-you-use/issues/detail?id=15

Patch submitted by paul.hol...@gmail.com and reviewed by csilvers
2011-02-24 21:14:57 +00:00
csilvers 1a6e2fd3ce Update the driver code to support 'response files', to match the
additions to the clang driver code in r108697:
   http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20100719/032322.html

Resolves http://code.google.com/p/include-what-you-use/issues/detail?id=14

Patch submitted by paul.hol...@gmail.com and reviewed by csilvers (by
comparing it to the top-of-tree clang\tools\driver\driver.cpp
2011-02-23 02:13:46 +00:00
csilvers c1a496ee6b Drat, I have to remember to run 'svn status' before committing! These
are new test files that go with the last checkin.
2011-02-19 02:44:28 +00:00
csilvers 20edea6c79 Oops, I missed this in the last commit. 2011-02-19 02:33:08 +00:00
csilvers 69d76e1239 * Rewrite iwyu_include_picker; now more pragma-friendly (csilvers)
* Add support for FakeNamedDecls for tests (dsturtevant)
	* Write our own symbol sanitizer rather than getQualified... (csilvers)
	* Change run_iwyu_tests to better fit python test framework (csilvers)
	* Revamp IWYU pragmas, now support keep + export + private (dsturtevant)
	* Fix a bug when nested classes are defined out of line (csilvers)
	* Add the ability to print an arbitrary ASTNode (csilvers)

All code by csilvers was reviewed by wan and dsturtevant.  Code by
dsturtevant was reviewed by csilvers.
2011-02-19 02:32:52 +00:00
csilvers 3f6d8dace4 Make iwyu compile again against the head of Clang/LLVM, following this
change:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110214/038992.html

It looks like it's no longer necessary to call setLLVMContext, as a default llvm context is now constructed by CodeGenAction.

Patch by paul.hol...@gmail.com, reviewed by csilvers
2011-02-18 21:11:03 +00:00
csilvers 660b668abb Fix the relative-path handling to work better on windows.
Patch submitted by paul.hol...@gmail.com.  Reviewed by csilvers.

Fixes http://code.google.com/p/include-what-you-use/issues/detail?id=11
2011-02-17 01:51:24 +00:00
csilvers 77fe0b2a05 Fix the top-of-file comment. 2011-02-16 01:40:07 +00:00
csilvers cbcb090a7a Oops, forgot to delete these files in the last commit. They're no
longer needed.
2011-02-16 01:22:03 +00:00
csilvers c8053e734f 1. Update three tests to increase their coverage a bit:
sizeof_reference, varargs_and_references, template_function_arg.
2. Add code to print a given ASTNode, no matter what kind of node it is.
3. Print the node contents in the ast-node flattener, at debug level 7.

All code written by csilvers, and reviewed by wan and dsturtevant.
2011-02-15 23:23:27 +00:00
csilvers 4ba3299fc0 A few cleanups; no functionality change.
1) Removed the use of <tr1/tuple> -- it wasn't getting us that much,
and cost us in portability.  Resolves
   http://code.google.com/p/include-what-you-use/issues/detail?id=2

2) Removed unused 'using' statements, renamed some vars to be cleaner,
added 'const' in a few places I could, etc.

3) Refactored some logic into a new function GetCalleeFunctionType().

4) Made a few tests more robust by using better fakes (mostly in
more_tests, so not directly relevant to the opensource code).

5) Added a check to make sure we don't add any new include-mappings
after we were supposed to have finialized the mappings.

All code reviewed by wan and/or dstur...
2011-02-11 23:08:41 +00:00
csilvers 1235245be2 Fix link order for linkers that care. Fixes
http://code.google.com/p/include-what-you-use/issues/detail?id=9
    http://code.google.com/p/include-what-you-use/issues/detail?id=10

The same exact patch was proposed by jason.ha... and bruce.r...

Reviewed by csilvers
2011-02-08 19:46:30 +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
csilvers 8de2590cec * Add a cmakefile (jason haslam)
* Add some helpful debugging tips to the README (csilvers)
2011-02-07 23:49:52 +00:00
csilvers dee92b5e0a Initial release! Grains of salt not included. 2011-02-04 22:28:15 +00:00