Stephan Bergmann
4e9dd6e1b7
Disambiguate clang::StringLiteral
...
...vs. recently introduced llvm::StringLiteral (llvm/ADT/StringRef.h)
Change-Id: I4d74546b0d1401a74b0c15368bbc93794ecd0b1d
2016-12-14 15:52:33 +01:00
Stephan Bergmann
3510a48794
loplugin:literaltoboolconversion: Better heuristic...
...
to determine code shared between C and C++
Change-Id: Ib1f3892b388ebd6a67cc88831a99dfb4ccdfbc2f
2016-07-11 21:30:34 +02:00
Stephan Bergmann
733198de1b
Remove support for Clang < 3.4
...
Change-Id: I81e97c5f720535b33dd3ce72d01151765e4e93a0
2016-06-29 09:15:25 +02:00
Stephan Bergmann
1ce7176ba1
Remove support for Clang < 3.3
...
Change-Id: I185852a738bac10dc6d331afccfcbc7ae1225cb1
2016-06-29 08:55:27 +02:00
Benjamin Ni
be729e7721
tdf#94269: Replace "n" prefix for bool variables with "b"
...
Change-Id: I178545792c7354a362658ac7ef8b1d4cf0865797
Signed-off-by: Michael Stahl <mstahl@redhat.com >
2015-11-02 23:40:57 +01:00
Stephan Bergmann
4d7b194dd5
Improved loplugin:literaltoboolconversion looking into cond. exprs.
...
Change-Id: If54ab99fc82c7895da6bb88ebf18a11570f597ed
2015-04-23 18:39:07 +02:00
Stephan Bergmann
78ad5ecd98
Clean up isMacroBodyExpansion
...
Change-Id: I745b320dd5f44d54371d8a0b961c49793e3e0ad6
2015-03-28 19:16:47 +01:00
Noel Grandin
c4a9241f72
new clang plugin: staticmethods
...
Genius suggestion from Tor Lillqvist, write a clang plugin that finds
methods that can be static.
Change-Id: Ie6684cc95d088e8750b300a028b49f763da00345
2015-03-27 10:51:08 +02:00
Stephan Bergmann
88a031e593
Missing initialization
...
Change-Id: I45eabbe9d1a4e3f85f16c2869c4031fc06f5ef31
2015-03-02 17:47:23 +01:00
Stephan Bergmann
9e6c2369a1
plugin:literaltoboolconversion: Recurse into comma operator's rhs
...
...inspired by <http://www.viva64.com/en/b/0308/#ID0EE4BI >'s V639 finding.
Change-Id: I3b49f00dd4a593ed0b94d81398fa89ff64f6c79b
2015-03-02 17:14:33 +01:00
Stephan Bergmann
f266c81b2d
Don't call isIntegerConstantExpr if isValueDependent
...
...some paths trough clang::Expr::isIntegerConstantExpr (esp. if
non-CPlusPlus11) assert the assumption that the given expr is not
value-dependent, so it appears to be a prereq
Change-Id: Ibc5fe472ea3f91b31c8cb7f06c4b7c7f4d6831a3
2014-12-21 22:00:40 +01:00
Luboš Luňák
e823a9bd63
do not warn about "null pointer conversions" from integers in C++98 mode
...
Change-Id: I15c7f52c542549ad131400c9b5395a06a4777687
2014-09-15 17:38:42 +02:00
Stephan Bergmann
b4e5b8bc1d
Add compat::isInMainFile
...
Change-Id: I0e155c6c68a43020110a8e1c0cb29cabdcade454
2014-04-02 17:53:43 +02:00
Luboš Luňák
f7859e5282
fix filename detection in clang plugins
...
SourceManager::getFilename() returns "<stdin>" whenever icecream is used.
Change-Id: I4e3e1b90880c5fd2b53f20e4ce3e38e3a0486973
2014-03-23 16:26:53 +01:00
Stephan Bergmann
907ffec490
isIntegerConstantExpr is more general than IntegerLiteral
...
...and subsumes not only the use of __builtin_expect in assert, but also the use
of __builtin_constant_p (nested) in htonl on Mac OS X.
Change-Id: I62ab6c71c42948c4ec1e2f1e1d23223cbb13416b
2014-02-25 19:05:01 +01:00
Stephan Bergmann
d36e60f685
Adapt to Clang <= 3.4
...
Change-Id: If9c9d63d85ce29629e6453f2d69355bd64ac2fc5
2014-02-21 23:59:24 +01:00
Stephan Bergmann
216bcceee1
Special handling of __builtin_expect in boolean expressions
...
...as found in Mac OS X' assert macro definition,
__builtin_expect(!(e), 0) ? ... : ...
with type
long __builtin_expect(long, long)
The code in literaltoboolconversion.cxx is needed for
assert(false);
Change-Id: I42f87482c56986af74b2ec849db9852f74c7c938
2014-02-21 23:47:23 +01:00
Noel Grandin
a1aa702861
literaltobool conversion plugin, reduce spurious warnings with clang 3.3
...
It appears that clang 3.3 also generates spurious warnings, so
adjust the ifdef
Change-Id: Idb57f7eafd55effd4c7c8b1f96c03c2ea6ddaba3
2014-01-30 15:41:27 +02:00
Stephan Bergmann
c03a2a0b1b
Further fix for old Clang versions
...
...maybe this needs adaption for 3.3 or 3.4 too, known to work with trunk
towards 3.5.
Change-Id: I9f05ae44e4a49ae51df69d5a3c1df5eb371a1c87
2014-01-29 11:15:44 +01:00
Stephan Bergmann
d433d8245b
Fix for old Clang versions
...
Change-Id: Ib902535c03a9f1b93a2c4ff3dd61d29e316bfd49
2014-01-29 09:58:10 +01:00
Stephan Bergmann
3de97578e4
Clang plugin to warn about implicit conversion of literals to bool
...
...which warns about apparent errors like
n == KIND_FOO || KIND_BAR
that should have read
n == KIND_FOO || n == KIND_BAR
It also warns about trivial (mis-)uses of 0/1 and sal_False/True like
while (1) { ... }
instead of
while (true) { ... }
which it can automatically rewrite.
It does not warn if the relevant code is inside a macro in a .h (i.e., C)
include file, nor when a string literal is used in the assert macro like
assert(!"this cannot happen");
Change-Id: If8c305a25e5da15e78f6139b5b0c0e868f06d4f3
2014-01-28 20:26:31 +01:00