summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* [modules] When merging one definition into another, propagate the list ofRichard Smith2016-09-142-20/+62
| | | | | | re-exporting modules from the discarded definition to the retained definition. llvm-svn: 281429
* Also don't inline dllimport functions referring to non-dllimport constructors.Hans Wennborg2016-09-131-0/+6
| | | | | | | | The AST walker wasn't visiting CXXConstructExprs before. This is a follow-up to r281395. llvm-svn: 281413
* [CUDA] Do not merge CUDA target attributes.Artem Belevich2016-09-131-1/+7
| | | | | | | | | | | | CUDA target attributes are used for function overloading and must not be merged. This fixes a bug where attributes were inherited during function template specialization in CUDA and made it impossible for specialized function to provide its own target attributes. Differential Revision: https://reviews.llvm.org/D24522 llvm-svn: 281406
* [CodeGen] Fix an assert in EmitNullConstant.Akira Hatanaka2016-09-131-1/+2
| | | | | | | | | | | | | | | r235815 changed CGRecordLowering::accumulateBases to ignore non-virtual bases of size 0, which prevented adding those non-virtual bases to CGRecordLayout's NonVirtualBases. This caused clang to assert when CGRecordLayout::getNonVirtualBaseLLVMFieldNo was called in EmitNullConstant. This commit fixes the bug by ignoring zero-sized non-virtual bases in EmitNullConstant. rdar://problem/28100139 Differential Revision: https://reviews.llvm.org/D24312 llvm-svn: 281405
* Temporary fix for MS _Interlocked intrinsicsAlbert Gutowski2016-09-132-10/+59
| | | | llvm-svn: 281401
* Reverse commit 281375 (breaks building Chromium)Albert Gutowski2016-09-137-36/+55
| | | | llvm-svn: 281399
* Try harder to not inline dllimport functions referencing non-dllimport functionsHans Wennborg2016-09-131-2/+23
| | | | | | | | In r246338, code was added to check for this, but it failed to take into account implicit destructor invocations because those are not reflected in the AST. This adds a separate check for them. llvm-svn: 281395
* Remove excessive padding from PTHWriterAlexander Shaposhnikov2016-09-131-3/+3
| | | | | | | | | | | The class PTHWriter is in lib/Frontend/CacheTokens.cpp inside the anonymous namespace. This diff changes the order of fields an removes excessive padding. Test plan: make -j8 check-clang Differential revision: https://reviews.llvm.org/D23902 llvm-svn: 281385
* [SemaObjC] Be more strict while parsing type arguments and protocolsBruno Cardoso Lopes2016-09-133-2/+14
| | | | | | | | | | | | | | | | | | | | Fix a crash-on-invalid. When parsing type arguments and protocols, parseObjCTypeArgsOrProtocolQualifiers() calls ParseTypeName(), which tries to find matching tokens for '[', '(', etc whenever they appear among potential type names. If unmatched, ParseTypeName() yields a tok::eof token stream. This leads to crashes since the parsing at this point is not expected to go beyond the param list closing '>'. Fix that by properly handling tok::eof in parseObjCTypeArgsOrProtocolQualifiers() callers. Differential Revision: https://reviews.llvm.org/D23852 rdar://problem/25063557 llvm-svn: 281383
* Add bunch of _Interlocked builtinsAlbert Gutowski2016-09-132-185/+38
| | | | | | | | | | Reviewers: compnerd, thakis, Prazek, majnemer, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24153 llvm-svn: 281378
* Add some MS aliases for existing intrinsicsAlbert Gutowski2016-09-137-55/+36
| | | | | | | | | | Reviewers: thakis, compnerd, majnemer, rsmith, rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24330 llvm-svn: 281375
* [analyzer] Fix ExprEngine::VisitMemberExprAlexander Shaposhnikov2016-09-131-1/+1
| | | | | | | | | | | AST may contain intermediate ParenExpr nodes between MemberExpr and ArrayToPointerDecay. This diff adjusts the check in ExprEngine::VisitMemberExpr accordingly. Test plan: make -j8 check-clang-analysis Differential revision: https://reviews.llvm.org/D24484 llvm-svn: 281373
* [clang-cl] Diagnose duplicate uuids.Nico Weber2016-09-133-4/+41
| | | | | | | | | | | | This mostly behaves cl.exe's behavior, even though clang-cl is stricter in some corner cases and more lenient in others (see the included test). To make the uuid declared previously here diagnostic work correctly, tweak stripTypeAttributesOffDeclSpec() to keep attributes in the right order. https://reviews.llvm.org/D24469 llvm-svn: 281367
* ObjectiveC Generics: Start using ObjCTypeParamType.Manman Ren2016-09-136-9/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | For ObjC type parameter, we used to have TypedefType that is canonicalized to id or the bound type. We can't represent "T <protocol>" and thus will lose the type information in the following example: @interface MyMutableDictionary<KeyType, ObjectType> : NSObject - (void)setObject:(ObjectType)obj forKeyedSubscript:(KeyType <NSCopying>)key; @end MyMutableDictionary<NSString *, NSString *> *stringsByString; NSNumber *n1, *n2; stringsByString[n1] = n2; --> no warning on type mismatch of the key. To fix the problem, we introduce a new type ObjCTypeParamType that supports a list of protocol qualifiers. We create ObjCTypeParamType for ObjCTypeParamDecl when we create ObjCTypeParamDecl. We also substitute ObjCTypeParamType instead of TypedefType on an ObjCTypeParamDecl. rdar://24619481 rdar://25060179 Differential Revision: http://reviews.llvm.org/D23080 llvm-svn: 281358
* AMDGPU: Fix target options fp32/64-denormalsYaxun Liu2016-09-131-10/+6
| | | | | | | | | | | | | | Fix target options for fp32/64-denormals so that +fp64-denormals is set if fp64 is supported -fp32-denormals if fp32 denormals is not supported, or -cl-denorms-are-zero is set +fp32-denormals if fp32 denormals is supported and -cl-denorms-are-zero is not set If target feature fp32/64-denormals is explicitly set, they will override default options and options deduced from -cl-denorms-are-zero. Differential Revision: https://reviews.llvm.org/D24512 llvm-svn: 281357
* ObjectiveC generics: Add ObjCTypeParamType in the type system.Manman Ren2016-09-1314-0/+246
| | | | | | | | | | | | | | | | | We also need to add ObjCTypeParamTypeLoc. ObjCTypeParamType supports the representation of "T <protocol>" where T is a type parameter. Before this, we use TypedefType to represent the type parameter for ObjC. ObjCTypeParamType has "ObjCTypeParamDecl *OTPDecl" and it extends from ObjCProtocolQualifiers. It is a non-canonical type and is canonicalized to the underlying type with the protocol qualifiers. rdar://24619481 rdar://25060179 Differential Revision: http://reviews.llvm.org/D23079 llvm-svn: 281355
* ObjectiveC: Refactor applyObjCProtocolQualifiers.Manman Ren2016-09-132-57/+78
| | | | | | | | | | | | | | To construct the canonical type of ObjCTypeParamType, we need to apply qualifiers on ObjCObjectPointerType. The updated applyObjCProtocolQualifiers handles this case by merging the protocol lists, constructing a new ObjCObjectType, then a new ObjCObjectPointerType. rdar://24619481 rdar://25060179 Differential Revision: http://reviews.llvm.org/D24059 llvm-svn: 281353
* Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.Manman Ren2016-09-131-6/+3
| | | | | | | | | | | | | | | Now ObjCObjectType extends from ObjCProtocolQualifiers. We save number of protocols in ObjCProtocolQualifiers. This is in preparation of adding a new type class ObjCTypeParamType that can take protocol qualifiers. rdar://24619481 rdar://25060179 Differential Revision: http://reviews.llvm.org/D23078 llvm-svn: 281351
* Remove redundant comma around parenthesis in parameter list.Eric Liu2016-09-131-0/+2
| | | | | | | | | | Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D24501 llvm-svn: 281344
* Revert accidentally checked in change in r281315.Vassil Vassilev2016-09-131-1/+1
| | | | llvm-svn: 281316
* Simplify. NFC.Vassil Vassilev2016-09-132-4/+4
| | | | llvm-svn: 281315
* Allow register variables in naked functions.Nikola Smiljanic2016-09-131-0/+15
| | | | llvm-svn: 281298
* Reapply r281276 with passing -emit-llvm in one of the testsAdam Nemet2016-09-133-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original commit message: Add -fdiagnostics-show-hotness Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281293
* Fix interaction between serialization and c++1z feature.Richard Trieu2016-09-131-1/+1
| | | | | | | | In c++1z, static_assert is not required to have a StringLiteral message, where previously it was required. Update the AST Reader to be able to handle a null StringLiteral. llvm-svn: 281286
* Update Clang for D20147 ("DebugInfo: New metadata representation for global ↵Peter Collingbourne2016-09-135-13/+17
| | | | | | | | variables.") Differential Revision: http://reviews.llvm.org/D20415 llvm-svn: 281285
* Revert "Add -fdiagnostics-show-hotness"Adam Nemet2016-09-133-20/+1
| | | | | | | | This reverts commit r281276. Many bots are failing. llvm-svn: 281279
* [DebugInfo] Deduplicate debug info limiting logicReid Kleckner2016-09-131-21/+10
| | | | | | | | | | | | | We should be doing the same checks when a type is completed as we do when a complete type is used during emission. Previously, we duplicated the logic, and it got out of sync. This could be observed with dllimported classes. Also reduce a test case for this slightly. Implementing review feedback from David Blaikie on r281057. llvm-svn: 281278
* [Sema] Fix PR30346: relax __builtin_object_size checks.George Burgess IV2016-09-121-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes us act more conservatively when trying to determine the objectsize for an array at the end of an object. This is in response to code like the following: ``` struct sockaddr { /* snip */ char sa_data[14]; }; void foo(const char *s) { size_t slen = strlen(s) + 1; size_t added_len = slen <= 14 ? 0 : slen - 14; struct sockaddr *sa = malloc(sizeof(struct sockaddr) + added_len); strcpy(sa->sa_data, s); // ... } ``` `__builtin_object_size(sa->sa_data, 1)` would return 14, when there could be more than 14 bytes at `sa->sa_data`. Code like this is apparently not uncommon. FreeBSD's manual even explicitly mentions this pattern: https://www.freebsd.org/doc/en/books/developers-handbook/sockets-essential-functions.html (section 7.5.1.1.2). In light of this, we now just give up on any array at the end of an object if we can't find the object's initial allocation. I lack numbers for how much more conservative we actually become as a result of this change, so I chose the fix that would make us as compatible with GCC as possible. If we want to be more aggressive, I'm happy to consider some kind of whitelist or something instead. llvm-svn: 281277
* Add -fdiagnostics-show-hotnessAdam Nemet2016-09-123-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281276
* CodeGen: use some range-based for loopsSaleem Abdulrasool2016-09-121-14/+10
| | | | | | | Use range-based for loops to simplify the logic. Add an explicit check for MachO as the inline asm uses MachO specific directives. llvm-svn: 281261
* [modules] When we merge two definitions of a function, mark the retainedRichard Smith2016-09-122-24/+31
| | | | | | | definition as visible in the discarded definition's module, as we do for other kinds of definition. llvm-svn: 281258
* [MS ABI] Add /include directives for dynamic TLSDavid Majnemer2016-09-121-0/+8
| | | | | | | | | MSVC emits /include directives in the .drective section for the __dyn_tls_init function (decorated as ___dyn_tls_init@12 for 32-bit). This fixes PR30347. llvm-svn: 281189
* CodeGen: remove unnecessary else caseSaleem Abdulrasool2016-09-111-6/+3
| | | | | | | Refactor the assignment so that its much more clear that the if-clause contains the lookup, and once cached is directly used. NFC. llvm-svn: 281150
* Modules: for ObjectiveC try to keep the definition invariant.Manman Ren2016-09-091-36/+59
| | | | | | | | | | | | When deserializing ObjCInterfaceDecl with definition data, if we already have a definition, try to keep the definition invariant; also pull in the categories even if it is not what getDefinition returns (this effectively combines categories). rdar://27926200 rdar://26708823 llvm-svn: 281119
* Debug info: Bump the default DWARF version on Darwin to 4.Adrian Prantl2016-09-091-1/+1
| | | | | | | This is a spiritual re-commit of r201375 with only a brief delay for upgrading the green dragon builders. llvm-svn: 281094
* [CUDA] Make __GCC_ATOMIC_XXX_LOCK_FREE macros the same on host/device.Justin Lebar2016-09-091-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: This fixes a bug where we were unable to compile the following CUDA file with libstdc++ (didn't try libc++): #include <future> void foo() { std::shared_future<int> x; } The problem is that <future> only defines std::shared_future if __GCC_ATOMIC_INT_LOCK_FREE > 1. When we compiled this file for device, the macro was set to 1, and then the class didn't exist at all. Reviewers: tra Subscribers: cfe-commits, jhen Differential Revision: https://reviews.llvm.org/D24407 llvm-svn: 281089
* Modules: revert r280728.Manman Ren2016-09-091-6/+4
| | | | | | | In post-commit review, Richard suggested a better way to fix this. rdar://27926200 llvm-svn: 281078
* Myriad: nominally "support" ASAN.Douglas Katzman2016-09-093-4/+16
| | | | | | Doesn't work, but needs to be enabled in order to get there. llvm-svn: 281071
* Also cleanup comments around redundant colons/commas in format::cleanup.Eric Liu2016-09-091-0/+2
| | | | | | | | | | Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D24400 llvm-svn: 281064
* [DebugInfo] Ensure complete type is emitted with -fstandalone-debugReid Kleckner2016-09-091-3/+7
| | | | | | | | | | | The logic for upgrading a class from a forward decl to a complete type was not checking the debug info emission level before applying the vtable optimization. This meant we ended up without debug info for a class which was required to be complete. I noticed it because it triggered an assertion during CodeView emission, but that's a separate issue. llvm-svn: 281057
* [codeview] Extend the heuristic for detecting classes imported from DLLsReid Kleckner2016-09-091-3/+15
| | | | | | | | | | | | | | If a dynamic class contains a dllimport method, then assume the class may not be constructed in this DLL, and therefore the vtable will live in a different PDB. This heuristic is still incomplete, and will miss things like abstract base classes that are only constructed on one side of the DLL interface. That said, this heuristic does detect some cases that are currently problematic, and may be useful to other projects that don't use many DLLs. llvm-svn: 281053
* Update clang for D21514. NFCAmaury Sechet2016-09-091-4/+5
| | | | | | | | | | | | Summary: As per title. Reviewers: ahatanak, bkramer, whitequark, mehdi_amini, void Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21515 llvm-svn: 281018
* C++ Modules TS: Add parsing and some semantic analysis support forRichard Smith2016-09-0813-27/+145
| | | | | | | export-declarations. These don't yet have an effect on name visibility; we still export everything by default. llvm-svn: 280999
* [Driver] Report invalid -mtune/-mcpu parameters when -arch=arm64Vedant Kumar2016-09-081-9/+11
| | | | | | Differential Revision: https://reviews.llvm.org/D23643 llvm-svn: 280998
* Implement MS _rot intrinsicsAlbert Gutowski2016-09-082-55/+52
| | | | | | | | | | Reviewers: thakis, Prazek, compnerd, rnk Subscribers: majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D24311 llvm-svn: 280997
* [modules] Apply ODR merging for function scoped tags only in C++ mode.Vassil Vassilev2016-09-081-1/+6
| | | | | | | | | | | In C mode, if we have a visible declaration but not a visible definition, a tag defined in the declaration should be have a visible definition. In C++ we rely on the ODR merging, whereas in C we cannot because each declaration of a function gets its own set of declarations in its prototype scope. Patch developed in collaboration with Richard Smith! llvm-svn: 280984
* Moved unreachable to appease msvc, gcc and clangSimon Pilgrim2016-09-081-3/+2
| | | | llvm-svn: 280921
* Fixed a 'not all control paths return a value' warning on MSVC buildsSimon Pilgrim2016-09-081-19/+22
| | | | llvm-svn: 280917
* CodeGen: Clean up implementation of vtable initializer builder. NFC.Peter Collingbourne2016-09-085-139/+121
| | | | | | | | | | | | | - Simplify signature of CreateVTableInitializer function. - Move vtable component builder to a separate function. - Remove unnecessary accessors from VTableLayout class. This is in preparation for a future change that will alter the type of the vtable initializer. Differential Revision: https://reviews.llvm.org/D22642 llvm-svn: 280897
* clang-format: [JavaScript] Change default AllowShortFunctionsOnASingleLineDaniel Jasper2016-09-071-1/+1
| | | | | | for Google style to "empty". llvm-svn: 280878
OpenPOWER on IntegriCloud