Dmitri Gribenko [Tue, 24 Jul 2012 17:52:18 +0000 (17:52 +0000)]
Comment parsing: couple TextTokenRetokenizer and comment parser together to
remove one of the two variable-length lookahead buffers. Now retokenizer will
ask for more tokens when it needs them.
Manuel Klimek [Tue, 24 Jul 2012 13:37:29 +0000 (13:37 +0000)]
Introduces a new concept for binding results to matchers
as per Chandler's request:
- introduces a new matcher base type BindableMatcher that
provides the bind() call
- makes all dynamic-cast matcher creation functions return
BindableMatchers; the special case about dynamic-cast
matchers is that the node they match on and the node
their child matchers match on are the same node, just
casted to a different type; thus, there is no ambiguity
on what bind() matches on; additionally, those are the
matchers that we name with nouns in the matcher language,
so it's easy for users to intuitively know which matchers
are bindable
To make this change possible, we got rid of a non-orthogonal
implementation of thisPointerType, which had an implicit
dynamic-cast matcher from CallExpr to CXXMemberCallExpr; as
alternative, we now provide a memberCall dynamic-cast matcher
and thisPointerType is a predicate on CXXMemberCallExpr.
Last, the ArgumentAdaptingMatcher is actually not required
for the implementation of makeDynCastAllOfComposite - this
simplification makes it more obvious where the bind() call
can be used based on the matcher creation function types.
Nick Lewycky [Tue, 24 Jul 2012 01:40:49 +0000 (01:40 +0000)]
Emit debug info for dynamic initializers. Permit __attribute__((nodebug)) on
variables that have static storage duration, it removes debug info on the
emitted initializer function but not all debug info about this variable.
Dmitri Gribenko [Mon, 23 Jul 2012 19:41:49 +0000 (19:41 +0000)]
libclang comments AST: clang_ParamCommandComment_getParamName: don't assert
when a \param command does not have a parameter name, just return an empty
string instead.
Michael Han [Mon, 23 Jul 2012 18:48:41 +0000 (18:48 +0000)]
Refactor handler functions for thread safety attributes.
Make handler functions for thread safety attributes consistent with other attributes handler functions
by removing the bool parameter from some of the thread safety attributes handler functions and extracting
common checks out of different handler functions.
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>.