Aaron Ballman [Tue, 28 Jan 2014 01:47:34 +0000 (01:47 +0000)]
Relaxing the alignment requirements for fields in a transparent_union. Emits the diagnostic only when subsequent alignments are more strict than the alignment required by the first field.
Kaelyn Uhrain [Tue, 28 Jan 2014 00:46:47 +0000 (00:46 +0000)]
Apply the typo correction replacement location fix from r191450 to the
case when correcting for too many arguments (r191450 had only fixed the
problem for when there were too few arguments). Also fix the underlining
for both cases.
Adrian Prantl [Mon, 27 Jan 2014 22:50:20 +0000 (22:50 +0000)]
Rumors of test_debuginfo's death are slightly exaggerated.
Revert "Revert r113780, "Recognize .ll as input files. Handle %test_debuginfo on a RUN command line.""
Aaron Ballman [Mon, 27 Jan 2014 22:10:04 +0000 (22:10 +0000)]
Add a new attribute meta-spelling called "GCC" -- it widens into being a GNU spelling, and a CXX11 spelling with the namespace "gnu". It also sets a bit on the spelling certifying that it is known to GCC. From this, we can warn about the extension appropriately. As a consequence, the FunctionDefinition functionality is completely removed.
Replacing the functionality from r199676, which didn't solve the problem as elegantly.
ObjectiveC. When introducing a new property declaration in
parimary class and in mrr mode, assume property's default
memory attribute (assign) and to prevent a bogus warning.
// rdar://15859862
Alp Toker [Mon, 27 Jan 2014 04:22:22 +0000 (04:22 +0000)]
Use ConstStringRef facility for getCustomDiagID() safety
This is one of various functions in clang that don't handle arbitrary strings
well and can benefit from compile-time safety checks.
Also fixes an off-by-one error that caused one additional null byte to get
added to the end of custom diagnostic descriptions. ConstStringRef handles
tricky details like that for us now.
Richard Smith [Mon, 27 Jan 2014 04:19:56 +0000 (04:19 +0000)]
PR17052 / DR1560 (+DR1550): In a conditional expression between a glvalue and a
throw-expression, the result is also a glvalue and isn't unnecessarily coerced
to a prvalue.
Evan Cheng [Sun, 26 Jan 2014 23:12:43 +0000 (23:12 +0000)]
Fix r195149. Triple should correctly reflect that target. If it contains ios,
e.g. thumbv7m-apple-ios3.0.0-eabi, then it should mean it's an iOS target. For
embedded targets, the OS should be unknown, e.g. thumbv7m-apple-unknown-macho.
Since Tim has recently fixed the triple, r195149 is no longer needed.
rdar://15911035
Alp Toker [Sun, 26 Jan 2014 06:17:37 +0000 (06:17 +0000)]
Enforce safe usage of DiagnosticsEngine::getCustomDiagID()
Replace the last incorrect uses and templatize the function to require a
compile-time constant string preventing further misuse.
The diagnostic formatter expects well-formed input and has undefined behaviour
with arbitrary input or crafted user strings in source files. Accepting user
input would also have caused unbounded generation of new diagnostic IDs which
can be problematic in long-running sessions or language bindings.
This completes the work to fix several incorrect callers that passed user
input or raw messages to the diagnostics engine where a constant format string
was expected.
Alp Toker [Sun, 26 Jan 2014 05:08:07 +0000 (05:08 +0000)]
Remove buggy example code from the documentation
Instead point readers to the latest, correct example code in SVN until we find
a way to automatically include example sources into the documentation (or until
someone steps up to maintain these actively).
This ensures that the examples are up-to-date, buildable, and most of all that
readers don't pick up incorrect usage.
Alp Toker [Sun, 26 Jan 2014 05:07:32 +0000 (05:07 +0000)]
ARCMigrate: Introduce proper diagnostics for TransformActions
This starts to switch ARCMT to use proper diagnostic messages. The old use was
based on incorrect example code from the documentation.
The logic of the previous report() functions has been retained to support any
external consumers that might be intercepting diagnostic messages through the
old interface.
Note that the change in test/Misc/warning-flags.c isn't a new warning without a
flag, rather one that was previously invisible to the test. Adding a flag might
be a good idea though.
Richard Smith [Sat, 25 Jan 2014 20:50:08 +0000 (20:50 +0000)]
PR18283: If a const variable of integral or enumeration type is
initialized from a constant expression in C++98, it can be used in
constant expressions, even if it was brace-initialized. Patch by
Rahul Jain!
unittests: explicit stringify StringRefs for conversion
When clang is built outside of the LLVM tree (against a corresponding version),
there is no definition providing for operator<<(std::ostream &, StringRef) which
is required for the assertion routines in google-test tests. Avoid the
compilation failure by explicitly stringifying the StringRef prior to use.
Reduces the ARCMT migrator plist writer down to a single function,
arcmt::writeARCDiagsToPlist() which shares supporting functions with the
analyzer plist writer.
Richard Trieu [Sat, 25 Jan 2014 01:10:35 +0000 (01:10 +0000)]
Broaden -Wstring-conversion to catch string literals in logical or expressions.
Previously, string literals were ignored in all logical expressions. This
reduces it to only ignore in logical and expressions.
Richard Smith [Fri, 24 Jan 2014 22:34:35 +0000 (22:34 +0000)]
Allow virt-specifiers after GNU attributes in member-declarators. GCC doesn't
allow this, and we should warn on it, but it turns out that people were already
relying on this.
We should introduce a -Wgcc-compat warning for this if the attributes are known
to GCC, but we don't currently track enough information about attributes to do
so reliably.
Aaron Ballman [Fri, 24 Jan 2014 21:32:49 +0000 (21:32 +0000)]
Adds a getSemanticSpelling function to semantic attribute subclasses which have a meaningful semantic spelling. Adds a sibling function to parsed attribtues (via AttributeList) for getting the semantic spelling, if one were to exist. This can be used for cleaner code that deals directly with the semantic spellings (such as the MSInheritance attribute).
Aaron Ballman [Fri, 24 Jan 2014 19:46:45 +0000 (19:46 +0000)]
Since Visual Studio 2012 is the minimum version of MSVC we support, the old-style visualizers are being removed. Adding a Natvis replacement for the debugging visualizers.
Yunzhong Gao [Fri, 24 Jan 2014 19:28:24 +0000 (19:28 +0000)]
Fixing PR18510 by checking whether the non-virtual base of the derived class
might have a smaller size as compared to the stand-alone type of the base class.
This is possible when the derived class is packed and hence might have smaller
alignment requirement than the base class.
Artyom Skrobov [Fri, 24 Jan 2014 11:10:39 +0000 (11:10 +0000)]
Combine the checks for returns_nonnull and for operator new returning null, in Sema::CheckReturnValExpr. Add the missing handling of value-dependent expressions for returns_nonnull.
Ismail Pazarbasi [Fri, 24 Jan 2014 10:54:12 +0000 (10:54 +0000)]
Initialize StandardConversionSequence correctly
MSAN detected a path that leaves DeprecatedStringLiteralToCharPtr uninitialized.
UserDefinedConversionSequence::First is a StandardConversionSequence that must
be initialized with setAsIdentityConversion.
Manuel Klimek [Fri, 24 Jan 2014 09:25:23 +0000 (09:25 +0000)]
Get rid of special parsing for return statements.
This was done when we were not able to parse lambdas to handle some
edge cases for block formatting different in return statements, but is
not necessary any more.
Richard Smith [Fri, 24 Jan 2014 03:13:34 +0000 (03:13 +0000)]
Update page on clang diagnostics to contrast to GCC 4.9 instead of 4.2. A lot
of the differences we identified here have been fixed by improvements in GCC.
Richard Smith [Fri, 24 Jan 2014 01:54:52 +0000 (01:54 +0000)]
PR18560: When switching to a new context, don't just save and restore an
override for the type of 'this', also clear it out (unless we're entering the
context of a lambda-expression, where it should be inherited).
Richard Smith [Thu, 23 Jan 2014 23:53:27 +0000 (23:53 +0000)]
Factor out repeated parsing of a member-declarator when parsing a
member-declaration. In the process, fix a couple of bugs that had crept in
where we would parse the first and subsequent member-declarators differently
(in particular, we didn't accept an asm-label on a member function definition
within a class, and we would accept virt-specifiers and attributes in the wrong
order on the first declarator but not on subsequent ones).
This returns a list of valid (and useful) completions for a context (a list
of outer matchers), ordered by decreasing relevance then alphabetically. It
will be used by the matcher parser to implement completion.
Serge Pavlov [Thu, 23 Jan 2014 15:05:00 +0000 (15:05 +0000)]
Fix to PR8880 (clang dies processing a for loop)
Due to statement expressions supported as GCC extension, it is possible
to put 'break' or 'continue' into a loop/switch statement but outside
its body, for example:
for ( ; ({ if (first) { first = 0; continue; } 0; }); )
This code is rejected by GCC if compiled in C mode but is accepted in C++
code. GCC bug 44715 tracks this discrepancy. Clang used code generation
that differs from GCC in both modes: only statement of the third
expression of 'for' behaves as if it was inside loop body.
This change makes code generation more close to GCC, considering 'break'
or 'continue' statement in condition and increment expressions of a
loop as it was inside the loop body. It also adds error for the cases
when 'break'/'continue' appear outside loop due to this syntax. If
code generation differ from GCC, warning is issued.
Tim Northover [Thu, 23 Jan 2014 15:00:01 +0000 (15:00 +0000)]
MachO embedded: default to soft float without issuing warning
This is a simpler rule, broadly in line with previous Darwin (which chose
between "soft" and "softfp") but probably safer. In practice the only real
reason for "softfp" is ABI compatibility, not usually an issue on limited chips
like these, so anyone who wanted hard-float should already be saying so.