Commit Graph

38092 Commits

Author SHA1 Message Date
Justin Hibbits 90ca05e5e5 Add PIC-level support to Clang.
Summary:
This distinguishes between -fpic and -fPIC now, with the additions in LLVM for
PIC level support.

Test Plan: No regressions

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rnk, emaste, llvm-commits

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

llvm-svn: 222227
2014-11-18 06:17:20 +00:00
Argyrios Kyrtzidis 1bde117bea [ASTReader] Add a convenience function to retrieve all the input files of a module file.
llvm-svn: 222224
2014-11-18 05:24:18 +00:00
Frederic Riss d253ed6565 Fully handle globals and functions in CGDebugInfo::getDeclarationOrDefinition()
Currently this function would return nothing for functions or globals that
haven't seen a definition yet. Make it return a forward declaration that will
get RAUWed with the definition if one is seen at a later point. The strategy
used to implement this is similar to what's done for types: the forward
declarations are stored in a vector and post processed upon finilization to
perform the required RAUWs.

For now the only user of getDeclarationOrDefinition() is EmitUsingDecl(), thus
this patch allows to emit correct imported declarations even in the absence of
an actual definition of the imported entity.

(Another user will be the debug info generation for argument default values
that I need to resurect).

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

llvm-svn: 222220
2014-11-18 03:40:51 +00:00
Frederic Riss 9db79f17c0 [DebugInfo] Move collection of various function/var decl properties into helper functions.
NFC. Helpers to be re-used in upcoming commit.

llvm-svn: 222219
2014-11-18 03:40:46 +00:00
Justin Bogner 94d384e423 InstrProf: Don't emit coverage for uninstantiated templates
We include unused functions and methods in -fcoverage-mapping so that
we can differentiate between uninstrumented and unused. This can cause
problems for uninstantiated templates though, since they may involve
an incomplete type that can't be mangled. This shows up in things like
libc++'s <unordered_map> and makes coverage unusable.

Avoid the issue by skipping uninstantiated methods of a templated
class.

llvm-svn: 222204
2014-11-18 00:34:46 +00:00
John McCall 0d8d6c094f Fix an assertion when ending a function definition.
The bug is that ExprCleanupObjects isn't always empty
in a fresh evaluation context.  New evaluation contexts just
track the current depth of the stack.

The assertion will misfire whenever we finish processing
a function body inside an expression that contained an earlier
block literal with non-trivial captures.  That's actually
a lot less likely than you'd think, though, because it has
to be a real function declaration, not just another block.
Mixed block/lambda code would work, as would a template
instantiation or a local class definition.

The code works correctly if the assertion is disabled.

rdar://16356628

llvm-svn: 222194
2014-11-18 00:19:01 +00:00
Alexander Kornienko 41c247a677 Make DiagnosticsEngine::takeClient return std::unique_ptr<>
Summary:
Make DiagnosticsEngine::takeClient return std::unique_ptr<>. Updated
callers to store conditional ownership using a pair of pointer and unique_ptr
instead of a pointer + bool. Updated code that temporarily registers clients to
use the non-owning registration (+ removed extra calls to takeClient).

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: cfe-commits

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

llvm-svn: 222193
2014-11-17 23:46:02 +00:00
Reid Kleckner d60b82f93e Handle use of default member initializers before end of outermost class
Specifically, when we have this situation:
  struct A {
    template <typename T> struct B {
      int m1 = sizeof(A);
    };
    B<int> m2;
  };

We can't parse m1's initializer eagerly because we need A to be
complete.  Therefore we wait until the end of A's class scope to parse
it. However, we can trigger instantiation of B before the end of A,
which will attempt to instantiate the field decls eagerly, and it would
build a bad field decl instantiation that said it had an initializer but
actually lacked one.

Fixed by deferring instantiation of default member initializers until
they are needed during constructor analysis. This addresses a long
standing FIXME in the code.

Fixes PR19195.

Reviewed By: rsmith

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

llvm-svn: 222192
2014-11-17 23:36:45 +00:00
Saleem Abdulrasool b7698745e9 CodeGen: make a check stricter
When targeting Windows itanium (a MSVC environment), use itanium style
exceptions rather than SEH.  Existing test cases already test this code path.
Applying this change ensures that tests wont break due to a parallel change in
LLVM (to correctly report isMSVCEnvironment).

llvm-svn: 222179
2014-11-17 22:11:07 +00:00
Sylvestre Ledru 55635cea27 Missing comma in a string array initialization (CID 1254893)
Summary:
We have this error from a while (Wed Jun 15 18:02:42 2011
r133103)

Reviewers: rsmith

Reviewed By: rsmith

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

llvm-svn: 222169
2014-11-17 19:41:49 +00:00
Hans Wennborg 6164753e81 clang-cl: Allow /Fo without an argument (PR21589)
When it's used without an argument, the default file name is
used. The same goes for /Fe.

Also, allow using /Fo, /Fa and /Fe with multiple inputs if they
don't have an argument.

llvm-svn: 222164
2014-11-17 19:16:36 +00:00
Daniel Jasper e1e348b857 clang-format: Fix more incorrect pointer detection.
Before:
  Constructor() : a(a), b(c, d *e) {}

After:
  Constructor() : a(a), b(c, d * e) {}

llvm-svn: 222158
2014-11-17 18:42:22 +00:00
Saleem Abdulrasool cb29c1ae25 Basic: tweak comment
Add a missing surrounding brace for doxygen group.  This messes with pair
jumping in vim and is annoying.  NFC.

llvm-svn: 222155
2014-11-17 18:40:15 +00:00
Sylvestre Ledru 30f1708b64 Fix the indentation: Nesting level does not match indentation (CID 1254863)
llvm-svn: 222152
2014-11-17 18:26:39 +00:00
Timur Iskhodzhanov 7081460287 Minor readability tweaks to VFTableBuilder.cpp
llvm-svn: 222140
2014-11-17 15:53:50 +00:00
Timur Iskhodzhanov 7d19fc1c37 Add a couple more examples illustrating why we need vtordisps and how they work
llvm-svn: 222133
2014-11-17 15:11:05 +00:00
Samuel Benzaquen 9743c9d88c Remove VariadicOperatorMatcherInterface as it is redundant with logic from DynTypedMatcher.
Summary:
The generic variadic matcher is faster (one less virtual function call
per match) and doesn't require template instantiations which reduces
compile time and binary size.
Registry.cpp.o generates ~14% less symbols and compiles ~7.5% faster.
The change also speeds up our clang-tidy benchmark by ~2%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 222131
2014-11-17 14:55:49 +00:00
Alexander Kornienko 4c0ef3797b A small correction for r221884. No functional changes.
llvm-svn: 222130
2014-11-17 14:46:28 +00:00
Daniel Jasper 6a3fd8361f clang-format: Fix regression introduced in r221609.
Before:
  void f() { f(a, c *d); }

After:
  void f() { f(a, c * d); }

llvm-svn: 222128
2014-11-17 13:55:04 +00:00
Alexey Samsonov 1e715a66d7 [Sanitizer] Parse and produce all sanitizer-relevant arguments in SanitizerArgs.
In particular, make SanitizerArgs responsible for parsing
and passing down to frontend -fsanitize-recover and
-fsanitize-undefined-trap-on-error flags.

Simplify parsing -f(no-)sanitize= flags parsing: get rid of
too complex filterUnsupportedKinds function.

No functionality change.

llvm-svn: 222105
2014-11-16 20:53:53 +00:00
Richard Trieu 6572489127 Fix issues missed during the review of r222099.
Shift some functions around, make a method in Sema private,
call the correct overloaded function.  No functional change.

llvm-svn: 222081
2014-11-15 06:37:39 +00:00
Reid Kleckner b1be683074 Fix IRGen for passing transparent unions
We have had a test for this for a long time with a FIXME saying what we
should be doing. This just does it.

Fixes PR21573.

llvm-svn: 222074
2014-11-15 01:41:41 +00:00
Duncan P. N. Exon Smith 2f68dadb0a CGDebugInfo: Update for DIBuilder API change
Tracking LLVM commit r222070.

llvm-svn: 222071
2014-11-15 00:24:50 +00:00
Fariborz Jahanian 68e7938361 This patch fixes couple of bugs for predefined expression
used inside blocks. It fixes a crash in naming code
for __func__ etc. when used in a block declared globally.
It also brings back old naming convention for
predefined expression which was broken. rdar://18961148

llvm-svn: 222065
2014-11-14 23:55:27 +00:00
Aaron Ballman 43f40103f0 [c++1z] Support [[deprecated]] attributes on namespaces. Note that it only applies to situations where the namespace is mentioned. Thus, use on anonymous namespaces is diagnosed.
llvm-svn: 222054
2014-11-14 22:34:56 +00:00
Anton Korobeynikov 5f951ee8bd Recommit r222044 with a test fix - it does not make sense to hunt
for a typedef before arithmetic conversion in all rare corner cases.

llvm-svn: 222049
2014-11-14 22:09:15 +00:00
Aaron Ballman d38341e942 Removing an unused variable; NFC.
llvm-svn: 222048
2014-11-14 21:57:30 +00:00
Anton Korobeynikov 50fc68f2d9 Again revert r222044 to resolve darwin objc test fails.
llvm-svn: 222047
2014-11-14 21:54:46 +00:00
Anton Korobeynikov dc12b367bc Follow-up to D6217
Summary:
Ok, here is somewhat addition to D6217 aiming to preserve old darwin behavior wrt the typedefed types. The actual change to SemaChecking turned out to be pretty gross, in particular:
  1. We need to extract the typedef'ed type for proper diagnostics
  2. We need to walk over paren expressions as well

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 222044
2014-11-14 21:41:07 +00:00
Steven Wu 2e2b0b3942 Add DiagID and Warning Flag to DiagnosticsLog
llvm-svn: 222042
2014-11-14 21:23:56 +00:00
David Blaikie 1cbb971c2d Remove some redundant virtual specifiers on overriden functions.
llvm-svn: 222024
2014-11-14 19:09:44 +00:00
Yaron Keren 8fbe439869 Typo fix.
llvm-svn: 222016
2014-11-14 18:33:42 +00:00
Daniel Jasper 4bfa736f1b clang-format: [Java] Further improve generics formatting.
llvm-svn: 222011
2014-11-14 17:30:15 +00:00
Daniel Jasper d127e3b6af clang-format: Correctly detect multiplication in ctor initializer.
Before:
  Constructor() : a(a), area(width *height) {}

After:
  Constructor() : a(a), area(width * height) {}

llvm-svn: 222010
2014-11-14 17:26:49 +00:00
Fariborz Jahanian b7859ddf9b [Sema]. Warn when logical expression is a pointer
which evaluates to true. rdar://18716393.
Reviewed by Richard Trieu

llvm-svn: 222009
2014-11-14 17:12:50 +00:00
Aaron Ballman 918474c7f9 Silencing a -Wparentheses warning; NFC.
llvm-svn: 221998
2014-11-14 14:40:49 +00:00
Timur Iskhodzhanov 4d28002728 Replace weird whitespace symbols with good old spaces
llvm-svn: 221997
2014-11-14 14:16:34 +00:00
Timur Iskhodzhanov 46a18efa5a Add one illustrative class hierarchy as an example in a comment to the VFTableBuilder code
llvm-svn: 221996
2014-11-14 14:10:15 +00:00
Aaron Ballman a0344c5d7b Complete support for the SD-6 standing document (based off N4200) with support for __has_cpp_attribute.
llvm-svn: 221991
2014-11-14 13:44:02 +00:00
Daniel Jasper 6c0ee17b89 clang-format: Improve function parameter packing.
Before:
  void SomeLoooooooooooongFunction(
      std::unique_ptr<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>
          aaaaaaaaaaaaaaaaaaaaaaaaaa, int bbbbbbbbbbbbb);

After:
  void SomeLoooooooooooongFunction(
      std::unique_ptr<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>
          aaaaaaaaaaaaaaaaaaaaaaaaaa,
      int bbbbbbbbbbbbb);

llvm-svn: 221989
2014-11-14 13:14:45 +00:00
Bill Schmidt 8ff672d397 [PowerPC] Enable vec_perm for long long and double vector types for VSX
VSX makes the "vector long long" and "vector double" types available.
This patch enables the vec_perm interface for these types.  The same
builtin is generated regardless of the specified type, so no
additional work or testing is needed in the back end.  Tests are added
to ensure this builtin is generated by the front end.

llvm-svn: 221988
2014-11-14 13:10:13 +00:00
Daniel Jasper 6c22c44e12 clang-format: Support assignments as conditional operands.
Before:
  return a != b
             // comment
             ? a
             : a = a != b
                   // comment
         ? a =
               b : a;
After:
  return a != b
             // comment
             ? a
             : a = a != b
                       // comment
                       ? a = b
                       : a;

llvm-svn: 221987
2014-11-14 13:03:40 +00:00
Daniel Jasper 119ff533e4 clang-format: Improve indentation of comments in expressions.
Before:
  int i = (a)
              // comment
          + b;
  return aaaa == bbbb
                 // comment
             ? aaaa
             : bbbb;
After:
  int i = (a)
          // comment
          + b;
  return aaaa == bbbb
             // comment
             ? aaaa
             : bbbb;

llvm-svn: 221985
2014-11-14 12:31:14 +00:00
Bill Schmidt cee13a2712 [PowerPC] Add VSX builtins for vec_div
This patch adds builtin support for xvdivdp and xvdivsp, along with a
new test case.  The builtins are accessed using vec_div in altivec.h.
Builtins are listed (mostly) alphabetically there, so inserting these
changed the line numbers for deprecation warnings tested in
test/Headers/altivec-intrin.c.

There is a companion patch for LLVM.

llvm-svn: 221984
2014-11-14 12:10:51 +00:00
Daniel Jasper 734d52b58b clang-format: [Java] Fix line break behavior of class declarations.
Change breaking preferences:
1. Break before "extends"
2. Break before "implements"
3. Break within the implements list.

llvm-svn: 221981
2014-11-14 10:15:56 +00:00
Daniel Jasper 09f6abe8d8 clang-format: [Java] Improve generic return type formatting.
Before:
  public<R> ArrayList<R> get() {

After:
  public <R> ArrayList<R> get() {

llvm-svn: 221979
2014-11-14 09:05:32 +00:00
Daniel Jasper 30a2406e65 clang-format: [Java] No altnerative operator names in Java.
Before:
  someObject.and ();

After:
  someObject.and();

llvm-svn: 221978
2014-11-14 09:02:28 +00:00
Daniel Jasper 61d81973c1 clang-format: [Java] Improve formatting of generics.
Before:
  Function < F, ? extends T > function;

After:
  Function<F, ? extends T> function;

llvm-svn: 221976
2014-11-14 08:22:46 +00:00
Alexey Bataev 9aba41c822 [OPENMP] Temporary fix for processing of global variables in loops.
Currently there is a bug in processing of global variables used as loop control variables in 'omp for/simd' constructs: these globals must be captured as private variables, but currently they are nor. This is a temporary bug fix for this problem until the correct solution is prepared. If a global var used as lcv without explicit mark as a private/linear/lastprivate the error message is emitted.

llvm-svn: 221970
2014-11-14 04:08:45 +00:00
Alexey Samsonov 4c12c6cf3b [Sanitizer] Refactor SanitizerArgs parsing in Driver.
Remove flag parsing details from the public header.
Use SanitizerSet to represent the set of enabled sanitizers.
Cleanup the implementation: update the comments to
reflect reality, remove dead code.

No functionality change.

llvm-svn: 221968
2014-11-14 02:59:20 +00:00
Reid Kleckner e070b99b84 Remove -fseh-exceptions in favor of checking the triple
This option was misleading because it looked like it enabled the
language feature of SEH (__try / __except), when this option was really
controlling which EH personality function to use. Mingw only supports
SEH and SjLj EH on x86_64, so we can simply do away with this flag.

llvm-svn: 221963
2014-11-14 02:01:10 +00:00
Alexey Samsonov 59f34bbb76 Cleanup SanitizerArgs: get rid of unused variable, make one method non-static. NFC.
llvm-svn: 221959
2014-11-14 00:46:39 +00:00
Richard Smith 6403e937d6 PR21565 Add an egregious hack to support broken libstdc++ headers that declare
a member named 'swap' and then expect unqualified lookup for the name 'swap' in
its exception specification to find anything else.

Without delay-parsed exception specifications, this was ill-formed (NDR) by
[basic.scope.class]p1, rule 2. With delay-parsed exception specifications, the
call to 'swap' unambiguously finds the function being declared, which then
fails because the arguments don't work for that function.

llvm-svn: 221955
2014-11-14 00:37:55 +00:00
Alexey Samsonov cbbd2fd8d6 [Profile] Always build profile runtime library with -fPIC.
This change removes libclang_rt.profile-pic-<arch>.a version of
profile runtime. Instead, it's sufficient to always build
libclang_rt.profile-<arch>.a with -fPIC, as it can be linked into
both executables and shared objects.

llvm-svn: 221952
2014-11-14 00:16:26 +00:00
Reid Kleckner 92493e5e96 -Wsentinel: Suggest nullptr in C++11 instead of NULL
llvm-svn: 221945
2014-11-13 23:19:36 +00:00
Richard Smith 98710fc4f5 Fix assert/crash on invalid with __builtin_constant_p conditionals in constant expressions.
llvm-svn: 221942
2014-11-13 23:03:19 +00:00
Fariborz Jahanian c62d16f304 Objective-C. Fixes a regression caused by implementation
of new warning for deprecated method call for receiver
of type 'id'. This addresses rdar://18960378 where
unintended warnings being issued.

llvm-svn: 221933
2014-11-13 22:27:05 +00:00
Richard Smith 0b3a46247e PR21437, final part of DR1330: delay-parsing of exception-specifications. This
is a re-commit of Doug's r154844 (modernized and updated to fit into current
Clang).

llvm-svn: 221918
2014-11-13 20:01:57 +00:00
Ed Maste 6a9eda5e3d Hook up FreeBSD AArch64 support
Patch from Andrew Turner.

llvm-svn: 221900
2014-11-13 16:55:42 +00:00
Nico Weber 34272657de clang-format: Format extern "C" blocks like namespace blocks.
namespace blocks act as if KeepEmptyLinesAtTheStartOfBlocks is always true,
and aren't collapsed to a single line even if they would fit. Do the same
for extern "C" blocks.

Before,

  extern "C" {

  void ExternCFunction();

  }

was collapsed into `extern "C" { void ExternCFunction(); }`. Now it stays like
it was.

Fixes http://crbug.com/432640 and part of PR21419.

llvm-svn: 221897
2014-11-13 16:25:37 +00:00
Daniel Jasper 6be0f55d44 clang-format: [Java] Support Java enums.
In Java, enums can contain a class body and enum constants can have
arguments as well as class bodies. Support most of that.

llvm-svn: 221895
2014-11-13 15:56:28 +00:00
Alexander Kornienko 254b7dba27 Support non-owned DiagnosticConsumer in SetupSerializedDiagnostics
This fixes an assertion when running clang-tidy on a file having
--serialize-diagnostics in compiler options. Committing a regression test
for clang-tidy separately.

Patch by Aaron Wishnick!

llvm-svn: 221884
2014-11-13 13:08:27 +00:00
Richard Smith 96d71c3936 PR19372: Keep checking template arguments after we see an argument pack
expansion into a parameter pack; we know that we're still filling in that
parameter's arguments. Previously, if we hit this case for an alias template,
we'd try to substitute using non-canonical template arguments.

llvm-svn: 221832
2014-11-12 23:38:38 +00:00
Anton Korobeynikov 50a3cbd7c0 Temporary revert r221818 until all the problems
with objc stuff will be resolved.

llvm-svn: 221829
2014-11-12 23:15:38 +00:00
Fariborz Jahanian 800821a3b2 [Objective-C++ IRGen] do not generate .cxx_construct
for class that contains trivially-constructible struct ivar.
rdar://18950072

llvm-svn: 221823
2014-11-12 22:37:43 +00:00
Anton Korobeynikov 0140aa8756 Fix fallout from r219557
Summary:
Consider the following nifty 1 liner: (0 ? csqrtl(2.0f) : sqrtl(2.0f)). One can easily obtain such code from e.g. tgmath. Right now it produces an assertion because we fail to do the promotion real => _Complex real.

The case was properly handled previously (old handleOtherComplexFloatConversion routine), but was forgotten in the current version. This seems to be about fallout from r219557

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221821
2014-11-12 22:19:06 +00:00
Reid Kleckner 6d829bdbef Fix brace init of unions with unnamed struct members
The check for unnamed members was intended to skip unnamed bitfields,
but it ended up skipping unnamed structs. This lead to an assertion in
IRGen.

llvm-svn: 221818
2014-11-12 21:30:23 +00:00
Richard Smith 38af8561f9 Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,
which we don't yet implement).

llvm-svn: 221816
2014-11-12 21:16:38 +00:00
Kaelyn Takata 98a3ec010a Pass the filter function_ref by value now that r221753 fixes the bug
that was preventing pass-by-value from working correctly.

llvm-svn: 221803
2014-11-12 18:34:08 +00:00
Rafael Espindola fd832395b1 Update for llvm api change.
llvm-svn: 221786
2014-11-12 14:48:44 +00:00
Rafael Espindola af0e40ac0e Simplify code a bit by passing StreamFile to the BitstreamCursor constructor.
llvm-svn: 221784
2014-11-12 14:42:25 +00:00
Nico Weber 83a63877dc Mark TypeDecls used in explicit destructor calls as referenced.
Fixes PR21221. Patch by Axel Naumann, test by me.

llvm-svn: 221771
2014-11-12 04:33:52 +00:00
Bill Schmidt 9ec8cea02b [PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics
This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for
PowerPC, which provide programmer access to the lxvd2x, lxvw4x,
stxvd2x, and stxvw4x instructions.

New code in altivec.h defines these in terms of new builtins, which
are themselves defined in BuiltinsPPC.def.  The builtins are converted
to LLVM intrinsics in CGBuiltin.cpp.  Additional code is added to
builtins-ppc-vsx.c to verify the correct generation of the intrinsics.

Note that I moved the other VSX builtins so all VSX builtins will be
alphabetical in their own section in BuiltinsPPC.def.

There is a companion patch for LLVM.

llvm-svn: 221768
2014-11-12 04:19:56 +00:00
Nico Weber 28309185b2 Mark TypeDecls used in member initializers as referenced.
Without this, -Wunused-local-typedef would incorrectly warn on the two typedefs
in this program:

void foo() {
  struct A {};
  struct B : public A {
    typedef A INHERITED;
    B() : INHERITED() {}

    typedef B SELF;
    B(int) : SELF() {}
  };
}

llvm-svn: 221765
2014-11-12 03:52:25 +00:00
Nico Weber aa0117c628 clang-format a few lines, fixes one 80col violation. nfc.
llvm-svn: 221764
2014-11-12 03:44:43 +00:00
Richard Smith 775118a28b Try a different workaround for GCC 4.7.2 lambda capture bug. The previous
workaround took us from wrong-code to ICE.

llvm-svn: 221754
2014-11-12 02:09:03 +00:00
Richard Smith 2e32155b58 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.


This is a re-commit of r219977:

r219977 was reverted in r220038 because it hit a wrong-code bug in GCC 4.7.2.
(That's gcc.gnu.org/PR56135, and affects any implicit lambda-capture of
'this' within a template.)


r219977 was a re-commit of r217995, r218011, and r218053:

r217995 was reverted in r218058 because it hit a rejects-valid bug in MSVC.
(Incorrect overload resolution in the presence of using-declarations.)
It was re-committed in r219977 with a workaround for the MSVC rejects-valid.

r218011 was a workaround for an MSVC parser bug. (Incorrect desugaring of
unbraced range-based for loop).

llvm-svn: 221750
2014-11-12 02:00:47 +00:00
Richard Smith d8a52a7831 PR21536: Fix a corner case where we'd get confused by a pack expanding into the
penultimate parameter of a template parameter list, where the last parameter is
itself a pack, and build a bogus empty final pack argument.

llvm-svn: 221748
2014-11-12 01:43:45 +00:00
Richard Smith 17c00b4328 Fix this code to follow the coding style regarding anonymous namespaces and
static functions. Make a bunch of file-local functions static. Remove one
unused static function revealed by this.

llvm-svn: 221745
2014-11-12 01:24:00 +00:00
Kostya Serebryany 4133eabb45 [clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field-padding >= 1
Summary: If we've added poisoned paddings to a type do not emit memcpy for operator=.

Test Plan: regression tests.

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221739
2014-11-11 23:38:13 +00:00
Kaelyn Takata 2e764b83aa Have LookupMemberExprInRecord only call CorrectTypoDelayed, dropping the
code for calling CorrectTypo.

Includes a needed fix for non-C++ code to not choke on TypoExprs (which
also resolves a TODO from r220698).

llvm-svn: 221736
2014-11-11 23:26:58 +00:00
Kaelyn Takata 49d84328d9 Create two helpers for running the typo-correction tree transform.
One takes an Expr* and the other is a simple wrapper that takes an
ExprResult instead, and handles checking whether the ExprResult is
invalid.

Additionally, allow an optional callback that is run on the full result
of the tree transform, for filtering potential corrections based on the
characteristics of the resulting expression once all of the typos have
been replaced.

llvm-svn: 221735
2014-11-11 23:26:56 +00:00
Kaelyn Takata 5c3dc4be08 Replace MemberTypoDiags and MemberExprTypoRecovery with lambdas.
llvm-svn: 221734
2014-11-11 23:26:54 +00:00
Daniel Jasper 3eb341c478 clang-format: Improve handling of comments in binary expressions.
Before:
  b = a &&
      // Comment
      b.c &&
      d;

After:
  b = a &&
      // Comment
      b.c && d;

This fixes llvm.org/PR21535.

llvm-svn: 221727
2014-11-11 23:04:51 +00:00
Kaelyn Takata fc8c61a5b8 Make LookupResult be copyable to avoid decomposing an existing one and
initializing a new one every time a copy is needed.

llvm-svn: 221724
2014-11-11 23:00:42 +00:00
Kaelyn Takata e9e4ecfe9e Explicitly exclude keywords from the member validator.
Also simply and remove dead code from MemberExprTypoRecovery.

llvm-svn: 221723
2014-11-11 23:00:40 +00:00
Kaelyn Takata db99de2d15 Fix some formatting prior to refactoring the code.
llvm-svn: 221722
2014-11-11 23:00:38 +00:00
Kostya Serebryany 75b4f9e1e6 Introduce -fsanitize-coverage=N flag
Summary:
This change makes the asan-coverge (formerly -mllvm -asan-coverge)
accessible via a clang flag.
Companion patch to LLVM is http://reviews.llvm.org/D6152

Test Plan: regression tests, chromium

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

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

llvm-svn: 221719
2014-11-11 22:15:07 +00:00
Alexey Samsonov e396bfc064 Bundle conditions checked by UBSan with sanitizer kinds they implement.
Summary:
This change makes CodeGenFunction::EmitCheck() take several
conditions that needs to be checked (all of them need to be true),
together with sanitizer kinds these checks are for. This would allow
to split one call into UBSan runtime into several calls in case
different sanitizer kinds would have different recoverability
settings.

Tests should be fixed accordingly, I'm working on it.

Test Plan: regression test suite.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221716
2014-11-11 22:03:54 +00:00
Fariborz Jahanian 3365bfc609 Revert r221702 until I address Richard Trieu's
comments.

llvm-svn: 221714
2014-11-11 21:54:19 +00:00
Duncan P. N. Exon Smith 2b1f278e77 Revert "IR: MDNode => Value: Update for LLVM API change in r221375"
This reverts commit r221376.

The API change was reverted in r221711.

llvm-svn: 221712
2014-11-11 21:31:03 +00:00
David Blaikie 42edade9d9 PR16091 continued: Debug Info for member functions with undeduced return types.
So DWARF5 specs out auto deduced return types as DW_TAG_unspecified_type
with DW_AT_name "auto", and GCC implements this somewhat, but it
presents a few problems to do this with Clang.

GCC's implementation only applies to member functions where the auto
return type isn't deduced immediately (ie: member functions of templates
or member functions defined out of line). In the common case of an
inline deduced return type function, GCC emits the DW_AT_type as the
deduced return type.

Currently GDB doesn't seem to behave too well with this debug info - it
treats the return type as 'void', even though the definition of the
function has the correctly deduced return type (I guess it sees the
return type the declaration has, doesn't understand it, and assumes
void). This means the function's ABI might be broken (non-trivial return
types, etc), etc.

Clang, on the other hand doesn't track this particular case of a
deducable return type that is deduced immediately versus one that is
deduced 'later'. So if we implement the DWARF5 representation, all
deducible return type functions would get adverse GDB behavior
(including deduced return type lambda functions, inline deduced return
type functions, etc).

Also, we can't just do this for auto types that are not deduced -
because Clang marks even the declaration's return type as deduced (&
provides the underlying type) once a definition is seen that allows the
deduction. So we have to ignore even deduced types - but we can't do
that for auto variables (because this representation only applies to
function declarations - variables and function definitions need the real
type so the function can be called, etc) so we'd need to add an extra
flag to the type unwrapping/creation code to indicate when we want to
see through deduced types and when we don't. It's also not as simple as
just checking at the top level when building a function type (for one
thing, we reuse the function type building for building function pointer
types which might also have 'auto' in them - but be the type of a
variable instead) because the auto might be arbitrarily deeply nested
("auto &", "auto (*)()", etc...)

So, with all that said, let's do the simple thing that works in existing
debuggers for now and treat these functions the same way we do function
templates and implicit special members: omit them from the member list,
since they can't be correctly called anyway (without knowing the return
type the ABI isn't know and a function call could put the arguments in
the wrong place) so they're not much use to the user.

At some point in the future, when GDB understands the DWARF5
representation better it might be worth plumbing through the extra type
builder handling to avoid looking through AutoType for some callers,
etc...

llvm-svn: 221704
2014-11-11 20:44:45 +00:00
Fariborz Jahanian c5fd4844da Patch to warn when logical evaluation of operand evalutes to a true value;
That this is a c-only patch. c++ already has this warning.
This addresses rdar://18716393

llvm-svn: 221702
2014-11-11 19:59:16 +00:00
Daniel Jasper 64a328e96f clang-format: Preserve trailing-comma logic even with comments.
Before:
  vector<int> SomeVector = {// aaa
                            1, 2,
  };

After:
  vector<int> SomeVector = {
      // aaa
      1, 2,
  };

llvm-svn: 221699
2014-11-11 19:34:57 +00:00
Richard Smith 57e18ac96d First half of CWG1962: decltype(__func__) should not be a reference type,
because __func__ is supposed to act like a local static variable.

llvm-svn: 221698
2014-11-11 19:30:41 +00:00
Fariborz Jahanian a29986c0b0 This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to  something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
(patch reapplied after lldb issue was fixed in r221660).

llvm-svn: 221691
2014-11-11 16:56:21 +00:00
NAKAMURA Takumi cdcbfba3b6 CGOpenMPRuntime.h: Fix a couple of \param(s) introduced in r221663. [-Wdocumentation]
llvm-svn: 221676
2014-11-11 07:58:06 +00:00
Alexey Bataev 9772000a22 [OPENMP] Codegen for threadprivate variables
For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); 
In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>);
Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info.
Differential Revision: http://reviews.llvm.org/D4002

llvm-svn: 221663
2014-11-11 04:05:39 +00:00
Richard Smith ea97e36dfc Fix parsing of fold-expressions within a cast expression. We parse the
parenthesized expression a bit differently in this case, just in case the
commas have special meaning.

llvm-svn: 221661
2014-11-11 03:28:50 +00:00
Justin Bogner 4cb85f36ca InstrProf: Remove an unnecessary helper function (NFC)
VisitSubStmtRBraceState is really just Visit, as long as
VisitCompoundStatement handles braces correctly.

llvm-svn: 221659
2014-11-11 02:47:05 +00:00
NAKAMURA Takumi 17d6094d14 CGExpr.cpp: Suppress a warning. [-Wunused-variable]
llvm-svn: 221655
2014-11-11 01:36:11 +00:00
Alexey Samsonov a041610f11 [Sanitizer] Refactor sanitizer options in LangOptions.
Get rid of ugly SanitizerOptions class thrust into LangOptions:
* Make SanitizeAddressFieldPadding a regular language option,
  and rely on default behavior to initialize/reset it.
* Make SanitizerBlacklistFile a regular member LangOptions.
* Introduce the helper class "SanitizerSet" to represent the
  set of enabled sanitizers and make it a member of LangOptions.
  It is exactly the entity we want to cache and modify in CodeGenFunction,
  for instance. We'd also be able to reuse SanitizerSet in
  CodeGenOptions for storing the set of recoverable sanitizers,
  and in the Driver to represent the set of sanitizers
  turned on/off by the commandline flags.

No functionality change.

llvm-svn: 221653
2014-11-11 01:26:14 +00:00
Alexey Samsonov e106102176 Move CodeGenOptions constructor out-of-line and add missing headers. NFC.
llvm-svn: 221646
2014-11-11 00:22:12 +00:00
Alexey Samsonov 4c1a96f519 Propagate SanitizerKind into CodeGenFunction::EmitCheck() call.
Make sure CodeGenFunction::EmitCheck() knows which sanitizer
it emits check for. Make CheckRecoverableKind enum an
implementation detail and move it away from header.

Currently CheckRecoverableKind is determined by the type of
sanitizer ("unreachable" and "return" are unrecoverable,
"vptr" is always-recoverable, all the rest are recoverable).
This will change in future if we allow to specify which sanitizers
are recoverable, and which are not by -fsanitize-recover= flag.

No functionality change.

llvm-svn: 221635
2014-11-10 22:27:30 +00:00
Ben Langmuir acb803e807 Validate user headers even if -fmodules-validate-once-per-build-session
is enabled. Unlike system headers, we want to be more careful about
modifications to user headers, because it's still easy to edit a header
while you're building.

llvm-svn: 221634
2014-11-10 22:13:10 +00:00
Tim Northover 642e770f68 AArch64: set all processor features from -arch if nothing else present
Darwin's "-arch arm64" option implies full Cyclone CPU, for both architectural
and tuning purposes. So if neither of the explicit options have been given,
forward that on to the proper invocation.

rdar://problem/18906227

llvm-svn: 221631
2014-11-10 21:17:23 +00:00
Richard Smith 99c464c3f3 Improve diagnostics if _Noreturn is placed after a function declarator. (This sometimes happens when a macro is used that expands to either the GNU noreturn attribute or _Noreturn.)
llvm-svn: 221630
2014-11-10 21:10:32 +00:00
Richard Smith 8e6923b7f2 Update fold-expression mangling to match cxx-abi-dev discussion.
llvm-svn: 221623
2014-11-10 19:44:15 +00:00
Daniel Jasper 0bd9a19b28 clang-format: Fix pointer formatting.
Before:
  void f(Bar* a = nullptr, Bar * b);
After:
  void f(Bar* a = nullptr, Bar* b);

llvm-svn: 221609
2014-11-10 16:57:30 +00:00
Nico Weber a644d7f39c clang-format: [Java] Never treat @interface as annotation.
'@' followed by any keyword can't be an annotation, but @interface is currently
the only combination of '@' and a keyword that's allowed, so limit it to this
case. `@interface Foo` without a leading `public` was misformatted prior to
this patch.

llvm-svn: 221607
2014-11-10 16:30:02 +00:00
Alexander Kornienko c48a535a7c [Tooling] Restore current directory after processing each file.
Summary:
If we actually change directory before processing a file, we need to
restore it afterwards. This was broken in r216620.

Added a comment for the changes in r216620.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 221600
2014-11-10 15:42:31 +00:00
Aaron Ballman c0ae7dfe75 Updated the wording for a diagnostic to be more grammatically correct, and use a %select. Also ensure that nested namespace definitions are diagnosed properly. Both changes are motivated by post-commit feedback from r221580.
llvm-svn: 221581
2014-11-08 17:07:15 +00:00
Aaron Ballman 730476b50e [c++1z] Support for attributes on namespaces and enumerators.
llvm-svn: 221580
2014-11-08 15:33:35 +00:00
Richard Smith 3e3a705062 [c++1z] Support for u8 character literals.
llvm-svn: 221576
2014-11-08 06:08:42 +00:00
Richard Smith 13307f5f24 [c++1z] Implement nested-namespace-definitions.
This allows 'namespace A::B { ... }' as a shorthand for 'namespace A {
namespace B { ... } }'. We already supported this correctly for error recovery;
promote that support to a full implementation.

This is not the right implementation: we do not maintain source fidelity
because we desugar the nested namespace definition in the parser. This is
tricky to avoid, since the definition genuinely does inject one named
entity per level in the namespace name.

llvm-svn: 221574
2014-11-08 05:37:34 +00:00
Richard Smith 0f0af19b05 [c++1z] N4295: fold-expressions.
This is a new form of expression of the form:

  (expr op ... op expr)

where one of the exprs is a parameter pack. It expands into

  (expr1 op (expr2onwards op ... op expr))

(and likewise if the pack is on the right). The non-pack operand can be
omitted; in that case, an empty pack gives a fallback value or an error,
depending on the operator.

llvm-svn: 221573
2014-11-08 05:07:16 +00:00
Ben Langmuir ed98258482 Check module signature when the module has already been loaded
We may need to verify the signature on subsequent imports as well, just
like we verify the size/modtime:
@import A;
@import B; // imports A
@import C; // imports A

llvm-svn: 221569
2014-11-08 00:34:30 +00:00
Ben Langmuir 264ea15e19 Fix unintended fallthrough in ASTReader
llvm-svn: 221567
2014-11-08 00:06:39 +00:00
Fariborz Jahanian 05e77f8349 [Objective-C Sema]. Issue availability/deprecated warning when
there is a uinque method found when message is sent to receiver 
of 'id' type. // rdar://18848183

llvm-svn: 221562
2014-11-07 23:51:15 +00:00
Tim Northover 5a1558ec31 ARM ABI: simplify decisions on whether args can be expanded.
Homogeneous aggregates on AAPCS_VFP ARM need to be passed *without* being
flattened (e.g. [2 x float] rather than "float, float") for various weird ABI
reasons. However, this isn't the case for anything else; further, we know at
the ABIArgInfo::getDirect callsites whether this flattening is allowed.

So, we can get more unified ARM code, with a simpler Clang, by just using that
knowledge directly.

llvm-svn: 221559
2014-11-07 22:30:50 +00:00
Alexey Samsonov edf99a92c0 Introduce a SanitizerKind enum to LangOptions.
Use the bitmask to store the set of enabled sanitizers instead of a
bitfield. On the negative side, it makes syntax for querying the
set of enabled sanitizers a bit more clunky. On the positive side, we
will be able to use SanitizerKind to eventually implement the
new semantics for -fsanitize-recover= flag, that would allow us
to make some sanitizers recoverable, and some non-recoverable.

No functionality change.

llvm-svn: 221558
2014-11-07 22:29:38 +00:00
Michael J. Spencer b011d48282 Fix style.
llvm-svn: 221546
2014-11-07 21:30:32 +00:00
Samuel Antao c909c9918f Fix clash of gcc toolchains in hexagon driver regression tests.
If clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by -ccc-install-dir. This causes several regression tests to fail as they will be using an unexpected path. Adding the switch --gcc-toolchain="" in each test command is not enough as the hexagon toolchain implementation in the driver is not evaluating this argument. This commit modifies the hexagon toolchain to take the --gcc-toolchain="" argument into account when deciding the toolchain path, similarly to what is already done for other targets toolchains. Additionally, the faulty regression tests are modified in order to --gcc-toolchain="" be passed to the commands.

llvm-svn: 221535
2014-11-07 17:48:03 +00:00
Fariborz Jahanian c48f7e76fa Revert r221404 which caused lldb to not display
vararg expressions.

llvm-svn: 221533
2014-11-07 16:47:05 +00:00
David Majnemer 1fb1a044e5 CodeGen, Itanium: Properly dllimport RTTI data
We would blindly assume that RTTI data should have the same linkage as
the vtable because we didn't think the RTTI data was external.  This
oversight stemmed because we didn't take dllimport into account.

This fixes PR21512.

llvm-svn: 221511
2014-11-07 07:26:38 +00:00
Frederic Riss 442293e83f Return a DIDescriptor from CGDebugInfo::getDeclarationOrDefinition...
... instead of a DIScope that might wrap something that's not actually
a DIScope (eg. a DIGlobalVariable);

llvm-svn: 221481
2014-11-06 21:12:06 +00:00
Charlie Turner 2919cbdb6c Remove references to the cortex-a9-mp CPU.
This CPU definition is redundant. The Cortex-A9 is defined as
supporting multiprocessing extensions. Remove references to this CPU.

This CPU was recently removed from LLVM. See http://reviews.llvm.org/D6057

Change-Id: I62ae7cc656fcae54fbaefc4b6976e77e694a8678
llvm-svn: 221458
2014-11-06 14:59:30 +00:00
Rafael Espindola 8b27bdb6c2 Don't manually insert L prefixes.
Simply marking the symbol private conveys the desire to hide them to LLVM.

llvm-svn: 221451
2014-11-06 13:30:38 +00:00
Andrea Di Biagio 9760a44d1a [X86] Slightly refactor default features for AMD bdver cpus (NFC). Also add missing checks to test for target features.
This patch simplifies how default target features are set for AMD bdver2
and bdver1. In particular, method 'getDefaultFeatures' now implements a
fallthrough from case 'CK_BDVER2' to case 'CK_BDVER1'.
That is because 'bdver2' has the same features available in bdver1 plus
BMI, FMA, F16C and TBM.

This patch also adds missing checks for predefined macros in test
predefined-arch-macros.c. In the case of BTVER2, the test now also checks 
for F16C, BMI and PCLMUL. In the case of BDVER3 and BDVER4, the test now
also checks for the presence of FSGSBASE.

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

llvm-svn: 221449
2014-11-06 12:08:57 +00:00
Alexey Bataev 73983918c4 Fix for exception specification mismatch in explicit instantiation.
According to C++ standard if an exception-specification is specified in an explicit instantiation directive, it shall be compatible with the exception-specifications of other declarations of that function. This patch adds checks for this.
Differential Revision: http://reviews.llvm.org/D5822

llvm-svn: 221448
2014-11-06 10:10:50 +00:00
Craig Topper db4dc08630 [X86] Use fallthroughs to reduce the number of calls to setFeatureEnabled for different CPUs.
llvm-svn: 221437
2014-11-06 05:52:19 +00:00
Fariborz Jahanian 5a29e6aadb Patch for small addition to availability attribute.
This is to accept "NA" in place of vesion number for availability
attribute. Used on introduced=NA to mean unavailable
and deprecated=NA to mean nothing (not deprecated).
rdar://18804883

llvm-svn: 221417
2014-11-05 23:58:55 +00:00
DeLesley Hutchins 6d41f38c74 Thread Safety Analysis: move warnings on range-based for loops out of beta
and into -Wthread-safety.

llvm-svn: 221410
2014-11-05 23:09:28 +00:00
Fariborz Jahanian 1839abdabe This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to  something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
John McCall, please review post-commit. 

llvm-svn: 221404
2014-11-05 21:50:22 +00:00
Reid Kleckner dd43a5c41f cmake: Conditionalize CodeGen's dependency on intrinsics_gen
Custom targets in cmake cannot be exported, and this dependency is only
needed in the combined build to ensure that Intrinsics.gen is created
before compiling CodeGen. In the standalone, all of LLVM is build first.

llvm-svn: 221391
2014-11-05 20:30:55 +00:00
Frederic Riss b1ab28c949 [DebugInfo] Do not record artificial global initializer functions in the DeclCache.
When we are generating the global initializer functions, we call
CGDebugInfo::EmitFunctionStart() with a valid decl which is describing
the initialized global variable. Do not update the DeclCache with this
key as it will overwrite the the cached variable DIGlobalVariable with
the newly created artificial DISubprogram.

One could wonder if we should put artificial subprograms in the DIE tree
at all (there are vaild uses for them carrying line information though).

llvm-svn: 221385
2014-11-05 19:19:04 +00:00
Duncan P. N. Exon Smith 2b049767b3 IR: MDNode => Value: Update for LLVM API change in r221375
llvm-svn: 221376
2014-11-05 18:16:35 +00:00
Daniel Jasper e551bb70a3 Revert "clang-format: [js] Updates to Google's JavaScript style."
This reverts commit eefd2eaad43c5c2b17953ae7ed1e72b28e696f7b.

Apparently, this change was a bit premature.

llvm-svn: 221365
2014-11-05 17:22:31 +00:00
Ben Langmuir 6caebfda78 Remove superceded warning warn_forgotten_module_header
This DefaultIgnore warning under -Wincomplete-module was firing on
any module map files that happened to be parsed (it's only supposed to
fire on headers), and it has been superceded by
-Wnon-modular-include-in-module anyway.

For compatibility, I rewired -Wincomplete-module to imply
-Wnon-modular-include-in-module.

llvm-svn: 221357
2014-11-05 16:43:18 +00:00
Will Wilson 5f38367c72 MS ABI: Correctly mangle CV qualifiers from typedefs
llvm-svn: 221344
2014-11-05 13:54:21 +00:00
Daniel Jasper 680b09ba88 clang-format: Improve free-standing macro detection.
Before:
  SOME_WEIRD_LOG_MACRO
  << "Something long enough to cause a line break";

After:
  SOME_WEIRD_LOG_MACRO
      << "Something long enough to cause a line break";

llvm-svn: 221338
2014-11-05 10:48:04 +00:00
Adrian Prantl 65d5d00cb7 Debug info: Emit the correct type for the __FuncPtr field in a block
descriptor.

rdar://problem/15984431

llvm-svn: 221326
2014-11-05 01:01:30 +00:00
Kaelyn Takata 445b0657a5 Filter out non-static class members when correcting non-member-references.
llvm-svn: 221319
2014-11-05 00:09:29 +00:00
Bob Wilson d5aad2a1e0 Use backslashes to escape spaces and other backslashes in -dwarf-debug-flags.
The command line options are specified in a space-separated list that is an
argument to -dwarf-debug-flags, so that breaks if there are spaces in the
options. This feature came from Apple's internal version of GCC, so I went back
to check how llvm-gcc handled this and matched that behavior.
rdar://problem/18775420

llvm-svn: 221309
2014-11-04 22:28:48 +00:00
Benjamin Kramer 7111b91ee7 Make helper function static. NFC.
llvm-svn: 221290
2014-11-04 20:26:01 +00:00
Kuba Brecka 9ff912db22 Use @rpath as LC_ID_DYLIB for ASan dylib on OS X
Change the LC_ID_DYLIB of ASan's dynamic libraries on OS X to be set to "@rpath/libclang_rt.asan_osx_dynamic.dylib" and similarly for iossim. Clang driver then sets the "-rpath" to be the real path to where clang currently has the dylib (because clang uses the relative path to its current executable). This means if you move the compiler or install the binary release, -fsanitize=address will link to the proper library.

Reviewed at http://reviews.llvm.org/D6018

llvm-svn: 221279
2014-11-04 17:35:17 +00:00
Daniel Jasper d0ec0d62d6 clang-format: Use identifier table for keywords in other languages.
Slightly easier to write, more efficient and prevents bugs by
misspelling them.

No functional changes intended.

llvm-svn: 221259
2014-11-04 12:41:02 +00:00
Daniel Jasper 58fcf6df65 clang-format: [Java] Fix class declaration line breaks.
Before:
  @SomeAnnotation()
  abstract
      class aaaaaaaaa<a> extends bbbbbbbbbbbb<b> implements cccccccccccc {
  }

After:
  @SomeAnnotation()
  abstract class aaaaaaaaa<a> extends bbbbbbbbbbbb<b>
      implements cccccccccccc {
  }

llvm-svn: 221256
2014-11-04 10:53:14 +00:00
David Majnemer 7b2e22cec4 Driver: Pass some std::strings by reference instead of value
No functional change intended. This fixes PR21463.

llvm-svn: 221249
2014-11-04 08:55:13 +00:00
Alexander Kornienko 616860994d [clang-tidy] Move -extra-arg handling to CommonOptionsProvider
Summary:
Handle -extra-arg and -extra-arg-before options in the
CommonOptionsProvider so they can be used in all clang tools. Adjust arguments
in a CompilationDatabase wrapper instead of adding ArgumentsAdjuster to the
tool.

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 221248
2014-11-04 08:51:24 +00:00
Michael J. Spencer 04162eaced [llvm-api-change] Use findProgramByName.
llvm-svn: 221222
2014-11-04 01:30:55 +00:00
Reid Kleckner 8cd0079d16 Use the new LLVM_END_WITH_NULL name
llvm-svn: 221217
2014-11-04 01:13:43 +00:00
Reid Kleckner 06ea7d6213 Lower __builtin_fabs* to @llvm.fabs.*
mingw64's headers implement fabs by calling __builtin_fabs, so using the
library call results in an infinite loop. If the backend legalizes
@llvm.fabs as a call to fabs later, things should work out, as the crt
provides a definition.

llvm-svn: 221206
2014-11-03 23:52:09 +00:00
Reid Kleckner 4cad00abf3 Remove dead AST type argument to EmitFAbs
llvm-svn: 221205
2014-11-03 23:51:40 +00:00
Reid Kleckner 899baf3625 Move the no-prototype calling conv check after decl merging
Now we don't warn on this code:
  void __stdcall f(void);
  void __stdcall f();

My previous commit regressed this functionality because I didn't update
the relevant test case which used a definition.

llvm-svn: 221188
2014-11-03 21:56:03 +00:00
Reid Kleckner 1eaa844f3e Don't diagnose no-prototype callee-cleanup function definitions
We already have a warning on the call sites of code like this:
  void f() { }
  void g() { f(1, 2, 3); }
t.c:2:21: warning: too many arguments in call to 'f'

We can limit ourselves to diagnosing unprototyped forward declarations
of f to cut down on noise.

llvm-svn: 221184
2014-11-03 21:24:50 +00:00
Fariborz Jahanian e3db7784b6 Further restrict issuance of 'override' warning if method
is argument to a macro which is defined in system header.

llvm-svn: 221172
2014-11-03 19:46:18 +00:00
Roman Divacky 8a12d84264 Implement vaarg lowering for ppc32. Lowering of scalars and aggregates
is supported. Complex numbers are not.

llvm-svn: 221170
2014-11-03 18:32:54 +00:00
Fariborz Jahanian d6efd3e0d0 This patch reverts r220496 which issues warning on comparing
parameters with nonnull attribute when comparison is always
true/false. Patch causes false positive when parameter is
modified in the function.

llvm-svn: 221163
2014-11-03 17:03:07 +00:00
Matt Arsenault 3f6469b4c6 Emit OpenCL local global variables without zeorinitializer
Local variables are not initialized, and every target has
been (incorrectly) ignoring the unnecessary request for
zero initialization.

llvm-svn: 221162
2014-11-03 16:51:53 +00:00
Hans Wennborg 8313c76836 Don't allow dllimport/export on classes with internal linkage (PR21399)
Trying to import or export such classes doesn't make sense, and Clang
would assert trying to export vtables for them.

This is consistent with how we treat functions with internal linkage,
but it is stricter than MSVC so we may have to back down if it breaks
real code.

llvm-svn: 221160
2014-11-03 16:09:16 +00:00
Daniel Jasper 82f9df9eb4 Revert "clang-format: [Java] Allow trailing semicolons after enums."
This reverts commit b5bdb2ef59ab922bcb4d6e843fffaee1f7f68a8c.

This doesn't really seem necessary on second though and causes problems
with C++ enum formatting.

llvm-svn: 221158
2014-11-03 15:42:11 +00:00
Hans Wennborg 606bd6dcc5 Don't dllimport inline functions when targeting MinGW (PR21366)
It turns out that MinGW never dllimports of exports inline functions.
This means that code compiled with Clang would fail to link with
MinGW-compiled libraries since we might try to import functions that
are not imported.

To fix this, make Clang never dllimport inline functions when targeting
MinGW.

llvm-svn: 221154
2014-11-03 14:24:45 +00:00
Craig Topper 54535fb069 [x86] Add cx16 feature to KNL, SKX, and CoreAVXi CPUs.
llvm-svn: 221132
2014-11-03 07:05:28 +00:00
Craig Topper 8dbc58436b [x86] Realphabetize the feature string decoding function since it was mostly in alphabetical order.
llvm-svn: 221131
2014-11-03 07:05:26 +00:00
Craig Topper 8c7f251e98 Add FSGSBASE intrinsics to x86 intrinsic headers.
llvm-svn: 221130
2014-11-03 06:51:41 +00:00
Craig Topper 554797f255 Remove definitions from Intrin.h that already exist in one of the other x86 intrinsic headers. Add a run line with Broadwell as the cpu type to ms-intrin.cpp test to catch some of these in the future.
llvm-svn: 221127
2014-11-03 04:19:58 +00:00
Daniel Jasper 5f2764d886 clang-format: [Java] Allow trailing semicolons after enums.
Before:
  enum SomeThing { ABC, CDE }
  ;

After:
  enum SomeThing { ABC, CDE };

llvm-svn: 221125
2014-11-03 03:00:42 +00:00
Daniel Jasper f056f45b77 clang-format: [Java] Fix more generics formatting.
Before:
  < T extends B > T getInstance(Class<T> type);

After:
  <T extends B> T getInstance(Class<T> type);

llvm-svn: 221124
2014-11-03 02:45:58 +00:00
Daniel Jasper db9a7a2f5f clang-format: [Java] Fix static generic methods.
Before:
  public static<R> ArrayList<R> get() {}

After:
  public static <R> ArrayList<R> get() {}

llvm-svn: 221122
2014-11-03 02:35:14 +00:00
Daniel Jasper 39af6cd5a4 clang-format: [Java] Fix class declaration formatting.
Before:
  @SomeAnnotation()
  abstract
      class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb implements cccccccccccc {
  }

After:
  @SomeAnnotation()
  abstract class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb
      implements cccccccccccc {
  }

llvm-svn: 221121
2014-11-03 02:27:28 +00:00
Daniel Jasper 8022226db7 clang-format: Fix false positive in lambda detection.
Before:
  delete [] a -> b;

After:
  delete[] a->b;

This fixes part of llvm.org/PR21419.

llvm-svn: 221114
2014-11-02 22:46:42 +00:00
Daniel Jasper df2ff002f0 clang-format: [Java] Support enums without trailing semicolon.
Before:
  class SomeClass {
    enum SomeThing { ABC, CDE } void f() {
    }
  }

After:
  class SomeClass {
    enum SomeThing { ABC, CDE }
    void f() {
    }
  }

This fixed llvm.org/PR21458.

llvm-svn: 221113
2014-11-02 22:31:39 +00:00
Daniel Jasper 5e7be1d536 clang-format: [Java] Don't break imports.
This fixes llvm.org/PR21453.

llvm-svn: 221112
2014-11-02 22:13:03 +00:00
Daniel Jasper b9d3db6b1b clang-format: [Java] Add space between "synchronized" and "(".
Before:
  synchronized(mData) {
    // ...
  }

After:
  synchronized (mData) {
    // ...
  }

This fixes llvm.org/PR21455.

llvm-svn: 221110
2014-11-02 22:00:57 +00:00
Daniel Jasper 7bd618f5aa clang-format: [Java] Support generics with "?".
Before:
  @Override
  public Map < String,
          ? > getAll() {
    // ...
  }

After:
  @Override
  public Map<String, ?> getAll() {
    // ...
  }

This fixes llvm.org/PR21454.

llvm-svn: 221109
2014-11-02 21:52:57 +00:00
Daniel Jasper a3ddf86dd4 clang-format: [Java] Support try/catch/finally blocks.
llvm-svn: 221104
2014-11-02 19:21:48 +00:00
Daniel Jasper 50b4bd7c0e clang-format: [Java] Don't break after extends/implements.
Before:
  abstract class SomeClass extends SomeOtherClass implements
      SomeInterface {}

After:
  abstract class SomeClass extends SomeOtherClass
      implements SomeInterface {}

llvm-svn: 221103
2014-11-02 19:16:41 +00:00
Bill Schmidt e6e9d15d5f [PowerPC] Change PPCTargetInfo::hasFeature() to use StringSwitch
Implement post-commit comment on r220989 from Eric Christopher.

llvm-svn: 221099
2014-11-02 14:56:41 +00:00
Craig Topper e1c664b136 Add _lzcnt_u32 and _lzcnt_u64 to lzcntintrin.h to match Intel documentation names for these intrinsics.
llvm-svn: 221066
2014-11-01 22:50:57 +00:00
Craig Topper a52e0d7cc0 Avoid undefined behavior in the x86 bmi header file by explicitly checking for 0 before calling __builtin_ctz. Without this the optimizers may take advantage of the undefined behavior and produce incorrect results. LLVM itself still needs to be taught to merge the zero check into the llvm.cttz with defined zero behavior.
llvm-svn: 221065
2014-11-01 22:50:54 +00:00
Craig Topper 3ca55d9c41 Avoid undefined behavior in the x86 lzcnt header file by explicitly checking for 0 before calling __builtin_clz. Without this the optimizers may take advantage of the undefined behavior and produce incorrect results. LLVM itself still needs to be taught to merge the zero check into the llvm.ctlz with defined zero behavior.
llvm-svn: 221064
2014-11-01 22:25:23 +00:00
David Majnemer 0868137ac8 CodeGen: Declutter the emitVirtualObjectDelete interface
No functionality change intended.

llvm-svn: 221043
2014-11-01 07:37:17 +00:00
David Majnemer b9bd6fb397 CodeGen: Virtual dtor thunks shouldn't have this marked as 'returned'
The ARM ABI virtual destructor thunks cannot be marked as 'returned'
because they return undef.

llvm-svn: 221042
2014-11-01 05:42:23 +00:00
NAKAMURA Takumi 8c89496d47 clang/lib/CodeGen/TargetInfo.cpp: Fix a couple of warnings. [-Winconsistent-missing-override]
llvm-svn: 221039
2014-11-01 01:32:27 +00:00
Richard Trieu 46847425c5 Fix a bug where -Wuninitialized would skip arguments to a function call.
llvm-svn: 221030
2014-11-01 00:46:54 +00:00
Reid Kleckner c311aba247 Silence a warning from MSVC "14" by making an enum unsigned
It says there is a narrowing conversion when we assign it to an unsigned
3 bit bitfield.

Also, use unsigned instead of size_t for the Size field of the struct in
question. Otherwise they won't run together in MSVC or clang-cl.

llvm-svn: 221019
2014-10-31 23:33:56 +00:00
Reid Kleckner 80944df6f4 Implement IRGen for the x86 vectorcall convention
The most complex aspect of the convention is the handling of homogeneous
vector and floating point aggregates.  Reuse the homogeneous aggregate
classification code that we use on PPC64 and ARM for this.

This convention also has a C mangling, and we apparently implement that
in both Clang and LLVM.

Reviewed By: majnemer

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

llvm-svn: 221006
2014-10-31 22:00:51 +00:00
Fariborz Jahanian a6556f7295 Objective-C SDK modernization tool. Use its own option
,-objcmt-migrate-property-dot-syntax, when migarting to use
property-dot syntax in place of messaging expression.
rdar://18839124

llvm-svn: 221001
2014-10-31 21:19:45 +00:00
Richard Trieu d4a0136002 Have -Wuninitialized catch uninitalized use in overloaded operator arguments.
llvm-svn: 221000
2014-10-31 21:10:22 +00:00
David Majnemer 0c0b6d9ac6 MS ABI: Properly call global delete when invoking virtual destructors
Summary:
The Itanium ABI approach of using offset-to-top isn't possible with the
MS ABI, it doesn't have that kind of information lying around.

Instead, we do the following:
- Call the virtual deleting destructor with the "don't delete the object
  flag" set.  The virtual deleting destructor will return a pointer to
  'this' adjusted to the most derived class.
- Call the global delete using the adjusted 'this' pointer.

Reviewers: rnk

Subscribers: cfe-commits

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

llvm-svn: 220993
2014-10-31 20:09:12 +00:00
Fariborz Jahanian 6e21338abb C++-11 [qoi]. Do not warn on missing 'verride' on use of
macros in user code when macros themselves are defined
in a system header. rdar://18295240

llvm-svn: 220992
2014-10-31 19:56:27 +00:00
Bill Schmidt 691e01d94e [PowerPC] Initial VSX intrinsic support, with min/max for vector double
Now that we have initial support for VSX, we can begin adding
intrinsics for programmer access to VSX instructions.  This patch
performs the necessary enablement in the front end, and tests it by
implementing intrinsics for minimum and maximum using the vector
double data type.

The main change in the front end is to no longer disallow "vector" and
"double" in the same declaration (lib/Sema/DeclSpec.cpp), but "vector"
and "long double" must still be disallowed.  The new intrinsics are
accessed via vec_max and vec_min with changes in
lib/Headers/altivec.h.  Note that for v4f32, we already access
corresponding VMX builtins, but with VSX enabled we should use the
forms that allow all 64 vector registers.

The new built-ins are defined in include/clang/Basic/BuiltinsPPC.def.

I've added a new test in test/CodeGen/builtins-ppc-vsx.c that is
similar to, but much smaller than, builtins-ppc-altivec.c.  This
allows us to test VSX IR generation without duplicating CHECK lines
for the existing bazillion Altivec tests.

Since vector double is now legal when VSX is available, I've modified
the error message, and changed where we test for it and for vector
long double, since the target machine isn't visible in the old place.
This serendipitously removed a not-pertinent warning about 'long'
being deprecated when used with 'vector', when "vector long double" is
encountered and we just want to issue an error.  The existing tests
test/Parser/altivec.c and test/Parser/cxx-altivec.cpp have been
updated accordingly, and I've added test/Parser/vsx.c to verify that
"vector double" is now legitimate with VSX enabled.

There is a companion patch for LLVM.

llvm-svn: 220989
2014-10-31 19:19:24 +00:00
Kostya Serebryany 5f1b4e8f58 ignore -mconstructor-aliases when adding field paddings for asan
Summary:
When we are adding field paddings for asan even an empty dtor has to remain in the code,
so we ignore -mconstructor-aliases if the paddings are going to be added.

Test Plan: added a test

Reviewers: rsmith, rnk, rafael

Reviewed By: rafael

Subscribers: cfe-commits

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

llvm-svn: 220986
2014-10-31 19:01:02 +00:00
Daniel Jasper e9ab42df0c clang-format: [Java] Improve line breaks around annotations.
Before:
  @SomeAnnotation("With some really looooooooooooooong text") private static final
      long something = 0L;

  void SomeFunction(@Nullable
                    String something) {}

After:
  @SomeAnnotation("With some really looooooooooooooong text")
  private static final long something = 0L;

  void SomeFunction(@Nullable String something) {}

llvm-svn: 220984
2014-10-31 18:23:49 +00:00
Daniel Jasper f739b0dbfa clang-format: [js] Updates to Google's JavaScript style.
The style guide is changing..

llvm-svn: 220977
2014-10-31 17:50:40 +00:00
David Blaikie 11ab078d80 Fix the build
llvm-svn: 220974
2014-10-31 17:18:09 +00:00
Reid Kleckner e9f6a717dd Fix ARM HVA classification of classes with non-virtual bases
Reuse the PPC64 HVA detection algorithm for ARM and AArch64. This is a
nice code deduplication, since they are roughly identical. A few virtual
method extension points are needed to understand how big an HVA can be
and what element types it can have for a given architecture.

Also make the record expansion code work in the presence of non-virtual
bases.

Reviewed By: uweigand, asl

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

llvm-svn: 220972
2014-10-31 17:10:41 +00:00
David Blaikie 9491a5cd4d Fix unused-function warning differently from r220853
Rather than executing this code only needed for an assertion even in a
non-asserts build, just roll the function into the assert. The assertion
text literally describes the two cases so it doesn't seem like this
benefits much from having a separate function (& have to hassle about
ifndef NDEBUG it out, etc)

llvm-svn: 220970
2014-10-31 17:08:11 +00:00
Argyrios Kyrtzidis 06e8d69ac7 [libclang] Disable spell-checking and warnings during code-completion since they are not needed.
llvm-svn: 220966
2014-10-31 16:44:32 +00:00