summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Accept "-Weverything" in clang diagnistic pragmasSunil Srivastava2016-02-131-4/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D15095 llvm-svn: 260788
* [Sema] More changes to fix Objective-C fallout from r249995.Bob Wilson2016-02-132-33/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up to PR26085. That was fixed in r257710 but the testcase there was incomplete. There is a related issue where the overload resolution for Objective-C incorrectly picks a method that is not valid without a bridge cast. The call to Sema::CheckSingleAssignmentConstraints that was added to SemaOverload.cpp's IsStandardConversion() function does not catch that case and reports that the method is Compatible even when it is not. The root cause here is that various Objective-C-related functions in Sema do not consistently return a value to indicate whether there was an error. This was fine in the past because they would report diagnostics when needed, but r257710 changed them to suppress reporting diagnostics when checking during overload resolution. This patch adds a new ACR_error result to the ARCConversionResult enum and updates Sema::CheckObjCARCConversion to return that value when there is an error. Most of the calls to that function do not check the return value, so adding this new result does not affect them. The one exception is in SemaCast.cpp where it specifically checks for ACR_unbridged, so that is also OK. The call in Sema::CheckSingleAssignmentConstraints can then check for an ACR_okay result and identify assignments as Incompatible. To preserve the existing behavior, it only changes the return value to Incompatible when the new Diagnose argument (from r257710) is false. Similarly, the CheckObjCBridgeRelatedConversions and ConversionToObjCStringLiteralCheck need to identify when an assignment is Incompatible. Those functions already return appropriate values but they need some fixes related to the new Diagnose argument. llvm-svn: 260787
* [RecursiveASTVisitor] Introduce dataTraverseStmtPre()/dataTraverseStmtPost() ↵Argyrios Kyrtzidis2016-02-131-3/+7
| | | | | | | | to allow clients to do before/after actions during data recursive visitation. This should fix the asan bot that hits stack overflow in a couple of test/Index tests. llvm-svn: 260785
* AMDGPU: Add sin/cos builtinsMatt Arsenault2016-02-131-0/+6
| | | | llvm-svn: 260783
* AMDGPU: Update builtin for intrinsic changeMatt Arsenault2016-02-131-3/+3
| | | | llvm-svn: 260781
* Make -Wnull-conversion more useful.Richard Trieu2016-02-131-7/+14
| | | | | | | | | | When a null constant is used in a macro, walk through the macro stack to determine where the null constant is written and where the context is located. Only warn if both locations are within the same macro expansion. This helps function-like macros which involve pointers be treated as if they were functions. llvm-svn: 260776
* [libclang] Separate the underlying indexing functionality of libclang and ↵Argyrios Kyrtzidis2016-02-128-0/+1759
| | | | | | | | introduce it into the clangIndex library. It is a general goodness for libclang itself to mostly be a wrapper of functionality provided by the libraries. llvm-svn: 260760
* Fix remaining Clang-tidy readability-redundant-control-flow warnings; other ↵Eugene Zelenko2016-02-1214-213/+110
| | | | | | | | minor fixes. Differential revision: http://reviews.llvm.org/D17218 llvm-svn: 260757
* Darwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++Tim Northover2016-02-121-0/+6
| | | | | | | Recent refactoring meant it only got passed down when explicitly specified, which breaks header search on Darwin. llvm-svn: 260755
* Added missing '__'.Artem Belevich2016-02-121-1/+1
| | | | llvm-svn: 260719
* [AST] Fix typos in RecordLayoutBuilderDavid Majnemer2016-02-121-5/+5
| | | | | | No functional change is intended. llvm-svn: 260709
* [CUDA] Tweak attribute-based overload resolution to match nvcc behavior.Artem Belevich2016-02-122-43/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | This is an artefact of split-mode CUDA compilation that we need to mimic. HD functions are sometimes allowed to call H or D functions. Due to split compilation mode device-side compilation will not see host-only function and thus they will not be considered at all. For clang both H and D variants will become function overloads visible to compiler. Normally target attribute is considered only if C++ rules can not determine which function is better. However in this case we need to ignore functions that would not be present during current compilation phase before we apply normal overload resolution rules. Changes: * introduced another level of call preference to better describe possible call combinations. * removed WrongSide functions from consideration if the set contains SameSide function. * disabled H->D, D->H and G->H calls. These combinations are not allowed by CUDA and we were reluctantly allowing them to work around device-side calls to math functions in std namespace. We no longer need it after r258880. Differential Revision: http://reviews.llvm.org/D16870 llvm-svn: 260697
* [Hexagon] Specify vector alignment in DataLayout stringKrzysztof Parzyszek2016-02-121-3/+6
| | | | | | | | | | | The DataLayout can calculate alignment of vectors based on the alignment of the element type and the number of elements. In fact, it is the product of these two values. The problem is that for vectors of N x i1, this will return the alignment of N bytes, since the alignment of i1 is 8 bits. The vector types of vNi1 should be aligned to N bits instead. Provide explicit alignment for HVX vectors to avoid such complications. llvm-svn: 260680
* Fix ICE with constexpr and friend functionsOlivier Goffart2016-02-121-7/+9
| | | | | | | | | | | | | Fix a crash while parsing this code: struct X { friend constexpr int foo(X*) { return 12; } static constexpr int j = foo(static_cast<X*>(nullptr)); }; Differential Revision: http://reviews.llvm.org/D16973 llvm-svn: 260675
* [OpenCL] Disable C99 standard lib functionsAnastasia Stulova2016-02-121-0/+6
| | | | | | | | | | | | | | The library functions defined in the C99 standard headers are not available (OpenCL v1.2 s6.9.f). This change stops treating OpenCL builtin functions as standard C lib functions to eliminate warning messages about printf format string. Patch by Liu Yaxun (Sam)! Differential Revision: http://reviews.llvm.org/D16812 llvm-svn: 260671
* [CMake] Add option to switch default C++ stdlibJonas Hahnfeld2016-02-123-29/+39
| | | | | | | | | With this option one can optionally override the architecture dependent default library to use if no -stdlib= is provided on compiler invocation. Differential Revision: http://reviews.llvm.org/D15920 llvm-svn: 260662
* Update functions in clang supplied headers to use the compiler reservedEric Christopher2016-02-127-262/+280
| | | | | | namespace for arguments. llvm-svn: 260647
* <float.h>: do not define DECIMAL_DIG in -std=c89 mode; this macro was added ↵Richard Smith2016-02-121-2/+6
| | | | | | | | in C99. Patch by Jorge Teixeira! llvm-svn: 260639
* Use __ before argument names in provided headers.Eric Christopher2016-02-121-4/+4
| | | | llvm-svn: 260631
* Remove decision logic for old NetBSD development versions, the 7.0Joerg Sonnenberger2016-02-112-2/+2
| | | | | | release made this obsolete. llvm-svn: 260617
* Now that Sparc/Sparc64 backend is mostly usable, provide the sameJoerg Sonnenberger2016-02-112-0/+4
| | | | | | | linking defaults as other NetBSD targets, i.e. compiler_rt-in-libc and libc++ as STL. llvm-svn: 260616
* [analyzer] Improve pattern matching in ObjCDealloc checker.Devin Coughlin2016-02-111-8/+17
| | | | | | | | Look through PseudoObjectExpr and OpaqueValueExprs when scanning for release-like operations. This commit also adds additional tests in anticipation of re-writing this as a path-sensitive checker. llvm-svn: 260608
* In C11, provide macros FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, and ↵Richard Smith2016-02-111-0/+6
| | | | | | | | LDBL_DECIMAL_DIG in <float.h>. Patch by Jorge Teixeira! llvm-svn: 260577
* [PR26550] Use a different TBAA root for C++ vs C.Manman Ren2016-02-111-2/+6
| | | | | | | | | | | | | | | | | | | This commit changes the root from "Simple C/C++ TBAA" to "Simple C++ TBAA" for C++. The problem is that the type name in the TBAA nodes is generated differently for C vs C++. If we link an IR file for C with an IR file for C++, since they have the same root and the type names are different, accesses to the two type nodes will be considered no-alias, even though the two type nodes are from the same type in a header file. The fix is to use different roots for C and C++. Types from C will be treated conservatively in respect to types from C++. Follow-up commits will change the C root to "Simple C TBAA" plus some mangling change for C types to make it a little more aggresive. llvm-svn: 260567
* [Modules] Early-exit if ReadOptionsBlock fails to avoid crashingBen Langmuir2016-02-111-3/+4
| | | | | | | | | | | | | | | If we didn't tell ReadOptionsBlock to allow failures then we can't assume that the stream is not in the middle of a block if it returns out-of-date. This was causing a crash when we tried to continue reading. Also, it's just generally a good idea to early-exit if we're doing implicit module builds, since we will want to immediately rebuild this module anyway and there's no reason to waste time continuing after failure. rdar://problem/24114938 llvm-svn: 260563
* [Driver] Add support for Qualcomm's Kryo CPU.Chad Rosier2016-02-112-1/+3
| | | | | | http://reviews.llvm.org/D17124 llvm-svn: 260555
* Remove unused includesDavid Majnemer2016-02-111-2/+0
| | | | llvm-svn: 260552
* Revert "Revert r260388 "[MS ABI] Never reference dllimport'd vtables""David Majnemer2016-02-114-11/+28
| | | | | | | | | | | | | This reverts commit r260449. We would supress our emission of vftable definitions if we thought another translation unit would provide the definition because we saw an explicit instantiation declaration. This is not the case with dllimport, we want to synthesize a definition of the vftable regardless. This fixes PR26569. llvm-svn: 260548
* [Modules] Don't infinite recurse on implicit import of circular modules in ↵Ben Langmuir2016-02-112-1/+4
| | | | | | | | | | | | | | preamble Update the Preprocessor's VisibleModuleSet when typo-correction creates an implicit module import so that we won't accidentally write an invalid SourceLocation into the preamble AST. This would later lead to infinite recursion when loading the preamble AST because we use the value in ImportLocs to prevent visiting a module twice. rdar://problem/24440990 llvm-svn: 260543
* Revert r260265, "clang-cl: Support loading plugins on Windows"NAKAMURA Takumi2016-02-111-8/+1
| | | | | | It causes memory exhaust on mingw-w64(x64). Investigating. llvm-svn: 260536
* [ARM] Add command-line options for ARMv8.2-AOliver Stannard2016-02-112-4/+2
| | | | | | | | | | | | | | | | | This allows ARMv8.2-A to be targeted either by using "armv8.2a" in the triple, or by using -march=armv8.2-a (or the alias -march=armv8.2a). The FP16 extension can be enabled with the "+fp16" suffix to the -march or -mcpu option. This is consistent with the AArch64 option, rather than the usual ARM option of -mfpu. We have agreed with the team which will be upstreaming this to GCC that we want to use this new option format for new architecture extensions for both ARM and AArch64. Most of the work for this was done by the TargetParser patch in llvm. Differential Revision: http://reviews.llvm.org/D15040 llvm-svn: 260533
* Revert "Bail on compilation as soon as a job fails."Rafael Espindola2016-02-111-8/+30
| | | | | | | | This reverts commit r260448. It was causing Driver/output-file-cleanup.c to fail. llvm-svn: 260522
* clang-format: [JS] Support for (.. of ..) loops.Daniel Jasper2016-02-112-1/+3
| | | | | | | | | | Before: for (var i of[2, 3]) {} After: for (var i of [2, 3]) {} llvm-svn: 260518
* clang-format: Make indentation after "<<" more consistent.Daniel Jasper2016-02-111-3/+9
| | | | | | | | | | | | | | | | | | | | | | Before: Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) << aaa; After: Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); Diag(aaaaaaaaaaaaaaaaaaaa, aaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) << aaa; llvm-svn: 260517
* [MCU] Fix assertion failure on function returning empty union.Denis Zobnin2016-02-111-1/+5
| | | | | | | | Treat empty struct/union in return type as void for MCU ABI. PR26438. Differential Revision: http://reviews.llvm.org/D16808 llvm-svn: 260510
* clang-format: Make it more expensive to break template parameters.Daniel Jasper2016-02-111-1/+1
| | | | | | | | | | | | | | | | | | In particular, make it more expensive than breaking after the return type of a function definition/declaration. Before: template <typename T> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaa< T>::aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaa); After: template <typename T> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaa); llvm-svn: 260497
* [Objective-c] Stop attaching section "datacoal_nt" to global variables.Akira Hatanaka2016-02-112-7/+2
| | | | | | | | | | | | | The current macho linker just copies symbols in section datacoal_nt to section data, so it doesn't really matter whether or not section "datacoal_nt" is attached to the global variable. This is a follow-up to r250370, which made changes in llvm to stop putting functions and data in the *coal* sections. rdar://problem/24528611 llvm-svn: 260496
* [OPENMP] Rename OMPCapturedFieldDecl to OMPCapturedExprDecl, NFC.Alexey Bataev2016-02-1112-77/+67
| | | | | | | | OMPCapturedExprDecl allows caopturing not only of fielddecls, but also other expressions. It also allows to simplify codegen for several clauses. llvm-svn: 260492
* [CUDA] Don't crash when trying to printf a non-scalar object.Justin Lebar2016-02-111-0/+7
| | | | | | | | | | | | | | Summary: We can't do the right thing, since there's no right thing to do, but at least we can not crash the compiler. Reviewers: majnemer, rnk Subscribers: cfe-commits, jhen, tra Differential Revision: http://reviews.llvm.org/D17103 llvm-svn: 260479
* Remove unused ToolChain arg from Driver::ConstructPhaseAction and BuildAction.Justin Lebar2016-02-111-13/+9
| | | | | | | | | | | | | | | | Summary: Actions don't depend on the toolchain; they get bound to a particular toolchain via BindArch. No functional changes. Reviewers: echristo Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17100 llvm-svn: 260478
* Revert r260388 "[MS ABI] Never reference dllimport'd vtables"Hans Wennborg2016-02-103-15/+6
| | | | | | | This caused the compiler to fail with "invalid linkage type for global declaration" (PR26569). llvm-svn: 260449
* Bail on compilation as soon as a job fails.Justin Lebar2016-02-101-30/+8
| | | | | | | | | | | | | | | | | | | | | | | | Previously we attempted to be smart; if one job failed, we'd run all jobs that didn't depend on the failing job. Problem is, this doesn't work well for e.g. CUDA compilation without -save-temps. In this case, the device-side and host-side Assemble actions (which actually are responsible for preprocess, compile, backend, and assemble, since we're not saving temps) are necessarily distinct. So our clever heuristic doesn't help us, and we repeat every error message once for host and once for each device arch. The main effect of this change, other than fixing CUDA, is that if you pass multiple cc files to one instance of clang and you get a compile error, we'll stop when the first cc1 job fails. Reviewers: tra, echristo Subscribers: jhen, cfe-commits Differential Revision: http://reviews.llvm.org/D16514 llvm-svn: 260448
* [clang-cl] /Z7 now generates normal debug info, not just line infoReid Kleckner2016-02-101-5/+2
| | | | | | | | | Previously LLVM could not process any debug info we produced, so it didn't make sense to spend time generating it. Now that it has primitive support for local variable info, it does make sense to generate normal debug info. llvm-svn: 260435
* Fix some Clang-tidy readability-redundant-control-flow warnings; other minor ↵Eugene Zelenko2016-02-1021-264/+189
| | | | | | | | fixes. Differential revision: http://reviews.llvm.org/D17060 llvm-svn: 260414
* Silence some MSVC false positive warnings about integer zexts and falling ↵Reid Kleckner2016-02-103-2/+3
| | | | | | off the end of a covered switch llvm-svn: 260411
* [MS ABI] Never reference dllimport'd vtablesDavid Majnemer2016-02-103-6/+15
| | | | | | | | | | | | | Referencing a dllimported vtable is impossible in a constexpr constructor. It would be friendlier to C++ programmers if we synthesized a copy of the vftable which referenced imported virtual functions. This would let us initialize the object in a way which preserves both the intent to import functionality from another DLL while also making constexpr work. Differential Revision: http://reviews.llvm.org/D17061 llvm-svn: 260388
* Reapply the patch of r260376.Andrey Turetskiy2016-02-101-2/+2
| | | | llvm-svn: 260379
* [X86] Fix stack alignment for MCU target (Clang part), by Anton Nadolskiy.Andrey Turetskiy2016-02-102-2/+11
| | | | | | | | This patch fixes stack alignments for MCU (should be aligned to 4 bytes). Differential Revision: http://reviews.llvm.org/D15647 llvm-svn: 260376
* [OPENMP 4.5] Initial support for data members in 'firstprivate' clause.Alexey Bataev2016-02-101-76/+73
| | | | | | | OpenMP 4.5 allows privatization of non-static data members of current class in non-static member functions. llvm-svn: 260374
* Fix assertion "Chunk.Kind == DeclaratorChunk::Function" with attributed type.Denis Zobnin2016-02-101-0/+7
| | | | | | | | | | This patch is to upgrade FunctionTypeUnwrapper for correct processing of AttributedType. Fixes PR25786. Patch by Alexander Makarov. Differential Revision: http://reviews.llvm.org/D15373 llvm-svn: 260373
OpenPOWER on IntegriCloud