]> granicus.if.org Git - clang/log
clang
9 years agoMove calls to ResolveExceptionSpec out of SetDeclDefaulted and into DefineImplicit*
Ben Langmuir [Thu, 25 Sep 2014 20:55:00 +0000 (20:55 +0000)]
Move calls to ResolveExceptionSpec out of SetDeclDefaulted and into DefineImplicit*

This fixes an assertion failure in CodeGen where we were not resolving
an exception specification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218466 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Avoid hashing back reference keys in mangler
David Majnemer [Thu, 25 Sep 2014 19:43:56 +0000 (19:43 +0000)]
MS ABI: Avoid hashing back reference keys in mangler

This patch replaces the back reference StringMap from the MS mangler
with a SmallVector of strings. My previous patches reduced the number of
hashes involved in back reference lookups, this one removes them
completely. The back reference map contains at most 10 entries, which
are likely to be of varying sizes and different initial subsequences,
and which can easily became huge (due to templates and namespaces).

The solution presented is the simplest possible one. Nevertheless, it's
enough to reduce compilation times for a particular test case from 11.1s
to 9s, versus 8.58s for the Itanium ABI. Possible further improvements
include using a sorted vector (carefully to not introduce an extra
comparison), storing the string contents in a common arena, and/or keep
the string storage in the context for reuse.

Patch by Agustín Bergé.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218461 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd increment/decrement operators and compound assignment operators to the
Richard Trieu [Thu, 25 Sep 2014 01:15:40 +0000 (01:15 +0000)]
Add increment/decrement operators and compound assignment operators to the
uninitialized checkers that did not have them before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218435 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix handling of preincrement on bit-fields. This gives a bit-field in C++, but
Richard Smith [Wed, 24 Sep 2014 23:55:00 +0000 (23:55 +0000)]
Fix handling of preincrement on bit-fields. This gives a bit-field in C++, but
we were failing to find that bit-field when performing integer promotions. This
brings us closer to following the standard, and closer to GCC.

In C, this change is technically a regression: we get bit-field promotions
completely wrong in C, promoting cases that are categorically not bit-field
designators. This change makes us do so slightly more consistently, though.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218428 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoThread Safety Analysis: Update to documentation.
DeLesley Hutchins [Wed, 24 Sep 2014 22:13:34 +0000 (22:13 +0000)]
Thread Safety Analysis:  Update to documentation.

The attribute documentation now conforms to Aaron Ballman's renaming of the
thread safety attributes, as well as the new paper that is due to be published
in the conference on Source Code Analysis and Manipulation (SCAM 2014) later
this week.  In addition, recent changes to the analysis, such as checking
of references and negative capabilities, are now documented.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218420 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agopass environment when invoking llvm-config and clang from lit.cfg
Scott Douglass [Wed, 24 Sep 2014 18:37:52 +0000 (18:37 +0000)]
pass environment when invoking llvm-config and clang from lit.cfg

Use the same environment when invoking llvm-config from lit.cfg as
will be used when running tests, so that ASAN_OPTIONS, INCLUDE, etc.
are present.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218404 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSimplify tests.
Nico Weber [Wed, 24 Sep 2014 18:25:54 +0000 (18:25 +0000)]
Simplify tests.

This reverts bits of r218166 that are no longer necessary now that r218394 made
-Wmissing-prototype-for-cc a regular warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218400 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDowngrade error about stdcall decls with no prototype to a warning
Reid Kleckner [Wed, 24 Sep 2014 17:49:24 +0000 (17:49 +0000)]
Downgrade error about stdcall decls with no prototype to a warning

Fixes PR21027.  The MIDL compiler produces code that does this.

If we wanted to improve the warning, I think we could do this:
  void __stdcall f(); // Don't warn without -Wstrict-prototypes.
  void g() {
    f(); // Might warn, the user probably meant for f to take no args.
    f(1, 2, 3); // Warn, we have no idea what args f takes.
    f(1); // Error, this is insane, one of these calls is broken.
  }

Reviewers: thakis

Differential Revision: http://reviews.llvm.org/D5481

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218394 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Don't let -style=Chromium imply c++03 template formatting.
Nico Weber [Wed, 24 Sep 2014 17:17:32 +0000 (17:17 +0000)]
clang-format: Don't let -style=Chromium imply c++03 template formatting.

Chromium's now using some c++11 language features, so it's now fine that
clang-format produces vector<vector<int>>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218392 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInclude debug info for types referenced only via explicit cast expressions.
David Blaikie [Wed, 24 Sep 2014 17:01:27 +0000 (17:01 +0000)]
Include debug info for types referenced only via explicit cast expressions.

Most of the debug info emission is powered essentially from function
definitions - if we emit the definition of a function, we emit the types
of its parameters, the members of those types, and so on and so forth.

For types that aren't referenced even indirectly due to this - because
they only appear in temporary expressions, not in any named variable, we
need to explicitly emit/add them as is done here. This is not the only
case of such code, and we might want to consider handling "void
func(void*); ... func(new T());" (currently debug info for T is not
emitted) at some point, though GCC doesn't. There's a much broader
solution to these issues, but it's a lot of work for possibly marginal
gain (but might help us improve the default -fno-standalone-debug
behavior to be even more aggressive in some places). See the original
review thread for more details.

Patch by jyoti allur (jyoti.yalamanchili@gmail.com)!

Differential Revision: http://reviews.llvm.org/D2498

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218390 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoConstify a functor's function call operator because it can/should be.
David Blaikie [Wed, 24 Sep 2014 16:35:29 +0000 (16:35 +0000)]
Constify a functor's function call operator because it can/should be.

Patch by Graham Lee (graham@iamleeg.com)!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218385 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPatch to allow mangling of microsoft’s __uuidof expression for the Itanium ABI
Fariborz Jahanian [Wed, 24 Sep 2014 16:28:40 +0000 (16:28 +0000)]
Patch to allow mangling of microsoft’s __uuidof expression for the Itanium ABI
when under -fms-extensions. Reviewed by John McCall.
//rdar://17784718

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218384 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoClean up ClangTool's argument adjuster handling a bit with unique_ptr.
Benjamin Kramer [Wed, 24 Sep 2014 11:47:42 +0000 (11:47 +0000)]
Clean up ClangTool's argument adjuster handling a bit with unique_ptr.

Make the dtor non-virtual while there. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218379 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSema: Inherit the flexible array property from struct fields
David Majnemer [Wed, 24 Sep 2014 11:04:09 +0000 (11:04 +0000)]
Sema: Inherit the flexible array property from struct fields

A record which contains a flexible array member is itself a flexible
array member.  A struct which contains such a record should also
consider itself to be a flexible array member.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218378 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] Fixed argument types in intrinsics:
Robert Khasanov [Wed, 24 Sep 2014 06:45:23 +0000 (06:45 +0000)]
[x86] Fixed argument types in intrinsics:
_addcarryx_u64
_addcarry_u64
_subborrow_u64

Thanks Pasi Parviainen for notice.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218376 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix the argument index error of __builtin___memccpy_chk
Steven Wu [Wed, 24 Sep 2014 04:37:33 +0000 (04:37 +0000)]
Fix the argument index error of __builtin___memccpy_chk

memccpy_check should have source and dest size at arg 3 and 4
rdar://18431336

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218367 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix an edge case with BinaryOperator's in -Wuninitialized. Add testcases for
Richard Trieu [Wed, 24 Sep 2014 03:53:56 +0000 (03:53 +0000)]
Fix an edge case with BinaryOperator's in -Wuninitialized.  Add testcases for
the other visitors as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218366 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFollow-up to r218292: Add more REVERTIBLE_TYPE_TRAITs.
Nico Weber [Wed, 24 Sep 2014 03:28:54 +0000 (03:28 +0000)]
Follow-up to r218292: Add more REVERTIBLE_TYPE_TRAITs.

r218292 reverted r197496 because it broke things. In addition to breaking
things, r197496 also made all traits starting with __is_ revertible.
Reinstantiate that part of r197496 because code out there (e.g. libc++) depends
on this behavior. Fixes PR21045.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218365 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Pure virtual functions don't contribute to vtordisps
David Majnemer [Tue, 23 Sep 2014 22:58:15 +0000 (22:58 +0000)]
MS ABI: Pure virtual functions don't contribute to vtordisps

Usually, overriding a virtual function defined in a virtual base
required emission of a vtordisp slot in the record.  However no vtordisp
is needed if the overriding function is pure; it should be impossible to
observe the pure virtual method.

This fixes PR21046.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218340 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoImprove -Wuninitialized to take into account field ordering with initializer
Richard Trieu [Tue, 23 Sep 2014 22:52:42 +0000 (22:52 +0000)]
Improve -Wuninitialized to take into account field ordering with initializer
lists.  Since the fields are inititalized one at a time, using a field with
lower index to initialize a higher indexed field should not be warned on.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218339 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPR18793: If we try to EnterTokenStream when our current lexer is a caching
Richard Smith [Tue, 23 Sep 2014 21:05:52 +0000 (21:05 +0000)]
PR18793: If we try to EnterTokenStream when our current lexer is a caching
lexer, add the token buffer underneath the caching lexer where possible and
push the tokens directly into the caching lexer otherwise. We previously
put the lexer into a corrupted state where we could not guarantee to provide
the tokens in the right order and would sometimes assert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218333 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't perform ADL when looking up operator=; there is no non-member form of
Richard Smith [Tue, 23 Sep 2014 20:31:39 +0000 (20:31 +0000)]
Don't perform ADL when looking up operator=; there is no non-member form of
that function, and apart from being slow, this is unnecessary: ADL can trigger
instantiations that are not permitted here. The standard isn't *completely*
clear here, but this seems like the intent, and in any case this approach is
permitted by [temp.inst]p7.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218330 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Don't use comdats for initializers on platforms that don't support it"
Reid Kleckner [Tue, 23 Sep 2014 16:20:01 +0000 (16:20 +0000)]
Revert "Don't use comdats for initializers on platforms that don't support it"

On further investigation, COMDATs should work with .ctors, and the issue
I was hitting probably reproduces with .init_array.

This reverts commit r218287.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218313 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Parsing/Sema of directive omp parallel for simd
Alexander Musman [Tue, 23 Sep 2014 09:33:00 +0000 (09:33 +0000)]
[OPENMP] Parsing/Sema of directive omp parallel for simd

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218299 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Fix r218248's testcase to use -O1 instead of -O3.
Daniel Sanders [Tue, 23 Sep 2014 08:58:04 +0000 (08:58 +0000)]
[mips] Fix r218248's testcase to use -O1 instead of -O3.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218298 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReverting r214064 and r215650 while investigating a pesky performance regression
Artyom Skrobov [Tue, 23 Sep 2014 08:34:41 +0000 (08:34 +0000)]
Reverting r214064 and r215650 while investigating a pesky performance regression

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218296 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix a typo in comment in ASTBitCodes.h
Alexander Musman [Tue, 23 Sep 2014 05:23:29 +0000 (05:23 +0000)]
Fix a typo in comment in ASTBitCodes.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218294 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAST: Mangle cast expression encoding more accurately
David Majnemer [Tue, 23 Sep 2014 04:27:55 +0000 (04:27 +0000)]
AST: Mangle cast expression encoding more accurately

Don't mangle all casts in expressions as "cv", use the appropriate
encoding which corresponds to a specific cast.

This fixes PR21034.

Differential Revision: http://reviews.llvm.org/D5453

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218293 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r197496, as it broke REVERTIBLE_TYPE_TRAITs from PCH files.
Nico Weber [Tue, 23 Sep 2014 04:09:56 +0000 (04:09 +0000)]
Revert r197496, as it broke REVERTIBLE_TYPE_TRAITs from PCH files.

Also add a test to make sure that this doesn't break again. Fixes PR21036.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218292 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAttempt to fix Sema/builtin-object-size.c after r218258
Hans Wennborg [Tue, 23 Sep 2014 00:02:36 +0000 (00:02 +0000)]
Attempt to fix Sema/builtin-object-size.c after r218258

The type of size_t varies between targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218288 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't use comdats for initializers on platforms that don't support it
Reid Kleckner [Tue, 23 Sep 2014 00:00:14 +0000 (00:00 +0000)]
Don't use comdats for initializers on platforms that don't support it

In particular, pre-.init_array ELF uses the .ctors section mechanism.
MinGW COFF also uses .ctors, now that I think about it. Therefore,
restrict this optimization to the two platforms that are currently known
to work: ELF with .init_array and COFF with .CRT$XCU.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218287 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix a vftable mangling bug
Reid Kleckner [Mon, 22 Sep 2014 23:14:46 +0000 (23:14 +0000)]
Fix a vftable mangling bug

We need to walk the class hierarchy twice: once in depth-first base
specifier order for mangling and again in depth-first layout order for
vftable layout.

Vftable layout seems to depend on the full path from the most derived
class to the base containing the vfptr.

Fixes PR21031.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218285 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoms-inline-asm: Add a test case for the usage of labels in bracket expressions
Ehsan Akhgari [Mon, 22 Sep 2014 20:41:39 +0000 (20:41 +0000)]
ms-inline-asm: Add a test case for the usage of labels in bracket expressions

Summary: This is a test for this patch: http://reviews.llvm.org/D5445.

Reviewers: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5446

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218271 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Remove a FIXME that has been fixed
David Majnemer [Mon, 22 Sep 2014 20:39:37 +0000 (20:39 +0000)]
MS ABI: Remove a FIXME that has been fixed

We've implemented MSVC-style RTTI for quite some time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218269 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReturn true from UnifySection when emitting a diagnostic
Ehsan Akhgari [Mon, 22 Sep 2014 19:46:39 +0000 (19:46 +0000)]
Return true from UnifySection when emitting a diagnostic

Test Plan: I noticed this through code inspection.  The callers use the return value to remove the SectionAttr if a diagnostic is emitted, but I don't think the failure to do so is observable right now.

Reviewers: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5438

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218265 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix test/CodeGen/mips-varargs.c to use %clang_cc1
Kaelyn Takata [Mon, 22 Sep 2014 18:06:01 +0000 (18:06 +0000)]
Fix test/CodeGen/mips-varargs.c to use %clang_cc1

Only tests under test/Driver should use %clang, and test/CodeGen in
particular must always use %clang_cc1.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218260 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix evatuated value of __builtin_object_size according to its
Fariborz Jahanian [Mon, 22 Sep 2014 17:11:59 +0000 (17:11 +0000)]
Fix evatuated value of __builtin_object_size according to its
'type'  argument when it cannot be determined which objects ptr
points to at compile time. rdar://18334276

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218258 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang/test/CodeGen/mips-varargs.c: Fixup for -Asserts.
NAKAMURA Takumi [Mon, 22 Sep 2014 16:40:05 +0000 (16:40 +0000)]
clang/test/CodeGen/mips-varargs.c: Fixup for -Asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218256 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Correct alignment of vectors passed in varargs for the O32 ABI.
Daniel Sanders [Mon, 22 Sep 2014 13:27:06 +0000 (13:27 +0000)]
[mips] Correct alignment of vectors passed in varargs for the O32 ABI.

Summary:
Vectors are normally 16-byte aligned, however the O32 ABI enforces a
maximum alignment of 8-bytes since the base of the stack is 8-byte aligned.
Previously, this was enforced on the caller side, but not on the callee side.

This fixes the output of OpenCL's printf when given vectors.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits, pekka.jaaskelainen

Differential Revision: http://reviews.llvm.org/D5433

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218248 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoremoved unicode symbols from comments.
Alexey Bataev [Mon, 22 Sep 2014 12:32:31 +0000 (12:32 +0000)]
removed unicode symbols from comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218244 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Codegen for 'omp critical' directive.
Alexey Bataev [Mon, 22 Sep 2014 10:01:53 +0000 (10:01 +0000)]
[OPENMP] Codegen for 'omp critical' directive.
This patch adds codegen for constructs:
#pragma omp critical [name]
<body>

It generates global variable ".gomp_critical_user_[name].var" of type int32[8]. Then it generates library call "kmpc_critical(loc, gtid, .gomp_critical_user_[name].var)", code for <body> statement and final call "kmpc_end_critical(loc, gtid, .gomp_critical_user_[name].var)".
Differential Revision: http://reviews.llvm.org/D5202

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218239 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd some documentation stating that the memory allocated by the ASTContext.h placemen...
Ehsan Akhgari [Mon, 22 Sep 2014 02:26:17 +0000 (02:26 +0000)]
Add some documentation stating that the memory allocated by the ASTContext.h placement new does not need to be explicitly freed

Reviewers: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5392

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218232 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoms-inline-asm: Scope inline asm labels to functions
Ehsan Akhgari [Mon, 22 Sep 2014 02:21:54 +0000 (02:21 +0000)]
ms-inline-asm: Scope inline asm labels to functions

Summary:
This fixes PR20023.  In order to implement this scoping rule, we piggy
back on the existing LabelDecl machinery, by creating LabelDecl's that
will carry the "internal" name of the inline assembly label, which we
will rewrite the asm label to.

Reviewers: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4589

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218230 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix bugs in cpuid.h.
Akira Hatanaka [Sat, 20 Sep 2014 01:31:09 +0000 (01:31 +0000)]
Fix bugs in cpuid.h.

This commit makes two changes:

- Remove the push and pop instructions that were saving and restoring %ebx
  before and after cpuid in 32-bit pic mode. We were doing this to ensure we
  don't lose the GOT address in pic register %ebx, but this isn't necessary
  because the GOT address is kept in a virtual register.

- In 64-bit mode, preserve base register %rbx around cpuid.

This fixes PR20311 and rdar://problem/17686779.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218173 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFollow-up to r214408: Warn on other callee-cleanup functions without prototype too.
Nico Weber [Fri, 19 Sep 2014 23:07:12 +0000 (23:07 +0000)]
Follow-up to r214408: Warn on other callee-cleanup functions without prototype too.

According to lore, we used to verifier-fail on:

  void __thiscall f();
  int main() { f(1); }

So that's fixed now. System headers use prototype-less __stdcall functions,
so make that a warning that's DefaultError -- then it fires on regular code
but is suppressed in system headers.

Since it's used in system headers, we have codegen tests for this; massage
them slightly so that they still compile.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218166 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix ctor/dtor aliases losing 'dllexport' (for Itanium ABI)
Dario Domizioli [Fri, 19 Sep 2014 22:06:24 +0000 (22:06 +0000)]
Fix ctor/dtor aliases losing 'dllexport' (for Itanium ABI)

This patch makes sure that the dllexport attribute is transferred to the alias when such alias is created. It only affects the Itanium ABI because for the MSVC ABI a workaround is in place to not generate aliases of dllexport ctors/dtors.
A new CodeGenModule function is provided, CodeGenModule::setAliasAttributes, to factor the code for transferring attributes to aliases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218159 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoIn the Itanium ABI, move stuff to the comdat of variables with static init.
Rafael Espindola [Fri, 19 Sep 2014 19:43:18 +0000 (19:43 +0000)]
In the Itanium ABI, move stuff to the comdat of variables with static init.

Clang can already handle

-------------------------------------------
struct S {
  static const int x;
};
template<typename T> struct U {
  static const int k;
};
template<typename T> const int U<T>::k = T::x;

const int S::x = 42;
extern const int *f();
const int *g() { return &U<S>::k; }
int main() {
  return *f() + U<S>::k;
}

const int *f() { return &U<S>::k; }
-------------------------------------------

since r217264 which puts the .inint_array section in the same COMDAT
as the variable.

This patch allows the linker to more easily delete some dead code and data by
putting the guard variable and init function in the same COMDAT.

This is a fixed version of r218089.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218141 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilence MSVC warnings from r218127 about not returning a value
Reid Kleckner [Fri, 19 Sep 2014 16:20:24 +0000 (16:20 +0000)]
Silence MSVC warnings from r218127 about not returning a value

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218128 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMake DynTypedNode have the dynamic type of the object, instead of its static type.
Samuel Benzaquen [Fri, 19 Sep 2014 16:10:03 +0000 (16:10 +0000)]
Make DynTypedNode have the dynamic type of the object, instead of its static type.

Summary:
Make DynTypedNode have the dynamic type of the object, instead of its static type.
Some optimizations that are in the works require that the nodes have the right type.

Reviewers: klimek

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5411

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218127 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilence a signed/unsigned mismatch warning from MSVC; NFC.
Aaron Ballman [Fri, 19 Sep 2014 12:21:56 +0000 (12:21 +0000)]
Silence a signed/unsigned mismatch warning from MSVC; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218121 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: [JS] add space before operator 'in'.
Daniel Jasper [Fri, 19 Sep 2014 10:48:15 +0000 (10:48 +0000)]
clang-format: [JS] add space before operator 'in'.

Before:
  return ('aaa')in bbbb;

After:
  return ('aaa') in bbbb;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218119 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] Add _addcarry_u{32|64} and _subborrow_u{32|64}.
Robert Khasanov [Fri, 19 Sep 2014 10:29:22 +0000 (10:29 +0000)]
[x86] Add _addcarry_u{32|64} and _subborrow_u{32|64}.
They are added to adxintrin.h but outside __ADX__ block.
These intrinics generates adc and sbb correspondingly that were available before ADX

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218118 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] Added _addcarryx_u32, _addcarryx_u64 intrinsics
Robert Khasanov [Fri, 19 Sep 2014 10:17:06 +0000 (10:17 +0000)]
[x86] Added _addcarryx_u32, _addcarryx_u64 intrinsics

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218117 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] Enable broadwell target in clang.
Robert Khasanov [Fri, 19 Sep 2014 09:53:48 +0000 (09:53 +0000)]
[x86] Enable broadwell target in clang.
Added -madx option

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218116 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Prevent column layout if elements aren't uniform enough.
Daniel Jasper [Fri, 19 Sep 2014 08:28:43 +0000 (08:28 +0000)]
clang-format: Prevent column layout if elements aren't uniform enough.

This patch only considers the difference between the length of the
shortest and longest element, but we might want to look at other
features (token count, etc.) in future.

Before:
  std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{
      aaaaaaa,      aaaaaaaaaa,
      aaaaa,        aaaaaaaaaaaaaaa,
      aaa,          aaaaaaaaaa,
      a,            aaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa,
      aaaaaaa,      a};

After:
  std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{
      aaaaaaaaaaaaaaaaa, aaaaa, aaaaaaaaaaaaaaa, aaa, aaaaaaaaaa, a,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaa, a};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218111 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Initial parsing/sema analysis of 'target' directive.
Alexey Bataev [Fri, 19 Sep 2014 08:19:49 +0000 (08:19 +0000)]
[OPENMP] Initial parsing/sema analysis of 'target' directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218110 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Undo r216377.
Daniel Jasper [Fri, 19 Sep 2014 08:01:25 +0000 (08:01 +0000)]
clang-format: Undo r216377.

It has proven to not be a food idea in many case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218107 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't use the third field of llvm.global_ctors for MachO.
Rafael Espindola [Fri, 19 Sep 2014 01:54:22 +0000 (01:54 +0000)]
Don't use the third field of llvm.global_ctors for MachO.

The field is defined as:

If the third field is present, non-null, and points to a global variable or function, the initializer function will only run if the associated data from the current module is not discarded.

And without COMDATs we can't implement that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218097 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Put more stuff in the comdat used for variables with static init."
Rafael Espindola [Fri, 19 Sep 2014 01:28:16 +0000 (01:28 +0000)]
Revert "Put more stuff in the comdat used for variables with static init."

This reverts commit r218089.
It looks like it was causing issues on COFF.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218094 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPut more stuff in the comdat used for variables with static init.
Rafael Espindola [Thu, 18 Sep 2014 23:41:44 +0000 (23:41 +0000)]
Put more stuff in the comdat used for variables with static init.

Clang can already handle

-------------------------------------------
struct S {
  static const int x;
};
template<typename T> struct U {
  static const int k;
};
template<typename T> const int U<T>::k = T::x;

const int S::x = 42;
extern const int *f();
const int *g() { return &U<S>::k; }
int main() {
  return *f() + U<S>::k;
}

const int *f() { return &U<S>::k; }
-------------------------------------------

since r217264 which puts the .inint_array section in the same COMDAT
as the variable.

This patch allows the linker to more easily delete some dead code and data by
putting the guard variable and init function in the same COMDAT.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218089 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoThread Safety Analysis: add new warning flag, -Wthread-safety-reference, which
DeLesley Hutchins [Thu, 18 Sep 2014 23:02:26 +0000 (23:02 +0000)]
Thread Safety Analysis: add new warning flag, -Wthread-safety-reference, which
warns when a guarded variable is passed by reference as a function argument.
This is released as a separate warning flag, because it could potentially
break existing code that uses thread safety analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218087 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Don't ICE for pointers to pointers to members of incomplete classes
David Majnemer [Thu, 18 Sep 2014 22:05:54 +0000 (22:05 +0000)]
MS ABI: Don't ICE for pointers to pointers to members of incomplete classes

CodeGen would try to come up with an LLVM IR type for a pointer to
member type on the way to forming an LLVM IR type for a pointer to
pointer to member type.

However, if the pointer to member representation has not been locked in yet,
we would not be able to come up with a pointer to member IR type.

In these cases, make the pointer to member type an incomplete type.
This will make the pointer to pointer to member type a pointer to an
incomplete type.  If the class eventually obtains an inheritance model,
we will make the pointer to member type represent the actual inheritance
model.

Differential Revision: http://reviews.llvm.org/D5373

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218084 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86, inlineasm] Do not allow using constraint 'x' for a variable larger than
Akira Hatanaka [Thu, 18 Sep 2014 21:58:54 +0000 (21:58 +0000)]
[X86, inlineasm] Do not allow using constraint 'x' for a variable larger than
128-bit unless the target CPU supports AVX.

rdar://problem/11846140

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218082 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86, inline-asm] Allow 256-bit wide operands for the 'x' constraints
Hans Wennborg [Thu, 18 Sep 2014 20:24:04 +0000 (20:24 +0000)]
[X86, inline-asm] Allow 256-bit wide operands for the 'x' constraints

The 'x' constraint is for "any SSE register", and GCC seems to include the
256-bit ymm registers in that concept.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218073 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86, inlineasm] Check that the output size is correct for the given constraint.
Akira Hatanaka [Thu, 18 Sep 2014 18:17:18 +0000 (18:17 +0000)]
[X86, inlineasm] Check that the output size is correct for the given constraint.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218064 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPatch to check at compile time for overflow when
Fariborz Jahanian [Thu, 18 Sep 2014 17:58:27 +0000 (17:58 +0000)]
Patch to check at compile time for overflow when
__builtin___memcpy_chk and similar builtins are
being used. Patch by Jacques Fortier (with added
clang tests).  rdar://11076881

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218063 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r217995 and follow-ups:
Hans Wennborg [Thu, 18 Sep 2014 16:01:32 +0000 (16:01 +0000)]
Revert r217995 and follow-ups:

r218053: Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
r218011: Work around MSVC parser bug by putting redundant braces around the body of
r217997: Skip parens when detecting whether we're instantiating a function declaration.
r217995: Instantiate exception specifications when instantiating function types (other

The Windows build was broken for 16 hours and no one had any good ideas of how to
fix it. Reverting for now to make the builders green. See the cfe-commits thread [1] for
more info.

This was the build error (from [2]):

C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1590) : error C2668: '`anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType' : ambiguous call to overloaded function
        C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1313): could be 'clang::QualType `anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)'
        with
        [
            Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>
        ]
        c:\bb-win7\ninja-clang-i686-msc17-r\llvm-project\clang\lib\sema\TreeTransform.h(4532): or       'clang::QualType clang::TreeTransform<Derived>::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)'
        with
        [
            Derived=`anonymous-namespace'::TemplateInstantiator,
            Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>
        ]
        while trying to match the argument list '(clang::TypeLocBuilder, clang::FunctionProtoTypeLoc, clang::CXXRecordDecl *, unsigned int, clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>)'

 1. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140915/115011.html
 2. http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/10515/steps/build_clang_tools_1/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218058 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUse exceptions() instead of getNumExceptions()/getExceptionType() to avoid
Alexander Kornienko [Thu, 18 Sep 2014 15:19:53 +0000 (15:19 +0000)]
Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
accesses to incorrect exception types when getExceptionSpecType() != EST_Dynamic

This fixes a crash in test/CXX/except/except.spec/template.cpp that happens in
certain build configurations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218053 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoParsing/Sema of directive omp for simd
Alexander Musman [Thu, 18 Sep 2014 05:12:34 +0000 (05:12 +0000)]
Parsing/Sema of directive omp for simd

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218029 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoWork around MSVC parser bug by putting redundant braces around the body of
Richard Smith [Thu, 18 Sep 2014 03:49:06 +0000 (03:49 +0000)]
Work around MSVC parser bug by putting redundant braces around the body of
this range-based for loop.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218011 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoBasic: use hex string for __ARM_FP macro
Saleem Abdulrasool [Thu, 18 Sep 2014 02:13:33 +0000 (02:13 +0000)]
Basic: use hex string for __ARM_FP macro

The ARM ACLE describes the values as hex constants rather than numeric
constants; follow suit.  Address post-commit review comments from Jon Roelofs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218009 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoChange -Wbind-to-temporary-copy from an ExtWarn to an Extension.
Nico Weber [Thu, 18 Sep 2014 02:09:53 +0000 (02:09 +0000)]
Change -Wbind-to-temporary-copy from an ExtWarn to an Extension.

The reasoning is that this construct is accepted by all compilers and valid in
C++11, so it doesn't seem like a useful warning to have enabled by default.
Building with -pedantic, -Wbind-to-temporary-copy, or -Wc++98-compat still
shows the warning.

The motivation is that I built re2, and this was the only warning that was
emitted during the build. Both changing re2 to fix the warning and detecting
clang and suppressing the warning in re2's build seem inferior than just giving
the compiler a good default for this warning.

Also move the cxx98compat version of this warning to CXX98CompatPedantic, and
update tests accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218008 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSema: Diagnose undefined structs used as Microsoft anonymous structs
David Majnemer [Thu, 18 Sep 2014 00:42:05 +0000 (00:42 +0000)]
Sema: Diagnose undefined structs used as Microsoft anonymous structs

Previously, we would not mark structs containing anonymous structs as
invalid.  Later, horrific things would occur when trying to determine
the size of the parent record.

Instead, require the struct to be a complete type when used as an
anonymous struct.  Mark both the anonymous field for the struct and the
parent context as invalid (this is similar to what we do when a struct
contains a field with an incomplete type.)

This fixes PR11847.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218006 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix test case.
Akira Hatanaka [Thu, 18 Sep 2014 00:29:04 +0000 (00:29 +0000)]
Fix test case.

This is another follow-up patch to r217996.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218003 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSkip parens when detecting whether we're instantiating a function declaration.
Richard Smith [Thu, 18 Sep 2014 00:12:09 +0000 (00:12 +0000)]
Skip parens when detecting whether we're instantiating a function declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217997 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix test case.
Akira Hatanaka [Thu, 18 Sep 2014 00:04:10 +0000 (00:04 +0000)]
Fix test case.

This is a follow-up to r217994.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217996 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInstantiate exception specifications when instantiating function types (other
Richard Smith [Wed, 17 Sep 2014 23:57:05 +0000 (23:57 +0000)]
Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate
these at all! This also covers the pathological case where the only mention of
a parameter pack is within the exception specification; this gives us a second
way (other than alias templates) to reach the horrible state where a type
contains an unexpanded pack, but its canonical type does not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217995 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86, inline-asm] Check that the input size is correct for constraints R, q, Q,
Akira Hatanaka [Wed, 17 Sep 2014 23:35:14 +0000 (23:35 +0000)]
[X86, inline-asm] Check that the input size is correct for constraints R, q, Q,
S, D, A, y, x, f, t, and u.

This is a follow-up patch for r167717.

rdar://problem/11846140
rdar://problem/17476970

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217994 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoBasic: add support for ARM ACLE 6.5.1
Saleem Abdulrasool [Wed, 17 Sep 2014 14:50:27 +0000 (14:50 +0000)]
Basic: add support for ARM ACLE 6.5.1

Extend ARM ACLE support (Section 6.5.1) for AArch32.  Define __ARM_FP if
hardware floating point support is available as per the value defined by the
ACLE.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217957 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoBasic: use range-based for loops for ARM target
Saleem Abdulrasool [Wed, 17 Sep 2014 14:50:23 +0000 (14:50 +0000)]
Basic: use range-based for loops for ARM target

Tweak handleTargetFeature for the ARM(32) target to use range based for loops.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217956 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoBasic: whitespace fixup for ARM target info
Saleem Abdulrasool [Wed, 17 Sep 2014 14:50:19 +0000 (14:50 +0000)]
Basic: whitespace fixup for ARM target info

Fix whitespace.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217955 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't try to devirtualize non-virtual calls
Reid Kleckner [Tue, 16 Sep 2014 22:23:33 +0000 (22:23 +0000)]
Don't try to devirtualize non-virtual calls

We would end up marking the vtable of the derived class as used for no
reason. Because the call itself is qualified, it is never virtual, and
the vtable of the derived class isn't helpful. We would end up rejecting
code that MSVC accepts for no benefit.

See http://crbug.com/413478

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217910 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't try to use C5/D5 comdats in COFF.
Rafael Espindola [Tue, 16 Sep 2014 20:19:43 +0000 (20:19 +0000)]
Don't try to use C5/D5 comdats in COFF.

This should fix the mingw bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217897 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix forwarding -l to MSVC's link.exe
Reid Kleckner [Tue, 16 Sep 2014 19:22:00 +0000 (19:22 +0000)]
Fix forwarding -l to MSVC's link.exe

Translate -lfoo to -lfoo.lib while making sure that -lfoo.lib stays as
-lfoo.lib. Also, these arguments were being passed twice: once
explicitly via AddAllArgs, and again implicitly as linker inputs. Now
they are passed once.

Fixes PR20868.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217895 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Allow unbroken ::: in inline assembly.
Daniel Jasper [Tue, 16 Sep 2014 16:36:57 +0000 (16:36 +0000)]
clang-format: Allow unbroken ::: in inline assembly.

Before:
  asm volatile("nop" :: : "memory");

After:
  asm volatile("nop" ::: "memory");

Patch by Eugene Toder. Thank you.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217883 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format: Restructure and add missing tests.
Daniel Jasper [Tue, 16 Sep 2014 16:22:30 +0000 (16:22 +0000)]
clang-format: Restructure and add missing tests.

Patch by Jean-Philippe Dufraigne, Thank you!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217880 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd support for putting constructors and destructos in explicit comdats.
Rafael Espindola [Tue, 16 Sep 2014 15:18:21 +0000 (15:18 +0000)]
Add support for putting constructors and destructos in explicit comdats.

There are situations when clang knows that the C1 and C2 constructors
or the D1 and D2 destructors are identical. We already optimize some
of these cases, but cannot optimize it when the GlobalValue is
weak_odr.

The problem with weak_odr is that an old TU seeing the same code will
have a C1 and a C2 comdat with the corresponding symbols. We cannot
suddenly start putting the C2 symbol in the C1 comdat as we cannot
guarantee that the linker will not pick a .o with only C1 in it.

The solution implemented by GCC is to expand the ABI to have a comdat
whose name uses a C5/D5 suffix and always has both symbols. That is
what this patch implements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217874 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[sphinx cleanup]
Dan Liew [Tue, 16 Sep 2014 08:44:27 +0000 (08:44 +0000)]
[sphinx cleanup]
Fix warning introduced by r211098.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217864 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDriver: use range based for loop
Saleem Abdulrasool [Tue, 16 Sep 2014 03:48:32 +0000 (03:48 +0000)]
Driver: use range based for loop

Use a couple more range based for loops.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217857 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReject a slightly-sneaky way to perform a read of mutable state from within a
Richard Smith [Tue, 16 Sep 2014 01:24:02 +0000 (01:24 +0000)]
Reject a slightly-sneaky way to perform a read of mutable state from within a
constexpr function. Part of this fix is a tentative fix for an as-yet-unfiled
core issue (we're missing a prohibition against reading mutable members from
unions via a trivial constructor/assignment, since that doesn't perform an
lvalue-to-rvalue conversion on the members).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217852 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTests for DR581-600.
Richard Smith [Mon, 15 Sep 2014 22:56:03 +0000 (22:56 +0000)]
Tests for DR581-600.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217844 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoPR19692: Add (passing) regression test.
Richard Smith [Mon, 15 Sep 2014 22:14:48 +0000 (22:14 +0000)]
PR19692: Add (passing) regression test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217836 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUnique_ptrify Preprocessor::PragmaHandlersBackup
David Blaikie [Mon, 15 Sep 2014 21:31:42 +0000 (21:31 +0000)]
Unique_ptrify Preprocessor::PragmaHandlersBackup

Follow up to r217656

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217829 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoObjective-C. Prevents a crash generating AST for a
Fariborz Jahanian [Mon, 15 Sep 2014 21:19:39 +0000 (21:19 +0000)]
Objective-C. Prevents a crash generating AST for a
a property assignment due to numerous user errors.
Cannot come up with a reasonable test case due to
array of user errors before the crash point.
rdar://17813651.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217825 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMajor rewrite of linking strategy for sanitizer runtimes on Linux.
Alexey Samsonov [Mon, 15 Sep 2014 19:58:40 +0000 (19:58 +0000)]
Major rewrite of linking strategy for sanitizer runtimes on Linux.

Change 1: we used to add static sanitizer runtimes at the
very beginning of the linker invocation, even before crtbegin.o, which
is gross and not correct in general. Fix this: now addSanitizerRuntimes()
adds all sanitizer-related link flags to the end of the linker invocation
being constructed. It means, that we should call this function in the
correct place, namely, before AddLinkerInputs() to make sure sanitizer
versions of library functions will be preferred.

Change 2: Put system libraries sanitizer libraries depend on at the
end of the linker invocation, where all the rest system libraries are
located. Respect --nodefaultlibs and --nostdlib flags. This is another way
to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends
immediately after static ASan runtime, before the user linker inputs.
This caused significant slowdown in dynamic linker for large binaries
linked against thousands of shared objects. Instead, to mark system
libraries as DT_NEEDED we prepend them with "--no-as-needed" flag,
discarding the "-Wl,--as-needed" flag that could be provided by the user.

Otherwise, this change is a code cleanup. Instead of having a special method
for each sanitizer, we introduce a function collectSanitizerRuntimes() that
analyzes -fsanitize= flags and returns the set of static and shared
libraries that needs to be linked.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217817 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReduce code duplication a bit more. NFC.
Rafael Espindola [Mon, 15 Sep 2014 19:43:47 +0000 (19:43 +0000)]
Reduce code duplication a bit more. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217813 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReduce code duplication a bit more. NFC.
Rafael Espindola [Mon, 15 Sep 2014 19:34:18 +0000 (19:34 +0000)]
Reduce code duplication a bit more. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217811 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSimplify the code a bit, NFC.
Rafael Espindola [Mon, 15 Sep 2014 19:24:44 +0000 (19:24 +0000)]
Simplify the code a bit, NFC.

hasConstructorVariants is always true for MS and false for Itanium.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217809 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMove emitCXXStructor to CGCXXABI.
Rafael Espindola [Mon, 15 Sep 2014 19:20:10 +0000 (19:20 +0000)]
Move emitCXXStructor to CGCXXABI.

A followup patch will address the code duplication.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217807 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCreate a emitCXXStructor function and make the existing emitCXXConstructor and
Rafael Espindola [Mon, 15 Sep 2014 18:46:13 +0000 (18:46 +0000)]
Create a emitCXXStructor function and make the existing emitCXXConstructor and
emitCXXDestructor static helpers.

A next patch will make it a helper in CGCXXABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217804 91177308-0d34-0410-b5e6-96231b3b80d8