summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [MS ABI] Remove mangleCXXCatchHandlerTypeDavid Majnemer2015-12-312-14/+0
| | | | | | It's dead code, no functional change is intended. llvm-svn: 256664
* [MS ABI] Change the ArgBackRefMap to hold const qualified pointersDavid Majnemer2015-12-311-2/+2
| | | | | | Just a cleanup, no functional change is intended. llvm-svn: 256663
* [MS ABI] Replace dead code with an assertionDavid Majnemer2015-12-311-2/+4
| | | | | | | 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
* [MSVC Compat] Diagnose multiple default ctors for dllexport'd classesDavid Majnemer2015-12-313-2/+31
| | | | | | | | | | | | | | | | | 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
* [TrailingObjects] Convert classes in ExprObjC.hJames Y Knight2015-12-314-122/+99
| | | | llvm-svn: 256659
* [TrailingObjects] Convert remaining classes in Expr.h and ExprCXX.hJames Y Knight2015-12-315-199/+153
| | | | llvm-svn: 256658
* Improve diagnostic for the case where a function template candidate is rejectedRichard Smith2015-12-318-16/+95
| | | | | | | | 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
* Implement [temp.deduct.type]p6: if the nested-name-specifier of a type isRichard Smith2015-12-303-11/+26
| | | | | | dependent, the type is a non-deduced context. llvm-svn: 256651
* Silencing a -Wcast-qual warning; NFC.Aaron Ballman2015-12-301-1/+1
| | | | llvm-svn: 256644
* When performing an implicit from float to bool, the floating point value ↵Aaron Ballman2015-12-302-1/+12
| | | | | | | | 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
* Disable generating movt on FreeBSD.Davide Italiano2015-12-302-2/+7
| | | | | | | | | | 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
* clang-format: Slightly row back on r256343 by increasing penalty forDaniel Jasper2015-12-302-1/+5
| | | | | | | | | | | | | breaking between array subscripts. Before: if (aaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa] [aaaaaaaaaaaaa]) After: if (aaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa][aaaaaaaaaaaaa]) llvm-svn: 256640
* [OPENMP 4.5] Allow 'ordered' clause on 'loop simd' constructs.Alexey Bataev2015-12-3010-12/+61
| | | | | | OpenMP 4.5 allows to use 'ordered' clause without parameter on 'loop simd' constructs. llvm-svn: 256639
* clang-format: [JS] Support TypeScript 1.6 user defined type guards.Daniel Jasper2015-12-303-0/+14
| | | | | | | | | | | | | | | | 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
* [ptr-traits] Add another complete type that is necessary for at leastChandler Carruth2015-12-301-1/+1
| | | | | | some of the build bots. Still can't reproduce these failures locally. llvm-svn: 256630
* [ptr-traits] Some compilers (older Clang? unsure) on build bots needChandler Carruth2015-12-302-3/+5
| | | | | | | | | 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
* [MS ABI] Add variable templates to the NameBackReferencesDavid Majnemer2015-12-302-1/+7
| | | | | | | | Only function template specializations are exempt from being added to the NameBackReferences. Redundant variable template specializations should be appropriately substituted. llvm-svn: 256623
* [MS ABI] Improve our mangling of pass_object_sizeDavid Majnemer2015-12-302-4/+34
| | | | | | | | | | | | | | 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
* Fix alignment issue in CodeGenFunction::PopCleanupBlock.James Y Knight2015-12-301-6/+18
| | | | | | | | | | | | 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
* [ptr-traits] Add #includes of headers rather than forward declarationsChandler Carruth2015-12-308-6/+8
| | | | | | | | | | | | | | 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
* [ptr-traits] Move a class definition up to the top of this header so itChandler Carruth2015-12-301-25/+24
| | | | | | | | | | | 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
* [ptr-traits] Move methods manipulating PointerUnions, DenseMap pointerChandler Carruth2015-12-3010-115/+196
| | | | | | | | | | | | | | | 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
* [ptr-traits] Switch the Redeclarable template to using a void pointer inChandler Carruth2015-12-301-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [ptr-traits] Switch from a really wasteful SmallDenseMap ofChandler Carruth2015-12-302-8/+12
| | | | | | | | | | | | | | | | | | | | | | 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
* [ptr-traits] Stop using two bogus types as stand-ins for flagsChandler Carruth2015-12-303-90/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [TrailingObjects] Convert CastExpr and subclasses.James Y Knight2015-12-305-49/+82
| | | | llvm-svn: 256608
* Clean up this code, NFC.Richard Smith2015-12-301-8/+12
| | | | llvm-svn: 256607
* [analyzer] Handle another Android assert function.Devin Coughlin2015-12-302-0/+13
| | | | | | | | | | | 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
* [analyzer] Suppress nullability warning for _Nonnull locals zero-initialized ↵Devin Coughlin2015-12-292-2/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* When a namespace alias redeclares a using declaration, point the diagnostic atRichard Smith2015-12-292-4/+15
| | | | | | the using declaration not at the thing it's using. llvm-svn: 256602
* Model NamespaceAliasDecls as having their nominated namespace as an underlyingRichard Smith2015-12-297-29/+54
| | | | | | | | | | | | | 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
* Address review comment on r256595Nico Weber2015-12-291-1/+1
| | | | llvm-svn: 256600
* Fix test from r256596Nico Weber2015-12-291-1/+1
| | | | llvm-svn: 256599
* Emit a -Wmicrosoft warning when treating ^Z as EOF in MS mode.Nico Weber2015-12-294-4/+11
| | | | llvm-svn: 256596
* Emit a -Wmicrosoft warning when pasting /##/ into a comment token in MS mode.Nico Weber2015-12-296-12/+22
| | | | llvm-svn: 256595
* [TrailingObjects] Convert OffsetOfExpr.James Y Knight2015-12-2911-165/+160
| | | | | | That necessitated moving the OffsetOfNode class out of OffsetOfExpr. llvm-svn: 256590
* [MS ABI] Invent a mangling for reference temporariesDavid Majnemer2015-12-292-6/+10
| | | | | | | | | MSVC is non-conforming and doesn't have a mangling for these. Invent our own to unblock folks using clang. This fixes PR25795. llvm-svn: 256589
* Use consistent types for all bit-field members in the same bit-field so that ↵Richard Smith2015-12-291-16/+16
| | | | | | MSVC's bit-field packing algorithm packs them properly. llvm-svn: 256587
* [TrailingObjects] Convert Decl* classes.James Y Knight2015-12-2912-68/+72
| | | | | | | | Also remove now-redundant explicit alignment specification on some of the classes converted prior to TrailingObjects automatically ensuring proper alignment. llvm-svn: 256585
* [MS ABI] Add a mangling for _ComplexDavid Majnemer2015-12-292-5/+14
| | | | | | | | | | | | | MSVC doesn't implement a mangling for C99's _Complex so we must invent our own. For now, treating it like a class type called _Complex in the __clang namespace. This means that 'void f(__Complex int))' will demangle as: 'void f(struct __clang::_Complex<int>)' llvm-svn: 256583
* [MS ABI] Mark an unreachable path appropriatelyDavid Majnemer2015-12-291-8/+2
| | | | | | No functional change is intended, just a small cleanup. llvm-svn: 256582
* fix typos; NFCSanjay Patel2015-12-292-3/+3
| | | | llvm-svn: 256576
* Teach typo correction to properly handle mapping declarations to theirRichard Smith2015-12-299-36/+47
| | | | | | | | | | underlying decls. Preserve the found declaration throughout, and only map to the underlying declaration when we want to check whether it's the right kind. This allows us to provide the right source location for the found declaration, and prepares for the possibility of underlying decls with a different name from the found decl. llvm-svn: 256575
* [TrailingObjects] Convert AST classes that had a ASTTemplateKWAndArgsInfo.James Y Knight2015-12-298-416/+337
| | | | | | | | | | | | | | | | | | | | So, also: - Moved the TemplateArgumentLoc array out of the ASTTemplateKWAndArgsInfo class (making it a simple fixed-size object), to avoid needing to have a variable-length object as part of a variable-length object. Now the objects that have a ASTTemplateKWAndArgsInfo also have some TemplateArgumentLoc objects appended directly. - Removed some internal-use accessors which became simply a wrapper on getTrailingObjects. - Moved MemberNameQualifier out of the MemberExpr class, renamed it MemberExprNameQualifier, because the template can't refer to a class nested within the class it's defining. llvm-svn: 256570
* [analyzer] Nullability: allow cast to _Nonnull to suppress warning about ↵Devin Coughlin2015-12-292-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | returning nil. The nullability checker currently allows casts to suppress warnings when a nil literal is passed as an argument to a parameter annotated as _Nonnull: foo((NSString * _Nonnull)nil); // no-warning It does so by suppressing the diagnostic when the *type* of the argument expression is _Nonnull -- even when the symbolic value returned is known to be nil. This commit updates the nullability checker to similarly honor such casts in the analogous scenario when nil is returned from a function with a _Nonnull return type: return (NSString * _Nonnull)nil; // no-warning This commit also normalizes variable naming between the parameter and return cases and adds several tests demonstrating the limitations of this suppression mechanism (such as when nil is cast to _Nonnull and then stored into a local variable without a nullability qualifier). These tests are marked with FIXMEs. rdar://problem/23176782 llvm-svn: 256567
* [TrailingObjects] Use a different technique to determine if a getDeclJames Y Knight2015-12-291-14/+24
| | | | | | | | | | | | | member function exists on a class. The previous trick depended on inheriting from the class it was checking, which will fail when I start marking things 'final'. Attempt #2: now with a special #ifdef branch for MSVC. Hopefully *this* actually builds with all supported compilers... llvm-svn: 256564
* [MS ABI] Implement a mangling for _Atomic typesDavid Majnemer2015-12-292-5/+15
| | | | | | | | | | | | | MSVC doesn't implement a mangling for C11's _Atomic so we must invent our own. For now, treating it like a class type called _Atomic in the __clang namespace. This means that 'void f(__Atomic(int))' will demangle as: 'void f(struct __clang::_Atomic<int>)' llvm-svn: 256557
* [MS ABI] Cleanup our mangling of vector typesDavid Majnemer2015-12-292-12/+15
| | | | | | | | | | | | | | We used to produce a type which demangled to: union __clang_vec8_F That 'F' is the mangling for 'short' but it is present in the mangled name in an inappropriate place, leading to it not getting demangled. Instead, create a synthetic class type in a synthetic namespace called __clang. With this, it now demangles to: union __clang::__vector<short,8> llvm-svn: 256556
* [MS ABI] Cleanup the mangling of artifical typesDavid Majnemer2015-12-291-46/+97
| | | | | | | Hand-rolling the mangling results in us not correctly adding names to the backreference map. llvm-svn: 256555
* clang-format: [JS/TypeScript] Support "enum" as property name.Daniel Jasper2015-12-293-8/+18
| | | | | | | | | | | Before: enum: string []; After: enum: string[]; llvm-svn: 256546
OpenPOWER on IntegriCloud