]> granicus.if.org Git - clang/log
clang
10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 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

10 years agoUse intrusive refcounted pointers to manage RopeRefCountString lifetime.
Benjamin Kramer [Mon, 15 Sep 2014 17:58:03 +0000 (17:58 +0000)]
Use intrusive refcounted pointers to manage RopeRefCountString lifetime.

std::shared_ptr<char []> would be even nicer, but shared_ptr doesn't work
with arrays :(

No functionality change.

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

10 years agounique_ptrify ChainedDiagnosticConsumer's ctor parameters
David Blaikie [Mon, 15 Sep 2014 17:50:10 +0000 (17:50 +0000)]
unique_ptrify ChainedDiagnosticConsumer's ctor parameters

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

10 years agoTeach Clang how to use response files when calling other tools
Reid Kleckner [Mon, 15 Sep 2014 17:45:39 +0000 (17:45 +0000)]
Teach Clang how to use response files when calling other tools

Patch by Rafael Auler!

This patch addresses PR15171 and teaches Clang how to call other tools
with response files, when the command line exceeds system limits. This
is a problem for Windows systems, whose maximum command-line length is
32kb.

I introduce the concept of "response file support" for each Tool object.
A given Tool may have full support for response files (e.g. MSVC's
link.exe) or only support file names inside response files, but no flags
(e.g. Apple's ld64, as commented in PR15171), or no support at all (the
default case). Therefore, if you implement a toolchain in the clang
driver and you want clang to be able to use response files in your
tools, you must override a method (getReponseFileSupport()) to tell so.

I designed it to support different kinds of tools and
internationalisation needs:

- VS response files ( UTF-16 )
- GNU tools ( uses system's current code page, windows' legacy intl.
  support, with escaped backslashes. On unix, fallback to UTF-8 )
- Clang itself ( UTF-16 on windows, UTF-8 on unix )
- ld64 response files ( only a limited file list, UTF-8 on unix )

With this design, I was able to test input file names with spaces and
international characters for Windows. When the linker input is large
enough, it creates a response file with the correct encoding. On a Mac,
to test ld64, I temporarily changed Clang's behavior to always use
response files regardless of the command size limit (avoiding using huge
command line inputs). I tested clang with the LLVM test suite (compiling
benchmarks) and it did fine.

Test Plan: A LIT test that tests proper response files support. This is
tricky, since, for Unix systems, we need a 2MB response file, otherwise
Clang will simply use regular arguments instead of a response file. To
do this, my LIT test generate the file on the fly by cloning many -DTEST
parameters until we have a 2MB file. I found out that processing 2MB of
arguments is pretty slow, it takes 1 minute using my notebook in a debug
build, or 10s in a Release build. Therefore, I also added "REQUIRES:
long_tests", so it will only run when the user wants to run long tests.

In the full discussion in
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130408/171463.html,
Rafael Espindola discusses a proper way to test
llvm::sys::argumentsFitWithinSystemLimits(), and, there, Chandler
suggests to use 10 times the current system limit (20MB resp file), so
we guarantee that the system will always use response file, even if a
new linux comes up that can handle a few more bytes of arguments.
However, by testing with a 20MB resp file, the test takes long 8 minutes
just to perform a silly check to see if the driver will use a response
file. I found it to be unreasonable. Thus, I discarded this approach and
uses a 2MB response file, which should be enough.

Reviewers: asl, rafael, silvas

Reviewed By: silvas

Subscribers: silvas, rnk, thakis, cfe-commits

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

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

10 years agoFix memory leak of raw_ostreams in LogDiagnosticPrinter handling.
David Blaikie [Mon, 15 Sep 2014 17:30:56 +0000 (17:30 +0000)]
Fix memory leak of raw_ostreams in LogDiagnosticPrinter handling.

This is another case of conditional ownership (in this case a raw
reference, plus a boolean to indicate whether the referenced object
should be deleted). While it's not ideal, I prefer to make the ownership
explicit with a unique_ptr than using a boolean flag (though it does
make the reference and the unique_ptr redundant in the sense that they
both refer to the same memory). At some point we might write a reusable
conditional ownership pointer (a stateful custom deleter for a unique_ptr
may be appropriate).

Based on a patch from a patch by Anton Yartsev.

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

10 years agoAdd -fseh-exceptions for MinGW-w64
Reid Kleckner [Mon, 15 Sep 2014 17:19:16 +0000 (17:19 +0000)]
Add -fseh-exceptions for MinGW-w64

This adds a flag called -fseh-exceptions that uses the native Windows
.pdata and .xdata unwind mechanism to throw exceptions. The other EH
possibilities are DWARF and SJLJ exceptions.

Patch by Martell Malone!

Reviewed By: asl, rnk

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

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

10 years agoPretty print attributes associated with record declarations.
Aaron Ballman [Mon, 15 Sep 2014 16:45:30 +0000 (16:45 +0000)]
Pretty print attributes associated with record declarations.

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

10 years agoObjective-C SDK modernizer. Do not modernize an enum
Fariborz Jahanian [Mon, 15 Sep 2014 16:41:47 +0000 (16:41 +0000)]
Objective-C SDK modernizer. Do not modernize an enum
which already has the underlying interger type specification.
// rdar://1826225

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

10 years agoAdding some FIXMEs to the attribute emitter code regarding whether pretty printing...
Aaron Ballman [Mon, 15 Sep 2014 16:16:14 +0000 (16:16 +0000)]
Adding some FIXMEs to the attribute emitter code regarding whether pretty printing enumerators should use quoted string literals, or identifiers. NFC.

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

10 years agoWhen pretty printing attributes that have enumeration arguments, print the enumerator...
Aaron Ballman [Mon, 15 Sep 2014 15:14:13 +0000 (15:14 +0000)]
When pretty printing attributes that have enumeration arguments, print the enumerator identifier (as a string literal) instead of the internal enumerator integral value.

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

10 years agoEdit: Do not extend a removal to include trailing whitespace if we're at the end
Benjamin Kramer [Mon, 15 Sep 2014 11:47:10 +0000 (11:47 +0000)]
Edit: Do not extend a removal to include trailing whitespace if we're at the end
of the file.

This would run past the end of the buffer. Sadly I don't have a great way to
test it, the only way to trigger the bug is having a removal fix it at the end
of the file, which none of our current warnings can generate.

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

10 years ago[ARM] Add ACLE predefines: maxmin, rounding and h/w integer division
James Molloy [Mon, 15 Sep 2014 11:25:38 +0000 (11:25 +0000)]
[ARM] Add ACLE predefines: maxmin, rounding and h/w integer division

Patch by Assad Hashmi!

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

10 years agoclang-format: Basic support for Java.
Daniel Jasper [Mon, 15 Sep 2014 11:21:46 +0000 (11:21 +0000)]
clang-format: Basic support for Java.

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

10 years agoclang-format: Add option to break before non-assignment operators.
Daniel Jasper [Mon, 15 Sep 2014 11:11:00 +0000 (11:11 +0000)]
clang-format: Add option to break before non-assignment operators.

This will allow:
  int aaaaaaaaaaaaaa =
      bbbbbbbbbbbbbb
      + ccccccccccccccc;

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

10 years agoMake test/Driver hermetic
JF Bastien [Sun, 14 Sep 2014 23:42:15 +0000 (23:42 +0000)]
Make test/Driver hermetic

Summary:
The includes shouldn't be there, use the compiler's built-in types/macros instead.

This is a follow-up to r217694, as discussed in:
  http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140908/114669.html

Test Plan: ninja check-clang

Reviewers: nlewycky, thakis, echristo, chandlerc

Subscribers: cfe-commits

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

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

10 years agoCheck delegating constructors for using uninitialized fields.
Richard Trieu [Fri, 12 Sep 2014 22:47:58 +0000 (22:47 +0000)]
Check delegating constructors for using uninitialized fields.

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

10 years agoclang-cl: Warn when a /TC or /TP argument is unused
Ehsan Akhgari [Fri, 12 Sep 2014 21:44:24 +0000 (21:44 +0000)]
clang-cl: Warn when a /TC or /TP argument is unused

Test Plan: The patch includes a test case.

Reviewers: hansw

Subscribers: cfe-commits

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

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