Commit Graph

61637 Commits

Author SHA1 Message Date
Daniel Jasper 9c8a774c48 clang-format: Fix corner case for lambda assignments.
Before:
  std::function<std::string(const std::string &)> my_lambda = [](
      const string &s) { return s; };

After:
  std::function<std::string(const std::string &)> my_lambda =
      [](const string &s) { return s; };

llvm-svn: 256739
2016-01-04 07:29:40 +00:00
Daniel Jasper 06a269574c clang-format: Fix corner-case in ObjC method declaration formatting
Before:
  - (void)shortf:(GTMFoo *)theFoo
     longKeyword:(NSRect)theRect
   longerKeyword:(float)theInterval
           error:(NSError **)theError {
  }

After:
  - (void)shortf:(GTMFoo *)theFoo
        longKeyword:(NSRect)theRect
      longerKeyword:(float)theInterval
              error:(NSError **)theError {
  }

llvm-svn: 256738
2016-01-04 07:29:07 +00:00
Daniel Jasper ffbad0e8aa clang-format: [Proto] Basic support for options with <> for repeated fields.
llvm-svn: 256737
2016-01-04 07:28:12 +00:00
Daniel Jasper ccff4d1e60 clang-format: [Proto] Improve wrapping of message field attributes.
Before:
  optional AAA aaa = 1 [foo =
			    {
			      key: "a"  //
			    },
			bar = {
			  key: "a"  //
			}];

After:
  optional AAA aaa = 1 [
    foo = {
      key: "a"  //
    },
    bar = {
      key: "a"  //
    }
  ];

llvm-svn: 256736
2016-01-04 07:27:33 +00:00
Craig Topper d3dfa14ad3 [TableGen] Call llvm_shutdown on exit so that all the ManagedStatic objects in the support library will be deleted.
llvm-svn: 256731
2016-01-04 04:51:46 +00:00
Craig Topper 1f26d5b1e0 ArrayRef-ize a function. NFC
llvm-svn: 256718
2016-01-03 19:43:23 +00:00
Craig Topper a346705b06 Use std::is_sorted instead of a manual loop. NFC
llvm-svn: 256717
2016-01-03 19:43:20 +00:00
Xinliang David Li 20b188c09c [PGO] Cleanup: Use covmap header definition in the template file
This is one last remaining instrumentatation related structure
that needs to be migrate to use the centralized template
definition.  With this change, instrumentation code 
related to coverage module header will be kept in sync
with the coverage mapping reader. The remaining code
which makes implicit assumption about covmap control
structure layout in the the lowering pass will cleaned
up in a different patch. This patch is not intended to
have no functional change.

llvm-svn: 256714
2016-01-03 19:25:54 +00:00
Dimitry Andric b1aa87e120 Fix several accidental DOS line endings in source files
Summary:
There are a number of files in the tree which have been accidentally checked in with DOS line endings. Convert these to native line endings.

There are also a few files which have DOS line endings on purpose, and I have set the svn:eol-style property to 'CRLF' on those.

Reviewers: joerg, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 256704
2016-01-03 15:55:40 +00:00
David Majnemer 30f9bfd574 Reimplement __readeflags and __writeeflags on top of intrinsics
Lean on LLVM to provide this functionality now that it provides the
necessary intrinsics.

llvm-svn: 256686
2016-01-01 06:50:08 +00:00
James Y Knight 88ddef7b17 [TrailingObjects] Fix "Convert classes in OpenMPClause.h" for MSVC
"friend class OMPVarListClause" -> "friend OMPVarListClause".  It's a
template, not a class.

llvm-svn: 256684
2016-01-01 01:12:48 +00:00
James Y Knight 374fd208ba [TrailingObjects] Convert classes in OpenMPClause.h
llvm-svn: 256683
2016-01-01 00:38:24 +00:00
Asaf Badouh a9d1e18f48 [X86][PKU] add clang intrinsic for {RD|WR}PKRU
Differential Revision: http://reviews.llvm.org/D15837

llvm-svn: 256672
2015-12-31 14:14:07 +00:00
Alexey Bataev a6f2a14b94 [OPENMP 4.5] Codegen for 'schedule' clause with monotonic/nonmonotonic modifiers.
OpenMP 4.5 adds support for monotonic/nonmonotonic modifiers in 'schedule' clause. Add codegen for these modifiers.

llvm-svn: 256666
2015-12-31 06:52:34 +00:00
James Y Knight db8cdd35b6 [TrailingObjects] Fix bug in "Convert classes in ExprObjC.h"
(Detected by asan)

llvm-svn: 256665
2015-12-31 06:01:19 +00:00
David Majnemer 822b4f20e0 [MS ABI] Remove mangleCXXCatchHandlerType
It's dead code, no functional change is intended.

llvm-svn: 256664
2015-12-31 05:36:54 +00:00
David Majnemer 622abd1559 [MS ABI] Change the ArgBackRefMap to hold const qualified pointers
Just a cleanup, no functional change is intended.

llvm-svn: 256663
2015-12-31 05:36:52 +00:00
David Majnemer e3d7191a74 [MS ABI] Replace dead code with an assertion
As per C++ [dcl.ref]p1, cv-qualified references are not valid. As such,
change the mangler to assert that this event does not happen.

llvm-svn: 256662
2015-12-31 05:36:50 +00:00
David Majnemer 474b323a03 [MSVC Compat] Diagnose multiple default ctors for dllexport'd classes
The MS ABI emits a special default constructor closure thunk if a
default constructor has a weird calling convention or default arguments.

The MS ABI has a quirk: there can be only one such thunk because the
mangling scheme does not have room for distinct manglings.  We must
raise a diagnostic in this eventuality.

N.B.  MSVC sorta gets this right.  Multiple default constructors result
in the default constructor closure getting emitted but they seem to
get confused by which default constructors are reasonable to reference
from the closure.  We try to be a little more careful which results in
mild differences in behavior.

llvm-svn: 256661
2015-12-31 05:36:46 +00:00
James Y Knight 6c2f06b4e0 [TrailingObjects] Convert classes in ExprObjC.h
llvm-svn: 256659
2015-12-31 04:43:19 +00:00
James Y Knight e00a67e24f [TrailingObjects] Convert remaining classes in Expr.h and ExprCXX.h
llvm-svn: 256658
2015-12-31 04:18:25 +00:00
Richard Smith 9b53454725 Improve diagnostic for the case where a function template candidate is rejected
by overload resolution because deduction succeeds, but the substituted
parameter type for some parameter (with deduced type) doesn't exactly match the
corresponding adjusted argument type.

llvm-svn: 256657
2015-12-31 02:02:54 +00:00
Richard Smith 50d5b97449 Implement [temp.deduct.type]p6: if the nested-name-specifier of a type is
dependent, the type is a non-deduced context.

llvm-svn: 256651
2015-12-30 20:56:05 +00:00
Aaron Ballman 0708832514 Silencing a -Wcast-qual warning; NFC.
llvm-svn: 256644
2015-12-30 16:02:17 +00:00
Aaron Ballman dbc441eb34 When performing an implicit from float to bool, the floating point value must be *exactly* zero in order for the conversion to result in 0. This does not involve a conversion through an integer value, and so truncation of the value is not performed.
This patch address PR25876.

llvm-svn: 256643
2015-12-30 14:26:07 +00:00
Davide Italiano 18799ff837 Disable generating movt on FreeBSD.
It's sort of an hack, but we have no choice.
The linker in the base system doesn't handle that correctly (yet).
Once FreeBSD will import lld, this can be backed out.

Patch by: Andrew Turner!

llvm-svn: 256641
2015-12-30 13:53:25 +00:00
Daniel Jasper e1afb9b8ee clang-format: Slightly row back on r256343 by increasing penalty for
breaking between array subscripts.

Before:
  if (aaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa]
                                                     [aaaaaaaaaaaaa])
After:
  if (aaaaaaaaaaaaaaaaaaaaaaaa &&
      aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa][aaaaaaaaaaaaa])

llvm-svn: 256640
2015-12-30 12:23:00 +00:00
Alexey Bataev 113438cd5c [OPENMP 4.5] Allow 'ordered' clause on 'loop simd' constructs.
OpenMP 4.5 allows to use 'ordered' clause without parameter on 'loop simd' constructs.

llvm-svn: 256639
2015-12-30 12:06:23 +00:00
Daniel Jasper 779c66f3ca clang-format: [JS] Support TypeScript 1.6 user defined type guards.
Before:
  function foo(check: Object): check
  is{foo: string, bar: string, baz: string, foobar: string} {
    return 'bar' in check;
  }

After:
  function foo(check: Object):
      check is {foo: string, bar: string, baz: string, foobar: string} {
    return 'bar' in check;
  }

llvm-svn: 256631
2015-12-30 08:00:58 +00:00
Chandler Carruth f98eb3548c [ptr-traits] Add another complete type that is necessary for at least
some of the build bots. Still can't reproduce these failures locally.

llvm-svn: 256630
2015-12-30 06:38:29 +00:00
Chandler Carruth bd452fb2ff [ptr-traits] Some compilers (older Clang? unsure) on build bots need
this constructor to be out of line in order to not require the complete
type of TemplateDecl.

Hopefully this will fix the build bots.

llvm-svn: 256629
2015-12-30 06:21:02 +00:00
David Majnemer 56e2adb6fd [MS ABI] Add variable templates to the NameBackReferences
Only function template specializations are exempt from being added to
the NameBackReferences.  Redundant variable template specializations
should be appropriately substituted.

llvm-svn: 256623
2015-12-30 05:40:32 +00:00
David Majnemer 5f177620c3 [MS ABI] Improve our mangling of pass_object_size
We didn't add the artificial pass_object_size arguments to the
backreference map which bloated the size of manglings which involved
pass_object_size with duplicate types.

This lets us go from:
?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size1@3@@Z

to:
?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z

llvm-svn: 256622
2015-12-30 05:13:03 +00:00
James Y Knight 54a3b2680f Fix alignment issue in CodeGenFunction::PopCleanupBlock.
It was copying an EHCleanupStack::Cleanup object into a
SmallVector<char>, with a comment saying that SmallVector's alignment is
always large enough. Unfortunately, that isn't actually true after
r162331 in 2012.

Expand the code (somewhat distastefully) to get a stack allocation with
a correct alignment.

llvm-svn: 256619
2015-12-30 03:58:33 +00:00
Chandler Carruth aa36b89b1c [ptr-traits] Add #includes of headers rather than forward declarations
for types which are used as pointees in PointerUnions, PointerIntPairs,
and DenseMap pointer keys.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

I think this is the last patch for getting Clang clean here!!!

llvm-svn: 256615
2015-12-30 03:40:23 +00:00
Chandler Carruth b9518f8f86 [ptr-traits] Move a class definition up to the top of this header so it
can be referenced as part of a PointerIntPair.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256613
2015-12-30 03:33:22 +00:00
Chandler Carruth 21c9060e61 [ptr-traits] Move methods manipulating PointerUnions, DenseMap pointer
keys, and PointerIntPairs where the pointee types are incomplete
out-of-line to where we have the complete type.

This is the standard pattern used throughout the AST library to address
the inherently mutually cross referenced nature of the AST.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256612
2015-12-30 03:24:14 +00:00
Chandler Carruth 6c6c78ff18 [ptr-traits] Switch the Redeclarable template to using a void pointer in
its PointerUnion rather than an ASTContext pointer.

Using pointers with PointerUnion really should be checking the pointee
type's alignment, and we can't do this without the complete type. The
Redeclarable template inherently can't know the complete type of
ASTContext because of its layering, and because it is a template its
methods can't reasonably be out-of-line the way we traditionally solve
circular references within the AST library.

After discussing this with Richard Smith, his suggestion which I have
implemented here was to just drop to a void* for the PointerUnion. This
essentially documents that we're going to completely ignore the type
(including its potential alignment consequences) for this code. There
are still of course dynamic guards that this ended up working correctly,
and because of the way the code is factored this doesn't leak outside of
the very narrow implementation guts of Redeclarable.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256611
2015-12-30 03:09:25 +00:00
Chandler Carruth ff5a01a7b1 [ptr-traits] Switch from a really wasteful SmallDenseMap of
SmallVector<.., 16> (16!!!!) objects to a simple SmallVector of pairs.

This no longer de-duplicates the common function pointers used during
deallocation, but this doesn't really seem worth the complexity and
overhead of managing the map-of-vectors. Notably, there is no reason to
assume that functions have the 4-byte alignment that DenseMap relies on,
and indeed this prevents checking the alignment of the DenseMap keys
because we can't even meaningfully query the alignment of functions
using our existing alignment tools.

Generally, function pointers don't seem like a great idea for keys in
a DenseMap. =]

I chatted with Richard Smith about this a bit as well and have written
down a FIXME because this *does* waste some memory and in general seems
a very clumsy memory management strategy. He would like to see a more
fundamental fix eventually here that tries to build a better pattern.

llvm-svn: 256610
2015-12-30 03:00:23 +00:00
Chandler Carruth 813faed920 [ptr-traits] Stop using two bogus types as stand-ins for flags
indicating the nature of the default argument in a ParmVarDecl.

Instead, this adds a proper enum stored exclusively in the ParmVarDecl
bits (which we have plenty of) for this. This even allows us to track
a previously unrepresented state in Clang when we parse a function
declaration with a default argument on a parameter but we cannot even
form an invalid expression node (for example, it is an invalid token).
Now, we can model this state in the AST at least, and potentially
improve recovery in this area in the future.

I've also cleaned up the functions managing both variable initializer
expressions and parameter default argument expresssions as much as
possible. I've left some comments about further improvements based on
a discussion with Richard Smith. Lots of credit to him for walking me
through exactly which of the *many* tradeoffs here he felt was the best
fit.

Should be NFC for now. I've tried my best to preserve existing behavior.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256609
2015-12-30 02:51:00 +00:00
James Y Knight 1d75c5eccf [TrailingObjects] Convert CastExpr and subclasses.
llvm-svn: 256608
2015-12-30 02:27:28 +00:00
Richard Smith 54894fdcc4 Clean up this code, NFC.
llvm-svn: 256607
2015-12-30 01:06:52 +00:00
Devin Coughlin 3369867aa7 [analyzer] Handle another Android assert function.
Android's assert can call both the __assert and __assert2 functions under the cover, but
the NoReturnFunctionChecker does not handle the latter. This commit fixes that.

A patch by Yury Gribov!

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

llvm-svn: 256605
2015-12-30 00:08:59 +00:00
Devin Coughlin 3ab8b2e7d4 [analyzer] Suppress nullability warning for _Nonnull locals zero-initialized by ObjC ARC.
Prevent the analyzer from warning when a _Nonnnull local variable is implicitly
zero-initialized because of Objective-C automated reference counting. This avoids false
positives in cases where a _Nonnull local variable cannot be initialized with an
initialization expression, such as:
  NSString * _Nonnull s; // no-warning
  @autoreleasepool {
    s = ...;
  }

The nullability checker will still warn when a _Nonnull local variable is explicitly
initialized with nil.

This suppression introduces the potential for false negatives if the local variable
is used before it is assigned a _Nonnull value. Based on a discussion with Anna Zaks,
Jordan Rose, and John McCall, I've added a FIXME to treat implicitly zero-initialized
_Nonnull locals as uninitialized in Sema's UninitializedValues analysis to avoid these
false negatives.

rdar://problem/23522311

llvm-svn: 256603
2015-12-29 23:44:19 +00:00
Richard Smith 7d8d6727e3 When a namespace alias redeclares a using declaration, point the diagnostic at
the using declaration not at the thing it's using.

llvm-svn: 256602
2015-12-29 23:42:34 +00:00
Richard Smith f2005d3de6 Model NamespaceAliasDecls as having their nominated namespace as an underlying
declaration. This fixes an issue where we would reject (due to a claimed
ambiguity) a case where lookup finds multiple NamespaceAliasDecls from
different scopes that nominate the same namespace.

The C++ standard doesn't make it clear that such a case is in fact valid (which
I'm working on fixing), but there are no relevant rules that distinguish using
declarations and namespace alias declarations here, so it makes sense to treat
them the same way.

llvm-svn: 256601
2015-12-29 23:34:32 +00:00
Nico Weber 0315920629 Address review comment on r256595
llvm-svn: 256600
2015-12-29 23:30:42 +00:00
Nico Weber ce1e53bb48 Fix test from r256596
llvm-svn: 256599
2015-12-29 23:23:38 +00:00
Nico Weber de2310bddf Emit a -Wmicrosoft warning when treating ^Z as EOF in MS mode.
llvm-svn: 256596
2015-12-29 23:17:27 +00:00
Nico Weber 446cf25c21 Emit a -Wmicrosoft warning when pasting /##/ into a comment token in MS mode.
llvm-svn: 256595
2015-12-29 23:06:17 +00:00