Richard Smith [Thu, 30 Jan 2014 22:24:05 +0000 (22:24 +0000)]
PR14995: Allow a dependent type as the second parameter of operator++ and
operator--, since it might instantiate as 'int' (or, if it's a pack, it
might instantiate as an empty pack).
Richard Smith [Thu, 30 Jan 2014 22:05:38 +0000 (22:05 +0000)]
Don't produce a 'returning reference to local' warning if a lambda returns a
reference (or pointer) to a variable from the closure object or from the
surrounding function scope.
Daniel Jasper [Thu, 30 Jan 2014 14:38:37 +0000 (14:38 +0000)]
clang-format: Support ObjC's NS_ENUMs.
Before:
typedef NS_ENUM(NSInteger, MyType) {
/// Information about someDecentlyLongValue.
someDecentlyLongValue,
/// Information about anotherDecentlyLongValue.
anotherDecentlyLongValue,
/// Information about aThirdDecentlyLongValue.
aThirdDecentlyLongValue};
After:
typedef NS_ENUM(NSInteger, MyType) {
/// Information about someDecentlyLongValue.
someDecentlyLongValue,
/// Information about anotherDecentlyLongValue.
anotherDecentlyLongValue,
/// Information about aThirdDecentlyLongValue.
aThirdDecentlyLongValue
};
John McCall [Thu, 30 Jan 2014 01:12:53 +0000 (01:12 +0000)]
Diagnose typedef names for linkage purposes that would change
a previously-computed linkage as an unsupportable error condition.
Per discussion on cfe-commits, this appears to be a
difficult-to-resolve flaw in our implementation approach;
we may pursue this as a language defect, but for now it's
better to diagnose it as unsupported than to produce
inconsistent results (or assertions). Anything that we can
do to limit how often this diagnostic fires, such as the
changes in r200380, is probably for the best, though.
Aaron Ballman [Wed, 29 Jan 2014 22:13:45 +0000 (22:13 +0000)]
Consolidating several table-generated files containing parser-related string switches into a single file. This reduces build-related complexity by replacing four separate projects (and table-gen instantiations) with a single one.
David Majnemer [Wed, 29 Jan 2014 22:07:36 +0000 (22:07 +0000)]
Sema: Diagnose improper application of inheritance keywords
We would previously allow inappropriate inheritance keywords to appear
on class declarations. We would also allow inheritance keywords on
templates which were not fully specialized; this was divergent from
MSVC.
John McCall [Wed, 29 Jan 2014 08:33:09 +0000 (08:33 +0000)]
Short-circuit a couple of queries (and avoid corrupting
the linkage cache) when type-checking static local
variables.
There's a very deep problem here where the linkage of
a declaration can suddenly massively change as soon as
it's given a typedef name; these fixes, while optimizations
in their own right, are really just targeted workarounds.
Objective-C. Fixes a bug where "new" family attribute
was not being overridden in the category method implementation
resulting in bogus warning. // rdar://15919775
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.