Daniel Jasper [Thu, 31 Jan 2013 14:59:26 +0000 (14:59 +0000)]
Several improvements to the formatting of static initializers.
1. Never avoid bin packing in static initializers as this can
lead to terrible results.
2. If an element has to be broken over multiple lines, break after
the following comma.
This should be a step forward, but there are still many cases
especially with nested static initializers that we handle badly.
More patches will follow.
Tim Northover [Thu, 31 Jan 2013 12:13:10 +0000 (12:13 +0000)]
Add support for AArch64 target.
In cooperation with the LLVM patch, this should implement all scalar front-end
parts of the C and C++ ABIs for AArch64.
This patch excludes the NEON support also reviewed due to an outbreak of
batshit insanity in our legal department. That will be committed soon bringing
the changes to precisely what has been approved.
Evgeniy Stepanov [Thu, 31 Jan 2013 09:53:29 +0000 (09:53 +0000)]
[msan] Run more optimizations after MemorySanitizer pass.
MSan instrumentation is driven by the original code. We take every
incoming instruction and emit another instruction (or ten) next to
it, operating on the shadow values (but sometimes on the real values,
too). Two programs in one, essentially. There can be any kinds of
redundancies in the second one, so we just run whatever is normally
run at -O2, and then exclude some passes that do not help much with
benchmarks.
Richard Smith [Thu, 31 Jan 2013 06:13:11 +0000 (06:13 +0000)]
Remove incorrect warning signs from QualType::getUnqualifiedType(). These
statements were only true for 65 CLs after they were introduced two years ago.
Douglas Gregor [Thu, 31 Jan 2013 05:50:40 +0000 (05:50 +0000)]
When we're emitting a constructor or destructor call from a delegating
constructor, retrieve our VTT parameter directly. Fixes PR14588 /
<rdar://problem/12867962>.
Richard Smith [Thu, 31 Jan 2013 05:19:49 +0000 (05:19 +0000)]
Improve 'failed template argument deduction' diagnostic for the case where we
have a direct mismatch between some component of the template and some
component of the argument. The diagnostic now says what the mismatch was, but
doesn't yet say which part of the template doesn't match.
Douglas Gregor [Thu, 31 Jan 2013 05:03:46 +0000 (05:03 +0000)]
When code completing in a statement, parenthesized expression, or
Objective-C message receiver, the user is as likely to want to write a
type name as any other declaration, so give types the same priority as
other declarations. Fixes <rdar://problem/12480600>.
Nick Lewycky [Thu, 31 Jan 2013 03:23:57 +0000 (03:23 +0000)]
Remove elements from Sema.UndefinedInternals as functions are defined. Also
filter the elements before emitting them into a PCH. No user-visible
functionality change, except that PCH files may be smaller?
Jordan Rose [Thu, 31 Jan 2013 02:57:06 +0000 (02:57 +0000)]
[analyzer] If a lazy binding is undefined, pretend that it's unknown instead.
This is a hack to work around the fact that we don't track extents for our
default bindings:
CGPoint p;
p.x = 0.0;
p.y = 0.0;
rectParam.origin = p;
use(rectParam.size); // warning: uninitialized value in rectParam.size.width
In this case, the default binding for 'p' gets copied into 'rectParam',
because the 'origin' field is at offset 0 within CGRect. From then on,
rectParam's old default binding (in this case a symbol) is lost.
This patch silences the warning by pretending that lazy bindings are never
made from uninitialized memory, but not only is that not true, the original
default binding is still getting overwritten (see FIXME test cases).
The long-term solution is tracked in <rdar://problem/12701038>
Richard Trieu [Thu, 31 Jan 2013 02:47:46 +0000 (02:47 +0000)]
When comparing two template template arguments in the template differ, consider
them the same if they are actually the same; having the same name isn't enough.
Similar to r174013, template template arguments were also mistakenly considered
the same when they had the same name but were in different namespaces.
In addition, when printing template template arguments, use the qualified name
if the regular name is the same.
Richard Trieu [Thu, 31 Jan 2013 01:44:26 +0000 (01:44 +0000)]
Add indents to AST dumping and removed parenthesis from AST nodes.
Indents were given the color blue when outputting with color.
AST dumping now looks like this:
Anna Zaks [Thu, 31 Jan 2013 01:19:52 +0000 (01:19 +0000)]
[analyzer] Fix a bug in region store that lead to undefined value false
positives.
The includeSuffix was only set on the first iteration through the
function, resulting in invalid regions being produced by getLazyBinding
(ex: zoomRegion.y).
Douglas Gregor [Thu, 31 Jan 2013 01:08:35 +0000 (01:08 +0000)]
When comparing two templates in the template differ, consider them the
same if they are actually the same; having the same name isn't
enough. Fixes <rdar://problem/12931988>.
Bill Wendling [Thu, 31 Jan 2013 00:30:05 +0000 (00:30 +0000)]
Make sure that the Attribute object represents one attribute only.
Several places were still treating the Attribute object as respresenting
multiple attributes. Those places now use the AttributeSet to represent
multiple attributes.
Jordan Rose [Wed, 30 Jan 2013 21:41:07 +0000 (21:41 +0000)]
Diagnostics: if a line is longer than 4096 characters, don't print it.
Specifically, don't print snippets, caret diagnostics, or ranges for
lines over 4096 characters. We copy the line around a few times in our
diagnostics machinery, and we have to print a caret line that's just as
long. This uses a lot of memory just to create a poor user experience as
we print out a line much too long for anyone to read...or spend extra
energy trying to fit it to -fmessage-length.
Anna Zaks [Wed, 30 Jan 2013 19:12:39 +0000 (19:12 +0000)]
[analyzer] Make shallow mode more shallow.
Redefine the shallow mode to inline all functions for which we have a
definite definition (ipa=inlining). However, only inline functions that
are up to 4 basic blocks large and cut the max exploded nodes generated
per top level function in half.
This makes shallow faster and allows us to keep inlining small
functions. For example, we would keep inlining wrapper functions and
constructors/destructors.
With the new shallow, it takes 104s to analyze sqlite3, whereas
the deep mode is 658s and previous shallow is 209s.
Jordan Rose [Wed, 30 Jan 2013 18:16:06 +0000 (18:16 +0000)]
[analyzer] Model trivial copy/move ctors with an aggregate bind.
This is faster for the analyzer to process than inlining the constructor
and performing a member-wise copy, and it also solves the problem of
warning when a partially-initialized POD struct is copied.
Before:
CGPoint p;
p.x = 0;
CGPoint p2 = p; <-- assigned value is garbage or undefined
Dmitri Gribenko [Wed, 30 Jan 2013 14:29:28 +0000 (14:29 +0000)]
Comment parsing: resolve more named character references
This reimplements r173850 with a better approach:
(1) use a TableGen-generated matcher instead of doing a linear search;
(2) avoid allocations for new strings by converting code points to string
iterals with TableGen.
Tim Northover [Wed, 30 Jan 2013 09:46:55 +0000 (09:46 +0000)]
Also promote fp16 types to double when they're anonymous variadic arguments.
__fp16 isn't covered by the standard, but this resolves the oddity that float
gets promoted when passed variadically, but not the smaller type. This is
required by the AArch64 ABI, and a sane action elsewhere.
Douglas Gregor [Wed, 30 Jan 2013 06:58:39 +0000 (06:58 +0000)]
The instance methods of the root class of an Objective-C hieararchy
can be messaged via the metaclass. Provide code completions for this
case. Fixes <rdar://problem/12560296>.
Summary:
A motivating example:
class ClassWithDtor {
public:
~ClassWithDtor() {}
};
void fallthrough3(int n) {
switch (n) {
case 2:
do {
ClassWithDtor temp;
return;
} while (0); // This generates a chain of unreachable CFG blocks.
case 3:
break;
}
}
Jordan Rose [Wed, 30 Jan 2013 01:52:57 +0000 (01:52 +0000)]
Don't warn about Unicode characters in -E mode.
People use the C preprocessor for things other than C files. Some of them
have Unicode characters. We shouldn't warn about Unicode characters
appearing outside of identifiers in this case.
There's not currently a way for the preprocessor to tell if it's in -E mode,
so I added a new flag, derived from the PreprocessorOutputOptions. This is
only used by the Unicode warnings for now, but could conceivably be used by
other warnings or even behavioral differences later.
David Blaikie [Wed, 30 Jan 2013 01:22:18 +0000 (01:22 +0000)]
Provide a fixit for constexpr non-static data members.
If the member has an initializer, assume it was probably intended to be static
and suggest/recover with that.
If the member doesn't have an initializer, assume it was probably intended to
be const instead of constexpr and suggest that.
(if the attempt to apply these changes fails, don't make any suggestion &
produce the same diagnostic experience as before. The only case where this can
come up that I know of is with a mutable constexpr with an initializer, since
mutable is incompatible with static (but it's already incompatible with
const anyway))
c: When checking on validity of sizeof passed as size of
argument to be memset, check for its type to be complete
before calling Context.getTypeSize(PointeeTy) to prevent
crash. // rdar://13081751.
Daniel Dunbar [Wed, 30 Jan 2013 00:19:24 +0000 (00:19 +0000)]
[Frontend] Add an ExternCSystem include entry group.
- The only group where it makes sense for the "ExternC" bit is System, so this
simplifies having to have the extra isCXXAware (or ImplicitExternC, depending
on what code you talk to) bit caried around.
Chad Rosier [Tue, 29 Jan 2013 23:31:22 +0000 (23:31 +0000)]
[ubsan] Implement the -fcatch-undefined-behavior flag using a trapping
implementation; this is much more inline with the original implementation
(i.e., pre-ubsan) and does not require run-time library support.
The trapping implementation can be invoked using either '-fcatch-undefined-behavior'
or '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error', with the latter
being preferred. Eventually, the -fcatch-undefined-behavior' flag will be removed.
[Preprocessor] When checking if we can concatenate two tokens, check
if they were already concatenated in source using the spelling locations
even if they came from a macro expansion.
This fixes an issue where a GUID passed as macro argument ends up
malformed after preprocessing because we added spaces inside it.
Chad Rosier [Tue, 29 Jan 2013 20:15:05 +0000 (20:15 +0000)]
[driver] Refactor the driver so that a failing commands doesn't prevent
subsequent commands from being executed.
The diagnostics generation isn't designed for this use case, so add a note to
fix this in the very near future. For now, just generated the diagnostics for
the first failing command.
Part of rdar://12984531