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.
Rafael Espindola [Tue, 17 Jul 2012 15:14:47 +0000 (15:14 +0000)]
Merge visibility from previous decls before looking at visibility pragma. This
is a bit fuzzy, but matches gcc behavior and existing code bases seem to
depend on it.
- lib/Driver/Driver.cpp, tools/driver/driver.cpp: Exit status should not be propagated, although clang driver should catch exceptions.
- test/Driver/crash-report.c: Add REQUIRES:shell for now.
FIXME: setenv should work also on Lit.InternalShellRunner.
- test/Driver/crash-report.c: Remove XFAIL.
Richard Smith [Tue, 17 Jul 2012 01:27:33 +0000 (01:27 +0000)]
Uninitialized variables: two little changes:
* Treat compound assignment as a use, at Jordy's request.
* Always add compound assignments into the CFG, so we can correctly diagnose the use in 'return x += 1;'
Richard Smith [Tue, 17 Jul 2012 00:06:14 +0000 (00:06 +0000)]
-Wuninitialized: Split the classification of DeclRefExprs as initialization or
use out of TransferFunctions, and compute it in advance rather than on-the-fly.
This allows us to handle compound assignments with DeclRefExprs on the RHS
correctly, and also makes it trivial to treat const& function parameters as not
initializing the argument. The patch also makes both of those changes.
Add hack (provided by Jonathan Sauer) to fall back to assuming Xcode is installed in /Developer
when using Python < 2.7.0. This is the case on Snow Leopard, where the tools are always
installed in /Developer. This isn't a proper fix for really figuring out where Xcode
is installed, but should work to fix an obvious problem on Snow Leopard.
Jordan Rose [Mon, 16 Jul 2012 20:52:12 +0000 (20:52 +0000)]
Don't crash when emitting fixits following Unicode characters.
This code is very sensitive to the difference between "columns" as printed
and "bytes" (SourceManager columns). All variables are now named explicitly
and our assumptions are (hopefully) documented as both comment and assertion.
Whether parseable fixits should use byte offsets or Unicode character counts
is pending discussion on the mailing list; currently the implementation uses
bytes (and has no problems on lines containing multibyte characters).
This has been added to the user manual.
Anna Zaks [Mon, 16 Jul 2012 20:21:42 +0000 (20:21 +0000)]
[analyzer] Make CmpRuns external-user friendly.
CmpRuns can be used for static analyzer bug report comparison. However,
we want to make sure external users do not rely on the way bugs are
represented (plist files). Make sure that we have a user
friendly/documented API for CmpRuns script.
Simon Atanasyan [Mon, 16 Jul 2012 18:52:02 +0000 (18:52 +0000)]
MIPS: Implement __builtin_mips_shll_qb builtin function overloading.
This function has two versions. The first one is used for a register operand.
The second one is used for an immediate number.
Richard Smith [Mon, 16 Jul 2012 01:59:26 +0000 (01:59 +0000)]
More for PR11848: a pack expansion type isn't necessarily type-dependent (its
pattern might be an alias template which doesn't use its arguments). It's always
instantiation-dependent, though.
Richard Smith [Mon, 16 Jul 2012 01:09:10 +0000 (01:09 +0000)]
PR13365: Fix code which was trying to treat an array of DeducedTemplateArgument
as an array of its base class TemplateArgument. Switch the const
TemplateArgument* parameters of InstantiatingTemplate's constructors to
ArrayRef<TemplateArgument> to prevent this from happening again in the future.
Richard Smith [Mon, 16 Jul 2012 00:20:35 +0000 (00:20 +0000)]
Related to PR11848 and core-21989: switch ContainsUnexpandedParameterPack from
being a property of a canonical type to being a property of the fully-sugared
type. This should only make a difference in the case where an alias template
ignores one of its parameters, and that parameter is an unexpanded parameter
pack.
Which is a bit silly and got a lot noisier now that we correctly handle
visibility pragmas. This patch fixes that and also has some extra quality
improvements:
* We now produce an error instead of a warning for
Refine CFG so that '&&' and '||' don't lead to extra confluence points when used in a branch, but
instead push the terminator for the branch down into the basic blocks of the subexpressions of '&&' and '||'
respectively. This eliminates some artifical control-flow from the CFG and results in a more
compact CFG.
Note that this patch only alters the branches 'while', 'if' and 'for'. This was complex enough for
one patch. The remaining branches (e.g., do...while) can be handled in a separate patch, but they
weren't immediately tackled because they were less important.
It is possible that this patch introduces some subtle bugs, particularly w.r.t. to destructor placement.
I've tried to audit these changes, but it is also known that the destructor logic needs some refinement
in the area of '||' and '&&' regardless (i.e., their are known bugs).
Chad Rosier [Fri, 13 Jul 2012 23:57:43 +0000 (23:57 +0000)]
Add a per target max vector alignment field (e.g., 32-byte alignment for x86 due to
AVX). Currently, if no aligned attribute is specified the alignment of a vector is
inferred from its size. Thus, very large vectors will be over-aligned with no
benefit. Target owners should set this target max.
Richard Smith [Fri, 13 Jul 2012 23:33:44 +0000 (23:33 +0000)]
PR13360: When deciding the earliest point which inevitably leads to an
uninitialized variable use, walk back over branches where we've reached all the
non-null successors, not just cases where we've reached all successors.
Joel Jones [Fri, 13 Jul 2012 23:26:27 +0000 (23:26 +0000)]
This is one of the first steps at moving to replace target-dependent
intrinsics with target-indepdent intrinsics. The first instruction(s) to be
handled are the vector versions of count leading zeros (ctlz).
The changes here are to clang so that it generates a target independent
vector ctlz when it sees an ARM dependent vector ctlz. The changes in llvm
are to match the target independent vector ctlz and in VMCore/AutoUpgrade.cpp
to update any existing bc files containing ARM dependent vector ctlzs with
target-independent ctlzs. There are also changes to an existing test case in
llvm for ARM vector count instructions and a new 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>
Richard Trieu [Fri, 13 Jul 2012 21:18:32 +0000 (21:18 +0000)]
Modify tree printing mode for template type diffing. If a diagnostic has
multiple %diff's, only print the first tree and fallback to inline printing
for the rest of the diagnostic.
Rafael Espindola [Fri, 13 Jul 2012 18:04:45 +0000 (18:04 +0000)]
Apply visibility pragmas to class template declarations. This is needed because
we might use the declaration to build a type before seeing the definition.
Richard Smith [Fri, 13 Jul 2012 04:12:04 +0000 (04:12 +0000)]
Provide a special-case diagnostic when two class member functions instantiate
to the same signature. Fix a bug in the type printer which would cause this
diagnostic to print wonderful types like 'const const int *'.
Rafael Espindola [Fri, 13 Jul 2012 01:19:08 +0000 (01:19 +0000)]
Fix a bug in my previous commit. The problem is not that we were not using the
canonical decl for the template, but that we were not merging attributes for
templates at all!