Commit Graph

53221 Commits

Author SHA1 Message Date
Sylvestre Ledru c7bc52596f Check that the directory does not exist.
Otherwise, it could allows local users to obtain sensitive information or
overwrite arbitrary files via a symlink attack on temporary directories with
predictable names. 

Reported as CVE-2014-2893 ( https://security-tracker.debian.org/tracker/CVE-2014-2893 )
Found by Jakub Wilk

llvm-svn: 211051
2014-06-16 20:31:15 +00:00
Richard Smith 675d279af4 [modules] When we merge redecl chains or mark a decl used with an update
record, mark all subsequent decls as 'used' too, to maintain the AST invariant
that getPreviousDecl()->Used implies this->Used.

llvm-svn: 211050
2014-06-16 20:26:19 +00:00
David Majnemer 4c2a0425b8 MS ABI: Implement x86_64 RTTI
Summary:
The RTTI scheme for x86_64 is largely the same as the one for i386.

Differences are largely limited to avoiding load-time relocations by
replacing pointers to RTTI metadata with the difference of that data
relative to the load address of the module.

Interestingly, this precludes the possibility of successfully using RTTI
data from another DLL.  The ImageBase reference is always relative to
the current DLL.

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

llvm-svn: 211041
2014-06-16 18:46:51 +00:00
Fariborz Jahanian 89ea9610b3 Objective-C. Diagnose when property access is using declared
property accessor methods which have become deprecated
or available. // rdar://15951801

llvm-svn: 211039
2014-06-16 17:25:41 +00:00
Richard Smith 78e1ca692b [C++1z] Implement N4051: 'typename' is permitted instead of 'class' when declaring a template template parameter.
llvm-svn: 211031
2014-06-16 15:51:22 +00:00
Richard Smith dbd4d4c837 Add -std=c++1z flag for C++17 features.
llvm-svn: 211030
2014-06-16 15:16:56 +00:00
Alp Toker 233b372831 Fix typos
llvm-svn: 211025
2014-06-16 14:23:44 +00:00
Alp Toker 04278ece9e Use the ShowInSystemHeader bit consistently for all diagnostics
By describing system header suppressions directly in tablegen we eliminate
special cases in getDiagnosticSeverity().

Dropping the reliance on builtin diagnostic classes when mapping also gets us
closer to the goal of reusing the diagnostic machinery for custom diagnostics.

No change in functionality.

llvm-svn: 211023
2014-06-16 13:56:47 +00:00
NAKAMURA Takumi aee59aede2 clang/AST/OpenMPClause.h: Update \param VL. [-Wdocumentation]
llvm-svn: 211011
2014-06-16 09:33:34 +00:00
Alexey Bataev c5e025831b [OPENMP] Initial support of 'reduction' clause
llvm-svn: 211007
2014-06-16 07:08:35 +00:00
Alp Toker d4a3f0e894 Hide the concept of diagnostic levels from lex, parse and sema
The compilation pipeline doesn't actually need to know about the high-level
concept of diagnostic mappings, and hiding the final computed level presents
several simplifications and other potential benefits.

The only exceptions are opportunistic checks to see whether expensive code
paths can be avoided for diagnostics that are guaranteed to be ignored at a
certain SourceLocation.

This commit formalizes that invariant by introducing and using
DiagnosticsEngine::isIgnored() in place of individual level checks throughout
lex, parse and sema.

llvm-svn: 211005
2014-06-15 23:30:39 +00:00
Saleem Abdulrasool 52a5d41b67 test: add missed file in previous commit
llvm-svn: 210992
2014-06-15 18:48:41 +00:00
Saleem Abdulrasool 0e3258cea8 Preprocessor: improve ACLE 6.4.1, 6.4.2 support
This improves conformance with ACLE 6.4.1.  Define additional macros that
indicate support for the ARM and Thumb instruction set architecture.  This
includes the following set of macros:

  __ARM_ARCH
  __ARM_ARCH_ISA_ARM
  __ARM_ARCH_ISA_THUMB
  __ARM_32BIT_STATE

These help identify the environment that the code is intended to execute on.

Adjust the handling for ACLE 6.4.2 to be more correct.  We would define the
profile as a free-standing token rather than a quoted single character.

llvm-svn: 210991
2014-06-15 18:35:07 +00:00
Sylvestre Ledru 06aebc4d69 One of our buildbot for FreeBSD does not support std::to_string.
Use stringstream instead to convert int to string

llvm-svn: 210972
2014-06-14 09:28:27 +00:00
Sylvestre Ledru ac5a08a56a List the function/method name in the index page of scan-build
llvm-svn: 210971
2014-06-14 08:49:40 +00:00
Sylvestre Ledru 9882e1a52c With the option '-analyzer-config stable-report-filename=true',
instead of report-XXXXXX.html, scan-build/clang analyzer generate
report-<filename>-<function, method name>-<function position>-<id>.html.
(id = i++ for several issues found in the same function/method)

llvm-svn: 210970
2014-06-14 08:45:32 +00:00
Anna Zaks a6fea1386f Fix a crash in Retain Count checker error reporting
Fixes a crash in Retain Count checker error reporting logic by handing
the allocation statement retrieval from a BlockEdge program point.

Also added a simple CFG dump routine for debugging.

llvm-svn: 210960
2014-06-13 23:47:38 +00:00
Adrian Prantl 4ad03dc355 Document Darwin-specific defaults.
llvm-svn: 210958
2014-06-13 23:35:54 +00:00
Richard Smith 8edda96296 A non-trivial array-fill expression isn't necessarily a CXXConstructExpr. It
could be an InitListExpr that runs constructors in C++11 onwards. Fixes a
recent regression (introduced in r210091).

llvm-svn: 210954
2014-06-13 23:04:49 +00:00
Adrian Prantl f2d3e34e6f Make these two words equally bold.
llvm-svn: 210938
2014-06-13 21:31:55 +00:00
Adrian Prantl 36b8067317 Copy the documentation of -fstandalone-debug from the man page to the user
manual.

rdar://problem/17307006

llvm-svn: 210936
2014-06-13 21:12:31 +00:00
Hans Wennborg e50cec3759 Add support for the /EP argument to clang-cl
This maps the /EP argument to both -E and -P.

Patch by Ehsan Akhgari!

Differential Reviion: http://reviews.llvm.org/D4133

llvm-svn: 210935
2014-06-13 20:59:54 +00:00
Tim Northover ba2b33b4fe Fix test for release builds.
llvm-svn: 210934
2014-06-13 20:00:38 +00:00
Tim Northover cadbbe1537 Atomics: emit "cmpxchg weak" where possible
Most builtins date from before the "cmpxchg weak" was a gleam in the
C++ committee's eye, so fortunately not much needs to change. But a
few of them *do* acknowledge that failure is possible.

For these, we'll emit the usual cartesian product of cmpxchg
operations if we can't statically determine weakness.  CodeGen can
sort it out later if the function gets inlined.

The only other non-trivial aspect of this is (I think) that we emit
the scalar expression for "IsWeak" once, at the beginning, and
propagate its value through the successive blocks. There's not much in
it, but it's slightly more consistent with the existing handling of
FailureOrder.

llvm-svn: 210932
2014-06-13 19:43:04 +00:00
Bill Schmidt 1cf7c64fa5 [PPC64LE] Run some existing Altivec tests on powerpc64le as well
There are several Altivec tests that formerly ran only on big-endian
targets (and in some cases only on 32-bit targets).  It is useful to
verify these on little-endian targets as well.

While testing these, I discovered a typo in <altivec.h>.  This is also
fixed by this patch.

llvm-svn: 210928
2014-06-13 18:30:06 +00:00
Tyler Nowicki e8b07ed080 Adds a Pragma spelling for attributes to tablegen and makes use of it for loop
hint attributes. Includes tests for pragma printing and for attribute order
which is incorrectly reversed by ParsedAttributes.

Reviewed by Aaron Ballman

llvm-svn: 210925
2014-06-13 17:57:25 +00:00
Alexey Samsonov e595e1ade0 Remove top-level Clang -fsanitize= flags for optional ASan features.
Init-order and use-after-return modes can currently be enabled
by runtime flags. use-after-scope mode is not really working at the
moment.

The only problem I see is that users won't be able to disable extra
instrumentation for init-order and use-after-scope by a top-level Clang flag.
But this instrumentation was implicitly enabled for quite a while and
we didn't hear from users hurt by it.

llvm-svn: 210924
2014-06-13 17:53:44 +00:00
Rafael Espindola 71de0b61cb Update for llvm api change.
llvm-svn: 210921
2014-06-13 17:20:50 +00:00
Tyler Nowicki f54bda6f12 First commit. Modified FIXME comment.
llvm-svn: 210918
2014-06-13 17:15:27 +00:00
Tim Northover b49b04bbe0 IR-change: cmpxchg operations now return { iN, i1 }.
This is a minimal fix for clang. I'll soon add support for generating
weak variants when requested, but that's not really necessary for the
LLVM change in isolation.

llvm-svn: 210907
2014-06-13 14:24:59 +00:00
Tim Northover d7756c5a68 Tests: use CHECK-LABEL to help debugging failures
llvm-svn: 210906
2014-06-13 14:24:48 +00:00
Samuel Benzaquen 3ca0a7b404 Do not store duplicate parents when memoization data is available.
Summary:
Do not store duplicate parents when memoization data is available.
This does not solve the duplication problem, but ameliorates it.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 210902
2014-06-13 13:31:40 +00:00
Daniel Jasper 5217a8b84f clang-format: [JS] Understand named function literals.
Before:
  return {a: function SomeFunction(){// ...
                                     return 1;
  }
  }
  ;

After:
  return {
    a: function SomeFunction() {
      // ...
      return 1;
    }
  };

llvm-svn: 210887
2014-06-13 07:02:04 +00:00
David Majnemer 5ef4fe7d8e MS ABI: Fix inheritance model calculation in CRTP
CRTP-like patterns involve a class which inherits from another class
using itself as a template parameter.

However, the base class itself may try to create a pointer-to-member
which involves the derived class.  This is problematic because we
may not have finished parsing the most derived classes' base specifiers
yet.

It turns out that MSVC simply uses the unspecified inheritance model
instead of doing anything fancy.

This fixes PR19987.

llvm-svn: 210886
2014-06-13 06:43:46 +00:00
Brad Smith 6d1dfdc011 Missed a space at the end of the line.
llvm-svn: 210884
2014-06-13 03:53:07 +00:00
Brad Smith 378e7f9b78 Use dwarf-2 by default on OpenBSD and FreeBSD.
The Tools.cpp part of the patch partially based on a patch from
FreeBSD's LLVM tree.

llvm-svn: 210883
2014-06-13 03:35:37 +00:00
Richard Smith 71b09acb73 Extend AST dump to include 'used' and 'referenced' flags, and put 'invalid' flag in the right place.
llvm-svn: 210872
2014-06-13 02:24:47 +00:00
Reid Kleckner 32506ed8be Recover from missing 'typename' in sizeof(T::InnerType)
Summary:
'sizeof' is a UnaryExprOrTypeTrait, and it can contain either a type or
an expression.  This change threads a RecoveryTSI parameter through the
layers between TransformUnaryExprOrTypeTrait the point at which we look
up the type.  If lookup finds a single type result after instantiation,
we now build TypeSourceInfo for it just like a normal transformation
would.

This fixes the last error in the hello world ATL app that I've been
working with, and it now links and runs with clang.  Please try it and
file bugs!

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 210855
2014-06-12 23:03:48 +00:00
Eli Bendersky 428c40352e Remove stale part of comment.
llvm-svn: 210851
2014-06-12 22:47:08 +00:00
Reid Kleckner 6713086bca Check the access of operator delete from the destructor context
Previously we would do the access check from the context of
MarkVTableUsed.

Also update this test to C++11, since that is typically used with the MS
C++ ABI.

Fixes PR20005.

llvm-svn: 210850
2014-06-12 22:39:12 +00:00
Richard Smith 1dafb9bb80 The Clang C API does not require C++. Thanks to Jordan Rose for pointing out this error!
llvm-svn: 210841
2014-06-12 22:09:11 +00:00
Reid Kleckner b6e7d64f30 s/pr2007/20007/ in a test
llvm-svn: 210834
2014-06-12 21:46:38 +00:00
Rafael Espindola b30469955d Prefix another use of error_code.
llvm-svn: 210832
2014-06-12 21:36:35 +00:00
Nico Weber 39f17b6d46 Tweak documentation.
1. Having "get started", "get involved", and "hacking" makes it hard to find
   how to send patches, so add a link from "get involved" to "hacking".
2. Remove an almost 5 year old note on the test running meachanism changing
   soon.
3. Let "hacking" link to the LLVM developer policy.

llvm-svn: 210826
2014-06-12 21:15:10 +00:00
Fariborz Jahanian 8df9e2438b Objective-C ARC. Blocks that strongly capture themselves
to call themselves will get the warning:
"Capturing <itself> strongly in this block is likely to
lead to a retain cycle". Cut down on the amount of noise
by noticing that user at some point sets the captured variable
to null in order to release it (and break the cycle). 
// rdar://16944538

llvm-svn: 210823
2014-06-12 20:57:14 +00:00
Rafael Espindola 8e650d7bf0 Refer to error_code with the std prefix.
llvm-svn: 210817
2014-06-12 20:37:59 +00:00
Reid Kleckner a766029b81 MS ABI: Fix forming pointers to members of a base class
Previously we would calculate the inheritance model of a class when
requiring a pointer to member type of that class to be complete.  The
inheritance model is used to figure out how many fields are used by the
member pointer.

However, once we require a pointer to member of a derived class type to
be complete, we can form pointers to members of bases without
calculating the inheritance model for those bases.  This was causing
crashes on this simple test case:

  struct A {
    void f();
    void f(int);
  };
  struct B : public A {};
  void g() { void (B::*a)() = &B::f; }

Now we calculate the inheritance models of all base classes when
completing a member pointer type.

Fixes PR2007.

llvm-svn: 210813
2014-06-12 19:49:17 +00:00
Saleem Abdulrasool fbfbaf6a93 Permit -Wswitch coverage for enumerations.
Thanks to David Blakie and Richard Smith for pointing out that we can retain the
-Wswitch coverage while avoiding the warning from GCC by pushing the unreachable
outside of the switch!

llvm-svn: 210812
2014-06-12 19:33:26 +00:00
Saleem Abdulrasool c9340d2575 Basic: fix warnings from GCC
tools/clang/lib/Basic/DiagnosticIDs.cpp: In function ‘clang::DiagnosticIDs::Level toLevel(clang::diag::Severity)’:
tools/clang/lib/Basic/DiagnosticIDs.cpp:382:1: warning: control reaches end of non-void function [-Wreturn-type]

tools/clang/lib/Format/Format.cpp: In member function ‘virtual std::string clang::format::ParseErrorCategory::message(int) const’:
tools/clang/lib/Format/Format.cpp:282:1: warning: control reaches end of non-void function [-Wreturn-type]

Add a default cases that asserts that we handle the severity, parse error.

llvm-svn: 210804
2014-06-12 17:43:37 +00:00
Rafael Espindola 8a8e554adc Include system_error directly.
llvm-svn: 210802
2014-06-12 17:19:42 +00:00
Fariborz Jahanian 8456406cdf More tests for // rdar://17259812
llvm-svn: 210798
2014-06-12 16:55:43 +00:00
Fariborz Jahanian 4eba3dc7df Objective-C. Use isObjCRetainableType in my last
patch. NFC.

llvm-svn: 210795
2014-06-12 16:12:30 +00:00
Eli Bendersky 96e1ee1ed4 Explicitly initialize all fields to avoid -Wmissing-field-initializers warning.
llvm-svn: 210791
2014-06-12 15:47:57 +00:00
Rafael Espindola c080917ec2 Replace llvm::error_code with std::error_code.
llvm-svn: 210780
2014-06-12 14:02:15 +00:00
Rafael Espindola 374597abfc Allow lowercase messages in this test again.
I misunderstood where the message was being converted.

llvm-svn: 210774
2014-06-12 12:40:04 +00:00
Rafael Espindola 1f24317d87 Fix msvc unittest build.
Looks like msvc has an asymmetrical operator ==.

llvm-svn: 210768
2014-06-12 11:35:17 +00:00
Alp Toker d576e00b44 DiagnosticsEngine: update severity setters to new terminology
llvm-svn: 210764
2014-06-12 11:13:52 +00:00
Alp Toker 46df1c0db8 Complete the switch from mappings to declarative diagnostic severities
This begins to address cognitive dissonance caused by treating the Note
diagnostic level as a severity in the diagnostic engine.

No change in functionality.

llvm-svn: 210758
2014-06-12 10:15:20 +00:00
Craig Topper 3aa4fb3b8b Use StringRef to simplify code. No functional change.
llvm-svn: 210751
2014-06-12 05:32:35 +00:00
Craig Topper e47535041c Use ArrayRef in some function parameters instead of a pointer and count. No functional change.
llvm-svn: 210750
2014-06-12 05:32:27 +00:00
Rafael Espindola 790589c8e3 Add a std:: prefix in cases where ADL would have failed on windows.
This is in preparation for removing make_error_code from the llvm namespace.

llvm-svn: 210745
2014-06-12 03:53:36 +00:00
Rafael Espindola 6d0d89b49c Fix typo.
Thanks to Alp Toker for noticing.

llvm-svn: 210744
2014-06-12 03:31:26 +00:00
Rafael Espindola d0136707a9 Give clang-format its own error category.
The posix errno values are probably to the best thing to use for
describing parse errors.

This should also fix the mingw build.

llvm-svn: 210739
2014-06-12 02:50:04 +00:00
Saleem Abdulrasool 2456cea2e1 Driver: use more range-based for loops
Mechanical change converting some of the simpler for loops into range-based for
loops.  NFC.

llvm-svn: 210738
2014-06-12 02:08:04 +00:00
Rafael Espindola 181efbf44a Use generic_category from the std namespace.
llvm-svn: 210736
2014-06-12 01:59:06 +00:00
Rafael Espindola b7d8bba0c4 Errno should use generic_category.
Sorry, no testcase, just noticed while trying to remove llvm's system_error.h

llvm-svn: 210727
2014-06-12 00:57:40 +00:00
Richard Smith 70e2e75e54 [modules] Add first-draft module maps for Clang. These don't cover everything
yet, but they're enough for a clean bootstrap (with a few local patches that
are yet to be committed).

llvm-svn: 210726
2014-06-12 00:32:32 +00:00
Richard Smith 29d0e6b601 PR19966: don't crash/assert when __underlying_type is applied to an incomplete
enumeration type. I've also filed a LWG issue pointing out that this should be
ill-formed.

llvm-svn: 210723
2014-06-12 00:01:45 +00:00
Rafael Espindola a8aef53849 Accomodate for message differences on windows.
llvm-svn: 210722
2014-06-11 23:53:06 +00:00
Hans Wennborg e8ad3839a1 Don't inherit dllimport to inline move assignment operators
Current MSVC versions don't have move assignment operators, so we
can't rely on them being available in the dll. If we have the
definition, we can just use that directly. This breaks pointer
equality, but should work fine otherwise.

When there is an MSVC version that supports move assignment,
we can key this off the -fmsc-ver option.

http://reviews.llvm.org/D4105

llvm-svn: 210715
2014-06-11 22:44:39 +00:00
Reid Kleckner 13a979911a Don't slice SemaDiagnosticBuilder
I wasn't able to figure out how to emit this diagnostic from a SFINAE
context, so I don't have a test.

llvm-svn: 210713
2014-06-11 21:57:15 +00:00
Hans Wennborg 660101302e Fix the VS2012 build.
It didn't handle the in-class member initializer and compound literal.

llvm-svn: 210707
2014-06-11 21:24:13 +00:00
Fariborz Jahanian 9c10032c79 Objective-C. Accept '__attribute__((__ns_returns_retained__))'
for function/methods returning block in MRR mode as well.
// rdar://17259812

llvm-svn: 210706
2014-06-11 21:22:53 +00:00
Bob Wilson bde66d812d Remove dev/null redirect and x86 backend requirement from new test.
llvm-svn: 210699
2014-06-11 20:19:07 +00:00
Richard Smith 3e79a57a6d Add missing "non-constant" diagnostic for a member call on a temporary of
non-literal class type.

llvm-svn: 210696
2014-06-11 19:53:12 +00:00
Hans Wennborg 8f00837110 clang-cl: accept the /C option with /P (PR19978)
(It's also allowed with /EP, but we haven't implemented that option yet.)

llvm-svn: 210695
2014-06-11 19:44:53 +00:00
Bob Wilson 5235803e67 Run new test with -fsyntax-only.
llvm-svn: 210693
2014-06-11 19:34:14 +00:00
Aaron Ballman 60e466f4d8 The automated server-side process isn't quite right yet, so this is a newly-generated attribute reference. Tanya is looking into the server process when she gets the chance.
llvm-svn: 210691
2014-06-11 19:11:24 +00:00
Fariborz Jahanian 9af6a78f36 Objective-C. More tests for both bridging attributes and
a fix to make it work when CFStructs have no definition.
// rdar://17238954.

llvm-svn: 210690
2014-06-11 19:10:46 +00:00
Rafael Espindola 96b033006d Use std::error_code instead of llvm::error_code.
This is an update for a llvm api change.

llvm-svn: 210688
2014-06-11 19:05:55 +00:00
Kaelyn Takata cd7c3a9de4 Add some comments to TypoCorrectionConsumer.
Also move the constructor for NamespaceSpecifierSet out of line to
improve the class' readability. I meant to do these two things while
cleaning up the previous TypoCorrectionConsumer changes and have them
folded into those changes.

No functionality changed.

llvm-svn: 210686
2014-06-11 18:33:46 +00:00
Kaelyn Takata 7dcc0e6f57 Sink SpecifierInfo into the only class that uses it.
SpecifierInfo is not used outside of NamespaceSpecifierSet except
indirectly through NamespaceSpecifierSet's iterator, so clean up the
code a bit by moving SpecifierInfo into NamespaceSpecifierSet. Also drop
SpecifierInfo's trivial yet verbose constructor since brace
initiialization is sufficient in the only two places the constructor was
being explicitly called.

No functionality changed.

llvm-svn: 210672
2014-06-11 18:07:08 +00:00
Kaelyn Takata a5bdbc840c Make a couple of helper classes private to TypoCorrectionConsumer.
The SpecifierInfo and NamespaceSpecifierSet are now only used by
TypoCorrectionConsumer, so treat them as the implementation details of
TypoCorrectionConsumer that they are. Also make NamespaceSpecifierSet's
method names more style guide compliant.

No functionality changed.

llvm-svn: 210671
2014-06-11 18:07:05 +00:00
Kaelyn Takata 9e2931ec60 Clean up the TypoCorrectionConsumer's interface a bit.
No functionality changed.

llvm-svn: 210670
2014-06-11 18:07:03 +00:00
Kaelyn Takata 68fdd59b31 Move TypoCorrection filtering into the TypoCorrectionConsumer and make it incremental.
The only external/visible functional change that fell out of this
refactoring is that there was one less case where the typo caching
and/or counting didn't work properly. The result is that a test case
had to be moved from typo-correction.cpp to typo-correction-pt2.cpp
to avoid the hard-coded limit on per file/TU typo correction attempts.

llvm-svn: 210669
2014-06-11 18:07:01 +00:00
Kaelyn Takata 0fc7519314 Move a few classes to be before TypoCorrectionConsumer.
This is in preparation for moving TypoCorrection filtering
into the TypoCorrectionConsumer, to separate out some of the purely
mechanical churn. It also makes some of the method names in
NamespaceSpecifierSet be more style guide compliant.

No functionality changed.

llvm-svn: 210668
2014-06-11 18:06:56 +00:00
Eli Bendersky 86483b3a0c Add loop unroll pragma support
http://reviews.llvm.org/D4089

Patch by Mark Heffernan.

llvm-svn: 210667
2014-06-11 17:56:26 +00:00
Fariborz Jahanian 5cbbb1be92 Objective-C. Patch to handle bridge attribute warnings
correctly when both NSAttributedString and
NSMutableAttributedString are specified on the same
CFStruct via different typedefs. // rdar://17238954

llvm-svn: 210660
2014-06-11 16:52:44 +00:00
Bill Schmidt 56a6967000 [PPC64LE] Fix vec_sld and vec_vsldoi for little endian
The vec_sld and vec_vsldoi interfaces perform a left-shift on vector
arguments for both big and little endian.  However, because they rely
on the vec_perm interface which is endian-dependent, the permutation
vector needs to be reversed for LE to get the proper shift direction.

I've added some extra testing for these interfaces for LE in the
builtins-ppc-altivec.c.

llvm-svn: 210657
2014-06-11 15:48:46 +00:00
Daniel Jasper 4ac7de7199 clang-format: Fix pointer/reference detection after decltype.
Before:
  [](const decltype(*a) & value) {}

After:
  [](const decltype(*a)& value) {}

llvm-svn: 210643
2014-06-11 07:35:16 +00:00
David Majnemer 1918787a72 MS ABI: Only class templates get complex nullptr pointer-to-member-functions
r210637 regressed CodeGenCXX/mangle-ms-templates-memptrs.cpp because it
did not believe that there is a distinction between class templates and
function templates.

Sadly, there is.  Function templates should behave in a compatible
manner with MSVC.

llvm-svn: 210642
2014-06-11 07:08:37 +00:00
David Majnemer 6a729c64e0 MS ABI: Mangle null pointer-to-member-functions compatibly
Summary:
Previously, we would mangle nullptr pointer-to-member-functions in class
templates with a mangling we invented because contemporary versions of
MSVC would crash when trying to compile such code.

However, VS "14" can successfully compile these sorts of template
instantiations.  This commit updates our mangling to be compatible with
theirs.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 210637
2014-06-11 04:55:08 +00:00
David Majnemer 35ab328e94 CodeGen: Correct linkage of thread_local for OS X
The backing store of thread local variables is internal for OS X and all
accesses must go through the thread wrapper.

However, individual TUs may have inlined through the thread wrapper.
To fix this, give the thread wrapper functions WeakAnyLinkage.  This
prevents them from getting inlined into call-sites.

This fixes PR19989.

llvm-svn: 210632
2014-06-11 04:08:55 +00:00
Kevin Qin afd8847189 [AArch64] Add default features for CPUs on AArch64 target.
For ARM target, we can use CRYPTO and CRC features if we select
cortex-a57 by '-mcpu', but for AArch64 target, it doesn't work
unless adding with '-mfpu=crypto-neon-fp-armv8'. To keep consistency
between front-end and back-end and get end-users more easier to use,
we'd better add default feature for CPUs on AArch64 target as well.

llvm-svn: 210625
2014-06-11 01:42:16 +00:00
David Blaikie 72f1cae5c0 Ensure test/Misc/win32-macho.c doesn't try to write to the source tree
llvm-svn: 210618
2014-06-11 00:50:07 +00:00
Richard Smith edcb26e61b PR19993: don't assert/crash if a static data member is initialized by '= delete;'.
llvm-svn: 210617
2014-06-11 00:49:52 +00:00
Richard Smith d88b44d444 PR19996: don't crash if -Wuninitialized sees a c++1y lambda init-capture.
llvm-svn: 210615
2014-06-11 00:31:00 +00:00
Reid Kleckner 10ca24c631 Allow lookup into dependent bases in more places under -fms-compatibility
We currently allow unqualified lookup for instance methods but not
static methods because we can't recover with a semantic 'this->'
insertion.

ATL headers have static methods that do unqualified lookup into
dependent base classes.  The pattern looks like:

  template <typename T> struct Foo : T {
    static int *getBarFromT() { return Bar; }
  };

Now we recover as if the user had written:

  template <typename T> struct Foo : T {
    static int *getBarFromT() { return Foo::Bar; }
  };

... which will eventually look up Bar in T at instantiation time.

Now we emit a diagnostic in both cases, and delay lookup in other
contexts where 'this' is available and refers to a class with dependent
bases.

Reviewed by: rsmith

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

llvm-svn: 210611
2014-06-11 00:01:28 +00:00
Richard Smith d7e1fe40e1 Teach __alignof__ to look through arrays before performing the
preferred-alignment transformations. Corrects alignof(T[]) to return
alignof(T) in all cases, as required by relevant standards.

llvm-svn: 210609
2014-06-10 23:43:44 +00:00
Richard Smith f6d7030f0f Related to PR19992: when the GNU alignof-expression extension is applied to an
expression of array-of-unknown-bound type, don't try to complete the array
bound, and return the alignment of the element type rather than 1.

llvm-svn: 210608
2014-06-10 23:34:28 +00:00
Reid Kleckner 377c1592f8 Recover from missing typenames on template args for MSVC compatibility
While matching a non-type template argument against a known template
type parameter we now modify the AST's TemplateArgumentLoc to assume the
user wrote typename.  Under -fms-compatibility, we downgrade our
diagnostic from an error to an extwarn.

Reviewed by: rsmith

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

llvm-svn: 210607
2014-06-10 23:29:48 +00:00
Zachary Turner 18532316f3 Revert "Clang changes to support LLVM removal of runtime multithreading"
This reverts r210601.

llvm-svn: 210604
2014-06-10 23:17:11 +00:00
Zachary Turner 475a76d93a Clang changes to support LLVM removal of runtime multithreading
support (llvm revision r210600).

Reviewers: rnk

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

llvm-svn: 210601
2014-06-10 23:02:10 +00:00
Reid Kleckner 4173f6aff9 *Really* fix DOS newlines introduced in r210330
r210369 didn't quite catch all of them.

llvm-svn: 210593
2014-06-10 21:35:24 +00:00
Bob Wilson 9c865ddb74 Try to fix clang-hexagon-elf failure by requiring x86 support for this test.
llvm-svn: 210586
2014-06-10 21:15:17 +00:00
Richard Smith c3fbf683e6 PR19992: alignof is permitted on an array of unknown bound.
llvm-svn: 210585
2014-06-10 21:11:26 +00:00
Bob Wilson 07216a1161 Fix crash with x86_64-pc-win32-macho target. <rdar://problem/17235840>
The changes in r204978 broke win32-macho targets. There were checks added for
MSVC and Itanium environments as special cases, and win32-macho needs to be
treated the same way.

llvm-svn: 210584
2014-06-10 21:07:12 +00:00
Kaelyn Takata 73429fd4a6 Remove a redundant conditional when caching typo failures.
No functionality change.

llvm-svn: 210583
2014-06-10 21:03:49 +00:00
Hans Wennborg 35bbf1cf8a Do not predefine __EXCEPTIONS in clang-cl (PR19977)
Patch by Ehsan Akhgari! (Test tweak by me.)

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

llvm-svn: 210582
2014-06-10 20:46:38 +00:00
Reid Kleckner b4848e7bab Fix mangling of __uuidof after two levels of template instantiation
llvm-svn: 210570
2014-06-10 20:06:25 +00:00
Fariborz Jahanian 3d5764091d Objective-C. Don't ignore availability attribute when
doing Objective-C subscript access. // rdar://16842487
PR19682.

llvm-svn: 210565
2014-06-10 19:02:48 +00:00
Hans Wennborg 9d06a8d060 Don't inherit dll attributes to deleted methods (PR19988)
We would previously end up with an error when instantiating the
following template:

  template <typename> struct __declspec(dllimport) S {
    void foo() = delete;
  };
  S<int> s;

error: attribute 'dllimport' cannot be applied to a deleted function
llvm-svn: 210550
2014-06-10 17:53:23 +00:00
Fariborz Jahanian 0b3bc24e39 Objective-C IRGen. Patch to generate a weak symbol reference when
'super' dispatches a class method in category for OBJC_METACLASS.
This is when class is a weak_import class.
// rdar://16529125

llvm-svn: 210547
2014-06-10 17:08:04 +00:00
Daniel Jasper 17062ff550 clang-format: [JS] Treat dict literals similar to objc method exprs.
Before:
  return {
    link:
        function() {
          f();  //
        }
        };
  return {
    a: a,
    link: function() {
      f();  //
    }
  }

After:
  return {
    link: function() {
      f();  //
    }
  };
  return {
    a: a,
    link: function() {
      f();  //
    }
  };

llvm-svn: 210537
2014-06-10 14:44:02 +00:00
Alexander Potapenko 14f8ac04e3 Add detection of OS X relocatable SDK to compiler-rt as a lit.util function
Clang's lit cfg already detects the currently selected SDK via
"xcrun --show-sdk-path". The same thing should be done for compiler-rt tests,
to make them work on recent OS X versions. Instead of duplicating the detection
code, this patch extracts the detection function into a lit.util method.

Patch by Kuba Brecka (kuba.brecka@gmail.com),
reviewed at http://reviews.llvm.org/D4072

llvm-svn: 210534
2014-06-10 14:22:00 +00:00
Daniel Jasper ecaba17996 clang-format: Increase penalty for wrapping array subscript expressions
Before:
  aaaaaaaaaaa aaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaa[0].aaaaaaa
                                    [0].aaaaaaaaaaaaaaaaaaaaaa();

After:
  aaaaaaaaaaa aaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaa[0]
                                    .aaaaaaa[0]
                                    .aaaaaaaaaaaaaaaaaaaaaa();

llvm-svn: 210529
2014-06-10 13:27:57 +00:00
Daniel Jasper 908180574e clang-format: Fix enum formatting with specific comment.
Before:
  enum Fruit {  //
    APPLE,
    PEAR };

After:
  enum Fruit {  //
    APPLE,
    PEAR
  };

llvm-svn: 210522
2014-06-10 10:42:26 +00:00
Alp Toker c726c367f4 Improve diagnostic mapping terminology
Diagnostic mappings are used to calculate the final severity of diagnostic
instances.

Detangle the implementation to reflect the terminology used in documentation
and bindings.

No change in functionality.

llvm-svn: 210518
2014-06-10 09:31:37 +00:00
Alp Toker 1e58f3aa3a Don't suppress backend diagnostics in system headers
Doing so would be inconsistent with the common fallback case where backend
diagnostics without source locations are emitted unconditionally.

llvm-svn: 210515
2014-06-10 07:03:25 +00:00
Daniel Jasper da18fd86c7 clang-format: Support variadic lambda captures.
Before:
  return [ i, args... ]{};

After:
  return [i, args...] {};

llvm-svn: 210514
2014-06-10 06:39:03 +00:00
Daniel Jasper 3251fff0e3 clang-format: Handle multiline strings inside ternary expressions.
With AlwaysSplitBeforeMultilineStrings, clang-format would not find any
valid solution.

llvm-svn: 210513
2014-06-10 06:27:23 +00:00
Alp Toker ed2c033b9b Show -Wdate-time in system headers
Anyone enabling this warning would expect to hear about all occurrences
including those in system headers that can cause non-reproducible builds.

To achieve this, rework ShowInSystemHeader to remove broken unused mapping code
that didn't make sense with a simpler and correct scheme.

llvm-svn: 210512
2014-06-10 06:09:00 +00:00
Alp Toker 4f43e55408 Implement -Wdate-time preprocessor warning
This GCC warning is useful for validating reproducible builds
and might help when tracking down issues with modules too.

llvm-svn: 210511
2014-06-10 06:08:51 +00:00
Alp Toker f9fc2dcb87 Improve specificity in the diag-mapping2.c test
Make sure grep catches the correct diagnostic, otherwise this test fails to
detect broken functionality.

llvm-svn: 210510
2014-06-10 06:08:41 +00:00
Hans Wennborg 91ebe6eb04 Improve checking for dynamic initializers of dllimport fields in template instantiation
We would previously assert if the initializer was dependent. I also think that
checking isConstantInitializer is more correct here than checkInitIsICE.

llvm-svn: 210505
2014-06-10 00:55:51 +00:00
Alp Toker d08473415f Make '-Werror=frame-larger-than=' and associated diagnostic pragmas GCC-compatible
It turns out the trailing '=' really is part of the option name spelling and
treating it as such gets us compatible with GCC's -Werror= and pragmas.

(GCC doesn't appear to support any -Wno- form for this diagnostic but we do.)

llvm-svn: 210503
2014-06-09 23:59:38 +00:00
Reid Kleckner 59148b3a4d Reduce indentation in ActOnIdExpression, NFC
llvm-svn: 210499
2014-06-09 23:16:24 +00:00
Richard Trieu ddd01cec0e Removing an "if (this == nullptr)" check from two print methods. The condition
will never be true in a well-defined context.  The checking for null pointers
has been moved into the caller logic so it does not rely on undefined behavior.

llvm-svn: 210498
2014-06-09 22:53:25 +00:00
Fariborz Jahanian 7ea91b2892 Objective-C. Consider block pointer as NSObject as well as conforming to
'NSCopying' protocol when diagnosing block to ObjC pointer conversion.
// rdar://16739120

llvm-svn: 210491
2014-06-09 21:42:01 +00:00
Alp Toker 9ea60874aa Disallow multiple inclusion of clang/Config/config.h
Internal config.h headers are only meant to be included from the main file.

llvm-svn: 210487
2014-06-09 19:09:28 +00:00
Hans Wennborg cd95922bd1 Allow definition of dllimport static fields in partial specializations (PR19956)
This expands the logic from r210141 to cover partial specializations too.

llvm-svn: 210484
2014-06-09 18:30:28 +00:00
Evgeniy Stepanov 2be29929be Fix line numbers for code inlined from __nodebug__ functions.
Instructions from __nodebug__ functions don't have file:line
information even when inlined into no-nodebug functions. As a result,
intrinsics (SSE and other) from <*intrin.h> clang headers _never_
have file:line information.

With this change, an instruction without !dbg metadata gets one from
the call instruction when inlined.

Fixes PR19001.

llvm-svn: 210459
2014-06-09 09:09:19 +00:00
Bill Schmidt 7f6596bb13 [PPC64LE] Implement little-endian semantics for vec_sums
The PowerPC vsumsws instruction, accessed via vec_sums, is defined
architecturally with a big-endian bias, in that the second input vector
and the result always reference big-endian element 3 (little-endian
element 0).  For ease of porting, the programmer wants elements 3 in
both cases.

To provide this semantics, for little endian we generate a permute for
the second input vector prior to the vsumsws instruction, and generate
a permute for the result vector following the vsumsws instruction.

The correctness of this code is tested by the new sums.c test added in
a previous patch, as well as the modifications to
builtins-ppc-altivec.c in the present patch.

llvm-svn: 210449
2014-06-09 03:31:47 +00:00
Craig Topper 4b56692e30 [C++11] Use 'nullptr'.
llvm-svn: 210448
2014-06-09 02:04:02 +00:00
Joey Gouly 41181d140c Convert tests I recently add to use -verify instead of FileCheck.
This uncovered something strange. Diagnostics for InlineAsm have source locations
that don't really map to where they are within the .c source file.

llvm-svn: 210440
2014-06-08 21:28:54 +00:00
Craig Topper 416fa34b87 [C++11] Use 'nullptr'. Unittests edition.
llvm-svn: 210423
2014-06-08 08:38:12 +00:00
Craig Topper 69186e731f [C++11] Use 'nullptr'. Tools edition.
llvm-svn: 210422
2014-06-08 08:38:04 +00:00
Alp Toker 1b935a88d5 Split out inline asm parsing into ParseStmtAsm.cpp
This change isolates various llvm/MC headers from the rest of the parser and
better aligns with the existing SemaStmtAsm.cpp.

No change in functionality, code move only.

llvm-svn: 210420
2014-06-08 05:40:04 +00:00
Alp Toker 1039927808 Don't include llvm/MC/MCParser throughout all of Sema
Requires LLVM r210417.

llvm-svn: 210418
2014-06-08 05:11:37 +00:00
David Majnemer c986fcc9aa MS ABI: Simplify microsoft mangling of template instantiations
Use mangled template instantiation name as key for back references.
Templates have their own context for back references, so their mangling
is always the same regardless of context. This avoids mangling template
instantiations twice.

Patch by Agustín Bergé!

llvm-svn: 210416
2014-06-08 04:51:13 +00:00
Alp Toker 84c424089f DeclObjC: Fix comments about bad API
What's going on here isn't overriding but rather the sketchy practice of member
hiding (shadowing of base members).

llvm-svn: 210404
2014-06-07 23:31:01 +00:00
Alp Toker 541d5070bf Avoid dubious IdentifierInfo::getNameStart() uses
These cases in particular were incurring an extra strlen() when we already knew
the length. They appear to be leftovers from when the interfaces worked with C
strings that have continued to compile due to the implicit StringRef ctor.

llvm-svn: 210403
2014-06-07 23:30:53 +00:00
Alp Toker 4925ba7ffe StringRefize TargetInfo::getABI()
llvm-svn: 210402
2014-06-07 23:30:42 +00:00
Saleem Abdulrasool aea65e9b13 Driver: add -m{,no-}long-calls support
This mirrors the GCC option for the ARM backend.  This option enables the
backend option "-enable-arm-long-calls".  The default behaviour is that this is
disabled due to the slight overhead of the generated calls.

If the target of jumps are greater than 64M range of offset-based jumps, then
the target address must be loaded into a register to make an indirect jump.  The
backend support for this has been present, but was not previously controllable
by the proper flag.

llvm-svn: 210398
2014-06-07 19:32:38 +00:00
Arnold Schwaighofer 553aa7b542 Unbreak release builds.
This test case relies on basic block labels.

llvm-svn: 210392
2014-06-07 02:30:08 +00:00
Bill Schmidt d7c53a91df [PPC64LE] Implement little-endian semantics for vec_unpack[hl]
The PowerPC vector-unpack-high and vector-unpack-low instructions
are defined architecturally with a big-endian bias, in that the vector
element numbering is assumed to be "left to right" regardless of
whether the processor is in big-endian or little-endian mode.  This
effectively reverses the meaning of "high" and "low."  Such a
definition is unnatural for little-endian code generation.

To facilitate ease of porting, the vec_unpackh and vec_unpackl
interfaces are designed to use natural element ordering, so that
elements are numbered according to little-endian design principles
when code is generated for a little-endian target.  The desired
semantics can be achieved by using the opposite instruction for
little-endian mode.  That is, when a call to vec_unpackh appears in
the code, a vector-unpack-low is generated, and when a call to
vec_unpackl appears in the code, a vector-unpack-high is generated.

The correctness of this code is tested by the new unpack.c test
added in a previous patch, as well as the modifications to
builtins-ppc-altivec.c in the present patch.

Note that these interfaces were originally incorrectly implemented
when they take a vector pixel argument.  This patch corrects this
implementation for both big- and little-endian code generation.

llvm-svn: 210391
2014-06-07 02:20:52 +00:00
Bill Schmidt 86f673a005 [PPC64LE] Update test for vec_sum2s interface
Commit r210384 prematurely included changes to the little-endian
implementation of the vec_sum2s interface.  This patch modifies
test/CodeGen/builtins-ppc-altivec.c to test those changes.

llvm-svn: 210389
2014-06-07 01:47:42 +00:00
Nick Lewycky 6fb99b90bc Fix crash declaring global allocation function with zero parameters. Fixes PR19968!
llvm-svn: 210388
2014-06-07 00:43:57 +00:00
Richard Trieu 731b501981 Fix my poor grammar from r210372
llvm-svn: 210387
2014-06-06 23:56:22 +00:00
Bill Schmidt 7f0a5c5141 [PPC64LE] Update builtins-ppc-altivec.c for PPC64 and PPC64LE
The Altivec builtin test case test/CodeGen/builtins-ppc-altivec.c has
always been executed only for 32-bit PowerPC.  These tests are equally
valid for 64-bit PowerPC.  This patch updates the test to be run for
three targets:  powerpc-unknown-unknown, powerpc64-unknown-unknown,
and powerpc64le-unknown-unknown.  The expected code generation changes
for some of the Altivec builtins for little endian, so this patch adds
new CHECK-LE variants to the test for the powerpc64le target.

These tests satisfy the testing requirements for some previous patches
committed over the last couple of days for lib/Headers/altivec.h:
r210279 for vec_perm, r210337 for vec_mul[eo], and r210340 for
vec_pack.

llvm-svn: 210384
2014-06-06 23:12:00 +00:00
Reid Kleckner df6e4a06e4 Delay lookup of simple default template arguments under -fms-compatibility
MSVC delays parsing of default arguments until instantiation.  If the
default argument is never used, it is never parsed.  We don't model
this.

Instead, if lookup of a type name fails in a template argument context,
we form a DependentNameType, which will be looked up at instantiation
time.

This fixes errors about 'CControlWinTraits' in atlwin.h.

Reviewers: rsmith

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

llvm-svn: 210382
2014-06-06 22:36:36 +00:00
Warren Hunt b57b4b098c [MS-ABI] Implement dynamic_cast
This patch implements call lower from dynamic_cast to __RTDynamicCast 
and __RTCastToVoid.  Test cases are included.  A feature of note is that 
helper function getPolymorphicOffset is placed in such a way that it can 
be used by EmitTypeid (to be implemented in a later patch) without being 
moved.  Details are included as comments directly in the code.

llvm-svn: 210377
2014-06-06 22:12:37 +00:00
Richard Trieu f7432755d0 Add -Wtautological-undefined-compare and -Wundefined-bool-conversion warnings
to detect underfined behavior involving pointers.

llvm-svn: 210372
2014-06-06 21:39:26 +00:00
Eli Bendersky 06a4042c8d Fix DOS-style newlines.
A previous patch r210330 (and possibly another) introduced DOS-style newlines
into a UNIX newline formatted file. 

Patch by Mark Heffernan (http://reviews.llvm.org/D4046)

llvm-svn: 210369
2014-06-06 20:31:48 +00:00
Hans Wennborg c94391d3bf MS ABI: Update the thunk linkage computation
As suggested by Reid:

 - class has GVA_Internal linkage -> internal
 - thunk has return adjustment -> weak_odr, to handle evil corner case [1]
 - all other normal methods -> linkonce_odr

 1. Evil corner case:

  struct Incomplete;
  struct A { int a; virtual A *bar(); };
  struct B { int b; virtual B *foo(Incomplete); };
  struct C : A, B { int c; virtual C *foo(Incomplete); };
  C c;

Here, the thunk for C::foo() will be emitted when C::foo() is defined, which
might be in a different translation unit, so it needs to be weak_odr.

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

llvm-svn: 210368
2014-06-06 20:04:01 +00:00
Hans Wennborg 80fb253fa7 test/SemaCXX/undefined-internal.cpp: Remove target triple.
This test seems to run fine in both MS and Itanium C++ ABI mode these days.

llvm-svn: 210357
2014-06-06 17:51:25 +00:00
Hans Wennborg dfcb7d6a97 Defer codegen of inline method definitions to the end of current top level declaration
We would previously fail to emit a definition of bar() for the following code:

  struct __declspec(dllexport) S {
    void foo() {
      t->bar();
    }
    struct T {
      void bar() {}
    };
    T *t;
  };

Note that foo() is an exported method, but bar() is not. However, foo() refers
to bar() so we need to emit its definition. We would previously fail to
realise that bar() is used.

By deferring the method definitions until the end of the top level declaration,
we can simply call EmitTopLevelDecl on them and rely on the usual mechanisms
to decide whether the method should be emitted or not.

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

llvm-svn: 210356
2014-06-06 17:36:17 +00:00
Richard Smith 9467be4f74 Retain an expression pack expansion when the parameter pack expansion code asks
us to.

llvm-svn: 210355
2014-06-06 17:33:35 +00:00
Richard Smith 07f7991f30 PR14841: If partial substitution of explicitly-specified template arguments
results in a template having too many arguments, but all the trailing arguments
are packs, that's OK if we have a partial pack substitution: the trailing pack
expansions may end up empty.

llvm-svn: 210350
2014-06-06 16:00:50 +00:00
Bill Schmidt 8a7b4f18bd [PPC64LE] Implement little-endian semantics for vec_pack family
The PowerPC vector-pack instructions are defined architecturally with
a big-endian bias, in that the vector element numbering is assumed to
be "left to right" regardless of whether the processor is in
big-endian or little-endian mode.  This definition is unnatural for
little-endian code generation.

To facilitate ease of porting, the vec_pack and related interfaces are
designed to use natural element ordering, so that elements are
numbered according to little-endian design principles when code is
generated for a little-endian target.  The vec_pack calls are
implemented as calls to vec_perm, specifying selection of the
odd-numbered vector elements.  For little endian, this means the
odd-numbered elements counting from the right end of the register.
Since the underlying instructions count from the left end, we must
instead select the even-numbered vector elements for little endian to
achieve the desired semantics.

The correctness of this code is tested by the new pack.c test added in
a previous patch.  I plan to later make the existing ppc32 Altivec
compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210340
2014-06-06 15:10:47 +00:00
Alp Toker 62438dab83 Fix RecursiveASTVisitor to visit types in ObjCPropertyDecl
Patch by Mathieu Baudet!

llvm-svn: 210339
2014-06-06 15:05:09 +00:00
Aaron Ballman 8bbb8446f3 Replacing r210333 with an improved solution; we should never reach this code with any other loop hint options.
llvm-svn: 210338
2014-06-06 15:01:47 +00:00
Bill Schmidt 7c0114f6e3 [PPC64LE] Implement little-endian semantics for vec_mul[eo]
The PowerPC vector-multiply-even and vector-multiply-odd instructions
are defined architecturally with a big-endian bias, in that the vector
element numbering is assumed to be "left to right" regardless of
whether the processor is in big-endian or little-endian mode.  This
definition is unnatural for little-endian code generation.

To facilitate ease of porting, the vec_mule and vec_mulo interfacs are
designed to use natural element ordering, so that elements are
numbered according to little-endian design principles when code is
generated for a little-endian target.  The desired semantics can be
achieved by using the opposite instruction for little-endian mode.
That is, when a call to vec_mule appears in the code, a
vector-multiply-odd is generated, and when a call to vec_mulo appears
in the code, a vector-multiply-even is generated.

The correctness of this code is tested by the new mult-even-odd.c test
added in a previous patch.  I plan to later make the existing ppc32
Altivec compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210337
2014-06-06 14:45:06 +00:00
Daniel Jasper 58cb2edd69 clang-format: Fix incorrect indentation.
Before (JavaScript example, but can extend to other languages):
  return {
    a: 'E',
    b: function() {
      return function() {
      f();  // This is wrong.
      };
    }
  };

After:
  return {
    a: 'E',
    b: function() {
      return function() {
        f();  // This is better.
      };
    }
  };

llvm-svn: 210334
2014-06-06 13:49:04 +00:00
Aaron Ballman 9c8274254a Quieting a false-positive which was causing the sanitizer bots to go red.
llvm-svn: 210333
2014-06-06 13:39:32 +00:00
Aaron Ballman b06b15aa28 Adding a new #pragma for the vectorize and interleave optimization hints.
Patch thanks to Tyler Nowicki!

llvm-svn: 210330
2014-06-06 12:40:24 +00:00
Alp Toker 15e62a37f0 Fix typos
llvm-svn: 210328
2014-06-06 12:02:07 +00:00
Alp Toker 7ce5f025a3 Don't generate assembly in backend diagnostic tests
A leftover -S was generating unwanted output in the source tree overriding
-only flags that normally disable output.

This reverts commit r210323 and implements the proper fix.

Reported by Timur Iskhodzhanov!

llvm-svn: 210326
2014-06-06 11:20:58 +00:00
Timur Iskhodzhanov eae19460a7 Fix C++ style // comments in a couple of C files
llvm-svn: 210325
2014-06-06 11:04:46 +00:00
Timur Iskhodzhanov f2a380325d Remove an unused variable
llvm-svn: 210324
2014-06-06 11:02:48 +00:00
Timur Iskhodzhanov 27700e28de Add -o /dev/null to one of the tests as it fails when run from a read-only checkout
llvm-svn: 210323
2014-06-06 10:58:21 +00:00
Alp Toker f988d00682 Revert "Revert "Devise a package-private means to determine the LLVM version string""
We probably just need to touch LLVM's configure this time to work around the
totally inadequate Makefile build server integration.

This reverts commit r210314.

llvm-svn: 210320
2014-06-06 10:36:22 +00:00
Alp Toker 27f333d3ad Revert "Devise a package-private means to determine the LLVM version string"
This didn't work out on the build servers. Investigating

This reverts commit r210313.

llvm-svn: 210314
2014-06-06 07:26:57 +00:00
Alp Toker 420d7ccbac Devise a package-private means to determine the LLVM version string
This will unbreak clang vendor builds as a follow-up to r210238, now that we
can't poke into LLVM's private config.h (nor should the string be exposed by
llvm-config.h).

This hopefully removes for good the last include of LLVM's config.h.

llvm-svn: 210313
2014-06-06 06:58:25 +00:00
Alp Toker 6cea318027 Always check for libxml2 in CMake
This is clang's business and LLVM will soon be updated not to perform the check
for us.

llvm-svn: 210308
2014-06-06 05:01:47 +00:00
Nikola Smiljanic 357af64d78 Add first set of tests for FriendDecl source range and location.
llvm-svn: 210306
2014-06-06 04:40:35 +00:00
Alexey Bataev 15e4ee7852 Rnamed Class to TestClass
llvm-svn: 210305
2014-06-06 03:41:14 +00:00
Nikola Smiljanic 69fdc9ff89 PR11306 - Variadic template fix-it suggestion. Recover from misplaced or redundant ellipsis in parameter pack.
llvm-svn: 210304
2014-06-06 02:58:59 +00:00
Rafael Espindola df540cbf92 Update for llvm api change.
llvm-svn: 210303
2014-06-06 01:20:47 +00:00
Richard Smith f15acc5f5c PR19936: Fix a really dumb bug where we would profile dependent operator* expressions incorrectly.
llvm-svn: 210296
2014-06-05 22:43:40 +00:00
Alp Toker 84ea12b5dc Remove old proposal notices
Let's just go ahead and assume the answer was 'I do'

llvm-svn: 210295
2014-06-05 22:11:20 +00:00
Alp Toker 27506271b4 Provide fallback locations for backend remarks
Instead of disembodied diagnostics when debug info is disabled it's now
possible to identify the associated function's location in order to provide
some amount of of context.

We use the definition's body right brace location to differentiate the fallback
from diagnostics that genuinely relate to the function declaration itself (a
convention also used by gcc).

llvm-svn: 210294
2014-06-05 22:11:12 +00:00
Alp Toker fb8d02b179 Implement -Wframe-larger-than backend diagnostic
Add driver and frontend support for the GCC -Wframe-larger-than=bytes warning.
This is the first GCC-compatible backend diagnostic built around LLVM's
reporting feature.

This commit adds infrastructure to perform reverse lookup from mangled names
emitted after LLVM IR generation. We use that to resolve precise locations and
originating AST functions, lambdas or block declarations to produce seamless
codegen-guided diagnostics.

An associated change, StringMap now maintains unique mangled name strings
instead of allocating copies. This is a net memory saving in C++ and a small
hit for C where we no longer reuse IdentifierInfo storage, pending further
optimisation.

llvm-svn: 210293
2014-06-05 22:10:59 +00:00
Joey Gouly 5798b26c65 When an inline-asm diagnostic is reported by the backend, report it with the
correct severity.

Previously all inline-asm diagnostics were reported as errors.

llvm-svn: 210286
2014-06-05 21:23:42 +00:00
Alexey Samsonov 8f4f1cf778 Mangle predefined string constants names to merge them at link-time
Summary:
This change generalizes the code used to create global LLVM
variables referencing predefined strings (e.g. __FUNCTION__): now it
just calls GetAddrOfConstantStringFromLiteral method. As a result,
global variables for these predefined strings may get mangled names
and linkonce_odr linkage. Fix the test accordingly.

Test Plan: clang regression tests

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: cfe-commits

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

llvm-svn: 210284
2014-06-05 20:53:34 +00:00
Richard Smith 8eb1d322e2 Cleanup, and always create a DecltypeType for a decltype expression, rather
than omitting it the first time we see a decltype type with a particular
expression.

llvm-svn: 210283
2014-06-05 20:13:13 +00:00
Bill Schmidt f7e289c0f2 [PPC64LE] Implement little-endian semantics for vec_perm
The PowerPC vperm (vector permute) instruction is defined
architecturally with a big-endian bias, in that the two input vectors
are assumed to be concatenated "left to right" and the elements of the
combined input vector are assumed to be numbered from "left to right"
(i.e., with element 0 referencing the high-order element).  This
definition is unnatural for little-endian code generation.

To facilitate ease of porting, the vec_perm interface is designed to
use natural element ordering, so that elements are numbered according
to little-endian design principles when code is generated for a
little-endian target.  The desired semantics can be achieved with the
vperm instruction provided that the two input vector registers are
reversed, and the permute control vector is complemented.  The
complementing is performed using an xor with a vector containing all
one bits.

Only the rightmost 5 bits of each element of the permute control
vector are relevant, so it would be possible to complement the vector
with respect to a <16xi8> vector containing all 31s.  However, when
the permute control vector is not a constant, using 255 instead has
the advantage that the vec_xor can be recognized during code
generation as a vnor instruction.  (Power8 introduces a vnand
instruction which could alternatively be generated.)

The correctness of this code is tested by the new perm.c test added in
a previous patch.  I plan to later make the existing ppc32 Altivec
compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210279
2014-06-05 19:07:40 +00:00
Samuel Benzaquen f56a29924f Add hasLocalStorage/hasGlobalStorage matchers.
Summary:
Add hasLocalStorage/hasGlobalStorage matchers for VarDecl nodes.
Update the doc. Also add them to the dynamic registry.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 210278
2014-06-05 18:22:14 +00:00
Renato Golin 0d2f580200 Fix bot for named register test
llvm-svn: 210275
2014-06-05 16:52:20 +00:00
Renato Golin 2e31e4e47b Add pointer types to global named register
This patch adds support for pointer types in global named registers variables.
It'll be lowered as a pair of read/write_register and inttoptr/ptrtoint calls.
Also adds some early checks on types on SemaDecl to avoid the assert.

Tests changed accordingly. (PR19837)

llvm-svn: 210274
2014-06-05 16:45:22 +00:00
Matheus Almeida b84b37d606 [mips] Add macros _MIPS_ISA and __mips_isa_rev (same expansion as defined by GCC).
Summary: The Linux Kernel is one example of a piece of software that relies on them.

Reviewers: atanasyan

Reviewed By: atanasyan

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

llvm-svn: 210270
2014-06-05 14:59:18 +00:00
Samuel Benzaquen 93d68595a9 Fix equalsNode() to accept pointers to derived types.
Summary:
Move the 'const' in the AST_*MATCHER_P* macros to the right of ParamType to
avoiad applying the constness on the wrong level when ParamType is a pointer.
Change equalsNode() to explicitly accept 'const Decl*' or 'const Stmt*'.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 210269
2014-06-05 14:47:08 +00:00
Evgeniy Stepanov dad9206564 Fix driver warning about -pthread on Android.
-pthread is no-op on Android. Suppress the unused argument warning.

llvm-svn: 210253
2014-06-05 11:41:39 +00:00
Evgeniy Stepanov 6f0ae18a59 Fix driver warning about -shared-libasan on Android.
Asan runtime library is always shared on Android, and -shared-libasan is no-op.
Suppress the unused argument warning.

llvm-svn: 210252
2014-06-05 11:14:00 +00:00
Robert Lytton 6adb20f720 XCore target: Fix 'typestring' binding qualifier to the array and not the type
Differential Revision: http://reviews.llvm.org/D3949

llvm-svn: 210250
2014-06-05 09:06:21 +00:00
Puyan Lotfi 54741fe603 Changing this line of code back to the way it was before Alp's config.h clean up changes.
I've already spoken to Alp and he signed off on making this one change, so that our buildbots
go green in the short term.

llvm-svn: 210238
2014-06-05 04:29:21 +00:00
Richard Smith 599bed75ed Bugfix: don't assert if someone manages to declare an operator new/delete template before the builtin operator new/delete.
llvm-svn: 210230
2014-06-05 00:43:02 +00:00
Reid Kleckner e931c06b21 Flush C stdio streams upon process termination
Due to what can only be described as a CRT bug, stdout and amazingly
even stderr are not always flushed upon process termination, especially
when the system is under high threading pressure.  I have found two
repros for this:

1) In lib\Support\Threading.cpp, change sys::Mutex to an
std::recursive_mutex and run check-clang.  Usually between 30 and 40
tests will fail.

2) Add OutputDebugStrings in code that runs during static initialization
and static shutdown.  This will sometimes generate similar failures.

After a substantial amount of troubleshooting and debugging, I found
that I could reproduce this from the command line without running
check-clang.  Simply make the mutex change described in #1, then
manually run the following command many times by running it once, then
pressing Up -> Enter very quickly:

D:\src\llvm\build\vs2013\Debug\bin\c-index-test.EXE -cursor-at=D:\src\llvm\tools\clang\test\Index\targeted-preamble.h:2:15 D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -include D:\src\llvm\build\vs2013\tools\clang\test\Index\Output\targeted-cursor.c.tmp.h -Xclang -error-on-deserialized-decl=NestedVar1      -Xclang -error-on-deserialized-decl=TopVar    | D:\src\llvm\build\vs2013\Debug\bin\FileCheck.EXE D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -check-prefix=PREAMBLE-CURSOR1

Sporadically they will fail, and attaching a debugger to a failed
instance indicates that stdin of FileCheck.exe is empty.

Note that due to the repro in #2, we can rule out a bug in the STL's
mutex implementation, and instead conclude that this is a real flake in
the windows test harness.

Test Plan:
Without patch: Ran check-clang 10 times and saw over 30 Unexpected failures on every run.
With patch: Ran check-clang 10 times and saw 0 unexpected failures across all runs.

Reviewers: rnk

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

Patch by Zachary Turner!

llvm-svn: 210225
2014-06-05 00:13:43 +00:00
Richard Smith 4244ea9ca1 [ubsan] Don't add a --dynamic-list for ubsan symbols when building a shared
library. That results in the linker resolving all references to weak symbols in
the DSO to the definition from within that DSO. Ironically, this rarely causes
observable problems, except that it causes ubsan's own dynamic type check to
spuriously fail (because we fail to properly merge type_info object names).

llvm-svn: 210220
2014-06-04 23:28:46 +00:00
Richard Smith 5659c866f4 Formatting cleanup.
llvm-svn: 210219
2014-06-04 23:26:06 +00:00