Mark Lacey [Sun, 6 Oct 2013 01:33:34 +0000 (01:33 +0000)]
Pass CGCXXABIs around directly.
In functions that only need to use the CGCXXABI member of a CodeGenTypes
class, pass that reference around directly rather than a reference to
a CodeGenTypes class.
This makes the actual dependence on CGCXXABI clear at the call sites.
Consumed Analysis: Change callable_when so that it can take a list of states
that a function can be called in. This reduced the total number of annotations
needed and makes writing more complicated behaviour less burdensome.
Patch by chriswails@gmail.com.
ObjectiveC. Allow readonly properties without an explicit ownership
(assign/unsafe_unretained/weak/retain/strong/copy) in super class
to be overridden by a property with any explicit ownership in the
subclass. // rdar://15014468
These IR instructions are undefined when the amount is equal to operand
size, but NEON right shifts support such shifts. Work around that by
emitting a different IR in these cases.
Simon Atanasyan [Fri, 4 Oct 2013 10:36:42 +0000 (10:36 +0000)]
[Mips] For MIPS '-fPIC -static' means to compile as -fPIC but link with
-static. So do not turn off the PIC flag if -static passed to the
driver in case of MIPS target.
Jordan Rose [Thu, 3 Oct 2013 16:57:20 +0000 (16:57 +0000)]
[analyzer] Replace bug category magic strings with shared constants.
One small functionality change is to bring the sizeof-pointer checker in
line with the other checkers by making its category be "Logic error"
instead of just "Logic". There should be no other functionality changes.
Jordan Rose [Thu, 3 Oct 2013 16:57:03 +0000 (16:57 +0000)]
[analyzer] Add new debug helper clang_analyzer_warnIfReached.
This will emit a warning if a call to clang_analyzer_warnIfReached is
executed, printing REACHABLE. This is a more explicit way to declare
expected reachability than using clang_analyzer_eval or triggering
a bug (divide-by-zero or null dereference), and unlike the former will
work the same in inlined functions and top-level functions. Like the
other debug helpers, it is part of the debug.ExprInspection checker.
Faisal Vali [Thu, 3 Oct 2013 06:29:33 +0000 (06:29 +0000)]
Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves.
This does not yet include capturing (that is next).
Please see test file for examples.
This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090048.html
When I first committed this patch - a bunch of buildbots were unable to compile the code that VS2010 seemed to compile. Seems like there was a dependency on Sema/Template.h which VS did not seem to need, but I have now added for the other compilers. It still compiles on Visual Studio 2010 - lets hope the buildbots remain quiet (please!)
Reid Kleckner [Wed, 2 Oct 2013 15:19:23 +0000 (15:19 +0000)]
Accept #pragma warning(push, 0) without warning
This partially addresses PR17435, but it doesn't actually implement the
pragma. If we implement it, we should map levels 1-4 to something like
-Wall and level 0 to something like -w.
Daniel Jasper [Wed, 2 Oct 2013 13:59:03 +0000 (13:59 +0000)]
clang-format: Fix clang-format-diff.py according to diff specification.
Patch by Alp Toker. Many thanks!
Original descriptions:
clang-format-diff incorrectly modifies unchanged lines due to an error
in diff parsing.
The unified diff format has a default line change count of 1, and 0 may
be specified to indicate that no lines have been added. This patch
updates the parser to accurately reflect the diff specification.
This also has the benefit of stabilising the operation so it will
produce the same output when run multiple times on the same changeset,
which was previously not the case.
No tests added because this script is not currently tested (though we
should look into that!)
Jordan Rose [Wed, 2 Oct 2013 01:20:28 +0000 (01:20 +0000)]
[analyzer] Add missing return after function pointer null check.
Also add some tests that there is actually a message and that the bug is
actually a hard error. This actually behaved correctly before, because:
- addTransition() doesn't actually add a transition if the new state is null;
it assumes you want to propagate the predecessor forward and does nothing.
- generateSink() is called in order to emit a bug report.
- If at least one new node has been generated, the predecessor node is /not/
propagated forward.
But now it's spelled out explicitly.
Found by Richard Mazorodze, who's working on a patch that may require this.
Nick Lewycky [Tue, 1 Oct 2013 21:51:38 +0000 (21:51 +0000)]
No functionality change. Reflow lines that could fit on one line. Break lines
that had 80-column violations. Remove spurious emacs mode markers on .cpp files.
ObjectiveC migrator: When doing migration, migrator must suggest
migration of headers which have become system headers by user having put
the .system_framework in the sdk directory.
// rdar://15066802
Ariel J. Bernal [Tue, 1 Oct 2013 14:59:00 +0000 (14:59 +0000)]
Fixed replacements for files with relative paths are not applied.
Replacements were no applied when using a compilation database with paths in the
compilation command relative to the compile directory. This patch makes those
paths abosulte.
Tim Northover [Tue, 1 Oct 2013 14:34:25 +0000 (14:34 +0000)]
Implement ARM GNU-style interrupt attribute
This attribute allows users to use a modified C or C++ function as an ARM
exception-handling function and, with care, to successfully return control to
user-space after the issue has been dealt with.
Faisal Vali [Tue, 1 Oct 2013 02:51:53 +0000 (02:51 +0000)]
Fix computation of linkage within nested lambdas.
When nested C++11 lambdas are used in NSDMI's - this patch prevents infinite recursion by computing the linkage of any nested lambda by determining the linkage of the outermost enclosing lambda (which might inherit its linkage from its parent).
See http://llvm-reviews.chandlerc.com/D1783 for Doug's approval.
[On a related note, I need this patch so as to pass tests of transformations of nested lambdas returned from member functions]
Eli Friedman [Tue, 1 Oct 2013 02:44:48 +0000 (02:44 +0000)]
Fix typo correction usage of SemaAccess.cpp.
When we check access for lookup results, make sure we propagate the
result's access to the access control APIs; this can be different from
the natural access of the declaration depending on the path used by the lookup.
Eli Friedman [Tue, 1 Oct 2013 00:28:29 +0000 (00:28 +0000)]
Tweak changes in r186464 to avoid a crash.
Currently, IR generation can't handle file-scope compound literals with
non-constant initializers in C++.
Fixes PR17415 (the first crash in the bug).
(We should probably change (T){1,2,3} to use the same codepath as T{1,2,3} in
C++ eventually, given that the semantics of the latter are actually defined by
the standard.)
The help text for clang-format's -style option and the function that processes
its value is moved to libFormat in this patch. The goal is to enable other
tools that use libFormat and also have a -style option to behave consistently
with clang-format.
Manuel Klimek [Mon, 30 Sep 2013 13:29:01 +0000 (13:29 +0000)]
Fix use-after-free.
TemplateDeclInstantiator takes the MultiLevelArgumentList by const-ref
and stores a const-ref member. Thus, we must not pass a temporary
into the constructor.
Add a bunch of other GCC '-f' options and ignore them. This covers every
such option I've been able to find in the wild in our build system.
Note that I haven't added test cases for this. I can do so if folks
want, but they're *really* boring considering that this is all generated
code to parse and ignore unsued options.
Switch one of the ignored boolean flag multiclasses to not have an 'f'
prefix. Sort the ignored boolean 'f' flags at the bottom of this file.
No functionality changed.
Remove an unnecessary overload from ASTLambda.h
As Richard pointed out to me, dyn_cast is very cheap - there is no real benefit from adding cluttery overloads to only avoid that cast.
No functionality change.
Implement conversion to function pointer for generic lambdas without captures.
The general strategy is to create template versions of the conversion function and static invoker and then during template argument deduction of the conversion function, create the corresponding call-operator and static invoker specializations, and when the conversion function is marked referenced generate the body of the conversion function using the corresponding static-invoker specialization. Similarly, Codegen does something similar - when asked to emit the IR for a specialized static invoker of a generic lambda, it forwards emission to the corresponding call operator.
This patch has been reviewed in person both by Doug and Richard. Richard gave me the LGTM.
A few minor changes:
- per Richard's request i added a simple check to gracefully inform that captures (init, explicit or default) have not been added to generic lambdas just yet (instead of the assertion violation).
- I removed a few lines of code that added the call operators instantiated parameters to the currentinstantiationscope. Not only did it not handle parameter packs, but it is more relevant in the patch for nested lambdas which will follow this one, and fix that problem more comprehensively.
- Doug had commented that the original implementation strategy of using the TypeSourceInfo of the call operator to create the static-invoker was flawed and allowed const as a member qualifier to creep into the type of the static-invoker. I currently kludge around it - but after my initial discussion with Doug, with a follow up session with Richard, I have added a FIXME so that a more elegant solution that involves the use of TrivialTypeSourceInfo call followed by the correct wiring of the template parameters to the functionprototypeloc is forthcoming.
Ed Schouten [Sun, 29 Sep 2013 07:54:52 +0000 (07:54 +0000)]
Add character set related __STDC_* definitions.
Clang uses UTF-16 and UTF-32 for its char16_t's and char32_t's
exclusively. This means that we can define __STDC_UTF_16__ and
__STDC_UTF_32__ unconditionally.
While there, define __STDC_MB_MIGHT_NEQ_WC__ for FreeBSD. FreeBSD's
wchar_t's don't encode characters as ISO-10646; the encoding depends on
the locale used. Because the character set used might not be a superset
of ASCII, we must define __STDC_MB_MIGHT_NEQ_WC__.
Richard Smith [Sun, 29 Sep 2013 04:40:38 +0000 (04:40 +0000)]
Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;
instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out
the backward-compatibility issues.