Commit Graph

16 Commits

Author SHA1 Message Date
Bolshakov ae98e1ebd7 Maintenance: redundant code removed
self-written using-decl lookup seems to became redundant after introducing
UsingType handling (ce4ccc665)
2022-04-21 21:46:25 +02:00
Kim Grasman 5b61a55190 Fix #310: Replace Each with C++11 range for loops
The Each construct was nice, but it's outlived its usefulness, the range for
loops are both easier to read and write.

For iteration over maps, we consistently use 'auto' to avoid repeating the map
value type.
2016-07-11 07:19:51 +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
csilvers+iwyu 66388e6410 iwyu was egregiously wrong in how it handled template
arguments using the 'precomputed cache'.  In such situations,
it totally ignored the currently active resugar_map, replacing
it with one of its own.  That worked fine for types outside of
templates, but not fine for types inside (such as a 'hash_map<T>'
inside a templated class).

I "fixed" this.  "Fixed" is in quotes because this turned up a
whole slew of other problems I don't even attempt to resolve
here (though I spent a few hours trying).  One is that it's
possible to have a type like hash_map that has some arguments
that are dependent and some that aren't; in theory, for these
types, we can correctly attribute the use to the template
author or template instantiator depending on which type it
is.  But I can't figure out how to get clang to do any
meaningful analysis of incomplete (dependent) types, so I've
punted on that for now.

The second thing wrong is I jumped through all sorts of hoops
to handle default template arguments correctly, so if a class
has a hash_map<T> and you instantiate T with string, you're
also made responsible for hash<string>.  This *should* work,
but clang is giving hash<string> a type I don't expect
(RecordType, not TemplateSpecializationType), and I don't know
how to deal with that -- I don't know how to extract the
'string' part of this RecordType.  Ugh.  I punt on this now,
as well.

Even in this incomplete form, it's enough to resolve a P1 bug,
so I figure it's worth putting in.

R=dsturtevant
DELTA=141  (97 added, 7 deleted, 37 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=3147
2011-08-31 11:42:23 +00:00
csilvers+iwyu 256da9418d Include-what-you-use fixit -- run iwyu on itself to fix up includes (part 2).
R=csilvers
DELTA=51  (3 added, 47 deleted, 1 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1736
2011-05-04 18:32:59 +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 3d55404056 Include-what-you-use fixes by running it on itself.
R=dsturtevant,csilvers
	DELTA=215  (135 added, 45 deleted, 35 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1731
2011-05-04 18:29:59 +00:00
csilvers+iwyu 32bf5284e8 Renames Contains() to ContainsKey() to stress that:
1. it only works with an associative container (e.g. set or map),
2. it takes a key_value rather than a value_type.

R=csilvers
DELTA=55  (1 added, 3 deleted, 51 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1570
2011-04-26 23:02:58 +00:00
csilvers+iwyu 33efb0fb45 Introduces ContainsValue() to simplify the common pattern
of determining whether a value is in a non-map container.

Contains(key) only works for map-like containers.

R=csilvers
DELTA=23  (12 added, 2 deleted, 9 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=1568
2011-04-26 23:01:59 +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+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 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 dee92b5e0a Initial release! Grains of salt not included. 2011-02-04 22:28:15 +00:00