summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Wrap to 80 columns. No behavior change.Nico Weber2015-02-161-4/+5
| | | | llvm-svn: 229450
* Sema: diagnose use of unscoped deprecated prior to C++14Saleem Abdulrasool2015-02-161-0/+7
| | | | | | | | | The deprecated attribute was adopted as part of the C++14, however, there is a GNU version available in C++11. When using C++ earlier than C++14, diagnose the use of the attribute without the GNU scope, but only when using the generalised attribute syntax. llvm-svn: 229447
* Move helper class into an anonymous namespace.Benjamin Kramer2015-02-161-1/+2
| | | | llvm-svn: 229404
* Fix crash when clang tries to build NSNumber literal after forward declarationAlex Denisov2015-02-161-1/+3
| | | | | | | | | | | Bug report: http://llvm.org/bugs/show_bug.cgi?id=22561 Clang tries to create ObjCBoxedExpression of type 'NSNumber' when 'NSNumber' has only forward declaration, this cause a crash later, when 'Sema' refers to a nil QualType of the whole expression. Please, refer to the bug report for the better explanation. llvm-svn: 229402
* DR1467: If aggregate initialization encounters an initializer list for whichRichard Smith2015-02-161-1/+2
| | | | | | | | subobject initialization is not possible, be sure to note the overall initialization as having failed so that overload resolution knows that the relevant candidate is not viable. llvm-svn: 229353
* Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for ↵Aaron Ballman2015-02-151-2/+2
| | | | | | requiring the macro. NFC; Clang edition. llvm-svn: 229339
* Partial revert of r229336; this wasn't intended to go in.Aaron Ballman2015-02-151-126/+53
| | | | llvm-svn: 229338
* Removing LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the ↵Aaron Ballman2015-02-151-53/+126
| | | | | | macro. NFC; Clang edition. llvm-svn: 229336
* Wrap to 80 columns. No behavior change.Nico Weber2015-02-151-1/+2
| | | | llvm-svn: 229282
* Make a reference const. No behavior change.Nico Weber2015-02-141-1/+1
| | | | llvm-svn: 229242
* [X86] Add range checking on immediate arguments on XOP vpcom builtins.Craig Topper2015-02-131-0/+8
| | | | llvm-svn: 229067
* Sema: Semantically check _Atomic-qualified pointersDavid Majnemer2015-02-121-5/+12
| | | | | | This fixes PR22568. llvm-svn: 228959
* More for DR1467: In C++, when initializing an element of an aggregate,Richard Smith2015-02-121-39/+40
| | | | | | | | | always use the normal copy-initialization rules. Remove a special case that tries to stay within the list initialization checker here; that makes us do the wrong thing when list-initialization of an aggregate would not perform aggregate initialization. llvm-svn: 228897
* Improve the "braces around scalar init" warning to determine whether to warnRichard Smith2015-02-121-6/+65
| | | | | | | | based on whether "redundant" braces are ever reasonable as part of the initialization of the entity, rather than whether the initialization is "top-level". In passing, add a warning flag for it. llvm-svn: 228896
* Add a warning for direct-list-initialization of a variable with a deduced typeRichard Smith2015-02-111-0/+8
| | | | | | | | (or of a lambda init-capture, which is sort-of such a variable). The semantics of such constructs will change when we implement N3922, so we intend to warn on this in Clang 3.6 then change the semantics in Clang 3.7. llvm-svn: 228792
* PR21857: weaken an incorrect assertion.Richard Smith2015-02-111-2/+12
| | | | llvm-svn: 228785
* [modules] When determining whether a name from a module replaces a name weRichard Smith2015-02-101-0/+5
| | | | | | | | | already have, check whether the name from the module is actually newer than the existing declaration. If it isn't, we might (say) replace a visible declaration with an injected friend, and thus make it invisible (or lose a default argument or an array bound). llvm-svn: 228661
* A temporary fix for backward compatibility breakages caused by PR12117.Larisse Voufo2015-02-101-4/+15
| | | | llvm-svn: 228654
* Sema: Don't give attribute alias vars with struct type an init exprDavid Majnemer2015-02-081-0/+2
| | | | | | | | | | We'd give the VarDecl a CXXConstructExpr even though it is annotated with an alias attribute. This would make us trip over sanity checking asserts. This fixes PR22493. llvm-svn: 228523
* Revert "OpenCL: handle shift operator with vector operands"Tom Stellard2015-02-061-65/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit r228382. This breaks the following case: Reported by Jeroen Ketema: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20150202/122961.html typedef __attribute__((ext_vector_type(3))) char char3; void foo() { char3 v = {1,1,1}; char3 w = {1,2,3}; w <<= v; } If I compile with: clang -x cl file.c Then an error is produced: file.c:10:5: error: expression is not assignable w <<= v; ~ ^ 1 error generated. llvm-svn: 228406
* Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer2015-02-064-65/+30
| | | | | | Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
* OpenCL: handle shift operator with vector operandsSameer Sahasrabuddhe2015-02-061-1/+65
| | | | | | | | | | | | | | | | | | | | Introduce a number of checks: 1. If LHS is a scalar, then RHS cannot be a vector. 2. Operands must be of integer type. 3. If both are vectors, then the number of elements must match. Relax the requirement for "usual arithmetic conversions": When LHS is a vector, a scalar RHS can simply be expanded into a vector; OpenCL does not require that its rank be lower than the LHS. For example, the following code is not an error even if the implicit type of the constant literal is "int". char2 foo(char2 v) { return v << 1; } Consolidate existing tests under CodeGenOpenCL, and add more tests under SemaOpenCL. llvm-svn: 228382
* Fix \param in r228276. [-Wdocumentation]NAKAMURA Takumi2015-02-051-1/+1
| | | | llvm-svn: 228355
* Re-land r228258 and make clang-cl's /EHs- disable -fexceptions againReid Kleckner2015-02-051-9/+24
| | | | | | | | | | | After r228258, Clang started emitting C++ EH IR that LLVM wasn't ready to deal with, even when exceptions were disabled with /EHs-. This time, make /EHs- turn off -fexceptions while still emitting exceptional constructs in functions using __try. Since Sema rejects C++ exception handling constructs before CodeGen, landingpads should only appear in such functions as the result of a __try. llvm-svn: 228329
* PR22465: when performing list-initialization for a class type C, if we see anRichard Smith2015-02-051-16/+19
| | | | | | | | | | initializer of the form {x}, where x is of type C or a type derived from C, perform *non-list* initialization of the entity from x, but create a CXXConstructExpr that knows that we used list-initialization syntax. Plus some fixes to ensure we mangle correctly in this and related cases. llvm-svn: 228276
* Various fixes to mangling of list-initialization.Richard Smith2015-02-052-2/+12
| | | | llvm-svn: 228274
* Revert r228258.Nico Weber2015-02-051-24/+9
| | | | | | | | | It caused a chromium base unittest that tests throwing and catching SEH exceptions to fail (http://crbug.com/455488) and I suspect it might also be the cause of the chromium clang win 64-bit shared release builder timing out during compiles. So revert to see if that's true. llvm-svn: 228262
* Sema: Add support for __declspec(restrict)David Majnemer2015-02-042-17/+17
| | | | | | | | | | __declspec(restrict) and __attribute(malloc) are both handled identically by clang: they are allowed to the noalias LLVM attribute. Seeing as how noalias models the C99 notion of 'restrict', rename the internal clang attribute to Restrict from Malloc. llvm-svn: 228120
* OpenCL: handle ternary operator when the condition is a vectorSameer Sahasrabuddhe2015-02-041-42/+194
| | | | | | | | | | When the condition is a vector, OpenCL specifies additional requirements on the operand types, and also the operations required to determine the result type of the operator. This is a combination of OpenCL v1.1 s6.3.i and s6.11.6, and the semantics remain unchanged in later versions of OpenCL. llvm-svn: 228118
* [MSVC2012] Allow 'mutable' referencesAlexey Bataev2015-02-041-3/+6
| | | | | | | | Some standard header files from MSVC2012 use 'mutable' on references, though it is directly prohibited by the standard. Fix for http://llvm.org/PR22444 Differential Revision: http://reviews.llvm.org/D7370 llvm-svn: 228113
* Generalize r228066 to give all implicit global allocation functions default ↵Larisse Voufo2015-02-041-0/+4
| | | | | | visibility. llvm-svn: 228107
* [inlineasm] Fix an incorrect warning about register constraint and modifier.Akira Hatanaka2015-02-041-23/+13
| | | | | | | | | | | | | | | Previously, when the following piece of code was compiled, clang would incorrectly warn that the size of "wide_two" does not match register size specified by the constraint and modifier": long wide_two = two; asm ("%w0 %1" : "+r" (one), "+r"(wide_two)); This was caused by a miscalculation of ConstraintIdx in Sema::ActOnGCCAsmStmt. This commit fixes PR21270 and rdar://problem/18668354. llvm-svn: 228089
* Wrap to 80 columns. No behavior change.Nico Weber2015-02-031-5/+8
| | | | llvm-svn: 228063
* SEH: Track users of __try so we can pick a per-func EH personalityReid Kleckner2015-02-031-9/+24
| | | | | | | | | | | | | | | | | | There are four major kinds of declarations that cause code generation: - FunctionDecl (includes CXXMethodDecl etc) - ObjCMethodDecl - BlockDecl - CapturedDecl This patch tracks __try usage on FunctionDecls and diagnoses __try usage in other decls. If someone wants to use __try from ObjC, they can use it from a free function, since the ObjC code will need an ObjC-style EH personality. Eventually we will want to look through CapturedDecls and track SEH usage on the parent FunctionDecl, if present. llvm-svn: 228058
* Diagnose CXX 'this' pointer reference in funcs with naked attrWeiming Zhao2015-02-031-0/+6
| | | | | | | | | Clang asserts for this pointer reference in asms of naked functions. This patch diagnoses if this pointer reference is used. Differential Revision: http://reviews.llvm.org/D7329 llvm-svn: 228052
* Thread Safety Analysis: add support for before/after annotations on mutexes.DeLesley Hutchins2015-02-032-3/+22
| | | | | | | | | | These checks detect potential deadlocks caused by inconsistent lock ordering. The checks are implemented under the -Wthread-safety-beta flag. This patch also replaces calls to getAttrs() with calls to attrs() throughout ThreadSafety.cpp, which fixes the earlier issue that cause assert failures. llvm-svn: 228051
* Revert "Thread Safety Analysis: add support for before/after annotations on ↵Reid Kleckner2015-02-032-22/+3
| | | | | | | | | mutexes." This reverts r227997, as well as r228009. It does not pass check-clang for me locally on Linux. llvm-svn: 228020
* Thread Safety Analysis: add support for before/after annotations on mutexes.DeLesley Hutchins2015-02-032-3/+22
| | | | | | | These checks detect potential deadlocks caused by inconsistent lock ordering. The checks are implemented under the -Wthread-safety-beta flag. llvm-svn: 227997
* Implement jump scope SEHmantic analysis.Nico Weber2015-02-031-3/+29
| | | | | | | | | | | | | | | | | | | Thou shall not jump into SEH blocks. Jumping out of SEH __try and __excepts is A-ok. Jumping out of __finally blocks is B-ok (msvc doesn't error about it, but warns that it has undefined behavior). I've checked that clang's behavior with this patch matches msvc's behavior. We don't have the warning on jumping out of a __finally yet, see the FIXME in the test. clang also currently crashes on codegen for a jump out of a __finally block, see PR22414 comment 7. I also added a few tests for the interaction of indirect jumps and SEH blocks. MSVC doesn't support indirect jumps, so there's no way to know if clang behave the same way as msvc here. clang's behavior with this patch does make sense to me, but maybe it could be argued that it should be more permissive (see FIXME in the indirect jump tests -- shout if you have an opinion on this). llvm-svn: 227982
* SEH: Diagnose use of C++ EH and SEH in the same functionReid Kleckner2015-02-022-8/+22
| | | | | | | | This check does not apply when Borland extensions are enabled, as they have a checked in test case indicating that mixed usage of SEH and C++ is supported. llvm-svn: 227876
* The prefix 'Ms-' should be 'MS-'David Majnemer2015-02-022-5/+5
| | | | | | | Clang is otherwise consistent that Microsoft be abbreviated as MS, not Ms. llvm-svn: 227842
* MS ABI: Implement support for 'novtable'David Majnemer2015-02-021-0/+3
| | | | | | | | | | It is common for COM interface classes to be marked as 'novtable' to tell the compiler that constructors and destructors should not reference virtual function tables. This commit implements this feature in clang. llvm-svn: 227796
* Allow objc_bridge(id) to be used on typedefs of [cv] void*.John McCall2015-02-011-0/+16
| | | | | | rdar://19678874 llvm-svn: 227774
* [X86] Add immediate range checking for a couple XOP builtins.Craig Topper2015-01-311-0/+4
| | | | llvm-svn: 227679
* [X86] Add range checking to the immediate arguments of many of the SSE/AVX ↵Craig Topper2015-01-311-6/+26
| | | | | | builtins. llvm-svn: 227674
* Code cleanupNathan Sidwell2015-01-301-7/+4
| | | | | | | Parser::ParseLexedMethodDeclaration: Use local var for Param Sema::MergeCXXFunctionDecls: Use hasInheritedDefaultArg llvm-svn: 227577
* Fix OpenCL 1.2 double as an optional core feature behaviourFraser Cormack2015-01-302-2/+6
| | | | | | | | | | | | | | | | | | | | In OpenCL 1.2, using double no longer requires using the pragma cl_khr_fp64, instead a kernel is allowed to use double, but must first have queried clGetDeviceInfo's CL_DEVICE_DOUBLE_FP_CONFIG. Page 197, section 6.1.1 of the OpenCL 1.2 specification has a footnote 23 describing this behaviour. I've also added test cases such that the pragma must be used if targeting OpenCL 1.0 or 1.1, but is ignored in 1.2 and 2.0. Patch by Neil Henning! Reviewers: Pekka Jääskeläinen Differential Revision: http://reviews.llvm.org/D7245 llvm-svn: 227565
* Sema: Disable template instantiation once a fatal error is raisedDavid Majnemer2015-01-301-0/+6
| | | | | | | | | | | | Fatal errors disable all further diagnostics. Continuing to permit template instantiation does nothing but make it take longer for clang to finish with the TU. Instead, halt all further instantiation. Fixed in PR22396. llvm-svn: 227556
* Wrap to 80 cols by removing trailing whitespace. No behavior change.Nico Weber2015-01-301-1/+1
| | | | llvm-svn: 227553
* Weaken an assertion that isn't true for invalid input.Nico Weber2015-01-301-2/+3
| | | | llvm-svn: 227540
OpenPOWER on IntegriCloud