Commit Graph

53560 Commits

Author SHA1 Message Date
Yi Kong 4e00ce7d0c Improve comments of ARM ACLE header file and tests
Include section number in ARM ACLE specification for easier navigation.

llvm-svn: 212887
2014-07-12 22:48:13 +00:00
Hal Finkel d8442b1b21 Add nonnull in CodeGen for __attribute__((returns_nonnull))
As a follow-up to r212835, also add the LLVM nonnull function attribute when
__attribute__((returns_nonnull)) is provided.

llvm-svn: 212874
2014-07-12 04:51:04 +00:00
Alexey Samsonov 15c9669615 [ASan] Collect unmangled names of global variables in Clang to print them in error reports.
Currently ASan instrumentation pass creates a string with global name
for each instrumented global (to include global names in the error report). Global
name is already mangled at this point, and we may not be able to demangle it
at runtime (e.g. there is no __cxa_demangle on Android).

Instead, create a string with fully qualified global name in Clang, and pass it
to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata
for some global, ASan will use the original algorithm.

This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264.

llvm-svn: 212872
2014-07-12 00:42:52 +00:00
Reid Kleckner fc31efe95a Require an x86 registered target for this test by splitting it out
This is a shot in the dark to fix the hexagon bot, so I'm not 100% sure
this is the issue.

llvm-svn: 212871
2014-07-12 00:40:59 +00:00
Reid Kleckner 681ae92083 clang-cl: Make all x86 CPU feature flags available, such as -msse3
Ideally, we would use the /arch cl.exe flag for this stuff.
Unfortunately, MSVC supports only 5 /arch flag values, which isn't
nearly enough to cover all the CPU features that LLVM cares about.  At
the very least, we need to know about SSE3 and SSE4.1 in addition to
SSE, SSE2, AVX, and AVX2.

In the future we should add the relevant /arch mappings in addition to
these gcc-style -m flags.

llvm-svn: 212869
2014-07-12 00:29:05 +00:00
Reid Kleckner f392ec6ecc Form a CallExpr from __noop without parens
MSVC accepts __noop without any trailing parens and treats it like a
literal zero.  We don't treat __noop as an integer literal, but now at
least we can parse a naked __noop expression.

Reviewers: rsmith

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

llvm-svn: 212860
2014-07-11 23:54:29 +00:00
Argyrios Kyrtzidis baa97663c2 [Driver] clang::driver::getARMCPUForMArch() moved to llvm::Triple::getARMCPUForArch().
Depends on llvm r212846.
Suggested by Eric Christopher.

llvm-svn: 212858
2014-07-11 23:47:48 +00:00
Alp Toker 5d96e0a3a7 Consolidate header inclusion diagnostics
Make argument orders match, unify diagnostic IDs and reword the message to be a
little less saccharine.

llvm-svn: 212845
2014-07-11 20:53:51 +00:00
David Majnemer 9b21c33da4 CodeGen: Don't emit a thread-wrapper if we can't touch the backing variable
OS X TLS has all accesses going through the thread-wrapper function and
gives the backing thread-local variable internal linkage.  This means
that thread-wrappers must have WeakAnyLinkage so that references to the
internal thread-local variables do not get propagated to other code.

It also means that translation units which do not provide a definition
for the thread-local variable cannot attempt to emit a thread-wrapper
because the thread wrapper will attempt to reference the backing
variable.

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

llvm-svn: 212841
2014-07-11 20:28:10 +00:00
Brad Smith 83510e70a9 oops. correct the prefix.
llvm-svn: 212840
2014-07-11 20:27:39 +00:00
Reid Kleckner ed5d4adb36 MS extension: Make __noop be the integer zero, not void
We still don't accept '__noop;', and we don't consider __noop to be the
integer literal zero.  More work is needed.

llvm-svn: 212839
2014-07-11 20:22:55 +00:00
Brad Smith 10cd0f457a Handle SPARC float command line parameters for SPARCv9.
llvm-svn: 212838
2014-07-11 20:12:08 +00:00
Richard Smith 547864d26a [modules] When merging a class template, also merge the definition of its pattern.
llvm-svn: 212836
2014-07-11 18:22:58 +00:00
Hal Finkel 82504f03ce Add nonnull in CodeGen for __attribute__((nonnull))
We now have an LLVM-level nonnull attribute that can be applied to function
parameters, and we emit it for reference types (as of r209723), but did not
emit it when an __attribute__((nonnull)) was provided. Now we will.

llvm-svn: 212835
2014-07-11 17:35:21 +00:00
Sylvestre Ledru 79e3da9653 Test for warning being silenced
Summary:
Added some tests to see if the new warning would be silenced with a flag.

Patch by Arthur Marble <arthur@info9.net> in the context of Debian Google Summer of code 2014.


Reviewers: sylvestre.ledru

Reviewed By: sylvestre.ledru

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

llvm-svn: 212833
2014-07-11 17:23:13 +00:00
Aaron Ballman 6288d0648a The returns_nonnull attribute does not require a function prototype because it affects only the return value, not any arguments. In turn, asking for a function or method result type should not require a function prototype either, so getFunctionOrMethodResultType has been relaxed.
llvm-svn: 212827
2014-07-11 16:31:29 +00:00
NAKAMURA Takumi ad4c06c656 Instantiate llvm::Registry<clang::PluginASTAction> in FrontendAction.cpp.
- Plugins don't need to export _ZN4llvm8Registry*.
  - Win32.DLL cannot merge common symbols among DLLs. Static members in llvm::Registry should be instantiated in a parent.

llvm-svn: 212821
2014-07-11 15:06:24 +00:00
Zinovy Nis 3d16387413 [PATCH] [x32] Introduce -mx32 flag enforcing x32 mode for other triplets. By Pavel Chupin (@pavel.v.chupin).
-mx32 flag setup target environment to GNUX32 and can be used for 
other 32/64-bit triplets (i386-unknown-linux, x86_64-unknown-linux) to
turn on x32 mode. Compatible with GCC -mx32 flag.

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

llvm-svn: 212817
2014-07-11 14:28:45 +00:00
Sylvestre Ledru 1028ae7441 Tiny improvement in a test (missing quote)
llvm-svn: 212806
2014-07-11 11:53:18 +00:00
Sylvestre Ledru 2fe501eef9 GCC compatibility: Create a Group to ignore unsupported optimization.
Returns a warning when using an unknown optimization flag.
This patch includes -finline-limit as one of those ignored flags.
More options will be moved in this group

Patch by Arthur Marble <arthur@info9.net> in the context of
Debian Google Summer of code 2014.

Reviewers: rnk, Sylvestre
llvm-svn: 212805
2014-07-11 11:43:57 +00:00
Alexey Bataev 9c2e8ee72f [OPENMP] Parsing and sema analysis for 'omp task' directive.
llvm-svn: 212804
2014-07-11 11:25:16 +00:00
Ben Langmuir e013bdc2e7 Don't assume StringRef.data() is null-terminated
llvm-svn: 212790
2014-07-11 00:43:47 +00:00
NAKAMURA Takumi 5787cc2ccf TestAfterDivZeroChecker.cpp: Avoid member initializer. It is unsupported in msc17.
llvm-svn: 212789
2014-07-11 00:32:35 +00:00
Richard Smith dc5523d38f [modules] Don't try to merge template specializations by performing name lookup
into their container; we won't find them there. These things are already being
merged when they're added to their primary template's folding set, so this
merging is redundant (and causes us to reject-valid because we think we've
found an odr violation).

llvm-svn: 212788
2014-07-11 00:20:06 +00:00
NAKAMURA Takumi 7660d653c8 clang/test/CodeGenCXX/PR20038.cpp: Appease targeting msvc due to incompatibility of dw.
llvm-svn: 212787
2014-07-11 00:18:29 +00:00
Reid Kleckner 675d438e23 Return a FixItHint instead of taking a diagnostic builder
Addressing review comments from r212784.

llvm-svn: 212786
2014-07-11 00:16:51 +00:00
Reid Kleckner 0902a51baf MSVC compat: Allow lookup of friend types in enclosing namespaces
The relevant portion of C++ standard says [namespace.memdef]p3:

  If the name in a friend declaration is neither qualified nor a
  template-id and the declaration is a function or an
  elaborated-type-specifier, the lookup to determine whether the entity
  has been previously declared shall not consider any scopes outside the
  innermost enclosing namespace.

MSVC does not implement that rule for types.  If there is a type in an
enclosing namespace, they consider an unqualified tag declaration with
the same name to be a redeclaration of the type from another namespace.

Implementing compatibility is a simple matter of disabling our
implementation of this rule for types, which was added in r177473.

Reviewers: rsmith

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

llvm-svn: 212784
2014-07-10 23:44:52 +00:00
Diego Novillo 94b276deba Enable -gcolumn-info by default.
This patch flips the default value for -gcolumn-info to be on by
default. I discussed the rationale and provided compile/size data
in:

http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-June/074290.html

This also updates the documentation and some tests that relied on
the lack of column information. Some tests had column information
in the expected output, but it was wrong (the tsan tests). Others
were using the driver to execute.

llvm-svn: 212781
2014-07-10 23:29:28 +00:00
Richard Smith d9967cccfb Add AST dumping for VarDecl init kind.
llvm-svn: 212774
2014-07-10 22:54:03 +00:00
Alexey Samsonov 848560125d [UBSan] Introduce type-based blacklisting.
Teach UBSan vptr checker to ignore technically invalud down-casts on
blacklisted types.

Based on http://reviews.llvm.org/D4407 by Byoungyoung Lee!

llvm-svn: 212770
2014-07-10 22:34:19 +00:00
Alexey Samsonov b2cc23df20 Be more specific about return types of some methods.
This would allow to call addCompilerUsedGlobal on some
Clang-generated globals.

llvm-svn: 212767
2014-07-10 22:18:36 +00:00
Richard Smith 95b83e917e PR20256: don't accidentally instantiate non-dependent default-initialization as
value-initialization.

llvm-svn: 212764
2014-07-10 20:53:43 +00:00
David Blaikie 1b5adb82d9 Fix the dtor location issues in PR20038 harder.
Originally committed in r211722, this fixed one case of dtor calls being
emitted without locations (this causes problems for debug info if the
call is then inlined), this caught only some of the cases.

Instead of trying to re-enable the location before the cleanup, simply
re-enable the location immediately after the unconditional branches in
question using a scoped device to ensure the no-location state doesn't
leak out arbitrarily.

llvm-svn: 212761
2014-07-10 20:42:59 +00:00
Ulrich Weigand b4153254b7 Fix (and reenable) ppc64-align-struct.c test for non-assert builds.
llvm-svn: 212757
2014-07-10 19:19:03 +00:00
David Blaikie 40f842de9c Remove use of uniform initialization ({}) introduced in r212725 since this isn't supported in MSVC.
llvm-svn: 212754
2014-07-10 18:46:15 +00:00
Ehsan Akhgari f3a896bd22 Avoid definining more GCC specific predefined macros in clang-cl
Reviewers: hansw, rnk

Subscribers: cfe-commits

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

llvm-svn: 212753
2014-07-10 18:44:24 +00:00
David Blaikie cceed090d2 Quick (attempted) fix for non-asserts builds for a test introduced in r212743.
llvm-svn: 212752
2014-07-10 18:40:54 +00:00
Argyrios Kyrtzidis 2e81dfc5cd [Driver/Unittests] Follow up for r212666, add unit test for the newly exposed getARMCPUForMArch() function.
llvm-svn: 212751
2014-07-10 18:38:38 +00:00
Ulrich Weigand 581badce4b [PowerPC] ABI support for aligned by-value aggregates
This patch adds support for respecting the ABI and type alignment
of aggregates passed by value.  Currently, all aggregates are aligned
at 8 bytes in the parameter save area.  This is incorrect for two
reasons:

- Aggregates that need alignment of 16 bytes or more should be aligned
  at 16 bytes in the parameter save area.  This is implemented by
  using an appropriate "byval align" attribute in the IR.

- Aggregates that need alignment beyond 16 bytes need to be dynamically
  realigned by the caller.  This is implemented by setting the Realign
  flag of the ABIArgInfo::getIndirect call.

In addition, when expanding a va_arg call accessing a type that is
aligned at 16 bytes in the argument save area (either one of the
aggregate types as above, or a vector type which is already aligned
at 16 bytes), code needs to align the va_list pointer accordingly.

Reviewed by Hal Finkel.

llvm-svn: 212743
2014-07-10 17:20:07 +00:00
Andy Gibbs c1f152ee6c Provide -verify support to match "any" line for diagnostics in included files.
Allow diagnostic checks that originate in included files to be matched without necessarily determining the line number that the diagnostic occurs on.  The new syntax replaces the line number with '*'.  This extension is limited to diagnostics in included files and may be used where the include file is not part of the test-suite itself.

Expected uses are for diagnostics originating in system headers, or for users who use -verify in testing 3rd-party library code where the location of diagnostics in header files may change from revision to revision and their precise location is not important to the success of the test-case.

llvm-svn: 212735
2014-07-10 16:43:29 +00:00
Ulrich Weigand f4eba98853 [PowerPC] ABI support for non-Altivec vector types
This patch adds support for passing arguments of non-Altivec vector type
(i.e. defined via attribute ((vector_size (...)))) on powerpc64-linux.

While such types are not mentioned in the formal ABI document, this
patch implements a calling convention compatible with GCC:

- Vectors of size < 16 bytes are passed in a GPR
- Vectors of size > 16 bytes are passed via reference

Note that vector types with a number of elements that is not a power
of 2 are not supported by GCC, so there is no pre-existing ABI to
follow.  We choose to pass those (of size < 16) as if widened to the
next power of two, so they might end up in a vector register or
in a GPR.  (Sizes > 16 are always passed via reference as well.)

Reviewed by Hal Finkel.

llvm-svn: 212734
2014-07-10 16:39:01 +00:00
David Majnemer 57417d0d97 Fix clang tests to be compliant with LLVM IR aliases
Comdat IR references were mistakenly printed for aliases when they
passed through the IR/AsmWriter code.

This makes clang's tests not check for the existance of these wrongly
printed comdat references.

llvm-svn: 212733
2014-07-10 16:26:19 +00:00
Jordan Rose dc352bb82b [analyzer] Check for code testing a variable for 0 after using it as a denominator.
This new checker, alpha.core.TestAfterDivZero, catches issues like this:

  int sum = ...
  int avg = sum / count; // potential division by zero...
  if (count == 0) { ... } // ...caught here

Because the analyzer does not necessarily explore /all/ paths through a program,
this check is restricted to only work on zero checks that immediately follow a
division operation (/ % /= %=). This could later be expanded to handle checks
dominated by a division operation but not necessarily in the same CFG block.

Patch by Anders Rönnholm! (with very minor modifications by me)

llvm-svn: 212731
2014-07-10 16:10:52 +00:00
Zinovy Nis 6e3c63064a [Codestyle][x32] Cosmetic codestyle fix.
llvm-svn: 212728
2014-07-10 15:42:35 +00:00
Zinovy Nis 1db9573f03 [x32] Adding X32 target support to driver, including TargetInfo,DescriptionString, flags, paths lookup, etc. Cover changes with new tests. The author of the patch is Pavel Chupin (@pavel.v.chupin).
The changes enable "hello world" on x32 target (x86_64-*-linux-gnux32). s/isX32/IsX32/ also fixed.

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

llvm-svn: 212725
2014-07-10 15:27:19 +00:00
Daniel Sanders 2bf1366ca6 [mips][mips64r6] Add support for mips-img-linux-gnu GCC toolchains
Summary:
* Support the multilib layout used by the mips-img-linux-gnu
* Recognize mips{,64}{,el}-img-linux-gnu as being aliases of mips-img-linux-gnu
* Use the correct dynamic linker for mips-img-linux-gnu
* Make mips32r6/mips64r6 the default CPU for mips-img-linux-gnu

Subscribers: mpf

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

llvm-svn: 212719
2014-07-10 14:40:57 +00:00
Daniel Sanders 28e5d39183 [mips] Add support for -modd-spreg/-mno-odd-spreg
Differential Revision: http://reviews.llvm.org/D4432

llvm-svn: 212700
2014-07-10 10:39:51 +00:00
Viktor Kutuzov 63537656c6 Add clang headers that fix machine-dependent definitions on FreeBSD 9.2
Differential Revision: http://reviews.llvm.org/D3908

llvm-svn: 212689
2014-07-10 08:43:39 +00:00
Alp Toker e81b42fde9 Prevent link warnings due to -Wframe-larger-than=
Although this is nominally a -W option, we actually handle it in the driver
exactly as an f-group flag that's translated directly to -mllvm.

That means f_Group (and unintuitively, not W_Group) has the semantics we want
to make it behave like a standard warning flag: no automatic forwarding, no
warning for link invocations and compile-only.

Silences diagnostics like:

  [691/1545] Linking CXX executable bin/llvm-diff
  clang-3.5: warning: argument unused during compilation: '-Wframe-larger-than=2048'

(Hopefully we can move towards handling these in the frontend but that'll
require some infrastructure work.)

llvm-svn: 212670
2014-07-10 02:13:29 +00:00
Reid Kleckner 677539d0af MS ABI: Fix __fastcall methods that return structs
The sret paramater consumes the register after the implicit 'this'
parameter, as with other calling conventions.

Fixes PR20278, which turned out to be very easy.

llvm-svn: 212669
2014-07-10 01:58:55 +00:00