objective-c nonfragile abi: discourage ivar declarations
in @interface by issuing warning (off by default) under
opt'ed in flag -Winterface-block-ivar. // rdar://10763173
Richard Smith [Tue, 15 May 2012 06:21:54 +0000 (06:21 +0000)]
Further improvement to wording of overload resolution diagnostics, and including
the sole parameter name in the diagnostic in more cases. Patch by Terry Long!
Richard Smith [Tue, 15 May 2012 06:15:11 +0000 (06:15 +0000)]
PR12798: Don't drop part of the nested name specifier when instantiating a
pseudo-destructor expression. This can affect whether virtual dispatch for
the destructor call is bypassed.
Richard Smith [Tue, 15 May 2012 04:39:51 +0000 (04:39 +0000)]
Fold the six functions checking explicitly-defaulted special member functions
into one. These were all performing almost identical checks, with different bugs
in each of them.
This fixes PR12806 (we weren't setting the exception specification for an
explicitly-defaulted, non-user-provided default constructor) and enforces
8.4.2/2's rule that an in-class defaulted member must exactly match the implicit
parameter type.
John McCall [Tue, 15 May 2012 02:01:59 +0000 (02:01 +0000)]
Change the mangling of a ref-qualifier on a function type so that
it is placed in a position which is never ambiguous with a
reference-to-function type. This follows some recent discussion
and ensuing proposal on cxx-abi-dev. It is not necessary to
change the mangling of CV-qualifiers because you cannot
apply CV-qualification in the normal sense to a function type.
It is not necessary to change the mangling of ref-qualifiers on
method declarations because they appear in an unambiguous
location.
In addition, mangle CV-qualifiers and ref-qualifiers on function
types when they occur in positions other than member pointers
(that is, when they appear as template arguments).
This is a minor ABI break with previous releases of clang. It
is not considered critical because (1) ref-qualifiers are
relatively rare, since AFAIK we're the only implementing compiler,
and (2) they're particularly likely to come up in contexts that
do not rely on the ODR for correctness. We apologize for any
inconvenience; this is the right thing to do.
Richard Smith [Mon, 14 May 2012 22:43:34 +0000 (22:43 +0000)]
Recover properly from a redundant 'typename' before a non-nested name. This is
permitted as a Microsoft extension. Patch by William Wilson! (Plus some minor
tweaking by me.)
Jordy Rose [Mon, 14 May 2012 17:58:35 +0000 (17:58 +0000)]
[analyzer] strncpy: Special-case a length of 0 to avoid an incorrect warning.
We check the address of the last element accessed, but with 0 calculating that
address results in element -1. This patch bails out early (and avoids a bunch
of other work at that).
Benjamin Kramer [Sat, 12 May 2012 21:10:52 +0000 (21:10 +0000)]
Add support for __attribute__((hot)) and __attribute__((cold)).
Currently cold functions are marked with the "optsize" attribute in CodeGen
so they are always optimized for size. The hot attribute is just ignored,
LLVM doesn't have a way to express hotness at the moment.
Gregory Szorc [Sat, 12 May 2012 20:49:13 +0000 (20:49 +0000)]
[clang.py] Followup to TranslationUnit refactor
* Document index argument in TranslationUnit.from_source
* Add numeric error code to TranslationUnitSaveError string representation
* Use None instead of [] for default argument value in
TranslationUnit.codeComplete
Jordy Rose [Sat, 12 May 2012 17:32:56 +0000 (17:32 +0000)]
Only check NSArray/NSDictionary boxing method params once.
Once we've found a "good" method, we don't need to check its argument types
again. (Even if we might have later found a "bad" method, we were already
caching the method we first looked up.)
Douglas Gregor [Fri, 11 May 2012 23:01:43 +0000 (23:01 +0000)]
Make sure that we recognize __attribute__((align)) as a synonym for
__attribute__((aligned)). Fixes <rdar://problem/11435441>, a
regression I introduced in r156003. This is the narrow fix; a more
comprehensive fix is coming.
Richard Smith [Fri, 11 May 2012 22:20:10 +0000 (22:20 +0000)]
When diagnosing inaccessible temporary destructors in decltype expressions, use
the correct type and the correct source location in the diagnostic. Spotted by
Johannes Schaub!
Richard Smith [Fri, 11 May 2012 05:16:41 +0000 (05:16 +0000)]
PR11857: When the wrong number of arguments are provided for a function
which expects exactly one argument, include the name of the argument in
the diagnostic text. Patch by Terry Long!
[objc] When boxing a BOOL/NSInteger/NSUInteger type, use the corresponding
numberWithBool:/numberWithInteger:/numberWithUnsignedInteger: NSNumber selectors.
Ted Kremenek [Thu, 10 May 2012 22:02:39 +0000 (22:02 +0000)]
Fix insidious RegionStore bug where we (a) didn't handle vector types and (b) had
a horrible bug in GetLazyBindings where we falsely appended a field suffix when traversing 3 or more
layers of lazy bindings. I don't have a reduced test case yet; but I have added the original source
to an internal regression test suite. I'll see about coming up with a reduced test case.
Fix an assertion hit when the serialized diagnostics writer receive a diagnostic
from the frontend when the location is invalid and the SourceManager null.
Instead of keeping the SourceManager object in DiagnosticRenderer, propagate it
to the calls accordingly (as reference when it is expected to not be null, or pointer
when it may be null).
This effectively makes DiagnosticRenderer not tied to a specific SourceManager,
removing a hack from TextDiagnosticPrinter.
Rafael Espindola [Thu, 10 May 2012 02:50:16 +0000 (02:50 +0000)]
Fix an old (2009) FIXME:
// FIXME: This needs to happen before we merge declarations. Then,
// let attribute merging cope with attribute conflicts.
This was already being done for variables, but for functions we were merging
then first and then applying the attributes. To avoid duplicating merging
logic, some of the helpers in SemaDeclAttr.cpp become methods that can
handle merging two attributes in one decl or inheriting attributes from one
decl to another.
With this change we are now able to produce errors for variables with
incompatible visibility attributes or warn about unused dllimports in
variables.
This changes the attribute list iteration back to being in reverse source
code order, as that matches what decl merging does and avoids differentiating
the two cases is the merge*Attr methods.
Anna Zaks [Thu, 10 May 2012 01:37:40 +0000 (01:37 +0000)]
[analyzer] Do not highlight the range of the statement in case of leak.
We report a leak at a point a leaked variable is no longer accessible.
The statement that happens to be at that point is not relevant to the
leak diagnostic and, thus, should not be highlighted.
Richard Smith [Wed, 9 May 2012 23:51:36 +0000 (23:51 +0000)]
RecursiveASTVisitor:
We don't create any declaration to mark the explicit instantiation of function
templates other than the instantiation itself, so visit that when traversing
the function template decl.
This is a temporary fix, pending the creation of a Decl node to represent the
explicit instantiation.
Richard Smith [Wed, 9 May 2012 20:55:26 +0000 (20:55 +0000)]
Push the knowledge that we are parsing a type-id/type-name further into the
parser, and use it to emit better diagnostics in cases where an identifer
can't be looked up as a type name.
Richard Smith [Wed, 9 May 2012 18:56:43 +0000 (18:56 +0000)]
Stop AltiVec parsing from going down the 'implicit int' codepath as part of its
normal parse for token sequences like 'vector pixel foo'. This incidentally also
fixes a couple of wrong-parse issues.
Simon Atanasyan [Wed, 9 May 2012 16:18:30 +0000 (16:18 +0000)]
Declare abstract class ArgumentsAdjuster. This abstract interface describes
a command line argument adjuster, which is responsible for command line
arguments modification before the arguments are used to run a frontend action.
Define class ClangSyntaxOnlyAdjuster implements ArgumentsAdjuster interface.
This class converts input command line arguments to the "syntax check only"
variant.
[AST/libclang] Speed up clang_getOverriddenCursors() considerably by reserving a bit
in ObjCMethodDecl to indicate whether the method does not override any other method,
which is the majority of cases.
That way we can avoid unnecessary work doing lookups, especially when PCH is involved.