Commit Graph

21830 Commits

Author SHA1 Message Date
Paul Robinson f067435026 Implement the 'optnone' attribute, which suppresses most optimizations
on a function.

llvm-svn: 205255
2014-03-31 22:29:15 +00:00
David Majnemer 2daf9b165e MS ABI: Add a test for Unicode literals
This adds coverage for Unicode code points which are encoded with
non-zero values in the upper half of the wchar_t.

No functionality change.

llvm-svn: 205251
2014-03-31 21:46:09 +00:00
Aaron Ballman fdd783a501 Unify __declspec attribute argument parsing with the common attribute argument parsing code.
This removes a diagnostic that is no longer required (the semantic engine now properly handles attribute syntax so __declspec and __attribute__ spellings no longer get mismatched). This caused several testcases to need updating for a slightly different wording.

llvm-svn: 205234
2014-03-31 18:18:43 +00:00
Aaron Ballman b8e203939e Introduced an attribute syntax-neutral method for parsing attribute arguments that is currently being used by GNU and C++-style attributes. This allows C++11 attributes with argument lists to be handled properly, fixing the "deprecated", "type_visibility", and capability-related attributes with arguments.
llvm-svn: 205226
2014-03-31 17:32:39 +00:00
Benjamin Kramer 9e135ddd1d Remove unused diagnostic + dead test for it.
llvm-svn: 205220
2014-03-31 16:55:01 +00:00
David Majnemer 7b4f7d2206 MS ABI: Make test introduced in r205217 more robust
Don't assume any particular IR Value name, pattern match the names from
the GEP instructions instead.

llvm-svn: 205218
2014-03-31 16:30:00 +00:00
David Majnemer 32b57b0a4c MS ABI: Use the proper type for inalloca args
Summary:
The definition of a type later in a translation unit may change it's
type from {}* to (%struct.foo*)*.  Earlier function definitions may use
the former while more recent definitions might use the later.  This is
fine until they interact with one another (like one calling the other).
In these cases, a bitcast is needed because the inalloca must match the
function call but the store to the lvalue which initializes the argument
slot has to match the rvalue's type.

This technique is along the same lines with what the other,
non-inalloca, codepaths perform.

This fixes PR19287.

Reviewers: rnk

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3224

llvm-svn: 205217
2014-03-31 16:12:47 +00:00
Tim Northover 0c68faa455 ARM64: enable aarch64-neon-intrinsics.c test
This adds support for the various NEON intrinsics used by
aarch64-neon-intrinsics.c (originally written for AArch64) and enables the
test.

My implementations are designed to be semantically correct, the actual code
quality looks like its a wash between the two backends, and is frequently
different (hence the large number of CHECK changes).

llvm-svn: 205210
2014-03-31 15:47:09 +00:00
Nico Rieck 8ca0bfc57f Sema: Require external linkage for dll attributes
llvm-svn: 205198
2014-03-31 14:56:58 +00:00
Nico Rieck 82f0b06749 Sema: Check dll attributes on redeclarations
A redeclaration may not add dllimport or dllexport attributes. dllexport is
sticky and can be omitted on redeclarations while dllimport cannot.

llvm-svn: 205197
2014-03-31 14:56:15 +00:00
Alexey Bataev d48bcd8a46 [OPENMP] Implemented 'copyin' clause
llvm-svn: 205164
2014-03-31 03:36:38 +00:00
NAKAMURA Takumi c1e8aa06aa clang/test/Preprocessor/headermap-rel2.c: Recognize dos path.
llvm-svn: 205152
2014-03-30 15:09:08 +00:00
Chandler Carruth 705cd965e3 Force a header file input to the headermap test to have different
contents than the header file by the same name under the system header
search root. Surprisingly, this is required to get the test to pass on
some systems.

So, it turns out that there exist filesystems in the world which unique
the inode of all files based on their contents. This results in two
files with the same contents at different paths suddenly having the same
inode. This doesn't actually cause any problems in practice as the
contents are the same, and the path used to access the files are the
same. However, it can cause tests like this one to be more brittle
because the file manager ends up de-duplicating the file entries by
inode. We don't have any other really easy ways to observe the behavior
shift because the whole point is that the #include written in the source
code doesn't contain the information -- instead it is contained in the
header map.

If folks have other solutions they would prefer, I'm more than happy to
work on them, but this seems a reasonable way to ensure that the test in
question exercises the code it wants to exercise.

llvm-svn: 205149
2014-03-30 14:04:32 +00:00
Chandler Carruth 1ae5a684a7 [ARM64] Use %clang_cc1 consistently in the new arm64 codegen tests.
Really, all tests outside of the Driver tree should use %clang_cc1, but
these are new and easy to fix, and many of them use buitlin headers
which don't work as well without using %clang_cc1.

llvm-svn: 205147
2014-03-30 13:40:57 +00:00
Hal Finkel ecdb454aa7 [PowerPC] Make -pg generate calls to _mcount not mcount
At least on REL6 (Linux/glibc 2.12), the proper symbol for generating gprof
data is _mcount, not mcount. Prior to this change, compiling with -pg would
generate linking errors (because of unresolved references to mcount), after
this change -pg seems at least minimally functional.

llvm-svn: 205144
2014-03-30 13:00:06 +00:00
David Majnemer ee4f4025c3 Sema: Implement DR317
Summary:
Declaring a function as inline after it has been defined is in violation
of [dcl.fct.spec]p4.  The program would get a strong definition instead
of getting a function with linkonce_odr linkage.

Reviewers: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3220

llvm-svn: 205129
2014-03-30 06:44:54 +00:00
Richard Smith 6190ee65e1 Tests for dr475-dr500.
llvm-svn: 205127
2014-03-30 06:05:29 +00:00
Tim Northover a2ee433c8d ARM64: initial clang support commit.
This adds Clang support for the ARM64 backend. There are definitely
still some rough edges, so please bring up any issues you see with
this patch.

As with the LLVM commit though, we think it'll be more useful for
merging with AArch64 from within the tree.

llvm-svn: 205100
2014-03-29 15:09:45 +00:00
David Majnemer af3698066a CodeGen: Don't crash when replacing functions
The peculiarities of C99 create scenario where an LLVM IR function
declaration may need to be replaced with a definition baring a different
type because the prototype and definition are not required to agree.

However, we were not properly deferring this when it occurred.

This fixes PR19280.

llvm-svn: 205099
2014-03-29 14:19:55 +00:00
Ted Kremenek ab57a1555a [-Wunreachable-code] Expand paren-suppression heuristic to C++/ObjC bools.
llvm-svn: 205074
2014-03-29 04:49:20 +00:00
Argyrios Kyrtzidis 48fb488706 [test] Add a triple to the test.
llvm-svn: 205073
2014-03-29 04:05:21 +00:00
Argyrios Kyrtzidis ca1aa4626d [test] Add a RUN line to get a hint on why the test is failing at the buildbots.
llvm-svn: 205072
2014-03-29 03:37:04 +00:00
Argyrios Kyrtzidis 7bd78a910a [HeaderSearch] Make sure we clear the mapped name from the LookupFileCacheInfo when we reset the start point.
rdar://16462455

llvm-svn: 205071
2014-03-29 03:22:54 +00:00
Ted Kremenek ec3bbf4933 Improve -Wunreachable-code to provide a means to indicate code is intentionally marked dead via if((0)).
Taking a hint from -Wparentheses, use an extra '()' as a sigil that
a dead condition is intentionally dead.  For example:

  if ((0)) { dead }

When this sigil is found, do not emit a dead code warning.  When the
analysis sees:

  if (0)

it suggests inserting '()' as a Fix-It.

llvm-svn: 205069
2014-03-29 00:35:20 +00:00
Fariborz Jahanian 6e94302ee3 Objective-C. Make -Wselector-type-mismatch off by
default until we provide a work-around for warning
suppression.

llvm-svn: 205066
2014-03-28 23:23:12 +00:00
Argyrios Kyrtzidis 6af9bc565e [SemaObjC] For the semantics of the designated-initializer attribute, consider that the ObjC interface of the class
includes its class extensions.

This is follow-up for rdar://16305347

llvm-svn: 205065
2014-03-28 22:45:38 +00:00
Dmitri Gribenko 237769ede5 libclang/libIndex: USR generation: mangle source location into USRs for macros,
unless the macro comes from a system header

llvm-svn: 205064
2014-03-28 22:21:26 +00:00
Hans Wennborg 5e91ef6326 Try to fix the cl-options.c test on ARM bots
The test was failing because clang-cl changes the default triple
to target MSVC-style Win32. This is kind of wonky, but hasn't been
a problem until we started warning:

  warning: unknown platform, assuming -mfloat-abi=soft

Some of the tests in cl-options.c were running with -Werror, causing them
to fail.

Fixing this by FileCheck-ifying those tests instead of using -Werror.

llvm-svn: 205049
2014-03-28 20:45:05 +00:00
Fariborz Jahanian 87f88c1850 Objective-C. revert r204965. This will make
-Wselector-type-mismatch default again. After
internal discussions, we think that in most cases
it has helped our developers find hard to detect
undefined behaviors. We are going to provide a syntax
(and fix-it) to suppress the warning in remaining of
false positive cases.

llvm-svn: 205024
2014-03-28 18:22:16 +00:00
Duncan P. N. Exon Smith d971cd1b18 InstrProf: Emit runtime hook directly in IRGen
-u behaviour is apparently not portable between linkers (see cfe-commits
discussions for r204379 and r205012).  I've moved the logic to IRGen,
where it should have been in the first place.

I don't have a Linux system to test this on, so it's possible this logic
*still* doesn't pull in the instrumented profiling runtime on Linux.

I'm in the process of getting tests going on the compiler-rt side
(llvm-commits "[PATCH] InstrProf: Add initial compiler-rt test").  Once
we have tests for the full flow there, the runtime logic should get a
whole lot less brittle.

<rdar://problem/16458307>

llvm-svn: 205023
2014-03-28 17:53:22 +00:00
Duncan P. N. Exon Smith 2d8f93e869 Revert "Link in profile library on Linux using --whole-archive"
This reverts commit r205012.

llvm-svn: 205022
2014-03-28 17:53:17 +00:00
Alexey Samsonov 4a37d60aca Link in profile library on Linux using --whole-archive
llvm-svn: 205012
2014-03-28 15:39:08 +00:00
Christian Pirker f01cd6f57b Add ARM big endian Target (armeb, thumbeb)
Reviewed at http://llvm-reviews.chandlerc.com/D3096

llvm-svn: 205008
2014-03-28 14:40:46 +00:00
Saleem Abdulrasool 377066a5f5 Use the new Windows environment for target detection
This follows the LLVM change to canonicalise the Windows target triple
spellings.  Rather than treating each Windows environment as a single entity,
the environments are now modelled properly as an environment.  This is a
mechanical change to convert the triple use to reflect that change.

llvm-svn: 204978
2014-03-27 22:50:18 +00:00
Fariborz Jahanian 1c43329e29 Objective-C. Make multiple selector warning
an opt-in option under -Wselector-type-mismatch.
// rdar://16445728

llvm-svn: 204965
2014-03-27 21:59:01 +00:00
David Blaikie 7e2fd943ae Support for -Wa,-compress-debug-sections.
Also, while I'm here, support -nocompress-debug-sections too.

llvm-svn: 204959
2014-03-27 20:47:30 +00:00
Stephan Tolksdorf 5604a27788 Don't emit exit-time destructor warnings for trivial explicitly defaulted dtors
This commit also adds an additional test case for the global destructor warning.

Reviewed in http://llvm-reviews.chandlerc.com/D3205

llvm-svn: 204954
2014-03-27 20:23:36 +00:00
Stephan Tolksdorf a6a0863470 Fix PR18307: Properly (de)serialize inherited constructors and their using declarations
Reviewed in http://llvm-reviews.chandlerc.com/D3102

llvm-svn: 204951
2014-03-27 19:22:19 +00:00
Dmitri Gribenko 7233cc5f9b Comment parsing: use different comment styles in different test cases
llvm-svn: 204944
2014-03-27 16:42:56 +00:00
Dmitri Gribenko ef099dc670 Comment parsing: attach comments to enums declared using the NS_ENUM macro
Previously we would only attach comments to the typedef.

llvm-svn: 204942
2014-03-27 16:40:51 +00:00
David Tweed ababa8f954 Enforce the restriction that a parameter to a kernel function
cannot be a pointer to the private address space (as clarified
in the OpenCL 1.2 specification).

Patch by Fraser Cormack!

llvm-svn: 204941
2014-03-27 16:34:11 +00:00
Dmitri Gribenko abfa261a63 Add a module cache path to the test that uses -fmodules
llvm-svn: 204938
2014-03-27 16:15:30 +00:00
Dmitri Gribenko 9ee0e303d6 Comment parsing: when comment ranges are deserialized from multiple modules,
correctly order comments in SourceManager::isBeforeInTranslationUnit() order

Unfortunately, this is not as simple as it was implemented previously, and
actually requires doing a merge sort.

llvm-svn: 204936
2014-03-27 15:40:39 +00:00
Rafael Espindola a39fc6dd2a Handle and warn on aliases to weak aliases.
This produces valid IR now that llvm rejects aliases to weak aliases and warns
the user that the resolution is not changed if the weak alias is overridden.

llvm-svn: 204935
2014-03-27 15:27:20 +00:00
Eric Christopher 4cbd0d9dc2 Revert "Just call getContextDescriptor to get the context for subprograms"
while I investigate as it seems to be causing issues with the gdb bot.

This reverts commit r204874.

llvm-svn: 204896
2014-03-27 05:29:34 +00:00
Richard Smith dc4ccaaf66 PR19252: Fix crash if alignas is used with an auto-typed variable. Don't check
the type of the variable until it's known.

llvm-svn: 204887
2014-03-27 01:22:48 +00:00
Rafael Espindola ef3e831965 Don't produce a L symbol in __DATA,__data.
The section __DATA,__data is atomized by the linker and cannot have L symbols.

llvm-svn: 204879
2014-03-27 00:02:45 +00:00
Reid Kleckner 185940a765 MS asm: Filter out fpsw clobbers
When parsing MS inline assembly, we note that fpsw is an implicit def of
most x87 FP operations, and add it to the clobber list.  However, we
don't recognize fpsw as a gcc register name, and we assert.  Clang
always adds an fpsr clobber, which means the same thing to LLVM, so we
can just use that.

This test case was broken by my LLVM change r196939.

Reviewers: echristo

Differential Revision: http://llvm-reviews.chandlerc.com/D2993

llvm-svn: 204878
2014-03-27 00:00:03 +00:00
Eric Christopher 43daad555d Just call getContextDescriptor to get the context for subprograms
instead of rolling an inefficient version of the function. This
changes some order of emission of metadata nodes, fix up those
testcases and make them more flexible to some changes.

llvm-svn: 204874
2014-03-26 23:09:30 +00:00
Reid Kleckner 55e3cec6ca Try to fix arm bots by removing a superfluous __cdecl
llvm-svn: 204872
2014-03-26 22:52:23 +00:00
Richard Smith 0f38374f71 PR19254: If a thread_local data member of a class is accessed via member access
syntax, don't forget to run its initializer.

llvm-svn: 204869
2014-03-26 22:48:22 +00:00
Fariborz Jahanian a773d08618 Objective-C. Improve diagnostic error for '@import'
when modules are disabled. // rdar://15505492

llvm-svn: 204862
2014-03-26 22:02:43 +00:00
Fariborz Jahanian ec762bda73 Objective-C. Fixes a bogus warning on unimplemented
selectors because we were not going through entire
elements in list of all implemented selectors. 
// rdar://16428638

llvm-svn: 204852
2014-03-26 20:59:26 +00:00
Logan Chien 74798a34e6 Fix atomic libcall.
This commit fixes a cast instruction assertion failure
due to the incompatible type cast.  This will only happen when
the target requires atomic libcalls.

llvm-svn: 204834
2014-03-26 17:35:01 +00:00
Jordan Rose 6b33c6f234 [analyzer] Handle the M_ZERO and __GFP_ZERO flags in kernel mallocs.
Add M_ZERO awareness to malloc() static analysis in Clang for FreeBSD,
NetBSD, and OpenBSD in a similar fashion to O_CREAT for open(2).
These systems have a three-argument malloc() in the kernel where the
third argument contains flags; the M_ZERO flag will zero-initialize the
allocated buffer.

This should reduce the number of false positives when running static
analysis on BSD kernels.

Additionally, add kmalloc() (Linux kernel malloc()) and treat __GFP_ZERO
like M_ZERO on Linux.

Future work involves a better method of checking for named flags without
hardcoding values.

Patch by Conrad Meyer, with minor modifications by me.

llvm-svn: 204832
2014-03-26 17:05:46 +00:00
Paul Robinson 5df175cec8 Recommit r204493 with a fix to look in both clang and llvm directories.
Hopefully addresses r204539.

Make clang/test/lit.cfg pre-scan the RUN line looking for tool names,
and substitute fully qualified path names pointing to the build
directory.  This ensures we're testing the just-built tools.

llvm-svn: 204831
2014-03-26 16:40:43 +00:00
Reid Kleckner c511f43b67 -Wglobal-constructors: Don't warn on trivial defaulted dtors
Fixes PR19253.

llvm-svn: 204825
2014-03-26 15:58:20 +00:00
Reid Kleckner 597e81dea1 -fms-extensions: Add __va_start builtin, which is used for x64
The main difference between __va_start and __builtin_va_start is that
the address of the va_list has already been taken, and the va_list is
always a char*.

__va_end and __va_arg are not needed.

llvm-svn: 204821
2014-03-26 15:38:33 +00:00
Renato Golin c491a8d457 Add support for __builtin___clear_cache in Clang
Adding the mapping between __builtin___clear_cache into @llvm.clear_cache

llvm-svn: 204820
2014-03-26 15:36:05 +00:00
Tim Northover 1a5b334e1c ARM: be more flexible about how --mhwdiv is accepted.
Patch by Gabor Ballabas.

llvm-svn: 204807
2014-03-26 14:09:48 +00:00
Joerg Sonnenberger 1f5984ca82 From Matt Thomas: use long long for [u]int64_t and [u]intmax_t on
NetBSD/aarch64 to simplify code sharing with NetBSD/arm.

llvm-svn: 204798
2014-03-26 11:48:29 +00:00
Timur Iskhodzhanov dd0a27664d Fix PR19066 - 0-sized vftable in the presence of virtual inheritance
Reviewed at http://llvm-reviews.chandlerc.com/D3181

llvm-svn: 204786
2014-03-26 08:12:53 +00:00
Richard Trieu 19582e9790 Add existing warnings to -Waddress so that it works closer to what GCC has.
Previously, -Waddress was empty.

Fixes PR9043.

llvm-svn: 204776
2014-03-26 01:55:33 +00:00
Alexander Kornienko 18fa48c9f9 Move the -i[no-]system-prefix options from CC1Options.td to Options.td.
Summary:
This allows them to be used without -cc1 the same way as -I and -isystem.
Renamed the options to --system-header-prefix=/--no-system-header-prefix to avoid interference with -isystem and make the intent of the option cleaner.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3185

llvm-svn: 204775
2014-03-26 01:39:59 +00:00
Bob Wilson 0ed74d9634 [PGO] Add simplified branch weights for Objective-C for-collection loops.
Conceptually one of these loops is just a while-loop, but the actual code-gen
is more complicated. We don't instrument all the different control flow edges
to get accurate counts for each conditional branch, nor do I think it makes
sense to do so. Instead, make the simplifying assumption that the loop behaves
like a while-loop. Use the same branch weights for the first check for an
empty collection as would be used for the back-edge of a while loop, and use
that same weighting for the innermost loop, ignoring the possibility that there
may be some extra code to go fetch more elements.

llvm-svn: 204767
2014-03-25 23:26:31 +00:00
Richard Smith d7b2a9ebd1 PR19249: Don't forget to DiagnoseUseOfDecl for the implicit use of a variable
in a lambda capture.

llvm-svn: 204757
2014-03-25 21:11:32 +00:00
Reid Kleckner 83055ade75 -fms-compatibility: Only form implicit member exprs for unqualified ids
If there are any scope specifiers, then a base class must be named or
the symbol isn't from a base class.

Fixes PR19233.

llvm-svn: 204753
2014-03-25 20:31:28 +00:00
Reid Kleckner d0fe317e0c MS ABI: Mark direct virtual bases as visted when building vtable paths
Fixes PR19240.  In retrospect, this is a fairly obvious bug.  :)

llvm-svn: 204744
2014-03-25 18:33:27 +00:00
Benjamin Kramer ab88f62614 Fix an logic error in the clang driver preventing crtfastmath.o from linking when -Ofast is used without -ffast-math
In gcc using -Ofast forces linking of crtfastmath.o.
In the current clang crtfastmath.o is only linked when -ffast-math/-funsafe-math-optimizations passed. It can lead to performance issues, when using only -Ofast without explicit -ffast-math (I faced with it).
My patch fixes inconsistency with gcc behaviour and also introduces few tests on it.

Patch by Zinovy Nis!

Differential Revision: http://llvm-reviews.chandlerc.com/D3114

llvm-svn: 204742
2014-03-25 18:02:07 +00:00
Hans Wennborg d8d49ba20e clang-cl: make /Gy imply -fdata-sections in addition to -ffunction-sections
llvm-svn: 204736
2014-03-25 17:50:25 +00:00
Jordan Rose b3ad07e0a6 [analyzer] Don't track retain counts of objects directly accessed through ivars.
A refinement of r198953 to handle cases where an object is accessed both through
a property getter and through direct ivar access. An object accessed through a
property should always be treated as +0, i.e. not owned by the caller. However,
an object accessed through an ivar may be at +0 or at +1, depending on whether
the ivar is a strong reference. Outside of ARC, we don't have that information,
so we just don't track objects accessed through ivars.

With this change, accessing an ivar directly will deliberately override the +0
provided by a getter, but only if the +0 hasn't participated in other retain
counting yet. That isn't perfect, but it's already unusual for people to be
mixing property access with direct ivar access. (The primary use case for this
is in setters, init methods, and -dealloc.)

Thanks to Ted for spotting a few mistakes in private review.

<rdar://problem/16333368>

llvm-svn: 204730
2014-03-25 17:10:58 +00:00
Hans Wennborg 5149a3b837 clang-cl: Forward /Gy or /Gy- when falling back to cl.exe
llvm-svn: 204723
2014-03-25 14:48:54 +00:00
Richard Smith 961eae5f95 Save out a correct lookup table if a lookup table entry is stale (it contains
an out-of-date external decls list). This happens if we declare some names,
force the lookup table for the decl context to be built, import a module that
adds more decls for the name, then write out our module without looking up the
name.

llvm-svn: 204694
2014-03-25 01:14:22 +00:00
Richard Smith 750f511f11 Fix a bug where an explicit instantiation declaration of a class template
specialization would make us think it might have a key function.

llvm-svn: 204686
2014-03-24 23:54:09 +00:00
Eli Bendersky cb39943f6f Proper handling of static local variables with address space qualifiers.
Similar to the implementation for globals in r157167.

Patch by Jingyue Wu.

llvm-svn: 204677
2014-03-24 22:05:38 +00:00
David Majnemer 58e5bee17a MS ABI: Eliminate Duplicate Strings
COFF doesn't have mergeable sections so LLVM/clang's normal tactics for
string deduplication will not have any effect.

To remedy this we place each string inside it's own section and mark
the section as IMAGE_COMDAT_SELECT_ANY.  However, we can only do this if the
string has an external name that we can generate from it's contents.

To be compatible with MSVC, we must use their scheme.  Otherwise identical
strings in translation units from clang may not be deduplicated with
translation units in MSVC.

This fixes PR18248.

N.B. We will not attempt to do anything with a string literal which is not of
type 'char' or 'wchar_t' because their compiler does not support unicode
string literals as of this date.  Further, we avoid doing this if
either -fwritable-strings or -fsanitize=address are present.

This reverts commit r204596.

llvm-svn: 204675
2014-03-24 21:43:36 +00:00
Warren Hunt c89450e054 [MS-ABI] Drop Special Layout in 64-bit mode.
As of cl.exe version 18, the special layout rules for structs with 
alignment 16 or greater has been dropped.  This patch drops the behavior 
from clang.  This patch also updates the lit tests to reflect the 
change.

llvm-svn: 204674
2014-03-24 21:37:27 +00:00
Adrian Prantl 9b963516a3 Cleanup testcase by adding return statements and replacing CHECK-DAG's with
plain old CHECKs.

Follow-up to r204633.

llvm-svn: 204670
2014-03-24 21:19:34 +00:00
Will Schmidt 5fa50f3c57 Update the powerpc64le check to include CALL_ELF=2 check.
This is a testcase follow-up to r204627.
(see also r204614 for CALL_ELF usage).

llvm-svn: 204669
2014-03-24 21:09:16 +00:00
Aaron Ballman 69e6e7c604 Capability attributes can now be declared on a typedef declaration as well as a structure declaration. This allows for C code to use Boolean expressions on a capability as part of another attribute. Eg) __attribute__((requires_capability(!SomeCapability)))
llvm-svn: 204657
2014-03-24 19:29:19 +00:00
Bob Wilson 5c65065605 Use CHECK-DAG in a test so that it isn't sensitive to metadata order.
This was failing on an internal branch where the order was different for
some reason. <rdar://problem/16407581>

llvm-svn: 204633
2014-03-24 18:14:15 +00:00
Will Schmidt c1fc190913 Update the parameters passed to the assembler and linker for
the PPC64LE target.  Specifically:
(assembler) adds/uses  -mppc64 -mlittle-endian
(linker) adds/uses  elf64lppc

Testcase included.

llvm-svn: 204626
2014-03-24 17:10:37 +00:00
Will Schmidt 0c67b7e3f2 Update DataLayout/DescriptionString for ppc64le
Update DataLayout/DescriptionString for ppc64le

Similar LLVM change made in r203664

Testcase included.

llvm-svn: 204613
2014-03-24 15:48:02 +00:00
Christian Pirker 227f5ed547 AArch64_BE test case for predefined macros
llvm-svn: 204604
2014-03-24 13:57:21 +00:00
Timur Iskhodzhanov 89f588ff73 Revert r204562,204566,204586,204587 as they broke ASan on Windows
llvm-svn: 204596
2014-03-24 10:31:09 +00:00
David Majnemer 914d8c0f48 CodeGen: Remove unneeded directives
Use two check-prefix patterns per FileCheck invocation for these tests,
this cleanly removes redundant CHECK directives.

Thanks to Richard Smith for the idea!

llvm-svn: 204587
2014-03-24 05:53:11 +00:00
David Majnemer 96bc4b0367 MS ABI: Add tests, other cleanups for r204562
This commit cleans up a few accidents:
- Do not rely on the order in which StringLiteral lays out bytes.
- Use a more efficient mechanism for handling so-called
  "special-mappings" when mangling string literals.
- There is no need to allocate a copy of the mangled name.
- Add the test written for r204562.

Thanks to Richard Smith for pointing these out!

llvm-svn: 204586
2014-03-24 05:53:08 +00:00
Nico Rieck 0854e59281 Fix tests in r204576
Proper redeclaration warnings for dllimport are not implemented yet.

llvm-svn: 204577
2014-03-23 22:07:53 +00:00
Nico Rieck e84f8db709 Treat dllimport globals without explicit storage class as extern
dllimport implies a definition which means the 'extern' keyword is optional
when declaring imported variables.

llvm-svn: 204576
2014-03-23 21:24:01 +00:00
Richard Smith eb8cc3d454 Add missing file from r204570.
llvm-svn: 204574
2014-03-23 21:01:41 +00:00
Richard Smith ecf74ff40a Consistently dump default template arguments for template parameters as 'TemplateArgument's.
llvm-svn: 204572
2014-03-23 20:50:39 +00:00
Richard Smith e3a97029da If a name is injected into an imported inline namespace without reopening that
namespace, we need to update both the visible names of that namespace and of
its enclosing namespace set.

llvm-svn: 204570
2014-03-23 20:41:56 +00:00
Richard Smith 561e0dce59 When we inject a declaration into a namespace, add the primary DeclContext to
the update set rather than the current DeclContext. Add test for the local
extern case too.

llvm-svn: 204568
2014-03-23 19:45:26 +00:00
Timur Iskhodzhanov f599d6f957 Simplify test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp by forcing VFTableBuilder invocation with virtual function calls or constructors codegen
Previously the vftables were built at the end of the TU in a reverse-to-random order

llvm-svn: 204567
2014-03-23 19:09:08 +00:00
David Majnemer b46a017248 CodeGen: Make string tests exercise the MS ABI
r204562 unwittingly failed tests for some bots.  Make those tests work
with both the Itanium and MS ABIs.

llvm-svn: 204566
2014-03-23 18:22:10 +00:00
David Majnemer da39ab299a Driver: Map /Gy to -ffunction-sections
/Gy is equivalent to -ffunction-sections.
/Gy- is equivalent to -fno-function-sections.

Currently, LLVM doesn't do anything interesting with -ffunction-sections
under WinCOFF.

llvm-svn: 204564
2014-03-23 17:47:22 +00:00
David Majnemer ca11641a41 Driver: cleanup /vd2 test
/vd2 is not ignored anymore, remove it from the ignored list.

Add a test to ensure that it does the right thing.

llvm-svn: 204563
2014-03-23 17:47:18 +00:00
David Majnemer 3843a05edf MS ABI: Eliminate Duplicate Strings
COFF doesn't have mergeable sections so LLVM/clang's normal tactics for
string deduplication will not have any effect.

To remedy this we place each string inside it's own section and mark
the section as IMAGE_COMDAT_SELECT_ANY.  However, we can only do this if the
string has an external name that we can generate from it's contents.

To be compatible with MSVC, we must use their scheme.  Otherwise identical
strings in translation units from clang may not be deduplicated with
translation units in MSVC.

This fixes PR18248.

N.B. We will not attempt to do anything with a string literal which is not of
type 'char' or 'wchar_t' because their compiler does not support unicode
string literals as of this date.

llvm-svn: 204562
2014-03-23 17:47:16 +00:00
Richard Smith c264d35adc If a template instantation introduces a name into a namespace, we need to write
out a visible update record for that namespace even if it was never declared in
this module.

llvm-svn: 204554
2014-03-23 02:30:01 +00:00
Richard Smith 04d05b5fa7 If an update record makes a declaration interesting, pass it to the consumer.
llvm-svn: 204550
2014-03-23 00:27:18 +00:00
Richard Smith d28ac5b998 Emit an update record if we instantiate the definition of a function template
specialization from a module. (This can also happen for function template
specializations in PCHs if they're instantiated eagerly, because they're
constexpr or have a deduced return type.)

llvm-svn: 204547
2014-03-22 23:33:22 +00:00
NAKAMURA Takumi 06246f10cd Revert r204493, "Make clang/test/lit.cfg pre-scan the RUN line looking for tool names,"
It was incompatible to standlalone clang build.

llvm-svn: 204539
2014-03-22 04:46:59 +00:00
Richard Smith 0ac1b8fd07 Refactor: move loading pending instantiations from chained PCHs to a more appropriate place, so that we only ask the external source once.
llvm-svn: 204535
2014-03-22 01:43:32 +00:00
Adrian Prantl 7b622ca9d9 relax testcase to unbreak windows buildbots.
llvm-svn: 204531
2014-03-21 22:58:28 +00:00
Kaelyn Uhrain ec2629964e Be a bit smarter about what nested name qualifiers to allow when
performing typo correction on very short (1 or 2 char) identifiers.

llvm-svn: 204525
2014-03-21 21:54:25 +00:00
Adrian Prantl bebb89359a CGDebugInfo: At the end of EmitFunctionStart, Initialize PrevLoc to the
location that the next call emitLocation() would default to. Otherwise
setLocation() may wrongly believe that the current source file didn't
change, when in fact it did.

llvm-svn: 204517
2014-03-21 21:01:58 +00:00
Paul Robinson bf8d3a00d3 Make clang/test/lit.cfg pre-scan the RUN line looking for tool names,
and substitute fully qualified path names pointing to the build
directory.  This ensures we're testing the just-built tools.

llvm-svn: 204493
2014-03-21 18:13:35 +00:00
Aaron Ballman df115d9bf3 The release_capability, release_shared_capability and release_generic_capability functions are now functionally distinct for capability analysis. The unlock_function attribute maps directly to release_generic_capability.
llvm-svn: 204469
2014-03-21 14:48:48 +00:00
Timur Iskhodzhanov c84eb81ac6 Simplify test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance-vtordisps.cpp by forcing VFTableBuilder invocation with virtual function calls
Previously the vftables were built at the end of the TU in a reverse-to-random order

llvm-svn: 204465
2014-03-21 13:27:08 +00:00
Timur Iskhodzhanov 341481ddb0 Simplify test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance.cpp by forcing VFTableBuilder invocation with virtual function calls
Previously the vftables were built at the end of the TU in a reverse-to-random order

llvm-svn: 204464
2014-03-21 13:11:09 +00:00
Timur Iskhodzhanov 503e2f2c58 Simplify test/CodeGenCXX/microsoft-abi-vtables-single-inheritance.cpp by forcing VFTableBuilder invocation with virtual function calls
Previously the vftables were built at the end of the TU in a reverse-to-random order

llvm-svn: 204455
2014-03-21 11:39:24 +00:00
Timur Iskhodzhanov 67c969367a Add one more test for PR19172
llvm-svn: 204453
2014-03-21 11:07:24 +00:00
Alexey Samsonov e1237993c7 Kill deprecated -fbounds-checking flag
llvm-svn: 204436
2014-03-21 07:15:47 +00:00
Ted Kremenek 1421037ece [-Wunreachable-code] add a specialized diagnostic for unreachable increment expressions of loops.
llvm-svn: 204430
2014-03-21 06:02:36 +00:00
Alexey Bataev 62c87d2509 [OPENMP] parsing of clause 'safelen' (for directive 'omp simd')
llvm-svn: 204428
2014-03-21 04:51:18 +00:00
Richard Smith 5652c0f448 Serialize and deserialize mangling numbers.
llvm-svn: 204423
2014-03-21 01:48:23 +00:00
Richard Smith 56be754262 PR19215: When writing/reading a PCH that imported a module, store the location
at which that PCH imported each visible submodule of the module. Such locations
are needed when synthesizing macro directives resulting from the import.

llvm-svn: 204417
2014-03-21 00:33:59 +00:00
Alexander Kornienko 36155dd274 Fixed newlines.
llvm-svn: 204413
2014-03-21 00:07:27 +00:00
Duncan P. N. Exon Smith 7c41451bc9 PGO: Don't define instrumentation data available_externally
Variables with available_externally linkage can be dropped at will.
This causes link errors, since there are still references to the
instrumentation!  linkonce_odr is almost equivalent, so use that
instead.

As a drive-by fix (I don't have an Elf system, so I'm not sure how to
write a testcase), use linkonce linkage for the instrumentation of
extern_weak functions.

<rdar://problem/15943240>

llvm-svn: 204408
2014-03-20 22:50:08 +00:00
Richard Smith 564417a071 When the exception specification for a function in an imported PCH or module is
resolved, emit an update record.

llvm-svn: 204403
2014-03-20 21:47:22 +00:00
DeLesley Hutchins d7fa5bd431 Consumed Analysis: IgnoreParens bugfix.
llvm-svn: 204395
2014-03-20 20:39:20 +00:00
Timur Iskhodzhanov ba5570221d Fix PR19172 - wrong this adjustment calculated for virtual destructor in a class with complex inheritance
Reviewed at http://llvm-reviews.chandlerc.com/D3128

llvm-svn: 204394
2014-03-20 20:38:34 +00:00
Duncan P. N. Exon Smith a7807637bf PGO: Change runtime prefix from pgo to profile
These functions are in the profile runtime.  PGO comes later.

Unfortunately, there's only room for 16 characters in a Darwin section,
so use __llvm_prf_ instead of __llvm_profile_ for section names.

<rdar://problem/15943240>

llvm-svn: 204390
2014-03-20 20:00:41 +00:00
Ted Kremenek d4576318b4 [-Wunreachable-code] Tweak isTrivialDoWhile() to handle implicit casts.
llvm-svn: 204376
2014-03-20 18:47:53 +00:00
Ben Langmuir c3ea5654f9 Prevent lookup of subframework modules by name without parent framework
We were 'allowing' the following import
@import Sub;

where Sub is a subframework of Foo and we had a -F path inside
Foo.framework/Frameworks and no module map file for Sub. This would
later hit assertion failures in debug builds.

Now we should correctly diagnose this as a module not found error.

llvm-svn: 204368
2014-03-20 18:27:26 +00:00
Aaron Ballman 18d85aed39 Replacing the exclusive_lock_function, shared_lock_function and unlock_function attributes with the acquire_capability and release_capability attributes. The old spellings will continue to work, but the underlying semantic attributes have been replaced.
Downgraded the capability diagnostics from error to warning to match the desired behavior, and updated the existing test cases.

llvm-svn: 204350
2014-03-20 16:02:49 +00:00
Jordan Rose 202113ff5b Remove wchar_t* buffer from scanf format fix-it test.
Amends r204300 to not try to test fixing a wchar_t* to "%ls", which we don't
do correctly anyway. In C mode, wchar_t is just a typedef for a normal
primitive integer type, not a distinct type like it is in C++. To make this
work correctly, we'll need to look for the wchar_t typedef, not just the
builtin type.

Should fix the buildbots.

llvm-svn: 204349
2014-03-20 15:54:16 +00:00
Evgeniy Stepanov 2bfcaabdec [msan] -fsanitize-memory-track-origins=[level] flag and docs.
This change turns -fsanitize-memory-track-origins into
-fsanitize-memory-track-origins=[level] flag (keeping the old one for
compatibility). Possible levels are 0 (off), 1 (default) and 2 (incredibly
detailed). See docs (part of this patch) for more info.

llvm-svn: 204346
2014-03-20 14:58:36 +00:00
NAKAMURA Takumi d49823667d Make format-strings-fixit.c aware of "%hu" uint16_t on wchar_t for targeting win32.
llvm-svn: 204334
2014-03-20 10:54:53 +00:00
Alexey Samsonov cb3f812b6b Kill -faddress-sanitizer, -fthread-sanitizer and -fcatch-undefined-behavior flags.
These flags are deprecated since at least Clang 3.3. Users should instead
use -fsanitize= with appropriate values.

llvm-svn: 204330
2014-03-20 10:48:29 +00:00
Ted Kremenek f5ae0bc671 [-Wunreachable-code] Look through member accesses for 'static const bool' configuration values.
llvm-svn: 204315
2014-03-20 06:44:35 +00:00
Ted Kremenek 2766ad27e8 [-Wunreachable-code] constexpr functions can be used as configuration values.
llvm-svn: 204308
2014-03-20 06:07:35 +00:00
Ted Kremenek f3c93bb61b [-Wunreachable-code] Simplify and broad -Wunreachable-code-return, including nontrivial returns.
The exception is return statements that include control-flow,
which are clearly doing something "interesting".

99% of the cases I examined for -Wunreachable-code that fired
on return statements were not interesting enough to warrant
being in -Wunreachable-code by default.  Thus the move to
include them in -Wunreachable-code-return.

This simplifies a bunch of logic, including removing the ad hoc
logic to look for std::string literals.

llvm-svn: 204307
2014-03-20 06:07:30 +00:00
Jordan Rose 177b0a3600 scanf format checking: include the buffer length in the fix-it for %s.
Patch by Zach Davis!

llvm-svn: 204300
2014-03-20 03:32:39 +00:00
Ben Langmuir 984e1df77a Add a new spelling for module map files 'module.modulemap'
This name, while more verbose, plays more nicely with tools that use
file extensions to determine file types. The existing spelling
'module.map' will continue to work, but the new spelling will take
precedence.

In frameworks, this new filename will only go in a new 'Modules'
sub-directory.

Similarly, add a module.private.modulemap corresponding to
module_private.map.

llvm-svn: 204261
2014-03-19 20:23:34 +00:00
Dmitri Gribenko dbff5c71fa Comment parsing: fix a crash when dumping comment ast for a function template
with variadic parameters

Patch by Joe Ranieri.

llvm-svn: 204236
2014-03-19 14:03:47 +00:00
Dmitri Gribenko d9eb05aca3 Comment parsing: recognize \param ... on function templates with variadic
parameters

Patch by Joe Ranieri.

llvm-svn: 204235
2014-03-19 13:59:36 +00:00
Manuel Klimek 98a9a6c667 Use the expansion location of the file name when finding the module.
The spelling location of stringified strings is not a file location.
Optimally, we'll want to solve the problem (as the FIXME states) by
handing in the right FileEntry of the #include location.

llvm-svn: 204220
2014-03-19 10:22:36 +00:00
Richard Smith 17710217fa Tests for DR450-475.
llvm-svn: 204217
2014-03-19 08:04:12 +00:00
Richard Smith 997ff02c7b Fix a typo in r204164 that made *all* keywords available in OpenCL mode.
llvm-svn: 204196
2014-03-18 22:43:19 +00:00
Justin Bogner b4416f58d5 CodeGen: Include a function hash in instrumentation based profiling
The hash itself is still the number of counters, which isn't all that
useful, but this separates the API changes from the actual
implementation of the hash and will make it easier to transition to
the ProfileData library once it's implemented.

llvm-svn: 204186
2014-03-18 21:58:06 +00:00
Yunzhong Gao fcdc45ff2d Creating a printing policy for "half":
Since "half" is an OpenCL keyword and clang accepts __fp16 as an extension for
other languages, error messages and metadata (and hence debug info) should refer
to the half-precision floating point as "__fp16" instead of "half" when
compiling for non-OpenCL languages. This patch creates a new printing policy for
half in a similar manner to what is done for bool and wchar_t.

Differential Revision: http://llvm-reviews.chandlerc.com/D2952

llvm-svn: 204164
2014-03-18 17:55:18 +00:00
Marshall Clow d28acc0d98 Added a __has_feature() for 'is_constructible'
llvm-svn: 204153
2014-03-18 14:13:10 +00:00
Matthew Curtis 68f426ef15 modify declare-use.S to work when full toolchain not present
Test doesn't actually require production of an object file and for
some targets (e.g. hexagon) an assembler is not always available when
lit tests are run.

llvm-svn: 204144
2014-03-18 12:25:27 +00:00
NAKAMURA Takumi a65db1e9ee clang/test/Driver/sanitizer-ld.c: Tweak to accept dos path.
llvm-svn: 204138
2014-03-18 10:47:10 +00:00
Viktor Kutuzov aa5b5f7b0d Add support for sanitizers arguments on FreeBSD
llvm-svn: 204129
2014-03-18 09:36:50 +00:00
NAKAMURA Takumi 4156d525bd clang/test/Modules/cxx-templates.cpp: Tweak for dos path.
llvm-svn: 204116
2014-03-18 05:58:02 +00:00
Adrian Prantl f521af81ef Debug info: Update testcases to new DIBuilder behaviour. Variables now
store DIRefs to their types for improved type uniquing.

llvm-svn: 204105
2014-03-18 02:34:54 +00:00
Richard Smith cbdf733dba AST dumper: if we have multiple implicit instantiations of the same class
template specialization (from different modules), dump them all, so that every
declaration is dumped somewhere.

llvm-svn: 204100
2014-03-18 02:07:28 +00:00
Richard Smith 6a70c6420f Remove 'REQUIRES: LP64' from these tests and use a more targeted fix.
llvm-svn: 204096
2014-03-18 00:30:09 +00:00
Fariborz Jahanian 19a08bbb9a Objective-C. No need to issue deprecated warning if deprecated method
in class extension is being implemented in primary class implementation
(no overriding is involved).
// rdar://16249335

llvm-svn: 204093
2014-03-18 00:10:37 +00:00
Richard Smith baf3ca5c01 Don't fold together the name lookup entries for two declarations if they are
declared in different namespaces in the same inline namespace set.

llvm-svn: 204082
2014-03-17 21:46:03 +00:00
Fariborz Jahanian ba419ce21d Objective-C. Consider blocks for designated initializer
warnings (warning or lack there of) as well since
blocks are another pattern for envoking other
designated initializers. // rdar://16323233

llvm-svn: 204081
2014-03-17 21:41:40 +00:00
Duncan P. N. Exon Smith 2fe531cb07 PGO: Statically generate data structures
In instrumentation-based profiling, we need a set of data structures to
represent the counters.  Previously, these were built up during static
initialization.  Now, they're shoved into a specially-named section so
that they show up as an array.

As a consequence of the reorganizing symbols, instrumentation data
structures for linkonce functions are now correctly coalesced.

This is the first step in a larger project to minimize runtime overhead
and dependencies in instrumentation-based profilng.  The larger picture
includes removing all initialization overhead and making the dependency
on libc optional.

<rdar://problem/15943240>

llvm-svn: 204080
2014-03-17 21:18:30 +00:00
Fariborz Jahanian 83d674e007 Objective-C. Do not warn when an instance method and
class method with the same selctor but different argument 
types having one of them in class extension.
// rdar://16312105

llvm-svn: 204065
2014-03-17 17:46:10 +00:00
Richard Smith 650459721a Remove unused variable from test.
llvm-svn: 204051
2014-03-17 16:53:13 +00:00
NAKAMURA Takumi 23b5eaf706 clang/test/CXX/drs: Add "REQUIRES:LP64" to a couple of tests in r204033. [PR8833]
llvm-svn: 204038
2014-03-17 11:55:46 +00:00
Richard Smith ba41a73993 Tests for DR400-450.
llvm-svn: 204033
2014-03-17 08:20:10 +00:00
Richard Smith d292b24f94 PR19152: If a variable template's type involves 'auto', instantiate the
initializer with the variable in order to determine the type.

llvm-svn: 204015
2014-03-16 01:00:40 +00:00
Stephan Tolksdorf e96f8b3774 Fix PR18806: Canonicalize the replacement type when deserializing a SubstTemplateTypeParmType
What's going on in the test case (without the patch applied) is this:

When the header is parsed, decltype(B()) is canonicalized to decltype(Y()),
because that was the first parsed equivalent decltype expression. Hence, the
TemplateSpecializationType for Id<decltype(B())> ends up with
SubstTemplateTypeParmType(T, decltype(Y())) as the AliasedType member.

When the PCH file is included and the AST reader reads Id<decltype(B())>, it
sees decltype(B()) before decltype(Y()). So, this time decltype(B()) ends up
being the canonical type for both decltypes, which leads to an assert violation
when the reader calls getSubstTemplateTypeParmType with the non-canonical
decltype(Y()) as the replacement type.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits, aemerson

Differential Revision: http://llvm-reviews.chandlerc.com/D3073

llvm-svn: 204005
2014-03-15 10:23:27 +00:00
Ted Kremenek 9dfe400dc2 -Wunreachable-code: treat 'const bool' locals as control values.
llvm-svn: 204001
2014-03-15 06:47:45 +00:00
Ted Kremenek ad8753c00e Further refine -Wunreachable-code groups so that -Wno-unreachable-code-break doesn't turn off all unreachable code warnings.
Also relax unreachable 'break' and 'return' to not check for being
preceded by a call to 'noreturn'.  That turns out to not be so
interesting in practice.

llvm-svn: 204000
2014-03-15 05:47:06 +00:00
Ted Kremenek 1a8641c1e7 Start breaking -Wunreachable-code up into different diagnostic groups.
Recent work on -Wunreachable-code has focused on suppressing uninteresting
unreachable code that center around "configuration values", but
there are still some set of cases that are sometimes interesting
or uninteresting depending on the codebase.  For example, a dead
"break" statement may not be interesting for a particular codebase,
potentially because it is auto-generated or simply because code
is written defensively.

To address these workflow differences, -Wunreachable-code is now
broken into several diagnostic groups:

-Wunreachable-code: intended to be a reasonable "default" for
most users.

and then other groups that turn on more aggressive checking:

-Wunreachable-code-break: warn about dead break statements

-Wunreachable-code-trivial-return: warn about dead return statements
that return "trivial" values (e.g., return 0).  Other return
statements that return non-trivial values are still reported
under -Wunreachable-code (this is an area subject to more refinement).

-Wunreachable-code-aggressive: supergroup that enables all these
groups.

The goal is to eventually make -Wunreachable-code good enough to
either be in -Wall or on-by-default, thus finessing these warnings
into different groups helps achieve maximum signal for more users.

TODO: the tests need to be updated to reflect this extra control
via diagnostic flags.

llvm-svn: 203994
2014-03-15 01:26:32 +00:00
Richard Smith ae385084c5 Implement the MS extension __identifier properly: take a token and strip it of
its keywordliness.

llvm-svn: 203987
2014-03-15 00:06:08 +00:00
Richard Smith 594461f02c Call RequireCompleteType when performing ADL even if the type is already
complete. We hook into this check from a couple of other places (modules,
debug info) so it's not OK to elide the check if the type was already
complete.

llvm-svn: 203978
2014-03-14 22:07:27 +00:00
Richard Smith 7e34fbdaa0 Add two missing entries to the C++11 support page. Bump one relevant diagnostic
(for an integer too large for any signed type) from Warning to ExtWarn -- it's
ill-formed in C++11 and C99 onwards, and UB during translation in C89 and
C++98. Add diagnostic groups for two relevant diagnostics.

llvm-svn: 203974
2014-03-14 21:21:24 +00:00
Fariborz Jahanian 312104a716 Objective-C. Turn off designated initialization warnings on
'init' methods which are unavailable. Subclasses of NSObject
have to implement such methods as a common pattern to prevent
user's own implementation. // rdar://16305460

llvm-svn: 203966
2014-03-14 20:35:00 +00:00
Fariborz Jahanian 6efab6eed7 Objective-C. Allow objc_designated_initializer for private
initializers; but only those declared in class extensions
(not in implementations). // rdar://16305347

llvm-svn: 203954
2014-03-14 18:19:46 +00:00
Timur Iskhodzhanov f1749427c5 Fix PR19104: Incorrect handling of non-virtual calls of virtual methods
Reviewed at http://llvm-reviews.chandlerc.com/D3054

llvm-svn: 203949
2014-03-14 17:43:37 +00:00
Christian Pirker 44f7cdc2fc clang/test/CodeGen/aarch64-varargs.c: works now regardless of assertions.
llvm-svn: 203944
2014-03-14 16:30:06 +00:00
Fariborz Jahanian a5a469efbd Objective-C++ IRGen. Due to change to AST for initialization of c++11’s
data members by addition of CXXDefaultInitExpr node to the initializer expression, 
it has broken treatment of arc code for such initializations. Reviewed by John McCall.
// rdar://16299964

llvm-svn: 203935
2014-03-14 15:40:54 +00:00
Daniel Jasper 5c77e39f2d Don't verify module inclusions in assembler files.
llvm-svn: 203929
2014-03-14 14:53:17 +00:00
NAKAMURA Takumi 3554912129 clang/test/CodeGen/aarch64-varargs.c: Suppress this for -Asserts, for now.
llvm-svn: 203920
2014-03-14 12:42:41 +00:00
Christian Pirker a74c7914ad AArch64_be specific clang target settings
llvm-svn: 203918
2014-03-14 12:15:45 +00:00
Christian Pirker f5164229f3 AArch64_be varargs processing for ARM ABI
llvm-svn: 203917
2014-03-14 11:51:06 +00:00
Argyrios Kyrtzidis 6d0753d42a [Modules] Emit the module file paths as dependencies of the PCH when we are building one.
This is because the PCH is tied to the module files, if one of the module files changes or gets removed
the build system should re-build the PCH file.

rdar://16321245

llvm-svn: 203885
2014-03-14 03:07:38 +00:00
Argyrios Kyrtzidis 68ccbe01b0 [Modules] Make sure that the synthesized file "__inferred_module.map" doesn't show up as dependency of a module file.
Follow-up for rdar://15459210

llvm-svn: 203882
2014-03-14 02:26:31 +00:00
Tim Northover 9c177223bc CodeGen: make use of weaker failure orders on cmpxchg.
This makes Clang take advantage of the recent IR addition of a
"failure" memory ordering requirement. As with the "success" ordering,
we try to emit just a single version if the expression is constant,
but fall back to runtime detection (to allow optimisation across
function-call boundaries).

rdar://problem/15996804

llvm-svn: 203837
2014-03-13 19:25:48 +00:00
Jordan Rose 821a3a0f77 [analyzer] Warn when passing pointers to const but uninitialized memory.
Passing a pointer to an uninitialized memory buffer is normally okay,
but if the function is declared to take a pointer-to-const then it's
very unlikely it will be modifying the buffer. In this case the analyzer
should warn that there will likely be a read of uninitialized memory.

This doesn't check all elements of an array, only the first one.
It also doesn't yet check Objective-C methods, only C functions and
C++ methods.

This is controlled by a new check: alpha.core.CallAndMessageUnInitRefArg.

Patch by Per Viberg!

llvm-svn: 203822
2014-03-13 17:55:39 +00:00
Richard Smith 4a558a44a0 Tests for DR389-399.
llvm-svn: 203771
2014-03-13 08:40:37 +00:00
Joerg Sonnenberger 52be0b4cf4 Always use --eh-frame-hdr on NetBSD, even for -static.
llvm-svn: 203742
2014-03-13 00:42:01 +00:00
Richard Smith aae4058453 PR18275: If a member function of a class template is declared with a
const-qualified parameter type and the defined with a non-const-qualified
parameter type, the parameter is not const inside its body. Ensure that
the type we use when instantiating the body is the right one. Patch by
suyog sarda!

This is still rather unsatisfactory; it seems like it might be better to
instantiate at least the function parameters, and maybe the complete function
declaration, when we instantiate the definition for such a member function
(instead of reusing the declaration from inside the instantiated class
definition).

llvm-svn: 203741
2014-03-13 00:28:45 +00:00
Richard Smith 8e6002f3bd Fix crash if delayed template parsing meets an erroneous trailing return type.
Based on a patch and test by Stephan Tolksdorf! Refactoring and fixing adjacent
brokenness by me.

llvm-svn: 203733
2014-03-12 23:14:33 +00:00
DeLesley Hutchins d13c872187 Thread Safety Analysis: new test case for lambdas
llvm-svn: 203720
2014-03-12 21:33:47 +00:00
Hans Wennborg dd0f5304f6 MS intrinsics: don't declare __readeflags and __writeeflags in Intrin.h
They're already defined in ia32intrin.h, and this would cause including Intrin.h
in 64-bit mode to fail because of conflicting types. Update ms-intrin.cpp to
also run in 64-bit mode to catch things like this.

llvm-svn: 203714
2014-03-12 21:09:03 +00:00
Justin Bogner d66a17d0a3 Revert "CodeGen: Use a binary format for instrumentation based profiling"
I've clearly done something wrong with how to get this to link
correctly. Reverting for now.

This reverts commit r203711.

llvm-svn: 203712
2014-03-12 21:06:31 +00:00
Justin Bogner ff9a058267 CodeGen: Use a binary format for instrumentation based profiling
This updates CodeGenPGO to use the ProfileDataReader introduced to
llvm in r203703 and the new API for writing out the profile introduced
to compiler-rt in r203710.

llvm-svn: 203711
2014-03-12 20:53:16 +00:00
Fariborz Jahanian 44be154b04 Objective-C. Issue diagnostics on mismatched methods when their selector is used
in an @selector expression. // rdar://15794055

llvm-svn: 203693
2014-03-12 18:34:01 +00:00
Richard Smith 0fc7bdc821 PR19113: Emit 'vtable' TBAA metadata when loading a vptr in a pointer-to-member-function call.
llvm-svn: 203691
2014-03-12 18:26:14 +00:00
Richard Smith 66204ecff9 DR1346: a parenthesized braced-init-list cannot be used as the initializer when
performing auto type deduction.

llvm-svn: 203683
2014-03-12 17:42:45 +00:00
Oliver Stannard 7c3c09e23f ARM: Correct alignment of structs passed as byval pointer
When a struct has bitfields overlapping with other members
(as required by the AAPCS), clang uses a packed struct to
represent this. If such a struct is large enough for clang to
pass it as a byval pointer (>64 bytes), we need to set the
alignment of the argument to match the original type.

llvm-svn: 203660
2014-03-12 14:02:50 +00:00
NAKAMURA Takumi b19018681a Disable cross-windows-on-linux.cpp for now. It may or may not fail. :/
llvm-svn: 203642
2014-03-12 06:16:26 +00:00
Saleem Abdulrasool bfaec9bf8b Lexer: split test into separate files
Unfortunately, XFAIL applies to the entire file.  Split the test into two
different units, enabling the proper application of XFAIL on the test which is
expected to fail on Windows.

llvm-svn: 203633
2014-03-12 02:53:12 +00:00
Saleem Abdulrasool 729b7d357d Lex: reduce buffer size, add a test
Reduce the stack usage as hopefully include paths are usually not too long.  Add
a test case for the path normalisation behaviour.

llvm-svn: 203632
2014-03-12 02:26:08 +00:00
Ben Langmuir dcf73861a5 Add an option -fmodules-validate-system-headers
When enabled, always validate the system headers when loading a module.
The end result of this is that when these headers change, we will notice
and rebuild the module.

llvm-svn: 203630
2014-03-12 00:06:17 +00:00
Aaron Ballman e8d69b7fc9 Allow GNU-style attributes on lambda expressions.
llvm-svn: 203628
2014-03-12 00:01:07 +00:00
David Blaikie 124d8a4544 DebugInfo: Remove debug-info-pubtypes.ccp - pubnames/pubtypes are adequately tested in LLVM now.
llvm-svn: 203625
2014-03-11 23:42:49 +00:00
David Blaikie f9b8472044 DebugInfo: Fix test for LLVM change r203619
I'll fix this to not test assembly in a moment.

llvm-svn: 203623
2014-03-11 23:38:05 +00:00
Duncan P. N. Exon Smith 5c17f8a7e0 PGO: appease the bots after r203592
llvm-svn: 203618
2014-03-11 23:12:31 +00:00
David Blaikie 29559b1efa Driver: Support -gmlt as an alias for -gline-tables-only
llvm-svn: 203603
2014-03-11 21:05:26 +00:00
Aaron Ballman 7e1fd018a8 Improving test coverage for lambda expressions with attribute specifiers.
llvm-svn: 203602
2014-03-11 20:32:35 +00:00
Fariborz Jahanian 0c325319cf Objective-C. Prevent an assertion crash due to buggy code
as it can commonly happen. // rdar://16261494

llvm-svn: 203598
2014-03-11 18:56:18 +00:00
Duncan P. N. Exon Smith 0bc22877a2 PGO: Clarify the testing README
<rdar://problem/16276448>

llvm-svn: 203593
2014-03-11 18:18:12 +00:00
Duncan P. N. Exon Smith 38402dc917 PGO: Scale large counters down to 32-bits
PGO counters are 64-bit and branch weights are 32-bit.  Scale them down
when necessary, instead of just taking the lower 32 bits.

<rdar://problem/16276448>

llvm-svn: 203592
2014-03-11 18:18:10 +00:00
Bob Wilson 3ca7904fea Remove trailing whitespace introduced in r203028.
llvm-svn: 203588
2014-03-11 17:17:16 +00:00
Fariborz Jahanian bf678e82e1 Objective-C. Diagose use of undefined protocols
when a class adopts a protocol that inherits from 
undefined protocols. // rdar://16111182

llvm-svn: 203586
2014-03-11 17:10:51 +00:00
Jordan Rose a6839aaa9b [analyzer] Check all conditions in a chained if against each other.
Like the binary operator check of r201702, this actually checks the
condition of every if in a chain against every other condition, an
O(N^2) operation. In most cases N should be small enough to make this
practical, and checking all cases like this makes it much more likely
to catch a copy-paste error within the same series of branches.

Part of IdenticalExprChecker; patch by Daniel Fahlgren!

llvm-svn: 203585
2014-03-11 16:52:29 +00:00
Aaron Ballman c6607cd2a1 Changing this test case to use an unknown attribute, since there are not currently any type attributes which would apply to a lambda, except in MSVC compatibility mode.
llvm-svn: 203566
2014-03-11 13:19:42 +00:00
Aaron Ballman b5c59f5862 Gracefully handle an attribute specifier following a lambda introducer when the parameter list wasn't present.
llvm-svn: 203565
2014-03-11 13:03:15 +00:00
Tim Northover c83472e0ff Sema: demote invalid atomic ordering message to warning.
Someone could write:
  if (0) {
    __c11_atomic_load(ptr, memory_order_release);
  }

or the equivalent, which is perfectly valid, so we shouldn't outright reject
invalid orderings on purely static grounds.

rdar://problem/16242991

llvm-svn: 203564
2014-03-11 11:35:10 +00:00
Tim Northover e94a34cae2 Sema: produce error when invalid ordering is passed to atomic builtin
This is a conservative check, because it's valid for the expression to be
non-constant, and in cases like that we just don't know whether it's valid.

rdar://problem/16242991

llvm-svn: 203561
2014-03-11 10:49:14 +00:00
NAKAMURA Takumi 020b32de0d clang/test/Modules/include-relative.c REQUIRES shell due to chdir.
llvm-svn: 203550
2014-03-11 09:00:49 +00:00
Richard Smith b81b196a58 Tests for DR381-388.
llvm-svn: 203549
2014-03-11 07:49:32 +00:00
Justin Bogner ffaa2330b9 test: Regenerate profile data for PGO tests
Some of this data had gotten out of date, so we weren't quite testing
what we thought we were. This also moves the outdated data test to its
own file to simplify regenerating the test data.

llvm-svn: 203546
2014-03-11 06:49:34 +00:00
Argyrios Kyrtzidis 34fad42003 [HeaderSearch] Fix issue where if a headermap entry maps the filename to a framework import (non-absolute path)
then we fail to find it if it is re-included later on.

rdar://16285490

llvm-svn: 203542
2014-03-11 06:21:28 +00:00
Justin Bogner 52a6a97d70 test: Give instrumentation based profiling tests their own directory
These tests are logically related, but they're spread about several
different CodeGen directories. Consolidate them in one place to make
them easier to manage.

llvm-svn: 203541
2014-03-11 04:37:49 +00:00
Justin Bogner a4fb799d00 test: Fix feature test for "native" in lit.cfg
Checking if the host arch is in the triple isn't quite correct. Change
the feature test to match llvm's, which made the same change in r193459.

llvm-svn: 203540
2014-03-11 04:34:17 +00:00
Richard Trieu 99e1c9515a Move the warning about unused relational comparison from -Wunused-value to
-Wunused-comparison.  Also, newly warn on unused result from overloaded
relational comparisons, now also in -Wunused-comparison.

llvm-svn: 203535
2014-03-11 03:11:08 +00:00
Richard Smith d91747980a If a visibility update record is found for a DeclContext after that Decl has
already been loaded, apply that update record to the Decl immediately, rather
than adding it to a pending list and never applying it.

llvm-svn: 203534
2014-03-11 03:10:46 +00:00
Richard Smith 723928c7dc If a module map is found in a relative -I path, convert the filenames within it
to absolute paths when building the includes file for the module. Without this,
the module build would fail, because the relative paths we were using are not
necessarily relative to a directory in our include path.

llvm-svn: 203528
2014-03-11 02:02:47 +00:00
David Majnemer 2f1f1818bf Basic: Add -Wswitch-bool to control warn_bool_switch_condition
This warning was missing a flag, add one.

test/Misc/warning-flags.c has one fewer entry.

llvm-svn: 203522
2014-03-11 00:26:28 +00:00
Fariborz Jahanian f322f2fb61 Objective-C IRGen. Fixes several regressions caused by changes made
to setting of ObjC linkages. //rdar://16206443

llvm-svn: 203521
2014-03-11 00:25:05 +00:00
Ben Langmuir 101390e116 Add -fmodules-cache-path to test/Headers/c11.c
This started failing for me the last time someone modified the AST file
format. It would be nice if we could just have lit take care of the
module cache used during testing for us, but this helps in the meantime.

llvm-svn: 203511
2014-03-10 23:17:14 +00:00
John McCall e54d92b0f1 RTTI symbols for visible local types may need weak linkage.
Previously, we would always emit them with internal linkage,
but with hidden visibility when the function was hidden, which
is an illegal combination, which could lead LLVM to actually
emit them as strong hidden symbols with hilarious results.

rdar://16265084

llvm-svn: 203503
2014-03-10 22:27:33 +00:00
David Majnemer 938bc1ea84 IRGen: __c11/__atomic compare-and-exchange should respect the standard
Summary:
'Expected' should only be modified if the operation fails.

This fixes PR18899.

Reviewers: chandlerc, rsmith, rjmccall

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2922

llvm-svn: 203493
2014-03-10 21:35:33 +00:00
Robert Lytton 2c942c64fb Make __LITTLE_ENDIAN__/__BIG_ENDOAN__ common PredefinedMacros
llvm-svn: 203455
2014-03-10 12:06:29 +00:00
NAKAMURA Takumi 2b85e546f2 clang/test/Index/preamble-reparse-warn-*.c: Stabilize on win32.
llvm-svn: 203446
2014-03-10 06:02:13 +00:00
NAKAMURA Takumi 5e9c821420 clang/test/Index/preamble-reparse-warn-*.c: Use @LINE in FileCheck.
llvm-svn: 203445
2014-03-10 06:02:03 +00:00
Richard Smith a108760b33 When a type's definition is instantiated, the definition becomes visible, even
if the type's declaration was previously instantiated in an unimported module.
(For an imported type definition, this already worked, because the source
location is set to the location of the definition, but for locally-instantiated
type definitions, it did not.)

llvm-svn: 203425
2014-03-10 00:04:29 +00:00
Ted Kremenek 2dd810a331 [-Wunreachable-code] Handle Objective-C bool literals in 'isConfigurationValue'.
This includes special casing 'YES' and 'NO', which are constants
defined as macros.

llvm-svn: 203380
2014-03-09 08:13:49 +00:00
David Majnemer 970714bcf9 Update clang to account for changes made to LLVM in r203376
llvm-svn: 203377
2014-03-09 07:09:06 +00:00
Argyrios Kyrtzidis 0098a4bd04 [Sema] Fix assertion hit with #pragma weak.
rdar://16264844

llvm-svn: 203372
2014-03-09 05:15:28 +00:00
Argyrios Kyrtzidis b255ee91a7 [libclang] Don't pad the main buffer for the preamble.
Padding does not seem to be useful currently, and it leads to bogus location if an error
points to the end of the file.

rdar://15836513

llvm-svn: 203370
2014-03-09 04:24:57 +00:00
NAKAMURA Takumi 9cd3ce20cc retain-comments-from-system-headers.c: Flush module cache, or incremental test would fail since r203317.
llvm-svn: 203367
2014-03-09 03:56:18 +00:00
Ted Kremenek c980afc578 [-Wunreachable-code] Tweak heuristic for configuration values to include arithmetic operations involving sizeof(), but not raw integers.
This case was motivated by a false positive with the
llvm::AlignOf<> specialization in LLVM.

llvm-svn: 203363
2014-03-08 23:20:11 +00:00
Ted Kremenek efea63450b [-Wunreachabe-code] Don't warn about unreachable destructors for temporaries.
This can possibly be refined later, but right now the experience
is so incomprehensible for a user to understand what is going on
this isn't a useful warning.

llvm-svn: 203336
2014-03-08 02:22:32 +00:00
Ted Kremenek fcc1417fad Fix CFG bug where the 'isTemporaryDtorsBranch' bit was silently lost for terminators.
llvm-svn: 203335
2014-03-08 02:22:29 +00:00
Ted Kremenek 04bfbeea04 [-Wunreachable-code] Handle 'return' with no argument dominated by 'noreturn' function.
llvm-svn: 203333
2014-03-08 02:22:23 +00:00
Richard Smith 9bca298f6d Module [extern_c] attribute: inherit to submodules, don't write 'extern "C"'
blocks when building in C mode, and serialize and deserialize the attribute.

llvm-svn: 203317
2014-03-08 00:03:56 +00:00
Ismail Pazarbasi 025f428c73 Replace "can not" with "cannot" in diagnostics messages.
llvm-svn: 203302
2014-03-07 22:36:23 +00:00
Ted Kremenek 94d1617a1f [-Wunreachable-code] Treat constant globals as configuration values in unreachable code heuristics.
This one could possibly be refined even further; e.g. looking
at the initializer and see if it is truly a configuration value.

llvm-svn: 203283
2014-03-07 20:51:13 +00:00
Timur Iskhodzhanov f0e88c72ec Remove a test that we don't need anymore
llvm-svn: 203228
2014-03-07 10:21:25 +00:00
Timur Iskhodzhanov a895758203 Fix PR18967 -- Bad this adjustment for virtual methods in a diamond virtual inheritance hierarchy
llvm-svn: 203222
2014-03-07 09:34:59 +00:00
Ben Langmuir 38f54a8ea5 Tweak some test paths to match on Windows
llvm-svn: 203215
2014-03-07 08:15:35 +00:00
Alexey Bataev d178ad4943 [OPENMP] Small update in threadprivate variables processing to fix template instantiation.
llvm-svn: 203214
2014-03-07 08:03:37 +00:00
Argyrios Kyrtzidis e1974dcd92 [Preprocessor] Pass TranslationUnitKind to the preprocessor and if it is TU_Prefix
avoid warning for unused macros.

rdar://15034698

llvm-svn: 203213
2014-03-07 07:47:58 +00:00
Alexey Bataev 648250a2e5 [OPENMP] Fixed linked libraries for libiomp5 on Linux
llvm-svn: 203212
2014-03-07 07:43:52 +00:00
Ben Langmuir 198c168518 Add a bunch of missing changes from r203208
Somehow lost these in a git operation.

llvm-svn: 203210
2014-03-07 07:27:49 +00:00
Ted Kremenek 7d47cace55 Fix recent regressions in -Wreturn-type caused by heuristics to -Wunreachable-code.
I had forgotten that the same reachability code is used by both -Wreturn-type
and -Wunreachable-code, so the heuristics applied to the latter were indirectly
impacting the former.

To address this, the reachability code is more refactored so that whiled
the logic at its core is shared, the intention of the clients are better
captured and segregated in helper APIs.

Fixes PR19074, and also some false positives reported offline to me
by Nick Lewycky.

llvm-svn: 203209
2014-03-07 07:14:36 +00:00
Ben Langmuir cb69b57b2a Add dependencies from imported modules with -MD
Add module dependencies to the dependency files created by -MD/-MMD/etc.
by attaching an ASTReaderListener that will call into the dependency
file generator when a module input file is seen in the serialized AST.

llvm-svn: 203208
2014-03-07 06:40:32 +00:00