summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [Sema] Avoid "case value not in enumerated type" warning for C++11 opaque enumsAlex Lorenz2016-12-082-1/+32
| | | | | | | | | | | | This commit ensures that the switch warning "case value not in enumerated type" isn't shown for opaque enums. We don't know the actual list of values in opaque enums, so that warning is incorrect. rdar://29230764 Differential Revision: https://reviews.llvm.org/D27299 llvm-svn: 289055
* [analyzer] Add dispatch_data_create as a special case in RetainCountChecker.Artem Dergachev2016-12-082-1/+84
| | | | | | | | | | | | | This function receives a callback block. The analyzer suspects that this block may be used to take care of releasing the libdispatch object returned from the function. In fact, it doesn't - it only releases the raw data buffer. Inform the analyzer about that. Fixes the resulting false negatives. rdar://problem/22280098 Differential Revision: https://reviews.llvm.org/D27409 llvm-svn: 289047
* [ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmTypeMalcolm Parsons2016-12-084-0/+48
| | | | | | | | | | | | Summary: Needed for https://reviews.llvm.org/D27166 Reviewers: sbenza, bkramer, klimek Subscribers: aemerson, cfe-commits Differential Revision: https://reviews.llvm.org/D27447 llvm-svn: 289042
* [DOXYGEN] Improved doxygen comments for avxintrin.h intrinsics.Ekaterina Romanova2016-12-081-135/+142
| | | | | | | Tagged parameter names with \a doxygen command to display them in italics. Formatted comments to fit into 80 chars. llvm-svn: 289022
* [c++1z] P0490R0, NB comment GB 20: if std::tuple_size<T> is complete, use theRichard Smith2016-12-082-6/+3
| | | | | | | | tuple-like interpretation of decomposition declaration even if there is no ::value member. We already did this, anticipating this resolution, just update comments and tweak a testcase. llvm-svn: 289021
* [c++1z] P0003R5: Removing dynamic exception specifications.Richard Smith2016-12-0815-27/+77
| | | | | | | | | | | | | | | | | | We continue to support dynamic exception specifications in C++1z as an extension, but produce an error-by-default warning when we encounter one. This allows users to opt back into the feature with a warning flag, and implicitly opts system headers back into the feature should they happen to use it. There is one semantic change implied by P0003R5 but not implemented here: violating a throw() exception specification should now call std::terminate directly instead of calling std::unexpected(), but since P0003R5 also removes std::unexpected() and std::set_unexpected, and the default unexpected handler calls std::terminate(), a conforming C++1z program cannot tell that we are still calling it. The upside of this strategy is perfect backwards compatibility; the downside is that we don't get the more efficient 'noexcept' codegen for 'throw()'. llvm-svn: 289019
* [Headers] Enable #include_next<float.h> on DarwinBruno Cardoso Lopes2016-12-083-2/+24
| | | | | | | | | Allows darwin targets to provide additional definitions and implementation specifc values for float.h rdar://problem/21961491 llvm-svn: 289018
* Loosen checks for _MSC_FULL_VER under -fms-extensions.David L. Jones2016-12-081-1/+1
| | | | | | | | | | | | Summary: On actual Windows hosts :-) , this could report something other than the fallback, with a non-zero minor/build number. Reviewers: rnk, llvm-commits Differential Revision: https://reviews.llvm.org/D27554 llvm-svn: 289011
* [Driver][Darwin] Disable default stack protector levels in freestanding mode.Bruno Cardoso Lopes2016-12-082-1/+21
| | | | | | | | | Currently -fstack-protector is on by default when using -ffreestanding. Change the default behavior to have it off when using -ffreestanding. rdar://problem/14089363 llvm-svn: 289005
* Refactor how the MSVC toolchain searches for a compatibility version.David L. Jones2016-12-076-88/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The MSVC toolchain and Clang driver combination currently uses a fairly complex sequence of steps to determine the MS compatibility version to pass to cc1. There is some oddness in this sequence currently, with some code which inspects flags in the toolchain, and some code which inspects the triple and local environment in the driver code. This change is an attempt to consolidate most of this logic so that Win32-specific code lives in MSVCToolChain.cpp. I'm not 100% happy with the split, so any suggestions are welcome. There are a few things you might want to watch for for specifically: - On all platforms, if MSVC compatibility flags are provided (and valid), use those. - The fallback sequence should be the same as before, but is now consolidated into MSVCToolChain::getMSVCVersion: - Otherwise, try to use the Triple. - Otherwise, on Windows, check the executable. - Otherwise, on Windows or with --fms-extensions, default to 18. - Otherwise, we can't determine the version. - MSVCToolChain::ComputeEffectiveTriple no longer calls the base ToolChain::ComputeEffectiveClangTriple. The only thing it would change for Windows the architecture, which we don't care about for the compatibility version. - I'm not sure whether this is philosophically correct (but it should be easy to add back to MSVCToolChain::getMSVCVersionFromTriple if not). - Previously, Tools.cpp just called getTriple() anyhow, so it doesn't look like the effective triple was always being used previously anyhow. Reviewers: hans, compnerd, llvm-commits, rnk Subscribers: amccarth Differential Revision: https://reviews.llvm.org/D27477 llvm-svn: 288998
* Add more tests for MSVC version handling.David L. Jones2016-12-072-0/+11
| | | | | | | | | | | | | | | | | Summary: This change adds more test cases for the default MSVC compatibility version: 1. When -fms-extensions is supplied, but -fmsc-version and -fms-compatibility-version are not. 2. With the target triple specifies an MSVC environment, but no other -fms* flags. Reviewers: rnk, llvm-commits Subscribers: hans, compnerd, amccarth Differential Revision: https://reviews.llvm.org/D27498 llvm-svn: 288997
* [Driver] Add tests for default stack protector values on DarwinBruno Cardoso Lopes2016-12-071-0/+15
| | | | llvm-svn: 288994
* [RecursiveASTVisitor] Improve post-order traversal unit testMalcolm Parsons2016-12-071-4/+4
| | | | llvm-svn: 288976
* [CUDA] Improve target attribute checking for function templates.Artem Belevich2016-12-0710-70/+247
| | | | | | | | | | | | * __host__ __device__ functions are no longer considered to be redeclarations of __host__ or __device__ functions. This prevents unintentional merging of target attributes across them. * Function target attributes are not considered (and must match) during explicit instantiation and specialization of function templates. Differential Revision: https://reviews.llvm.org/D25809 llvm-svn: 288962
* [RecursiveASTVisitor] Fix post-order traversal of UnaryOperatorMalcolm Parsons2016-12-072-3/+9
| | | | | | | | | | Reviewers: aaron.ballman, klimek, doug.gregor, teemperor, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26742 llvm-svn: 288923
* [analyzer] Fix typo in nullability checker diagnosticDevin Coughlin2016-12-071-1/+1
| | | | | | 'infered' --> 'inferred' llvm-svn: 288922
* [analyzer] Remove an unused enum value in RetainCountChecker.Artem Dergachev2016-12-072-16/+11
| | | | | | | | No functional change intended. Differential Revision: https://reviews.llvm.org/D27408 llvm-svn: 288917
* [analyzer] pr31226: Disable CastSizeChecker in C++ because it's not quite ready.Artem Dergachev2016-12-072-3/+27
| | | | | | | | Avoids a crash and a related false positive. Investigation by Daniel Krupp! llvm-svn: 288914
* Implement the -Wstrict-prototypes warningAlex Lorenz2016-12-075-0/+114
| | | | | | | | | | | | | | | This commit fixes PR20796. It implements the C only -Wstrict-prototypes warning. Clang now emits a warning for function declarations which have no parameters specified and for K&R function definitions with more than 0 parameters that are not preceded by a previous prototype declaration. The patch was originally submitted by Paul Titei! rdar://15060615 Differential Revision: https://reviews.llvm.org/D16533 llvm-svn: 288896
* [ObjC++] Don't enter a C++ declarator scope when the current context isAlex Lorenz2016-12-073-0/+48
| | | | | | | | | | | | | | | an Objective-C declaration This commit ensures that Sema won't enter a C++ declarator scope when the current context is an Objective-C declaration. This prevents an assertion failure in EnterDeclaratorContext that's used to ensure that current context will be restored correctly after exiting the declarator context. rdar://20560175 Differential Revision: https://reviews.llvm.org/D26922 llvm-svn: 288893
* Compilation database test: don't try to output to CWDSam McCall2016-12-071-4/+5
| | | | | | | | | | | | | | | Summary: Write output from compilation database test to %T rather than the working dir. Sometimes CWD isn't writable! Also specify no-canonical-prefixes so that clang has 'clang' in the name. Reviewers: bkramer Subscribers: joerg, cfe-commits Differential Revision: https://reviews.llvm.org/D27504 llvm-svn: 288892
* [OpenCL] Added a LIT test for ensuring address space mangling is done the ↵Alexey Bader2016-12-071-0/+14
| | | | | | | | | | | | | | same both in OpenCL1.2 and OpenCL2.0. Patch by Egor Churaev (echuraev). Reviewers: Anastasia Subscribers: yaxunl, cfe-commits, bader Differential Revision: https://reviews.llvm.org/D27403 llvm-svn: 288891
* [OpenCL] Fix SPIR version generation.Alexey Bader2016-12-072-11/+16
| | | | | | | | | | | | Patch by Egor Churaev (echuraev). Reviewers: Anastasia Subscribers: bader, yaxunl, cfe-commits Differential Revision: https://reviews.llvm.org/D27300 llvm-svn: 288890
* Driver: Remove support for -fobjc-gc*Duncan P. N. Exon Smith2016-12-077-58/+7
| | | | | | | | | | | | As a first step toward removing Objective-C garbage collection from Clang, remove support from the driver. I'm hoping this will flush out any expected bots/configurations/whatever that might rely on it. I've left the options behind temporarily in -cc1 to keep tests passing. I'll kill them off entirely in a follow up when I've had a chance to update/delete the rest of Clang. llvm-svn: 288872
* Fix test.Richard Smith2016-12-071-1/+1
| | | | llvm-svn: 288870
* [MS-ABI]V-base dtor called more than needed when throw happens in v-base ↵Erich Keane2016-12-072-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ctor in window. Need add "complete object flag" check in eh cleanup code. The problem only happen on window ( A MS-ABI issuer ) The nature of the problem is virtual base dtor called more than it is needed after exception throw in inheriting base class(with virtual bases) ctor. The root problem is when throw happen, not all virtual base classes have been contructed, so not all virtual base dtors are need to call for ehcleanup. clang has code to handle vbase initialization: basically add check for "complete object flag" before call to v-base ctor. But that part is missing for cleanup code. To fix this add similar code as v-base init to cleanup code, same algorithm. 1> Add new routine: EmitDtorCompleteObjectHandler With corresponding to EmitCtorCompleteObjectHandler 2> In the EmitDestructorCal Call EmitDtorCompleteObjectHandler when generate ehcleanup inside ctor. Just add check for "complete object flag" before call to v-base dtor. Without my change: ehcleanup: ; preds = %ctor.skip_vbases %13 = cleanuppad within none [], !dbg !66 %14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66 %15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66 %16 = bitcast i8* %15 to %struct.class_2*, !dbg !66 call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token %13) ], !dbg !66 cleanupret from %13 unwind to caller, !dbg !66 with my change: ehcleanup: ; preds = %ctor.skip_vbases %13 = cleanuppad within none [], !dbg !66 %14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66 %15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66 %16 = bitcast i8* %15 to %struct.class_2*, !dbg !66 %is_complete_object4 = icmp ne i32 %is_most_derived2, 0, !dbg !66 br i1 %is_complete_object4, label %Dtor.dtor_vbase, label %Dtor.skip_vbase, !d bg !66 Dtor.dtor_vbase: ; preds = %ehcleanup call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token %13) ], !dbg !66 br label %Dtor.skip_vbase, !dbg !66 Dtor.skip_vbase: ; preds = %Dtor.dtor_vbase, %ehcleanup cleanupret from %13 unwind to caller, !dbg !66 Please let me know you need more info. Patch by Jennifer Yu. Differential Revision: https://reviews.llvm.org/D27358 llvm-svn: 288869
* Address review feedback by adding comments about ${:uid}Reid Kleckner2016-12-071-3/+5
| | | | llvm-svn: 288868
* [c++17] P0135R1: Guaranteed copy elision.Richard Smith2016-12-0618-68/+428
| | | | | | | | When an object of class type is initialized from a prvalue of the same type (ignoring cv qualifications), use the prvalue to initialize the object directly instead of inserting a redundant elidable call to a copy constructor. llvm-svn: 288866
* [OpenMP] Fix typo in the run command in the test case. NFC.Kelvin Li2016-12-061-2/+2
| | | | llvm-svn: 288862
* Disable -Wweak-vtables when there are no key functionsReid Kleckner2016-12-062-14/+21
| | | | | | | | | | | | Our -Wweak-vtables diagnostic is powered by our key function calculation, which checks if key functions are enabled. We won't find any key functions in C++ ABIs that lack key functions, so -Wweak-vtables was warning on every dynamic class before this change. So, turn off this warning in ABIs without key functions. Addresses PR31220 llvm-svn: 288850
* [OpenMP] Fix typo in the test case. NFC.Kelvin Li2016-12-061-2/+1
| | | | llvm-svn: 288838
* Fix FileCheck pattern.Joerg Sonnenberger2016-12-061-2/+2
| | | | llvm-svn: 288828
* Allow additional output since e.g. OSX appends flags likeJoerg Sonnenberger2016-12-061-2/+2
| | | | | | | | "-mlinker-version=264.3.102" automatically. Wiring down a target on the other hand is problematic as this actually needs to run codegen and doesn't work with -###. llvm-svn: 288827
* [MS ABI] Implement more of the Itanium mangling rulesDavid Majnemer2016-12-062-21/+77
| | | | | | | | | | | | We didn't implement handle corner cases like: - lambdas used to initialize a field - lambdas in default argument initializers This fixes PR31197. Differential Revision: https://reviews.llvm.org/D27226 llvm-svn: 288826
* Make test case slightly more robust by explicitly passing --sysroot.Joerg Sonnenberger2016-12-061-3/+3
| | | | | | Otherwise it would change when DEFAULT_SYSROOT is provided. llvm-svn: 288823
* If clang was configured for a DEFAULT_SYSROOT and no --sysroot argumentJoerg Sonnenberger2016-12-061-0/+5
| | | | | | is seen, record one with the implicit default. llvm-svn: 288822
* Allow clang to write compilation database records.Joerg Sonnenberger2016-12-065-1/+81
| | | | | | | | | | | | | | | | | | | | When integrating compilation database output into existing build systems, two approaches dominate so far. Ad-hoc implementation of the JSON output rules or using compiler wrappers. This patch adds a new option "-MJ foo.json" which gives a slightly cleaned up compilation record. The output is a fragment, i.e. you still need to add the array markers, but it allows multiple files to be easy merged. This way the only change in a build system is adding the option with potentially a per-target output file and merging the files with something like (echo '['; cat *.o.json; echo ']' > compilation_database.json or some additional filtering to remove the trailing comma for strict JSON compliance. Differential Revision: https://reviews.llvm.org/D27140 llvm-svn: 288821
* Fix doc string typo: s/@__yes/@__objc_yes/Jonathan Roelofs2016-12-061-1/+1
| | | | llvm-svn: 288818
* Fix two clang-tidy misc-move-forwarding-reference warningsMalcolm Parsons2016-12-062-2/+2
| | | | | | Patch by Michael Sharpe. llvm-svn: 288813
* Also recognize -std=iso9899:201xBenjamin Kramer2016-12-062-1/+4
| | | | | | | | | | | It should already be handled but a typo in the LANGSTANDARD() definition was introduced in r147220. Patch by Alexander Richardson, test case by me. Differential Revision:https://reviews.llvm.org/D27427 llvm-svn: 288793
* [clang] Fix D26214: Move error handling out of MC and to the callers.Mandeep Singh Grang2016-12-064-6/+44
| | | | | | | | | | | | | | Summary: Related llvm patch: https://reviews.llvm.org/D27359 Reviewers: echristo, t.p.northover, rengolin, grosbach, compnerd Subscribers: mehdi_amini, cfe-commits, llvm-commits Tags: #clang-c Differential Revision: https://reviews.llvm.org/D27360 llvm-svn: 288762
* Clean up some Sema checking code. NFCRichard Trieu2016-12-062-48/+14
| | | | | | | | | - Rename CheckMinZero to CheckMaxUnsignedZero to reflect its actual purpose. - Remove unused parameters from CheckAbsoluteValueFunction and CheckMaxUnsignedZero functions. - Refactor the function name check so both functions can use the same one. llvm-svn: 288756
* Revert r288626, which reverts r288449. Original commit message:Richard Smith2016-12-064-15/+54
| | | | | | Recover better from an incompatible .pcm file being provided by -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually. llvm-svn: 288741
* Add test for r288732, warn on unsigned zero in std::maxRichard Trieu2016-12-061-0/+55
| | | | llvm-svn: 288740
* Additional test file missed from r288737.Richard Smith2016-12-061-0/+12
| | | | llvm-svn: 288738
* [modules] Use the "redundant #include" diagnostic rather than the "moduleRichard Smith2016-12-065-19/+28
| | | | | | | | import can't appear here" diagnostic if an already-visible module is textually entered (because we have the module map but not the AST file) within a function/namespace scope. llvm-svn: 288737
* Warn on unsigned zero in call to std::maxRichard Trieu2016-12-054-0/+99
| | | | | | | | | | | New default warning that triggers when an unsigned zero is used in a call to std::max. For unsigned values, zero is the minimum value, so any call to std::max is always equal to the other value. A common pattern was to take the max of zero and the difference of two unsigned values, not taking into account that unsigned values wrap around below zero. This warning also emits a note with a fixit hint to remove the zero and call to std::max. llvm-svn: 288732
* [docs] Use x86_64 and i386 instead of x86 as arch for triples.Florian Hahn2016-12-051-2/+2
| | | | | | | | | | | | Summary: x86 is not a valid arch for target triples, but x86_64 and i386 are. Reviewers: rengolin, silvas Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26960 llvm-svn: 288723
* CodeGen: fix windows itanium RTTI in EH modeSaleem Abdulrasool2016-12-052-2/+10
| | | | | | | | | When emitting RTTI for EH only, we would mark the locally defined (LinkOnceODR) RTTI definition as dllimport, which is incorrect. Ensure that if we are generating the type information for EH only, it is marked as LinkOnceODR and we do not make it dllimport. llvm-svn: 288721
* [analyzer] Print type for SymbolRegionValues when dumping to streamDominic Chen2016-12-052-2/+3
| | | | | | | | | | Reviewers: NoQ, dcoughlin, zaks.anna Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27365 llvm-svn: 288696
OpenPOWER on IntegriCloud