Commit Graph

49320 Commits

Author SHA1 Message Date
Bob Wilson 83e723a9c9 Fix assertion failure left over from changes to move away from "darwin" triples.
I happened to notice this while trying to write a test for an iOS simulator
target. I suspect we just missed this when we added separate "macosx" and "ios"
triples instead of the generic "darwin" OS.

llvm-svn: 196527
2013-12-05 19:38:42 +00:00
Alp Toker a31d1dd179 AttributeList: tweak the conditional order to avoid two strcmps
llvm-svn: 196518
2013-12-05 18:04:42 +00:00
Hans Wennborg 6a3816a66f clang-format vsix cmake build: use ${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}
as the location for grabbing clang-format.exe, and also output the .vsix here.

This allows us to find clang-format.exe when building from a MSVC Solution.

llvm-svn: 196512
2013-12-05 17:49:58 +00:00
Alp Toker 52937abc8b Check the initial line number without going through PresumedLoc
No practical difference in this case and would return 1 either way, but this is
more self-explanatory.

llvm-svn: 196511
2013-12-05 17:28:42 +00:00
Alp Toker f6a24ce40f Fix a tranche of comment, test and doc typos
llvm-svn: 196510
2013-12-05 16:25:25 +00:00
Richard Smith f03bd30854 PR17983: Fix crasher bug in C++1y mode when performing a non-global array
delete on a class which has no array cookie and has no class-specific operator
new.

llvm-svn: 196488
2013-12-05 08:30:59 +00:00
Argyrios Kyrtzidis 9ef5775a94 [libclang] Record ranges skipped by the preprocessor and expose them with libclang.
Patch by Erik Verbruggen!

llvm-svn: 196487
2013-12-05 08:19:32 +00:00
Argyrios Kyrtzidis 011e6a5f44 [c-index-test] Enhance perform_test_reparse_source() to allow remapping a file
at a particular reparsing iteration.

Passing '-remap-file-1=from:to' will remap the files in the second iteration.

llvm-svn: 196486
2013-12-05 08:19:23 +00:00
Argyrios Kyrtzidis a60d8ae09d [c-index-test] For the '-remap-file=' option use ':' instead of ';' for separator.
lldb does not like semicolon as part of an option.

llvm-svn: 196485
2013-12-05 08:19:18 +00:00
Alp Toker fcf30326fd clang-format-diff.py: pass through errors to stderr, not stdout
Also use write() for unified diff output to avoid further processing by the
print function (e.g. trailing newline).

llvm-svn: 196484
2013-12-05 08:14:54 +00:00
Richard Smith 28b1939849 Update C++ status from 'SVN' to 'Clang 3.4' in preparation for release. Leave
boxes yellow until we release, though.

llvm-svn: 196482
2013-12-05 07:52:05 +00:00
Richard Smith a230224be4 Implement DR482: namespace members can be redeclared with a qualified name
within their namespace, and such a redeclaration isn't required to be a
definition any more.

Update DR status page to say Clang 3.4 instead of SVN and add new Clang 3.5
category (but keep Clang 3.4 yellow for now).

llvm-svn: 196481
2013-12-05 07:51:02 +00:00
Alp Toker beccbb84ad Fix comment typo in r196476
llvm-svn: 196477
2013-12-05 07:16:23 +00:00
Argyrios Kyrtzidis b9a405b33e [objc] If an interface has no initializer marked as designated and introduces at least one new initializer,
don't assume that it inherits the designated initializers from the super class.

If the assumption was wrong because a new initializer was a designated one that was not marked as such,
we will emit misleading warnings for subclasses of the interface.

llvm-svn: 196476
2013-12-05 07:07:03 +00:00
Alp Toker d473363876 Correct hyphenations in comments and assert messages
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities in nearby lines.

llvm-svn: 196466
2013-12-05 04:47:09 +00:00
Richard Smith 72bcaeca1d Per [dcl.meaning]p1, a name in an inline namespace can be redeclared using a
name from the enclosing namespace set if the name is specified as a
qualified-id.

llvm-svn: 196464
2013-12-05 04:30:04 +00:00
Richard Trieu e99bb4b2b9 Fixed a bad assert from r194968. r194969 removed the assert.
llvm-svn: 196463
2013-12-05 04:27:16 +00:00
Alp Toker f580a3cc05 Add an assert to make it clear we're on the first line
A raw lexer in its initial state is guaranteed to be on line number one.

llvm-svn: 196461
2013-12-05 03:41:20 +00:00
Richard Trieu 314a27360c Remove unused variable.
llvm-svn: 196459
2013-12-05 02:52:09 +00:00
Reid Kleckner 06bd7e64b9 Fix non-MSVC build error in ASTContext::getAdjustedType
Use FunctionTypeUnwrapper like we do in AttributedType to try to keep
some sugar.  We can actually do one better here in the future by
avoiding the AdjustedType node altogether when no sugar would be lost.

llvm-svn: 196455
2013-12-05 01:41:37 +00:00
Faisal Vali 5fb7c3c4ed Fix init-captures for generic lambdas.
For an init capture, process the initialization expression
right away.  For lambda init-captures such as the following:
const int x = 10;
 auto L = [i = x+1](int a) {
   return [j = x+2,
          &k = x](char b) { };
 };
keep in mind that each lambda init-capture has to have:
 - its initialization expression executed in the context
   of the enclosing/parent decl-context.
 - but the variable itself has to be 'injected' into the
   decl-context of its lambda's call-operator (which has
   not yet been created).
Each init-expression is a full-expression that has to get
Sema-analyzed (for capturing etc.) before its lambda's
call-operator's decl-context, scope & scopeinfo are pushed on their
respective stacks.  Thus if any variable is odr-used in the init-capture
it will correctly get captured in the enclosing lambda, if one exists.
The init-variables above are created later once the lambdascope and
call-operators decl-context is pushed onto its respective stack.

Since the lambda init-capture's initializer expression occurs in the
context of the enclosing function or lambda, therefore we can not wait
till a lambda scope has been pushed on before deciding whether the
variable needs to be captured.  We also need to process all
lvalue-to-rvalue conversions and discarded-value conversions,
so that we can avoid capturing certain constant variables.
For e.g.,
 void test() {
  const int x = 10;
  auto L = [&z = x](char a) { <-- don't capture by the current lambda
    return [y = x](int i) { <-- don't capture by enclosing lambda
         return y;
    }
  };
If x was not const, the second use would require 'L' to capture, and
that would be an error.
Make sure TranformLambdaExpr is also aware of this.

Patch approved by Richard (Thanks!!) 
http://llvm-reviews.chandlerc.com/D2092

llvm-svn: 196454
2013-12-05 01:40:41 +00:00
David Majnemer 3252fd0d5b Parse: Recover better from bad definitions with base specifiers
We would skip until the next comma, hoping good things whould lie there,
however this would fail when we have such things as this:

struct A {};
template <typename>
struct D;
template <>
struct D<C> : B, A::D;

Once this happens, we would believe that D with a nested namespace
specifier of A was a variable that was being declared. We would go on
to complain that there was an extraneous 'template <>' on their variable
declaration.

Crashes would happen when 'A' gets defined as 'enum class A {}' as
various asserts would fire.

Instead, we should skip up until the semicolon if we see that we are in
the middle of a definition and the current token is a ':'

This fixes PR17084.

llvm-svn: 196453
2013-12-05 01:36:53 +00:00
Reid Kleckner 0503a870a9 Add an AdjustedType sugar node for adjusting calling conventions
Summary:
In general, this type node can be used to represent any type adjustment
that occurs implicitly without losing type sugar.  The immediate use of
this is to adjust the calling conventions of member function pointer
types without breaking template instantiation.

Fixes PR17996.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D2332

llvm-svn: 196451
2013-12-05 01:23:43 +00:00
Mark Lacey d33ff74b19 Simplify the constructor to CodeGenABITypes.
The CodeGenOptions are not used for ABI type selection, so we will just
create one with the default constructor (there is a FloatABI option in
CodeGenOptions that is passed on to LLVM, but not used in Clang for LLVM
IR type generation).

We can use the DiagnosticsEngine on the ASTContext rather than making a
client pass one in explicitly.

llvm-svn: 196450
2013-12-05 01:23:01 +00:00
Richard Smith d091dc179d Reject template-ids containing literal-operator-ids that have a dependent
nested-name-specifier, rather than crashing. (In fact, reject all
literal-operator-ids that have a non-namespace nested-name-specifier). The
grammar doesn't allow these in some cases, and in other cases does allow them
but instantiation will always fail.

llvm-svn: 196443
2013-12-05 00:58:33 +00:00
Aaron Ballman 8b9e236bb4 Giving a Subjects list to DllExport, which allows the removal of some custom semantic handling. The same cannot be done for DllImport, and so comments were left explaining why.
llvm-svn: 196429
2013-12-04 23:23:19 +00:00
Aaron Ballman aad23ecadb Common functionality is already checked within SemaDeclAttr.cpp and so it does not need to be re-checked for each target.
llvm-svn: 196428
2013-12-04 23:07:58 +00:00
Reid Kleckner feb8ac9bd1 Factor duplicated code for TransformTypeInObjectScope
Fixes the relevant FIXME about copy-pasted code.

llvm-svn: 196425
2013-12-04 22:51:51 +00:00
Faisal Vali bb9071ea80 Fix for PR18052 - Lambdas within NSDMI's and default arguments in Nested classes.
Clang currently croaks on the following:
  struct X1 {
    struct X2 {
      int L = ([] (int i) { return i; })(2);
    };
  };

asserting that the containing lexical context of the lambda is not Sema's cur context, when pushing the lambda's decl context on.

This occurs because (prior to this patch) getContainingDC always returns the non-nested class for functions at class scope (even for inline member functions of nested classes (to account for delayed parsing of their bodies)).  The patch addresses this by having getContainingDC always return the lexical DC for a lambda's call operator.

Link to the bug: http://llvm.org/bugs/show_bug.cgi?id=18052
Link to Richard Smith's feedback on phabricator: http://llvm-reviews.chandlerc.com/D2331

Thanks!

llvm-svn: 196423
2013-12-04 22:43:08 +00:00
Aaron Ballman b4c112338f The MSP430Interrupt attribute does have a sema handler (it's in TargetAttributesSema). Added a FIXME about the attribute being nameless when it really does have a valid name, and a comment explaining why we're using the name instead of the attribute kind.
llvm-svn: 196420
2013-12-04 22:23:43 +00:00
Aaron Ballman d9c5c5cb3f Getting rid of some hard-coded strings. No functional changes intended, though some test cases needed to be updated for attribute names becoming quoted.
llvm-svn: 196417
2013-12-04 22:02:33 +00:00
Aaron Ballman 3001339783 This attribute somehow remained nameless in the attribute tablegen, until now.
llvm-svn: 196415
2013-12-04 21:43:30 +00:00
Rafael Espindola 85a657601b Remove empty header.
llvm-svn: 196410
2013-12-04 20:44:03 +00:00
Fariborz Jahanian 1a2519a7e9 ObjectiveC - Introducing objc_bridge_related attribute
which specifies couple of (optional) method selectors
for bridging a CFobject to or from an ObjectiveC 
object. This is wip. // rdsr://15499111

llvm-svn: 196408
2013-12-04 20:32:50 +00:00
John Thompson 17c357342a Enea Zaffanella's fix for the PPCallbacks Elif callback, with a slight re-org, and an update of the new PPCallbacks test (soon to be moved to clang from extra), rather the unittest.
llvm-svn: 196407
2013-12-04 20:19:30 +00:00
Richard Smith 711ee8381e Fix indentation.
llvm-svn: 196406
2013-12-04 20:05:45 +00:00
Reid Kleckner 739756c0f9 [ms-cxxabi] Construct and destroy call arguments in the correct order
Summary:
MSVC destroys arguments in the callee from left to right.  Because C++
objects have to be destroyed in the reverse order of construction, Clang
has to construct arguments from right to left and destroy arguments from
left to right.

This patch fixes the ordering by reversing the order of evaluation of
all call arguments under the MS C++ ABI.

Fixes PR18035.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D2275

llvm-svn: 196402
2013-12-04 19:23:12 +00:00
David Blaikie 2183e70ce2 Fix test case due to r196394 and improve it to not rely on LLVM code generation either.
llvm-svn: 196399
2013-12-04 19:09:19 +00:00
Aaron Ballman 66037479af When parsing ignored attribute arguments, presuming the first argument is an unresolved identifier the same way that we do for unknown arguments. This resolves PR18075, where we regressed the handling of OpenBSD's bounded attribute.
llvm-svn: 196387
2013-12-04 15:32:26 +00:00
Alexander Kornienko 06dd15a01a Added a regression test for the change in r196380
llvm-svn: 196384
2013-12-04 13:58:27 +00:00
Alexander Kornienko ecc232d521 Fix the regression caused by r196378
llvm-svn: 196380
2013-12-04 13:25:26 +00:00
Alexander Kornienko 31e9554024 Leave constructor initializer lists on one line in styles with no column limit.
Summary:
Allow tryFitMultipleLinesInOne join unwrapped lines when
ContinuationIndenter::mustBreak doesn't agree. But don't merge any lines, that
are separate in the input.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D2321

llvm-svn: 196378
2013-12-04 12:21:08 +00:00
NAKAMURA Takumi ddc867985a Revert r196372, "do not warn about unknown pragmas in modes that do not handle them (pr9537)"
It broke clang tests on some hosts with +Asserts. Seems "STDC" clashes.

llvm-svn: 196376
2013-12-04 11:12:26 +00:00
Lubos Lunak 5c4269c688 do not warn about unknown pragmas in modes that do not handle them (pr9537)
And refactor to have just one place in code that sets up the empty
pragma handlers.

llvm-svn: 196372
2013-12-04 10:21:41 +00:00
Richard Sandiford cdd86884a4 [SystemZ] Fix handling of pass-by-pointer arguments
I'd misunderstood getIndirect() to mean that the argument should be passed
as a pointer at the ABI level, with the ByVal argument choosing caller-copy
semantics over no-caller-copy (callee-copy-on-write) semantics.  But
getIndirect(x) actually means that x is passed by pointer at the IR
level but (at least on all other targets I looked at) directly at the
ABI level.  getIndirect(x, false) selects a pointer to a caller-made
copy, which is what SystemZ was aiming for.

This fixes a miscompilation of c-index-test.  Structure arguments were being
passed by pointer, but no copy was being made, so a write in the callee
stomped over a caller's local variable.

llvm-svn: 196370
2013-12-04 09:59:57 +00:00
David Majnemer dbc0c8f941 Sema: Propagate the mangling number into instantiations
We would lose track of the mangling number assigned to the original
declaration which would cause us to create manglings that didn't match
the Itanium C++ specification.

e.g. Two static fields with the same name inside of a function template
would receive the same mangling with LLVM fixing up the second field so
they wouldn't collide.  This would create an incompatibility with other
compilers following the Itanium ABI.

I've confirmed that the new mangling is identical to the ones generated
by icc and gcc.

N.B. This was uncovered while working on Microsoft mangler.

llvm-svn: 196368
2013-12-04 09:01:55 +00:00
Kevin Qin ad53b87c70 [AArch64 NEON] Add ACLE intrinsic vceqz_f64.
llvm-svn: 196361
2013-12-04 08:02:11 +00:00
Kevin Qin 8903f8df4b [AArch64 NEON] Add missing compare intrinsics.
llvm-svn: 196359
2013-12-04 07:53:09 +00:00
Serge Pavlov f79bd5cb9d Fix error recovery in return statement.
This patch fixes PR16989.

llvm-svn: 196352
2013-12-04 03:51:59 +00:00
Faisal Vali cb7e5df97e Fix PR17637: incorrect calculation of template parameter depth
In delayed template parsing mode, adjust the template depth counter for each template parameter list associated with an out of line member template specialization.

llvm-svn: 196351
2013-12-04 03:51:14 +00:00