Richard Smith [Mon, 23 Jul 2012 05:45:25 +0000 (05:45 +0000)]
Add diagnostics for comma at end of enum and for extra semicolon at namespace
scope to -Wc++11-extensions. Move extra semicolon after member function
definition diagnostic out of -pedantic, since C++ allows a single semicolon
there. Keep it in -Wextra-semi, though, since it's still questionable.
Douglas Gregor [Mon, 23 Jul 2012 04:23:39 +0000 (04:23 +0000)]
When we have an Objective-C object with non-trivial lifetime in a
structor class under ARC, that struct/class does not have a trivial
move constructor or move assignment operator. Fixes the rest of
<rdar://problem/11738725>.
Richard Smith [Sun, 22 Jul 2012 23:45:10 +0000 (23:45 +0000)]
PR12917: Remove incorrect assumption that lambda mangling information cannot
change once it's been assigned. It can change in two ways:
1) In a template instantiation, the context declaration should be the
instantiated declaration, not the declaration in the template.
2) If a lambda appears in the pattern of a variadic pack expansion, the
mangling number will depend on the pack length.
Dmitri Gribenko [Sat, 21 Jul 2012 01:47:43 +0000 (01:47 +0000)]
Comment to HTML conversion: add more CSS classes to identify function arguments
by index. This is useful if the user does not document all arguments, and we
can't find a particular argument by index via :nth-of-type() CSS selector.
Dmitri Gribenko [Fri, 20 Jul 2012 21:34:34 +0000 (21:34 +0000)]
Add libclang APIs to walk comments ASTs and an API to convert a comment to an
HTML fragment.
For testing, c-index-test now has even more output:
* HTML rendering of a comment
* comment AST tree dump in S-expressions like Comment::dump(), but implemented
* with libclang APIs.
Chad Rosier [Fri, 20 Jul 2012 21:20:33 +0000 (21:20 +0000)]
Add a new flag, -fms-inline-asm, that enables the output of MS-style inline
assembly.
By default, we don't emit IR for MS-style inline assembly (see r158833 as to
why). This is strictly for testing purposes and should not be enabled with the
expectation that things will work. This is a temporary flag and will be removed
once MS-style inline assembly is fully supported.
Jordan Rose [Fri, 20 Jul 2012 18:50:51 +0000 (18:50 +0000)]
Re-apply r160319 "Don't crash when emitting fixits following Unicode chars"
This time, make sure we don't try to print fixits with newline characters,
since they don't have a valid column width, and they don't look good anyway.
PR13417 (and originally <rdar://problem/11877454>)
Fixes an ObjC++ parse crash caused by delayed parsing
of c-functions nested in namespace in method implementations
by turning off its delayed parsing until a proper solution is
figured out. pr13418
Jordan Rose [Thu, 19 Jul 2012 18:10:23 +0000 (18:10 +0000)]
For varargs, diagnose passing ObjC objects by value like other non-POD types.
While we still want to consider this a hard error (non-POD variadic args are
normally a DefaultError warning), delaying the diagnostic allows us to give
better error messages, which also match the usual non-POD errors more closely.
In addition, this change improves the diagnostic messages for format string
argument type mismatches by passing down the type of the callee, so we can
say "variadic method" or "variadic function" appropriately.
Simplify UninitializedValues.cpp by removing logic to handle the previous (imprecise) representation
of '&&' and '||' in the CFG. This is no longer needed, and greatly simplifies the code.
Relaxed enumeration constant naming rules for scoped enumerators so they no longer emit a diagnostic when the enumeration's name matches that of the class. Fixes PR13128.
Bob Wilson [Thu, 19 Jul 2012 01:35:55 +0000 (01:35 +0000)]
Force the OS X version to 10.6 for old-style simulator builds.
The hack of recognizing a -D__IPHONE_OS_VERSION_MIN_REQUIRED option
in place of -mios-simulator-version-min leaves the Darwin version
unspecified. It can be set separately with -mmacosx-version-min (which
makes no sense) or inferred to match the host version (which is unpredictable
and usually wrong). This really needs to get cleaned up, but in the
meantime, force the OS X version to 10.6 so that the behavior is sane for
the iOS simulator. Thanks for Argyrios for the patch.
<rdar://problem/11858187>
Dmitri Gribenko [Thu, 19 Jul 2012 00:01:56 +0000 (00:01 +0000)]
Fix ParagraphComment::isWhitespace(): a paragraph without a non-whitespace
TextComment node was considered whitespace even if it contained other child
nodes.
Richard Smith [Wed, 18 Jul 2012 23:52:59 +0000 (23:52 +0000)]
Fix OverloadCandidateSet::clear to not leak PartialDiagnostics, found by Samuel
Panzer. I've not been able to trigger a failure caused by this, so no test yet.
Also included is a small change from Paul Robinson to only consider the
FailureKind if the overload candidate did actually fail.
Jordan Rose [Wed, 18 Jul 2012 21:59:51 +0000 (21:59 +0000)]
[analyzer] Combine all ObjC message CallEvents into ObjCMethodCall.
As pointed out by Anna, we only differentiate between explicit message sends
This also adds support for ObjCSubscriptExprs, which are basically the same
as properties in many ways. We were already checking these, but not emitting
nice messages for them.
This depends on the llvm::PointerIntPair change in r160456.
Jordan Rose [Wed, 18 Jul 2012 21:59:41 +0000 (21:59 +0000)]
[analyzer] Make CallEvent a value object.
We will need to be able to easily reconstruct a CallEvent from an ExplodedNode
for diagnostic purposes, and that's exactly what factory functions are for.
CallEvent objects are small enough (four pointers and a SourceLocation) that
returning them through the stack is fairly cheap. Clients who just need to use
existing CallEvents can continue to do so using const references.
This uses the same sort of "kind-field-dispatch" as SVal, though most of the
nastiness is contained in the DISPATCH and DISPATCH_ARG macros at the end of
the file. (We can't use a template for this because member-pointers to base
class methods don't call derived-class methods even when casting to the
derived class. We can't use variadic macros because they're a C99 feature.)
Jordan Rose [Wed, 18 Jul 2012 21:59:37 +0000 (21:59 +0000)]
[analyzer] Remove obsolete ObjCPropRef SVal kind.
ObjC properties are handled through their semantic form of ObjCMessageExprs
and their wrapper PseudoObjectExprs, and have been for quite a while. The
syntactic ObjCPropertyRefExprs do not appear in the CFG and are not visited
by ExprEngine.
Benjamin Kramer [Wed, 18 Jul 2012 19:08:44 +0000 (19:08 +0000)]
Remove trivial destructor from SVal.
This enables the faster SmallVector in clang and also allows clang's unused
variable warnings to be more effective. Fix the two instances that popped up.
The RetainCountChecker change actually changes functionality, it would be nice
if someone from the StaticAnalyzer folks could look at it.
Dmitri Gribenko [Wed, 18 Jul 2012 16:30:42 +0000 (16:30 +0000)]
On Darwin, the linker removes functions in CommentDumper.o (Comment::dump())
despite __attribute__(__used__). As explained by Argyrios,
> .a archive files do some stripping of their own and they remove .o files that
> contain functions that are not referenced by any other .o file.
The fix is to use these functions from another .o file.
Richard Smith [Wed, 18 Jul 2012 03:51:16 +0000 (03:51 +0000)]
PR13381, part 2: when determining if a defaulted special member function should
be defined as deleted, take cv-qualifiers on class members into account when
looking up the copy or move constructor or assignment operator which will be
used for them.
Richard Smith [Wed, 18 Jul 2012 03:36:00 +0000 (03:36 +0000)]
PR13381: consider cv-qualifiers on a class member's type when determining which
constructor will be used for moving that object, in the computation of its
exception specification.
Richard Smith [Wed, 18 Jul 2012 01:29:05 +0000 (01:29 +0000)]
PR13386: When matching up parameters between a function template declaration
and a function template instantiation, if there's a parameter pack in the
declaration and one at the same place in the instantiation, don't assume that
the pack wasn't expanded -- it may have expanded to nothing. Instead, go ahead
and check whether the parameter pack was expandable. We can do this as a
side-effect of the work we'd need to do anyway, to find how many parameters
were produced.
Douglas Gregor [Wed, 18 Jul 2012 00:14:59 +0000 (00:14 +0000)]
When performing the deduced/actual argument type check for C++
[temp.deduct.call]p4 under Objective-C++ ARC, make sure to adjust the
qualifiers to introduce the implicit strong lifetime when
needed. Fixes <rdar://problem/11825671>.
Joel Jones [Wed, 18 Jul 2012 00:01:03 +0000 (00:01 +0000)]
More replacing of target-dependent intrinsics with target-indepdent
intrinsics. The second instruction(s) to be handled are the vector versions
of count set bits (ctpop).
The changes here are to clang so that it generates a target independent
vector ctpop when it sees an ARM dependent vector bits set count. The changes
in llvm are to match the target independent vector ctpop and in
VMCore/AutoUpgrade.cpp to update any existing bc files containing ARM
dependent vector pop counts with target-independent ctpops. There are also
changes to an existing test case in llvm for ARM vector count instructions and
to a test for the bitcode upgrade.
There is deliberately no test for the change to clang, as so far as I know, no
consensus has been reached regarding how to test neon instructions in clang;
q.v. <rdar://problem/8762292>
Dmitri Gribenko [Tue, 17 Jul 2012 22:01:09 +0000 (22:01 +0000)]
Implement an optimization for finding the comment that occurs just after a
given declaration.
It is based on the observation that during parsing the comment that should be
attached to the decl is usually among the last two documentation comments
parsed.
Douglas Gregor [Tue, 17 Jul 2012 21:16:27 +0000 (21:16 +0000)]
Teach the ASTImporter how to handle anonymous structs/unions
better. Fixes <rdar://problem/11466212>; the test (and back-ported
version of this code) were committed to LLDB in r160186.
Issue warning when assigning out-of-range integer values to enums.
Due to performance cost, this is an opt-in option placed
under -Wassign-enum. // rdar://11824807
Jordan Rose [Tue, 17 Jul 2012 17:46:48 +0000 (17:46 +0000)]
-Wobjc-literal-compare: don't warn when comparing against nil.
Checks against nil often appear as guards in macros, and comparing
Objective-C literals to nil has well-defined behavior (if tautological).
On OS X, 'nil' has not been typed as 'id' since 10.6 (possibly earlier),
so the warning was already not firing, but other runtimes continue to use
((id)0) or some variant. This change accepts comparisons to any null pointer;
to keep it simple, it looks through all casts (not just casts to 'id').
Jordan Rose [Tue, 17 Jul 2012 17:46:44 +0000 (17:46 +0000)]
Add -Wobjc-string-compare under -Wobjc-literal-compare.
Suggested by Ted, since string literal comparison is at least slightly more
sensible than comparison of runtime literals. (Ambiguous language on
developer.apple.com implies that strings are guaranteed to be uniqued within
a translation unit and possibly across a linked binary.)
Jordan Rose [Tue, 17 Jul 2012 17:46:40 +0000 (17:46 +0000)]
Now that -Wobjc-literal-compare is a warning, put the fixit on a note.
Recovering as if the user had actually called -isEqual: is a bit too far from
the semantics of the program as written, /even though/ it's probably what they
intended.