Richard Smith [Fri, 20 Apr 2012 18:46:14 +0000 (18:46 +0000)]
Fix bug where a class's (deleted) copy constructor would be implicitly given a
non-const reference parameter type if the class had any subobjects with deleted
copy constructors. This causes a rejects-valid if the class's copy constructor
is explicitly defaulted (as happens for some implementations of std::pair etc).
Richard Smith [Fri, 20 Apr 2012 07:12:26 +0000 (07:12 +0000)]
Replace r155185 with a better fix, which also addresses PR12557. When looking
up an elaborated type specifier in a friend declaration, only look for type
declarations, per [basic.lookup.elab]p2. If we know that the redeclaration
lookup for a friend class template in a dependent context finds a non-template,
don't delay the diagnostic to instantiation time.
Chad Rosier [Fri, 20 Apr 2012 00:30:04 +0000 (00:30 +0000)]
When generating the clang crash diagnostic script, strip out the -D, -F, and -I
flags. We have preprocessed source, so we don't need these.
No test case as it's fairly difficult to make the compiler crash on demand. I'll
patiently wait for Ben to tell me how to do this in 2 lines of code. :)
rdar://11283560
objective-arc: Retune my previous patch so warning
is issued on weak property as receiver and not on
any other use of a weak property. // rdar://10225276
Re-add the closing '}' for the namespace I accidentally deleted when
removing a (new) duplicate test whose only difference was the tag type
being an enum instead of a struct.
In Parser::isCXXDeclarationSpecifier, consider a non-type identifier
followed by an identifier as declaration specificer (except for ObjC).
This allows e.g. an out-of-line C++ member function definitions to be
recognized as functions and not as variable declarations if the type
name for the first parameter is not recognized as a type--say, when there
is a function name shadowing an enum type name and the parameter is
missing the "enum" keyword needed to distinguish the two.
Note that returning TPResult::Error() instead of TPResult::True()
appears to have the same end result, while TPResult::Ambiguous()
results in a crash.
Richard Smith [Thu, 19 Apr 2012 22:09:22 +0000 (22:09 +0000)]
In an attempt to reduce confusion, mark 'Strong compare exchange' as done, since
we generate correct code for both strong and weak atomic compare-exchanges, even
though we don't propagate to the IR enough information to generate optimal weak
compare-exchanges on architectures which support them.
Thread safety analysis: split warnings into two groups: attribute warnings
which are checked in the parser, and analysis warnings that require the
full analysis. This allows attribute syntax to be checked independently
of the full thread safety analysis. Also introduces a new warning for the
case where a string is used as a lock expression; this allows the analysis
to gracefully handle expressions that would otherwise cause a parse error.
Richard Smith [Thu, 19 Apr 2012 06:58:00 +0000 (06:58 +0000)]
Add missing -Wc++98-compat warnings for initializer list initializations which
initialize references, create std::initializer_list objects, or call constructors.
Rafael Espindola [Thu, 19 Apr 2012 05:50:08 +0000 (05:50 +0000)]
In mergeVisibility, if we already have an explicit visibility, keep it.
This fixes the included testcase and lets us simplify the code a bit. It
does require using mergeWithMin when merging class information to its
members. Expand the comments to explain why that works.
Rafael Espindola [Thu, 19 Apr 2012 05:34:51 +0000 (05:34 +0000)]
In mergeVisibilityWithMin, let an implicit hidden symbol take precedence over
an explicit default one. This means that with -fvisibility hidden we
now produce a hidden symbol for
template <typename T>
class DEFAULT foo {
void bar() {}
};
class zed {};
template class foo<zed>;
Rafael Espindola [Thu, 19 Apr 2012 05:24:05 +0000 (05:24 +0000)]
Now that we check visibility attributes in an appropriate order,
there is no need for mergeVisibily to ever increase the visibility. Not
doing so lets us replace an incorrect use of mergeVisibilityWithMin. The
testcase
struct HIDDEN RECT {
int top;
};
DEFAULT RECT foo = {0};
shows that we should give preference to one of the attributes instead of
keeping the minimum. We still get this testcase wrong because mergeVisibily
handles two explicit visibilities incorrectly, but this is a step in the
right direction.
Rafael Espindola [Thu, 19 Apr 2012 02:55:01 +0000 (02:55 +0000)]
Move the point in the code where we handle -fvisibility=hidden. With
the current implementation this should be a nop as explicit visibility
takes precedence in mergeVisibility.
The location chosen is such that attributes checked above it can force
a symbol to be default. For example, an attribute is the variable or function.
Attributes checked after this point, can only make the visibility more
restrictive. An attribute in a type for example.
Rafael Espindola [Thu, 19 Apr 2012 02:22:07 +0000 (02:22 +0000)]
Make setVisibility private and change users to mergeVisibility. This is
currently a nop as those users are the first merge or are a merge
of a hidden explicit visibility, which always wins in the current
implementation.
modern objective-c translator: Fix writing a spurious 'static'
into the wrong place when rewriting a static function
which declares block literals. // rdar://11275241
Richard Smith [Thu, 19 Apr 2012 00:08:28 +0000 (00:08 +0000)]
PR 12586: Fix assert while running libc++ testsuite: deal with exception
specifications on member function templates of class templates and other such
nested beasties. Store the function template from which we are to instantiate
an exception specification rather than trying to deduce it. Plus some
additional test cases.
Revert some Hexagon builtin commits to match reverts done to LLVM in
r155047. See the LLVM log for the primary motivation:
http://llvm.org/viewvc/llvm-project?rev=155047&view=rev
Primary commit r154828:
- Several issues were raised in review, and fixed in subsequent
commits.
- Follow-up commits also reverted, and which should be folded into the
original before reposting:
- r154837: Re-add the 'undef BUILTIN' thing to fix the build.
- r154928: Fix build warnings, re-add (and correct) header and
license
- r154937: Typo fix.
Please resubmit this patch with the relevant LLVM resubmission.
As per John McCall comment:
Follow up to r154924: check that we are in a static CMethodDecl to enable the Microsoft bug emulation regarding access to protected member during PTM creation. Not just any static function.
Nicer display of unprintable source, and fix caret display for non-ascii text
Unprintable source in diagnostics is transformed to a printable form and then
displayed with reversed colors if possible. Unprintable characters are
displayed as <U+NNNN> while bytes that do not represent valid characters are
shown as <XX>.
Column adjustments to diagnostic carets, highlighted ranges, and fixups are
made both for characters escaped as above and for characters which are
printable but take up more than a single column.
Nicer display of unprintable source, and fix caret display for non-ascii text
Unprintable source in diagnostics is transformed to a printable form and then
displayed with reversed colors if possible. Unprintable characters are
displayed as <U+NNNN> while bytes that do not represent valid characters are
shown as <XX>.
Column adjustments to diagnostic carets, highlighted ranges, and fixups are
made both for characters escaped as above and for characters which are
printable but take up more than a single column.
Manuel Klimek [Tue, 17 Apr 2012 16:54:26 +0000 (16:54 +0000)]
Switches the JSONCompilationDatabase to use the YAML parser.
This will allow us to delete the JSON parser from llvm.
The biggest change is a general change of strategy - instead
of storing StringRef's to the values for the command line and
directory in the input buffer, we store ScalarNode*'s. The
reason is that the YAML parser's getRawValue on ScalarNodes
returns a string that includes the quotes in case of double
quoted strings.
For the same reason we're removing the JSON parsing part of
the command line parsing - this means an extra copy for a
command line when it is requested (and only when it is requested).
Convert vperm2f128 and vperm2i128 intrinsics back to using llvm intrinsics. Unfortunately, these instructions have behavior that can't be modeled with shuffle vector.
Richard Smith [Tue, 17 Apr 2012 00:58:00 +0000 (00:58 +0000)]
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
Chad Rosier [Tue, 17 Apr 2012 00:35:38 +0000 (00:35 +0000)]
Make sure EmitMoveFromReturnSlot is passing the correct alignment to
EmitFinalDestCopy (and thus pass EmitAggregateCopy the correct alignment).
rdar://11220251
Eli Friedman [Mon, 16 Apr 2012 19:23:57 +0000 (19:23 +0000)]
Per Richard's comments on r154794, add the checks necessary to handle constant-folding relational comparisons safely in case the user is using -fwrapv or equivalent.
Douglas Gregor [Mon, 16 Apr 2012 18:27:27 +0000 (18:27 +0000)]
Implement the last part of C++ [class.mem]p2, delaying the parsing of
exception specifications on member functions until after the closing
'}' for the containing class. This allows, for example, a member
function to throw an instance of its own class. Fixes PR12564 and a
fairly embarassing oversight in our C++98/03 support.
Douglas Gregor [Mon, 16 Apr 2012 07:05:22 +0000 (07:05 +0000)]
Implement C++11 [expr.prim.general]p3, which permits the use of 'this'
in the declaration of a non-static member function after the
(optional) cv-qualifier-seq, which in practice means in the exception
specification and late-specified return type.
The new scheme here used to manage 'this' outside of a member function
scope is more general than the Scope-based mechanism previously used
for non-static data member initializers and late-parsesd attributes,
because it can also handle the cv-qualifiers on the member
function. Note, however, that a separate pass is required for static
member functions to determine whether 'this' was used, because we
might not know that we have a static function until after declaration
matching.
Finally, this introduces name mangling for 'this' and for the implicit
'this', which is intended to match GCC's mangling. Independent
verification for the new mangling test case would be appreciated.
Eli Friedman [Mon, 16 Apr 2012 05:04:45 +0000 (05:04 +0000)]
Add note to hacking.html that running the test harness directly from the command-line requires making sure the relevant files are generated first. Patch by Matt Fowles, with some minor modifications.
The result of the Microsoft __uuidof operator must be considered a global lvalue during constant expression evaluation.
Otherwise we would get this error in C++11 mode (because of a recent change):
error: non-type template argument of type 'const _GUID *' is not a constant expression
For code like:
template <const GUID* g = &__uuidof(struct_with_uuid)>
class COM_CLASS { };
Nick Lewycky [Mon, 16 Apr 2012 02:51:46 +0000 (02:51 +0000)]
Implement the all_lookups_iterator for PCH as a follow-up to r153970. This
includes a patch from Matthias Kleine with a regression testcase!
Adds a new iterator 'data_iterator' to OnDiskHashTable which doesn't try to
reconstruct the external_key from the internal_key, which is useful for traits
that don't store enough information to do that mapping in their key. Also
deletes the 'item_iterator' from OnDiskHashTable as dead code.
Change _mm256_permute4x64_epi64 and _mm256_permute4x64_pd to use builtin_shufflevector instead of specific builtins. Old builtins will be removed from llvm now that vpermq/vpermpd are supported by shuffle lowering code.