Commit Graph

51596 Commits

Author SHA1 Message Date
Manuel Klimek 1f9d80ac66 Improve handling of bool expressions in template arguments.
Now correctly formats:
  foo<true && false>();

llvm-svn: 204950
2014-03-27 19:00:52 +00:00
Eric Christopher 8018e414bb Add an explanatory comment and FIXME about the function declaration
for a subprogram DIE.

llvm-svn: 204949
2014-03-27 18:50:35 +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
Duncan P. N. Exon Smith a19ffae1b0 InstrProf: Pull in runtime on non-Darwin
r204379 changed the way the profile runtime gets pulled in, but missed
updating non-Darwin targets.

llvm-svn: 204939
2014-03-27 16:20:02 +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
Daniel Jasper 5d2587daa2 clang-format: Avoid line-breaks that increase the current column.
While these might make sense for some rule (e.g. break after multi-line
operand), they generally appear ugly and confusing.

Before:
  fffffffffff(R\"x(
  multiline raw string literal xxxxxxxxxxxxxx
  )x\" + bbbbbb)

After:
  fffffffffff(R\"x(
  multiline raw string literal xxxxxxxxxxxxxx
  )x\" +
              bbbbbb)

llvm-svn: 204937
2014-03-27 16:14:13 +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
Alexander Musman fd2b75948d [OPENMP] OMPExecutableDirective re-factoring
Store the number of clauses and children of OMPExecutableDirective and dynamically compute the locations of corresponding arrays.

http://llvm-reviews.chandlerc.com/D2977

llvm-svn: 204933
2014-03-27 15:14:18 +00:00
Daniel Jasper 9f388d0404 clang-format: Extract getNewLineColumn out of addTokenOnNewLine.
No functional changes intended.

llvm-svn: 204930
2014-03-27 14:33:30 +00:00
Manuel Klimek f81e5c0e50 Fix bool expression special case.
Clang-format now correctly formats:
  some_type<a * b> v;
  template <bool a, bool b> typename enabled_if<a && b>::type f() {}

llvm-svn: 204913
2014-03-27 11:17:36 +00:00
Chandler Carruth e24605bbcd [cleanup] Stop specifying size overrides for BumpPtrAllocators.
These don't seem to have any real point. Let's start with
IndexingContext. I can't come up with any conceivable reason to have
many hundereds of thousands of these alive in an address space which
would make the 4x difference in allocated (but unused) memory for the
string scratch buffer a significant memory usage problem.

The EditedSource one is somewhat more surprising. This is an 8x increase
in the memory allocated (but not used) per editted source file. However,
for this to realistically be a problem, you would need to have over half
a million editted source files in a single address space, and even that
would only really have problems on 32-bit Windows where you really only
have 2gb of virtual address space. And what's more important, the fix to
this if it is actually an issue shouldn't be to shrink the allocator's
size, it is to pass a single allocator into *many* edited source file
objects and let them share the memory.

These were the only two uses of custom sized BumpPtrAllocators
(excluding ones in the JIT using a custom allocation strategy) in all of
LLVM, Clang, LLD, LLDB, or Polly. I don't think we actually need this
complexity in the primary BumpPtrAllocator at all and am planning to
remove it.

llvm-svn: 204910
2014-03-27 10:45:22 +00:00
Daniel Jasper c13ee34378 clang-format: Correctly identify ObjC Block with return type.
llvm-svn: 204905
2014-03-27 09:43:54 +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
Duncan P. N. Exon Smith 1b67cfd40f InstrProf: Use unique_ptr
llvm-svn: 204846
2014-03-26 19:26:05 +00:00
Duncan P. N. Exon Smith 3586be7216 InstrProf: Use references
llvm-svn: 204845
2014-03-26 19:26:02 +00:00
Jordan Rose 6fc2ec96b8 [analyzer] Remove the implemented Identical* checkers from the "potential" list.
Edit by Daniel Fahlgren.

llvm-svn: 204842
2014-03-26 18:59:22 +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 7dd8bc0a84 Intrin.h: Implement _InterlockedExchangePointer
llvm-svn: 204827
2014-03-26 16:09:48 +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 1523c610c9 Make the 'for (auto ...)' names more readable
llvm-svn: 204787
2014-03-26 08:22:48 +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
Rafael Espindola 2f8d0104b0 Revert "Update for llvm api change."
This reverts commit r204783.

llvm-svn: 204785
2014-03-26 06:14:54 +00:00
Rafael Espindola 02633f63eb Update for llvm api change.
llvm-svn: 204783
2014-03-26 05:34:18 +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
David Blaikie f596145ac5 Use an option alias to implement -gmlt
Review feedback from Reid Kleckner on r203603.

llvm-svn: 204755
2014-03-25 20:42:27 +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