Commit Graph

57292 Commits

Author SHA1 Message Date
Reid Kleckner 2a1332245f Implement section pragma feedback on r205810
Mostly short-circuits some conditionals.  Adds target validation of
sections passed to these pragmas.

llvm-svn: 231317
2015-03-04 23:39:17 +00:00
Anton Yartsev 9907fc9053 [analyzer] Bug fix: do not report leaks for alloca()
llvm-svn: 231314
2015-03-04 23:18:21 +00:00
Hans Wennborg e4c47f2e8b Pass -dll to link.exe when building with -shared (PR22697)
And start building a test for non-clang-cl link.exe invocations.

llvm-svn: 231312
2015-03-04 23:16:21 +00:00
David Blaikie a4533b1016 Fix the clang self-host -Werror build
Sorry about the breakage.

llvm-svn: 231302
2015-03-04 22:15:41 +00:00
Nemanja Ivanovic 55e757db4a Add Clang support for PPC cryptography builtins
Review: http://reviews.llvm.org/D7951

llvm-svn: 231291
2015-03-04 21:48:22 +00:00
Reid Kleckner 533bd17268 Fix test/CodeGen/builtins.c for platforms that don't lower sjlj
Opt in Win64 to supporting sjlj lowering. We have the backend lowering,
so I think this was just an oversight because WinX86_64TargetCodeGenInfo
doesn't inherit from X86_64TargetCodeGenInfo.

llvm-svn: 231280
2015-03-04 19:24:16 +00:00
Reid Kleckner 77b1811fde Try to fix the build after removing DataLayoutPass
llvm-svn: 231278
2015-03-04 19:10:41 +00:00
Gabor Horvath e40c71c10a [analyzer] Individual configuration options can be specified for checkers.
Reviewed by: Anna Zaks

Original patch by: Aleksei Sidorin

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

llvm-svn: 231266
2015-03-04 17:59:34 +00:00
Alex Denisov e1d882c726 New ObjC warning: circular containers.
This commit adds new warning to prevent user from creating 'circular containers'.

Mutable collections from NSFoundation allows user to add collection to itself, e.g.: 

NSMutableArray *a = [NSMutableArray new]; 
[a addObject:a]; 

The code above leads to really weird behaviour (crashes, 'endless' recursion) and 
retain cycles (collection retains itself) if ARC enabled.

Patch checks the following collections: 
  - NSMutableArray, 
  - NSMutableDictionary, 
  - NSMutableSet, 
  - NSMutableOrderedSet, 
  - NSCountedSet. 

llvm-svn: 231265
2015-03-04 17:55:52 +00:00
Argyrios Kyrtzidis 5c585253e5 [Modules] Fix crash in Preprocessor::getLastMacroWithSpelling().
Macro names that got undefined inside a module may not have their MacroInfo set.

llvm-svn: 231251
2015-03-04 16:03:07 +00:00
Daniel Jasper cbdf3b79d4 Revert "[IAS] Teach -cc1as about the 'target-abi' option."
This reverts commit 0e41c8faeff75614cf4627533331d780ba3db030.

This is breaking buildbots:
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/4668/

llvm-svn: 231248
2015-03-04 15:02:22 +00:00
Daniel Jasper 8dc4a2a3be Prevent test from writing files.
llvm-svn: 231247
2015-03-04 15:02:17 +00:00
Joerg Sonnenberger 244a577754 Adjust the changes from r230255 to bail out if the backend can't lower
__builtin_setjmp/__builtin_longjmp and don't fall back to the libc
functions.

llvm-svn: 231245
2015-03-04 14:25:35 +00:00
Toma Tabacu 71f5be1ed0 [IAS] Teach -cc1as about the 'target-abi' option.
Summary:
When using the IAS from clang, the 'target-abi' option gets passed to cc1as, but cc1as doesn't know about it and gives an "unknown argument" error.

This is fixed by adding the 'CC1AsOption' flag to the 'target-abi' option in CC1Options.td.

Reviewers: atanasyan, echristo, dsanders

Reviewed By: dsanders

Subscribers: cfe-commits

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

llvm-svn: 231244
2015-03-04 14:24:25 +00:00
Daniel Jasper ad8d849f48 Move one more diagnostic into the new -Wformat-pedantic group.
This was apparently overlooked in r231211.

llvm-svn: 231242
2015-03-04 14:18:20 +00:00
Seth Cantrell 7934007d61 AT.isValid() should come before AT.matchesType()
llvm-svn: 231213
2015-03-04 05:58:08 +00:00
Seth Cantrell b480296e6c Add a format warning for "%p" with non-void* args
GCC -pedantic produces a format warning when the "%p" specifier is used with
arguments that are not void*. It's useful for portability to be able to
catch such warnings with clang as well. The warning is off by default in
both gcc and with this patch. This patch enables it either when extensions
are disabled with -pedantic, or with the specific flag -Wformat-pedantic.

The C99 and C11 specs do appear to require arguments corresponding to 'p'
specifiers to be void*: "If any argument is not the correct type for the
corresponding conversion specification, the behavior is undefined."
[7.19.6.1 p9], and of the 'p' format specifier "The argument shall be a
pointer to void." [7.19.6.1 p8]

Both printf and scanf format checking are covered.

llvm-svn: 231211
2015-03-04 03:12:10 +00:00
Jacques Pienaar b92e7a992d TypePrinter print __restrict if not in C99 mode
restrict is a keyword in C99 but not in C++ while clang accepts __restrict for C++ code. Modify the TypePrinter to print __restrict when not processing C99 code.

Printing restrict in C++ was problematic as printing the argument of
  int f(int * __restrict a) { ... }
resulted in
  int *restrict a
which is incorrect.

http://reviews.llvm.org/D8048

llvm-svn: 231179
2015-03-03 23:58:09 +00:00
Filipe Cabecinhas 7bd441d7fc Try to unbreak the Windows buildbots.
llvm-svn: 231170
2015-03-03 23:36:57 +00:00
Anton Yartsev c38d7952b2 [analyzer] unix.Malloc: preserve AllocaRegion bound to __builtin_alloca().
Binding __builtin_alloca() return value to the symbolic value kills previous binding to a AllocaRegion established by the core.BuiltinFunctions checker. Other checkers may rely upon this information. Rollback handling of __builtin_alloca() to the way prior to r229850.

llvm-svn: 231160
2015-03-03 22:58:46 +00:00
Duncan P. N. Exon Smith bcf02b44de DebugInfo: Remove useless test
This test doesn't provide any value (it just checks that the frontend
produces exactly one compile unit), and it certainly isn't doing what
the comment says.  Noticed via IRC review of my update to it in r231083.

llvm-svn: 231152
2015-03-03 22:18:24 +00:00
Alexey Samsonov 783b8174ad [UBSan] Split -fsanitize=shift into -fsanitize=shift-base and -fsanitize=shift-exponent.
-fsanitize=shift is now a group that includes both these checks, so
exisiting users should not be affected.

This change introduces two new UBSan kinds that sanitize only left-hand
side and right-hand side of shift operation. In practice, invalid
exponent value (negative or too large) tends to cause more portability
problems, including inconsistencies between different compilers, crashes
and inadequeate results on non-x86 architectures etc. That is,
-fsanitize=shift-exponent failures should generally be addressed first.

As a bonus, this change simplifies CodeGen implementation for emitting left
shift (separate checks for base and exponent are now merged by the
existing generic logic in EmitCheck()), and LLVM IR for these checks
(the number of basic blocks is reduced).

llvm-svn: 231150
2015-03-03 22:15:35 +00:00
Alexey Samsonov 83791e27e6 [Sanitizers] Use uint64_t for bitmask of enabled sanitizers.
The total number of sanitizers and sanitizer groups will soon
reach 32.

llvm-svn: 231149
2015-03-03 22:15:32 +00:00
Sumanth Gundapaneni 3a159294d0 Fix program name in "clang -help"
With out this patch,
"clang -help" prints "USAGE: clang-3 [options] <inputs>".
It should either print
USAGE: clang [options] <inputs>
or

USAGE: clang-3.7 [options] <inputs>
With this patch, on Linux, it prints
USAGE: clang-3.7 [options] <inputs>

On Windows, it prints
USAGE: clang.exe [options] <inputs>

llvm-svn: 231124
2015-03-03 20:43:12 +00:00
Bill Seurer 2351bec3ea [PowerPC]Activate "vector bool long long" (and alternate spellings) as a valid type for Altivec support for Power.
There are two test case updates for very basic testing. While I was editing cxx-altivec.cpp I also updated it to better match some other changes in altivec.c.

Note: "vector bool long" was not also added because its use is considered deprecated.

http://reviews.llvm.org/D7235

llvm-svn: 231118
2015-03-03 20:08:43 +00:00
Reid Kleckner fff8e7f6ba Split catch IRgen into ItaniumCXXABI and MicrosoftCXXABI
Use llvm.eh.begincatch for Microsoft-style catches.

This moves lots of CGException code into ItaniumCXXABI. Sorry for the
blame pain.

llvm-svn: 231105
2015-03-03 19:21:04 +00:00
Reid Kleckner f7e1e75828 Disable the right RUN line
llvm-svn: 231098
2015-03-03 18:36:38 +00:00
Filipe Cabecinhas a96989dc8d Disabled the other test from r231086 (like in r231087) since it also had problems
llvm-svn: 231096
2015-03-03 18:32:38 +00:00
Dan Albert 84aee012ea Support __attribute__((availability)) on Android.
Reviewers: srhines

Reviewed By: srhines

Subscribers: cfe-commits

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

llvm-svn: 231092
2015-03-03 18:28:38 +00:00
Dan Albert 77214a4498 Don't force -pie for Android.
Summary:
There is no -no-pie flag that can override this, so making it default
to being on for Android means it is no longer possible to create
non-PIE executables on Android. While current versions of Android
support (and the most recent requires) PIE, ICS and earlier versions
of Android cannot run PIE executables, so this needs to be optional.

Reviewers: srhines

Reviewed By: srhines

Subscribers: thakis, volkalexey, cfe-commits

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

llvm-svn: 231091
2015-03-03 18:24:57 +00:00
Reid Kleckner 1859025df8 Disable a Clang test until the begincatch change lands
llvm-svn: 231087
2015-03-03 17:51:26 +00:00
Hans Wennborg e292262e59 Migrate clang-format-vs plugin project to VS 2013
The plugin still works fine in versions starting from 2010,
but this was needed to make the project _build_ in VS 2013, which
is the blessed version for building LLVM projects these days.

http://reviews.llvm.org/D8021

llvm-svn: 231084
2015-03-03 17:30:50 +00:00
Duncan P. N. Exon Smith f04be1fb3a DebugInfo: Move new hierarchy into place (clang)
Update testcases for LLVM change in r231082 to use the new debug info
hierarchy.

llvm-svn: 231083
2015-03-03 17:25:55 +00:00
Juergen Ributzka 9baa03fc07 Lower _mm256_broadcastsi128_si256 directly to a vector shuffle.
Originally we were using the same GCC builtins to lower this AVX2 vector
intrinsic. Instead we will now lower it directly to a vector shuffle.

This will not only allow LLVM to generate better code, but it will also allow us
to remove the GCC intrinsics.

Reviewed by Andrea

This is related to rdar://problem/18742778.

llvm-svn: 231081
2015-03-03 17:22:53 +00:00
Fariborz Jahanian 773fa2cb03 [SDK modernizer]. Patch fixes driver's lack of
recognition of mernizer's -objcmt-migrate-property-dot-syntax
option with a new test in test/Driver. rdar://19994452

llvm-svn: 231080
2015-03-03 17:15:38 +00:00
Manuel Klimek 27ee25f738 Make -Wuninitialized warn on pointer-to-member and comma operators.
`isTrackedVar` has been updated to also track records.
`DeclRefExpr`s appearing on the left side of a comma operator are
ignored, while those appearing on the right side are classified as
`Use`.

Patch by Enrico Pertoso.

llvm-svn: 231068
2015-03-03 14:54:25 +00:00
Manuel Klimek 2d29340095 Make sure we initialize all values in WhitespaceManager::Change.
llvm-svn: 231067
2015-03-03 14:21:48 +00:00
Daniel Jasper 0391e55650 clang-format: Fix access to uninitialized memory.
With incomplete code, we aren't guaranteed to generated changes for
every token. In that case, we need to assume that even the very first
change can continue a preprocessor directive and initialize values
accordingly.

llvm-svn: 231066
2015-03-03 13:59:49 +00:00
Daniel Jasper 34d761d893 Revert r231008 (and dependent r231019).
As Chandler responded on the initial commit, just directly setting the
triple through -Xclang option to the driver creates havoc on other
platforms. The driver test should specifically go into test/Driver and
test the cc1 commandline itself.

llvm-svn: 231063
2015-03-03 10:02:53 +00:00
Argyrios Kyrtzidis f0b4cd1ed3 [ASTUnit] Fix crash when trying to load a module file via ASTUnit::LoadFromASTFile.
rdar://19997358

llvm-svn: 231060
2015-03-03 08:04:19 +00:00
David Majnemer fba75df599 Sema: Caught exception objects should be unqualified
The exception object should be unqualified.  Using a qualified exception
object results in the wrong copy constructor getting called when the
catch handler executes.

llvm-svn: 231054
2015-03-03 04:38:34 +00:00
Nico Weber a3ef8cad11 Remove obsolete FIXME. override on definitions is fine.
llvm-svn: 231053
2015-03-03 03:31:15 +00:00
David Majnemer d09a51c299 Sema: Properly initialize the thrown exception object
We would create the exception object with the wrong qualifiers, ensuring
that the wrong copy constructor would get called.

llvm-svn: 231049
2015-03-03 01:50:05 +00:00
Alexey Samsonov 042e51823b [Sanitizers] Remove duplication in sanitizer group definition. NFC.
There is no need to list sanitizers in both "UndefinedTrap" and
"Undefined" groups - it turns out using one group in a defintion
of another group "just works".

llvm-svn: 231040
2015-03-03 00:14:32 +00:00
Matthias Braun dae4bac847 Fix typo in my last commit.
llvm-svn: 231039
2015-03-03 00:12:08 +00:00
Fariborz Jahanian 7b012d3728 [SDK modernizer] Patch to fix type of the typed enums when
migrating to NS_ENUM typedef. rdar://19994496

llvm-svn: 231036
2015-03-02 23:58:02 +00:00
Reid Kleckner 1bc469f0fc Remove shell requirement from test/Modules/explicit-build-relpath.cpp
It only relies on 'cd', which the internal shell has now.

llvm-svn: 231031
2015-03-02 22:55:01 +00:00
Reid Kleckner 83fb85c8f0 Revert bad change from r231029
llvm-svn: 231030
2015-03-02 22:50:09 +00:00
Reid Kleckner acbd23adf1 Remove shell requirements from tests that use 'cd'
Modules and Tooling tests in particular tend to want to change the cwd,
so we were missing test coverage in this area on Windows. It should now
be easier to write such portable tests.

llvm-svn: 231029
2015-03-02 22:42:58 +00:00
Hans Wennborg e215594013 clang-cl: Correctly ignore /openmp- (PR22748)
llvm-svn: 231026
2015-03-02 22:09:05 +00:00
Sanjoy Das edadecbe66 Fix test case.
r230921 broke backend-optimization-failure.cpp: after
r230921, LLVM no longer emits an expression to compute 'Length - 1'
and this perturbs LoopSimplify enough to emit the warning on line 10
instead of line 9.  This is a review request to fix the test case once
I re-land r230921.

llvm-svn: 231020
2015-03-02 21:47:47 +00:00
Fariborz Jahanian 6d2cd611bb Attempt to fix buildbot.
llvm-svn: 231019
2015-03-02 21:46:17 +00:00
Matthias Braun e0fc8cabda Improve robustness of dependency-generation-crash.c test.
The test wants to provoke a failure when opening the output file.
Using chmod 0 on the output file does not work reliably on all
filesystems or when running the test as root.
Change the test to use a nonexistant directory instead.

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

llvm-svn: 231009
2015-03-02 20:44:09 +00:00
Fariborz Jahanian 4c616d4df5 [SDK modernizer]. Patch fixes driver's lack of
recognition of mernizer's -objcmt-migrate-property-dot-syntax
option. rdar://19994452

llvm-svn: 231008
2015-03-02 20:43:32 +00:00
Filipe Cabecinhas 1f72a0006c Add -fexceptions for targets where it isn't the default.
It still tests that objc++-cpp-output turns on -fcxx-exceptions and
-fobjc-exceptions by being a c++ and objc(++) file.

llvm-svn: 230992
2015-03-02 19:11:53 +00:00
Bob Wilson b111ec94b3 Add clang support for Objective-C application extensions.
This adds the -fapplication-extension option, along with the
ios_app_extension and macosx_app_extension availability attributes.
Patch by Ted Kremenek

llvm-svn: 230989
2015-03-02 19:01:14 +00:00
Filipe Cabecinhas 5c5c00b7da Add -frtti and -fexceptions to tests that assume these are on.
Summary:
We now have targets that don't enable rtti/exceptions by default, and the
ASTMatchers tests are assuming that these features are on (e.g: They use
dynamic_cast or try).

Reviewers: klimek, thakis, djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 230984
2015-03-02 18:49:37 +00:00
Benjamin Kramer 83b1bf3a27 CodeGen: Fix passing of classes with only one AVX vector member in AVX registers
isSingleElementStruct was a bit too tight in its definition of struct
so we got a mismatch between classify() and the actual code generation.
To make matters worse the code in GetByteVectorType still defaulted to
<2 x double> if it encountered a type it didn't know, making this a
silent miscompilation (PR22753).

Completely remove the "preferred type" stuff from GetByteVectorType and
make it fail an assertion if someone tries to use it with a type not
suitable for a vector register.

llvm-svn: 230971
2015-03-02 16:09:24 +00:00
Benjamin Kramer 39ccabe500 Replace loop with equivalent ArrayRef function. NFC.
llvm-svn: 230949
2015-03-02 11:57:06 +00:00
Daniel Jasper e662316994 clang-format: Prefer wrapping a lambda's body over the lambda's return type.
Before:
  aaaaaaaaaaaaaaaaaaaaaa(
      [](aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &aaa)
          -> aaaaaaaaaaaaaaaaaaaaa { return aaaaaaaaaaaaaaaaa; });

After:
  aaaaaaaaaaaaaaaaaaaaaa(
      [](aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &aaa) -> aaaaaaaaaaaaaaaaaaaaa {
        return aaaaaaaaaaaaaaaaa;
      });

llvm-svn: 230942
2015-03-02 10:35:13 +00:00
Nico Weber f609839244 Fix ObjCInterfaceDecl::getCategoryMethod() and give it a caller. No behavior change.
llvm-svn: 230928
2015-03-02 01:12:28 +00:00
Peter Collingbourne d251b0a60e DebugInfo: Give externally defined types a size and alignment where
possible. Fixes PR22736.

llvm-svn: 230914
2015-03-01 22:07:04 +00:00
Benjamin Kramer 33335df819 Add missing include.
llvm-svn: 230910
2015-03-01 21:36:40 +00:00
Daniel Jasper bea1ab46d9 clang-format: Always align */& in multi-var DeclStmts.
Seems like the most consistent thing to do and in multi-var DeclStmts,
it is especially important to point out that the */& bind to the
identifier.

llvm-svn: 230903
2015-03-01 18:55:26 +00:00
Benjamin Kramer e0ca6e1375 Sema: Remove stray static
This is a real bug if the code path is ever used with different pointer
sizes in the same process.

llvm-svn: 230893
2015-03-01 18:09:50 +00:00
Richard Smith 8825f280e1 Add change accidentally missed from r230840.
llvm-svn: 230843
2015-02-28 09:58:41 +00:00
Filipe Cabecinhas d0dc529da3 Add PS4's autolink syntax to autolink.m's CHECK lines.
llvm-svn: 230841
2015-02-28 07:35:07 +00:00
Richard Smith c3a532576c [modules] Avoid adding a redecl chain to the 'pending out of date' list as the
very first step in updating it.

llvm-svn: 230840
2015-02-28 05:57:02 +00:00
Richard Smith 37bd29a5e6 Give better diagnostics when -fmodule-file= finds a bad file: if the file is
found indirectly, explain how we got there, and distinguish between 'file not
found' and 'file found but invalid'.

llvm-svn: 230839
2015-02-28 03:09:52 +00:00
Richard Smith 36befcee75 [modules] Deduplicate when merging lists of template specializations from imported modules.
llvm-svn: 230834
2015-02-28 01:45:19 +00:00
Richard Smith 91c18de755 Rework our handling of key functions. We used to track a complete list of all
dynamic classes in the translation unit and check whether each one's key
function is defined when we got to the end of the TU (and when we got to the
end of each module). This is really terrible for modules performance, since it
causes unnecessary deserialization of every dynamic class in every compilation.

We now use a much simpler (and, in a modules build, vastly more efficient)
system: when we see an out-of-line definition of a virtual function, we check
whether that function was in fact its class's key function. (If so, we need to
emit the vtable.)

llvm-svn: 230830
2015-02-28 01:01:56 +00:00
Saleem Abdulrasool cd187f033e DebugInfo: hoist definition into global context when needed
When generating debug info for a static inline member which is initialized for
the DLLExport storage class, hoist the definition into a non-composite type
context. Otherwise, we would trigger an assertion when generating the DIE for
the associated global value as the debug context has a type association. This
addresses PR22669.

Thanks to David Blakie for help in coming up with a solution to this!

llvm-svn: 230816
2015-02-28 00:13:13 +00:00
Richard Smith 509fc85b4e [modules] When writing out a list of specializations for a template, if we have
undeserialized specializations (because we merged an imported declaration of
the same template since we last added one), don't bother reading in the
specializations themselves just so we can write out their IDs again.

llvm-svn: 230805
2015-02-27 23:05:10 +00:00
David Blaikie a953f2825b Update Clang tests to handle explicitly typed load changes in LLVM.
llvm-svn: 230795
2015-02-27 21:19:58 +00:00
Richard Smith 78bea7395f [modules] Avoid the possibility of a redeclaration chain not being marked 'up
to date' after it gets updated.

llvm-svn: 230789
2015-02-27 20:14:19 +00:00
David Blaikie 218b783192 Update Clang tests to handle explicitly typed gep changes in LLVM.
llvm-svn: 230783
2015-02-27 19:18:17 +00:00
Nico Weber 6bdd9b0608 Reland __leave tests (r230717 and r230720, reverted in r230740).
The only change is that line 266 changed from
    // CHECK:  br label %[[except]]
to
    // CHECK:  br label %[[except:[^ ]*]]

llvm-svn: 230764
2015-02-27 16:40:43 +00:00
Renato Golin 9ba392351e Add __ARM_DWARF_EH__ to signify the use of Itanium ABI for unwind instructions.
Equally to NetBSD, Bitrig will be using .eh_frame unwinding on ARM.

Patch by Patrick Wildt.

llvm-svn: 230763
2015-02-27 16:35:48 +00:00
Tom Stellard fded50f2f9 AMDGCN: Define cl_khr_fp64 when compiling OpenCL programs
llvm-svn: 230761
2015-02-27 15:10:19 +00:00
Aaron Ballman 152ad170b8 Silence an MSVC warning about not all control paths returning a value; NFC.
llvm-svn: 230754
2015-02-27 13:55:58 +00:00
Daniel Jasper 308062bd0d clang-format: Make trailing commas in array inits force one per line.
Before:
  NSArray *array = @[ @"a", @"a", ];

After:
  NSArray *array = @[
    @"a",
    @"a",
  ];

llvm-svn: 230741
2015-02-27 08:41:05 +00:00
Daniel Jasper 7fe82ad80b Revert r230717 (and subsequent r230720).
The tests keeps failing on build bots:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/2355/testReport/junit/Clang/CodeGen/exceptions_seh_leave_c/

llvm-svn: 230740
2015-02-27 08:16:32 +00:00
Craig Topper b1bc5cf4bc [X86] Remove pblendw and pblendd builtins that aren't being used by the intrinsic headers.
llvm-svn: 230738
2015-02-27 06:54:25 +00:00
Alexey Bataev b832926176 [OPENMP] Codegen for "#pragma omp atomic write"
For global reg lvalue - use regular store through global register.
For simple lvalue - use simple atomic store.
For bitfields, vector element, extended vector elements - the original value of the whole storage (for vector elements) or of some aligned value (for bitfields) is atomically read, the part of this value for the given lvalue is modified and then use atomic compare-and-exchange operation to try to atomically write modified value (if it was not modified).
Also, changes in this patch fix the bug for '#pragma omp atomic read' applied to extended vector elements.
Differential Revision: http://reviews.llvm.org/D7369

llvm-svn: 230736
2015-02-27 06:33:30 +00:00
Richard Smith 4a7e390c12 [modules] Don't write out name lookup table entries merely because the module
happened to query them; only write them out if something new was added.

llvm-svn: 230727
2015-02-27 03:40:09 +00:00
David Majnemer 5bc883f39e MS ABI: Simplify the code which performs base adjustments
llvm-svn: 230722
2015-02-27 02:38:02 +00:00
Nico Weber 5339a52c9a Add last missing __leave test.
llvm-svn: 230720
2015-02-27 02:26:14 +00:00
Nico Weber 497bf5587e Add another __leave test.
llvm-svn: 230717
2015-02-27 01:58:08 +00:00
Richard Smith f81c2cc6ca [modules] For an inheriting constructor, the inherited constructor is stored in
a map keyed off the canonical declaration. Don't try to set it if we're loading
some non-canonical merged declaration.

llvm-svn: 230716
2015-02-27 01:57:00 +00:00
Richard Smith 0b88437ebd [modules] When loading in multiple canonical definitions of a template,
accumulate the set of specializations rather than overwriting one list
with another.

llvm-svn: 230712
2015-02-27 00:25:58 +00:00
Nico Weber ff62a6a0b7 Don't crash on leaving nested __finally blocks through an EH edge.
The __finally emission block tries to be clever by removing unused continuation
edges if there's an unconditional jump out of the __finally block. With
exception edges, the EH continuation edge isn't always unused though and we'd
crash in a few places.

Just don't be clever. That makes the IR for __finally blocks a bit longer in
some cases (hence small and behavior-preserving changes to existing tests), but
it makes no difference in general and it fixes the last crash from PR22553.

http://reviews.llvm.org/D7918

llvm-svn: 230697
2015-02-26 22:34:33 +00:00
Nico Weber 6307cf0aa3 Wrap to 80 columns. No behavior change.
llvm-svn: 230682
2015-02-26 20:43:00 +00:00
Reid Kleckner 3c6963b806 Add myself as a code owner for Microsoft C++ ABI code and general Windows support
Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 230681
2015-02-26 20:37:49 +00:00
Reid Kleckner 9fde2e013e Win64: Silently ignore __stdcall, __fastcall, and __thiscall
MSVC doesn't warn on this. Users are expected to apply the WINAPI macro
to functions passed by pointer to the Win32 API, and this macro expands
to __stdcall. This means we end up with a lot of useless noisy warnings
about ignored calling conventions when compiling code with clang for
Win64.

llvm-svn: 230668
2015-02-26 19:43:46 +00:00
Filipe Cabecinhas a076430ba9 Add -frtti/-fexceptions to some more tests that assume they're on
llvm-svn: 230656
2015-02-26 18:29:41 +00:00
Petar Jovanovic d55ae6ba37 Add support for generating MIPS legacy NaN
Currently, the NaN values emitted for MIPS architectures do not cover
non-IEEE754-2008 compliant case. This change fixes the issue.

Patch by Vladimir Radosavljevic.

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

llvm-svn: 230653
2015-02-26 18:19:22 +00:00
Fariborz Jahanian 947efbc138 Patch to prevent crash when default argument expression
is null due to its previous bad declaration, etc.
rdar://19871240

llvm-svn: 230649
2015-02-26 17:59:54 +00:00
Evgeniy Stepanov 6e09bca0ef [msan] Change track-origins default mode from 1 to 2.
Change -fsanitize-memory-track-origins to be equivalent to
-fsanitize-memory-track-origins=2.

Track-origins=2 provides a lot more detailed reports at the cost of
some additional slowdown (ranging from none to, sometimes, 3x; ~3% average on
SPEC2006).

llvm-svn: 230644
2015-02-26 15:59:30 +00:00
Daniel Jasper b812e323fa clang-format: Make braced list formatting more consistent.
Before:
  Aaaa aaaaaaaaaaa{
      {
       a, // +1 indent weird.
       b, // trailing comma signals one per line.
      },  // trailing comma signals one per line.
  };

After:
  Aaaa aaaaaaaaaaa{
      {
          a, // better!?
          b, // trailing comma signals one per line.
      },     // trailing comma signals one per line.
  };

Interesting that this apparently was entirely untested :-(.

llvm-svn: 230627
2015-02-26 11:46:29 +00:00
Daniel Jasper beaa322c36 clang-format: Fix space of arrays of pointers to templated types.
Before:
  vector<int>(*foo_)[6];

After:
  vector<int> (*foo_)[6];

llvm-svn: 230625
2015-02-26 11:30:50 +00:00
Alexey Bataev 8cbe0a6b62 [OPENMP] Fixed codegen for directives without function outlining.
Fixed crash on codegen for directives like 'omp for', 'omp single' etc. inside of the 'omp parallel', 'omp task' etc. regions.

llvm-svn: 230621
2015-02-26 10:27:34 +00:00
Daniel Jasper a42de763ac clang-format: Allow breaking after "else if(" as a last resort.
This isn't generally nice, but better than violating the column limit.

llvm-svn: 230620
2015-02-26 09:49:08 +00:00
Craig Topper ac0d58bc4c [X86] Remove the blendps/blendpd builtins. They aren't used by the intrinsic headers. We use appropriate shuffle vector instead.
llvm-svn: 230616
2015-02-26 08:09:05 +00:00
Craig Topper 1e2f885a03 [X86] Correct immediate range checking for blendps/blendpd/blendpd256 builtins.
llvm-svn: 230615
2015-02-26 06:23:15 +00:00
Simon Atanasyan 59b25cbeaa [Mips] Handle -mips32r[3|5] / -mips64r[3|5] options while selecting lib/headers paths
There is no supported toolchain which provides headers / libs / object
files specific to the mips32r[3|5] and mips64r[3|5] ISA. So select "r2"
specific folders when they are available.

http://reviews.llvm.org/D7879

llvm-svn: 230611
2015-02-26 04:45:57 +00:00
Duncan P. N. Exon Smith a346e03084 CGDebugInfo: Use DIImportedEntity default constructor, NFC
Use the newly minted `DIImportedEntity` default constructor (r230609)
rather than explicitly specifying `nullptr`.  The latter will become
ambiguous when the new debug info hierarchy is committed, since we'll
have both of the following:

    explicit DIImportedEntity(const MDNode *);
    DIImportedEntity(const MDImportedEntity *);

(Currently we just have the former.)

A default constructor is just as clear.

llvm-svn: 230610
2015-02-26 04:44:27 +00:00
Richard Trieu 555c9673fd Update assumption in template diffing about integer template arguments.
Fix for PR22017.  Integer template arguments are automatically bit extended to
the size of the integer type.  In template diffing, evaluated expressions were
not having their results extending, leading to comparing two APSInt's with
different widths.  Apply the proper bit extending when evaluating template
arguments.  This mainly affected bool template arguments.

llvm-svn: 230603
2015-02-26 02:40:48 +00:00
Richard Smith f609a1db58 Split StaticAnalyzer module into three to fix a cyclic dependency. Dependencies
are now:

  FrontendTool -> StaticAnalyzer/Frontend -> Frontend -> StaticAnalyzer/Core

The final dependency edge here is probably removable: AnalyzerOptions (and
Analyses.def) should probably live in Basic rather than StaticAnalyzer/Core.

llvm-svn: 230600
2015-02-26 01:11:08 +00:00
Reid Kleckner bd92dbacee clang-cl: Expose -fcolor-diagnostics and -fansi-escape-codes
They don't conflict with MSVC flags.

llvm-svn: 230598
2015-02-26 01:10:15 +00:00
David Majnemer 5123664431 Sema: __assume with side effects shouldn't result in invalid AST nodes
We'd diagnose an __assume expression which contained a function call.
This would result in us wrongly returning ExprError, causing mysterious
failures later on.

llvm-svn: 230597
2015-02-26 00:57:33 +00:00
Reid Kleckner d6aab731e0 Silence unused variable warning in NDEBUG build
llvm-svn: 230590
2015-02-26 00:33:41 +00:00
Eric Christopher 8213f7f87d Fix a [-Werror,-Wreorder] initialization ordering error.
llvm-svn: 230589
2015-02-26 00:29:54 +00:00
Peter Collingbourne 4b0924dad6 docs: Document CFI padding and all-ones optimizations. Link to viewvc.
llvm-svn: 230588
2015-02-26 00:18:04 +00:00
Reid Kleckner 1df0fea593 Add -fuse-line-directive flag to control usage of #line with -E
Currently -fms-extensions controls this behavior, which doesn't make
much sense. It means we can't identify what is and isn't a system header
when compiling our own preprocessed output, because #line doesn't
represent this information.

If someone is feeding Clang's preprocessed output to another compiler,
they can use this flag.

Fixes PR20553.

Reviewers: rsmith

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

llvm-svn: 230587
2015-02-26 00:17:25 +00:00
Richard Smith ebdfc00995 Remove some unused includes of llvm/IR headers from parts of Clang that really
shouldn't depend on LLVM IR.

llvm-svn: 230586
2015-02-26 00:01:03 +00:00
Larisse Voufo 697b32a0cb Improvement on sized deallocation from r230160:
Do not declare sized deallocation functions dependently on whether it is found in global scope. Instead, enforce the branching in emitted code by (1) declaring the functions extern_weak and (2) emitting sized delete expressions as a branching between both forms delete.

llvm-svn: 230580
2015-02-25 23:48:43 +00:00
Larisse Voufo 17151eba64 Fix typo.
llvm-svn: 230579
2015-02-25 23:48:35 +00:00
Larisse Voufo 351f309dab Move -fdefine-sized-deallocation and -fno-sized-deallocation options from driver into CC1 for now.
llvm-svn: 230577
2015-02-25 23:48:25 +00:00
Peter Collingbourne 69b004d987 UBSan: Use the correct function prologue for x32.
llvm-svn: 230571
2015-02-25 23:18:42 +00:00
David Majnemer dbdab4037e MS ABI: Turn throw into std::terminate for now, make try/catch "work"
This lets us compile programs which make use of exceptional constructs
statically without executing any of them dynamically.

llvm-svn: 230568
2015-02-25 23:01:21 +00:00
Richard Smith 8cebe37fe9 [modules] Even if we already have a definition of a class, loading in another
one can give us more lookup results (due to implicit special members). Be sure
to complete the redecl chain for every kind of DeclContext before performing a
lookup into it, rather than only doing so for NamespaceDecls.

llvm-svn: 230558
2015-02-25 22:20:13 +00:00
Richard Smith 4a2ceea193 Remove non-existent file from module map.
llvm-svn: 230538
2015-02-25 20:20:39 +00:00
Ben Langmuir 443aa4b4b0 Allow (Object *)kMyGlobalCFObj casts without bridging
Previously we allowed these casts only for constants declared in system
headers, which we assume are retain/release-neutral. Now also allow them
for constants in user headers, treating them as +0.  Practically, this
means that we will now allow:
id x = (id)kMyGlobalConst;

But unlike with system headers we cannot mix them with +1 values:
id y = (id)(b ? kMyGlobalConst : [Obj newValAtPlusOne]); // error
id z = (id)(b ? kSystemGlobalConst: [Obj newValAtPlusOne]); // OK

Thanks to John for suggesting this improvement.

llvm-svn: 230534
2015-02-25 20:09:06 +00:00
Richard Smith f42e1eca9f Add missing #include found by modules buildbot.
llvm-svn: 230532
2015-02-25 19:55:49 +00:00
Reid Kleckner c00927cd20 clang-cl: Ignore /Fd silently
While it's true that we don't create the PDB as requested on the command
line, this is a well-documented limitation. Warning about it doesn't
help people using legacy build systems with clang-cl, and it makes the
clang-cl self-host very noisy.

llvm-svn: 230527
2015-02-25 19:17:50 +00:00
Reid Kleckner 1cbd9aa96d Reland (2x) r230314, "Fix codegen for virtual methods that are (re-) exported from multiple modules."
This reverts commits r230477 and r230478.

llvm-svn: 230526
2015-02-25 19:17:48 +00:00
Reid Kleckner 8b6d034cab Reland r230446, "MS ABI: Try to respect external AST source record layouts"
It broke test/PCH/headersearch.cpp because it was using -Wpadding, which
only works for Itanium layout. Before this commit, we would use Itanium
record layout when using PCH, which is crazy. Now that the test uses an
explicit Itanium triple, we can reland.

llvm-svn: 230525
2015-02-25 19:17:45 +00:00
Reid Kleckner c22fe1299a Use Itanium triple in test using -Wpadding
-Wpadding is not implemented in the Microsoft record layout builder.
This test only passes on Windows because PCH forces us to use the
Itanium record layout builder. I'm about to fix that, so change the
test to not rely on that ridiculous behavior.

llvm-svn: 230524
2015-02-25 19:04:51 +00:00
Nico Weber d9b8bd6b86 Make __leave test pass in -Asserts builds.
llvm-svn: 230514
2015-02-25 17:44:04 +00:00
David Majnemer ced8bdf74a Sema: Parenthesized bound destructor member expressions can be called
We would wrongfully reject (a.~A)() in both the destructor and
pseudo-destructor cases.

This fixes PR22668.

llvm-svn: 230512
2015-02-25 17:36:15 +00:00
Nico Weber e68b9f3e0a Reland r230460 with a test fix for -Asserts builds.
Original CL description:
Produce less broken basic block sequences for __finally blocks.

The way cleanups (such as PerformSEHFinally) get emitted is that codegen
generates some initialization code, then calls the cleanup's Emit() with the
insertion point set to a good place, then the cleanup is supposed to emit its
stuff, and then codegen might tack in a jump or similar to where the insertion
point is after the cleanup.

The PerformSEHFinally cleanup tries to just stash away the block it's supposed
to codegen into, and then does codegen later, into that stashed block.  However,
after codegen'ing the __finally block, it used to set the insertion point to
the finally's continuation block (where the __finally cleanup goes when its body
is completed after regular, non-exceptional control flow).  That's not correct,
as that block can (and generally does) already ends in a jump.  Instead,
remember the insertion point that was current before the __finally got emitted,
and restore that.

Fixes two of the crashes in PR22553.

llvm-svn: 230503
2015-02-25 16:25:00 +00:00
Alexander Kornienko a9b01eb776 Add support for inserting ArrayRef<FixItHint> into DiagnosticBuilder.
This is going to be needed in clang-tidy as more checks add complex fixits.

llvm-svn: 230495
2015-02-25 14:40:56 +00:00
NAKAMURA Takumi b01d86b315 Fix UTF8 chars to ASCII.
llvm-svn: 230479
2015-02-25 11:02:00 +00:00
NAKAMURA Takumi 073f2b4795 Whitespace.
llvm-svn: 230478
2015-02-25 10:50:06 +00:00
NAKAMURA Takumi e218a40a40 Revert r230448, "Reland r230314 "Fix codegen for virtual methods that are (re-) exported from multiple modules."", since I have reverted r230446.
llvm-svn: 230477
2015-02-25 10:49:59 +00:00
NAKAMURA Takumi 472041f027 Whitespace.
llvm-svn: 230475
2015-02-25 10:32:20 +00:00
NAKAMURA Takumi a2acc360ed Revert r230446, "MS ABI: Try to respect external AST source record layouts"
It fails on Clang::PCH/headersearch.cpp for targeting msvc.

llvm-svn: 230474
2015-02-25 10:32:13 +00:00
Daniel Jasper 1c22048834 clang-format: Fix spacing for function with ref-qualification ..
.. when using SpacesInCStyleCastParentheses != SpacesInParentheses.

Before:
  FormatStyle Spaces = getLLVMStyle();
  Deleted &operator=(const Deleted &)& = default;

  Spaces.SpacesInParentheses = true;
  Deleted(const Deleted &)& = default;

  Spaces.SpacesInCStyleCastParentheses = true;
  Spaces.SpacesInParentheses= false;
  Deleted( const Deleted & )& = default;

After:
  FormatStyle Spaces = getLLVMStyle();
  Deleted &operator=(const Deleted &)& = default;;

  Spaces.SpacesInParentheses= true;
  Deleted( const Deleted & )& = default;

  Spaces.SpacesInCStyleCastParentheses = true;
  Spaces.SpacesInParentheses= false;
  Deleted(const Deleted &)& = default;

Patch by Jean-Philippe Dufraigne. Thank you!

llvm-svn: 230473
2015-02-25 10:30:06 +00:00
Daniel Jasper cd94c40b10 Revert "Produce less broken basic block sequences for __finally blocks."
The test is broken on buildbots:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/2279/

This reverts commit adda738b6dc533c42db5f5f5b31344098a3aba7d.

llvm-svn: 230472
2015-02-25 10:07:14 +00:00
Alexey Bataev 3eff5f46d7 [OPENMP] Rename methods of OpenMPRuntime class. NFC.
llvm-svn: 230470
2015-02-25 08:32:46 +00:00
Simon Atanasyan 3f02403b3a [Mips] Support mips-r6 path suffix for Adnroid MIPS toolchain
This path suffix is used if user provides the -mips32r6 command line
options.

llvm-svn: 230469
2015-02-25 07:31:12 +00:00
Sameer Sahasrabuddhe a75db66eee Restores r228382, which was reverted in r228406.
The original commit failed to handle "shift assign" (<<=), which
broke the test mentioned in r228406. This is now fixed and the
test added to the lit tests under SemaOpenCL.

*** Original commit message from r228382 ***

OpenCL: handle shift operator with vector operands

Introduce a number of checks:
1. If LHS is a scalar, then RHS cannot be a vector.
2. Operands must be of integer type.
3. If both are vectors, then the number of elements must match.

Relax the requirement for "usual arithmetic conversions":
When LHS is a vector, a scalar RHS can simply be expanded into a
vector; OpenCL does not require that its rank be lower than the LHS.
For example, the following code is not an error even if the implicit
type of the constant literal is "int".

  char2 foo(char2 v) { return v << 1; }

Consolidate existing tests under CodeGenOpenCL, and add more tests
under SemaOpenCL.

llvm-svn: 230464
2015-02-25 05:48:23 +00:00
Nico Weber 795bd2d411 Produce less broken basic block sequences for __finally blocks.
The way cleanups (such as PerformSEHFinally) get emitted is that codegen
generates some initialization code, then calls the cleanup's Emit() with the
insertion point set to a good place, then the cleanup is supposed to emit its
stuff, and then codegen might tack in a jump or similar to where the insertion
point is after the cleanup.

The PerformSEHFinally cleanup tries to just stash away the block it's supposed
to codegen into, and then does codegen later, into that stashed block.  However,
after codegen'ing the __finally block, it used to set the insertion point to
the finally's continuation block (where the __finally cleanup goes when its body
is completed after regular, non-exceptional control flow).  That's not correct,
as that block can (and generally does) already ends in a jump.  Instead,
remember the insertion point that was current before the __finally got emitted,
and restore that.

Fixes two of the crashes in PR22553.

llvm-svn: 230460
2015-02-25 04:05:18 +00:00
Nico Weber ebf9a058c6 Add comments for two CleanupKinds.
llvm-svn: 230459
2015-02-25 03:58:36 +00:00
Peter Collingbourne 03054d489e docs: Document optimizations in control flow integrity design doc.
llvm-svn: 230458
2015-02-25 03:35:03 +00:00
Adrian Prantl cbc368c5b5 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
llvm-svn: 230454
2015-02-25 02:44:04 +00:00
Adrian Prantl 7153ce8a06 Revert "Add a missing target requirement."
llvm-svn: 230453
2015-02-25 02:43:38 +00:00
Reid Kleckner b20cd673ff Fix bots failing on an explicit triple
Why do we need a registered target for this?

llvm-svn: 230450
2015-02-25 02:32:00 +00:00
Nico Weber fc3fe4f0a1 Don't crash on missing '{' after __except or __finally, PR22687.
Also add some general test/Parser coverage for SEH blocks.

llvm-svn: 230449
2015-02-25 02:22:06 +00:00
Reid Kleckner 64b04b9bdf Reland r230314 "Fix codegen for virtual methods that are (re-) exported from multiple modules."
This reverts the revert from commit r230406.

The changes in r230445 and r230446 make the test pass on Windows now.

llvm-svn: 230448
2015-02-25 02:19:56 +00:00
Reid Kleckner 7706f6a97b MS ABI: Add triple to test relying on key functions
llvm-svn: 230447
2015-02-25 02:16:15 +00:00
Reid Kleckner 3990db79c5 MS ABI: Try to respect external AST source record layouts
Covered by existing tests in test/CodeGen/override-layout.c and
test/CodeGenCXX/override-layout.cpp. Seriously, they found real bugs in
my code. :)

llvm-svn: 230446
2015-02-25 02:16:09 +00:00
Reid Kleckner 240ef5708e Add missing MD canonicalization to MS vtable builder
llvm-svn: 230445
2015-02-25 02:16:02 +00:00
Adrian Prantl 38beb0abc5 Add a missing target requirement.
llvm-svn: 230429
2015-02-25 01:52:05 +00:00
Richard Smith c4c34e2722 Remove slow and apparently pointless updating of all identifiers at the start
of writing out an AST file.

llvm-svn: 230428
2015-02-25 01:45:32 +00:00
Nico Weber dd25674a40 Fold ParseSEHTryBlockCommon() into its only caller. No behavior change.
ParseCXXTryBlockCommon() makes sense because it has two callers due to
function try blocks.  There are no SEH function try blocks.

llvm-svn: 230426
2015-02-25 01:43:27 +00:00
Adrian Prantl 8bf7af3de8 Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

This reapplies r230044 with a fixed configure+make build and updated
dependencies and testcase requirements. Over the last iteration this
version adds
- missing target requirements for testcases that specify an x86 triple,
- a missing clangCodeGen.a dependency to libClang.a in the make build.

rdar://problem/19104245

llvm-svn: 230423
2015-02-25 01:31:45 +00:00
Richard Smith c89bb9dd51 Make RedeclarableResult's ownership-transferring constructor be a move
constructor.

llvm-svn: 230417
2015-02-25 01:11:29 +00:00
Richard Smith 5638c1146e [modules] Fix a bug that would result in a build with P paths through a module
graph with M modules to take O(P) time, not just O(M) time, when using explicit
module builds.

llvm-svn: 230412
2015-02-25 00:56:02 +00:00
NAKAMURA Takumi e976aab1df Revert r230314, "Fix codegen for virtual methods that are (re-) exported from multiple modules."
It crashes for targeting (i686|x86_64)-win32.

  clang: clang/lib/AST/VTableBuilder.cpp:142: {anonymous}::FinalOverriders::OverriderInfo {anonymous}::FinalOverriders::getOverrider(const clang::CXXMethodDecl*, clang::CharUnits) const: Assertion `OverridersMap.count(std::make_pair(MD, BaseOffset)) && "Did not find overrider!"' failed.

llvm-svn: 230406
2015-02-25 00:18:22 +00:00
Jacques Pienaar 411b251cea clang-format: Change location of stashed token
Commit of patch in http://reviews.llvm.org/D7871

llvm-svn: 230395
2015-02-24 23:23:24 +00:00
Justin Bogner f07e34e9d8 InstrProf: Simplify a couple of tests after r230383
Most of the checks in these two tests were actually testing the
behaviour of the instrprof LLVM pass. Now that we're testing that
specifically in LLVM's test suite, it's better if we only test the
frontend's behaviour here.

llvm-svn: 230387
2015-02-24 21:49:28 +00:00
Jacques Pienaar a50178c23e CUDA: Add option to allow host device functions to call host functions
Commiting code from review http://reviews.llvm.org/D7841

llvm-svn: 230385
2015-02-24 21:45:33 +00:00
Richard Smith 7c9442a6ae PR22673 again: diagnose use of the used decl, not the found decl. This is also
wrong (DiagnoseUseOfDecl should take both), but it's more consistent with what
we do in other places.

llvm-svn: 230384
2015-02-24 21:44:43 +00:00
Richard Smith d3f2d321d7 PR22673: Don't forget to check a constructor for deletedness when we use it to
implicitly construct a temporary in a reference binding.

llvm-svn: 230381
2015-02-24 21:16:19 +00:00
Richard Smith 589cab5efb Add test that we reject invocations of deleted constructors. One of these
constructs is not rejected by should be; that's PR22673.

llvm-svn: 230370
2015-02-24 20:41:36 +00:00
Reid Kleckner 85c7e0a3f3 MS extensions: Properly diagnose address of MS property decl
Summary: Fixes PR22671.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 230362
2015-02-24 20:29:40 +00:00
Tim Northover bc784d1caa ARM: Simplify PCS handling.
The backend should now be able to handle all AAPCS rules based on argument
type, which means Clang no longer has to duplicate the register-counting logic
and the CodeGen can be significantly simplified.

llvm-svn: 230349
2015-02-24 17:22:40 +00:00
Michael Wong 867eeb5861 Commit patch for PR19649. Set the correct sign of wide character for literals based on underlying type of wchar_t.
Reviewed:
http://reviews.llvm.org/D7559
Patch by Rachel Craig; Test cases by Hubert Tong.

llvm-svn: 230333
2015-02-24 13:34:20 +00:00
Alexey Bataev d76df6d0ff [OPENMP] Update codegen for 'omp flush' directive.
__kmpc_omp_flush() runtime library now has only one argument and is not a vararg
anymore. This update makes the codegen compatible with these changes.

llvm-svn: 230331
2015-02-24 12:55:09 +00:00
Michael Kuperstein 4f818708a8 [WinX86_64 ABI] Treat C99 _Complex as a struct
MSVC does not support C99 _Complex.
ICC, however, does support it on windows x86_64, and treats it, for purposes of parameter passing, as equivalent to a struct containing two fields (for the real and imaginary part). 

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

llvm-svn: 230315
2015-02-24 09:35:58 +00:00
Manuel Klimek 7906f139c3 Fix codegen for virtual methods that are (re-) exported from multiple modules.
Fixes multiple crashes where a non-canonical decl would be used as key
in a lookup.

llvm-svn: 230314
2015-02-24 09:06:28 +00:00
Adrian Prantl a39924a1f8 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit r230305.
Off to fix another round of missing dependencies on various platforms.

llvm-svn: 230309
2015-02-24 05:14:17 +00:00
Ben Langmuir 1f6a32b3e7 Don't load Framework module.map files when searching subdirectories
This would cause frameworks to have spurious "redefinition" errors if
they had both a (legacy) "module.map" and a (new) "module.modulemap" file and we
happened to do a sub-directory search in that directory using a
non-framework include path (e.g. -Ifoo/ -Ffoo/).  For migration
purposes it's very handy that the compiler will prefer the new spelling
of the filename and not look at the old one if it doesn't need to.

llvm-svn: 230308
2015-02-24 04:58:15 +00:00
Adrian Prantl fc360dc30b Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

rdar://problem/19104245

This reapplies r230044 with a fixed configure+make build and updated
dependencies. Take 3.

llvm-svn: 230305
2015-02-24 04:25:59 +00:00
Justin Bogner c109102ecb InstrProf: Make sure counts in lambdas don't escape to the parent scope
When generating coverage maps, we were traversing the body as if it
were part of the parent function, but this doesn't make sense since
we're currently counting lambdas as separate functions.

llvm-svn: 230304
2015-02-24 04:13:56 +00:00
Richard Smith 7d7dee753d [modules] Properly check whether a declaration is std::initializer_list. This
bug is not actually modules-specific, but it's a little tricky to tickle it
outside of modules builds, so submitting with the reduced testcase I have.

llvm-svn: 230303
2015-02-24 03:30:14 +00:00
Richard Smith e3536dda40 [modules] Ensure we've imported all declarations of a template before
attempting to lazily deserialize its specializations; otherwise, there might be
pending specializations that we don't know about yet.

llvm-svn: 230301
2015-02-24 02:44:23 +00:00
Richard Smith e977e51d71 Refactor *TemplateDecl::addSpecialization to reduce duplication and add some
more asserts.

llvm-svn: 230296
2015-02-24 01:23:23 +00:00
Peter Collingbourne 4794190d81 CodeGenModule::EmitVTableBitSetEntries: Add check for identical bit set entries.
No two elements of this array should be the same, but the standard library
may pass the same element as both arguments to this function.

llvm-svn: 230293
2015-02-24 01:12:53 +00:00
Dmitri Gribenko a586ea13a4 Restore the libc++ definition of max_align_t on Apple platforms
Clang has introduced ::max_align_t in stddef.h in r201729, but libc++ was
already defining std::max_align_t on Darwin because there was none in the
global namespace.  After that Clang commit though, libc++ started defining
std::max_align_t to be a typedef for ::max_align_t, which has a different
definition.  This changed the ABI.  This commit restores the previous
definition.

rdar://19919394 rdar://18557982

llvm-svn: 230292
2015-02-24 01:06:22 +00:00
Justin Bogner d26f95bc94 Revert "Improve declaration / expression disambiguation around ptr-operators, and use"
This seems to break mixing function-style and c-style casts, and is
breaking bootstrapping llvm.

This reverts r230261.

llvm-svn: 230274
2015-02-23 22:36:28 +00:00
Dmitri Gribenko 78a38c9f6d Fix copy-paste errors in the test
llvm-svn: 230272
2015-02-23 22:08:10 +00:00
Richard Smith 152a172899 Improve declaration / expression disambiguation around ptr-operators, and use
the presence of an abstract declarator with a ptr-operator as proof that a
construct cannot parse as an expression to improve diagnostics along error
recovery paths.

llvm-svn: 230261
2015-02-23 21:16:05 +00:00
Joerg Sonnenberger 096feeb741 Only lower __builtin_setjmp / __builtin_longjmp to
llvm.eh.sjlj.setjmp / llvm.eh.sjlj.longjmp, if the backend is known to
support them outside the Exception Handling context. The default
handling in LLVM codegen doesn't work and will create incorrect code.
The ARM backend on the other hand will assert if the intrinsics are
used.

llvm-svn: 230255
2015-02-23 20:23:47 +00:00
Peter Collingbourne 0100e6c08c CFI: Improve design doc with larger virtual tables and asm examples.
llvm-svn: 230254
2015-02-23 20:22:17 +00:00
Zoran Jovanovic 5e7483a4c1 Fixed typo.
llvm-svn: 230253
2015-02-23 20:20:49 +00:00
Justin Bogner e4ca441a65 InstrProf: Run clang-format to fix some strange indentation (NFC)
Somehow this file ended up with a strange hybrid of the old "indent
inside a namespace" style and the new "don't", giving us a wonderful
two-space indent starting halfway through a namespace. Fix it.

llvm-svn: 230244
2015-02-23 19:27:00 +00:00
Reid Kleckner c4da9c8e50 -fms-extensions: Bump the default _MSC_VER from 1700 to 1800, aka VS2013
VS 2013 is the minimum supported version, so it's reasonable for Clang
to simulate this by default. This also simplifies the clang-cl
self-host, since we have the 18.00 version check.

llvm-svn: 230243
2015-02-23 19:25:48 +00:00
Mohit K. Bhakkad 69963e72f3 [TSan][Clang][MIPS] Enabled thread option for MIPS64 platform
Reviewers: kcc, samsonov, petarj, eugenis

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

llvm-svn: 230209
2015-02-23 09:32:35 +00:00
Ed Schouten 4992099b42 Add C11 *_DECIMAL_DIG.
Before C11 there was only the DECIMAL_DIG definition. As of C11, we now
have one definition per floating point type (e.g. DBL_DECIMAL_DIG).
Change the existing code to define the new versions. To remain backward
compatible, define __DECIMAL_DIG__ as __LDBL_DECIMAL_DIG__.

Also update the tests. It seems that some of the existing test vectors
were incorrect. Change all tests for __DECIMAL_DIG__ to expect
__LDBL_DECIMAL_DIG__. Add tests for *_DECIMAL_DIG for FreeBSD/amd64, as
I happen to have such a system laying around. I've validated that the
values are in sync with <float.h>.

llvm-svn: 230207
2015-02-23 09:12:31 +00:00
Nico Weber 6c4f606c08 Remove comment addressed by d0k in r229327.
llvm-svn: 230199
2015-02-23 02:23:19 +00:00
Larisse Voufo a65298af65 Relax the requirement on sized deallocation a bit: Default on unsized delete if sized delete is not provided in global scope, and -fdefine-sized-deallocation option is disabled.
llvm-svn: 230160
2015-02-22 06:36:53 +00:00
Larisse Voufo 01c97c0860 Fix typo.
llvm-svn: 230159
2015-02-22 06:36:49 +00:00
Larisse Voufo 0d0237f6cb Move -fdefine-sized-deallocation and -fno-sized-deallocation options from driver into CC1 for now.
llvm-svn: 230158
2015-02-22 06:36:46 +00:00
Nico Weber 805747956b Remove two unused methods. No behavior change.
llvm-svn: 230152
2015-02-22 00:27:32 +00:00
Richard Smith cf4bdde33a Cleanup: remove artificial division between lookup results and const lookup
results. No-one was ever modifying a lookup result, and it would not be
reasonable to do so.

llvm-svn: 230123
2015-02-21 02:45:19 +00:00
Richard Smith 40c7806451 Revert r167816 and replace it with a proper fix for the issue: do not
invalidate lookup_iterators and lookup_results for some name within a
DeclContext if the lookup results for a *different* name change.

llvm-svn: 230121
2015-02-21 02:31:57 +00:00
Hans Wennborg 5870373d19 Improve diagnostic when failing to synthesize implicit member due to dllexport (PR22591)
This is only a problem in C++03 mode targeting MS ABI (MinGW doesn't
export inline methods, and C++11 marks these methods implicitly
deleted).

Since targeting the MS ABI in pre-C++11 mode is a rare configuration,
this will probably not get fixed, but we can at least have a better
error message.

llvm-svn: 230115
2015-02-21 01:07:24 +00:00
Larisse Voufo 2e5c25ac77 Fix typo.
llvm-svn: 230114
2015-02-21 01:05:29 +00:00