summaryrefslogtreecommitdiffstats
path: root/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Merging r228118:upstream/release_36Tom Stellard2015-06-221-42/+194
| | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r228118 | sameer.sahasrabuddhe | 2015-02-04 01:38:18 -0500 (Wed, 04 Feb 2015) | 8 lines OpenCL: handle ternary operator when the condition is a vector 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. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@240324 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r235931:Tom Stellard2015-05-051-0/+10
| | | | | | | | | | | ------------------------------------------------------------------------ r235931 | aaron | 2015-04-27 18:31:12 -0400 (Mon, 27 Apr 2015) | 2 lines Check whether the operand to a noexcept expression is valid or not. Fixes PR15842. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@236502 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r226983:Tom Stellard2015-05-041-22/+34
| | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r226983 | rtrieu | 2015-01-23 21:48:32 -0500 (Fri, 23 Jan 2015) | 16 lines When checking the template argument list, use a copy of that list for changes and only update the orginal list on a valid arugment list. When checking an individual expression template argument, and conversions are required, update the expression in the template argument. Since template arguments are speculatively checked, the copying of the template argument list prevents updating the template arguments when the list does not match the template. Additionally, clean up the integer checking code in the template diffing code. The code performs unneccessary conversions from APSInt to APInt. Fixes PR21758. This essentially reverts r224770 to recommits r224667 and r224668 with extra changes to prevent the template instantiation problems seen in PR22006. A test to catch the discovered problem is also added. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@236438 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r233508:Daniel Sanders2015-04-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r233508 | petarj | 2015-03-30 01:43:56 +0100 (Mon, 30 Mar 2015) | 23 lines Add check for kind of UnqualifiedId in Declarator::isStaticMember() Method CXXMethodDecl::isStaticOverloadedOperator expects Operator field from the struct OperatorFunctionId, which is a member of the union in the class UnqualifiedId. If the kind of UnqualifiedId is not checked, there is no guarantee that the value that this method receives will be correct, because it can be the value of another union member and not OperatorFunctionId. This bug manifests itself when running make check-all on mips64 BE. This fix resolves the following regression tests: Clang :: CXX/special/class.dtor/p9.cpp Clang :: CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp Clang :: CodeGenCXX/ctor-dtor-alias.cpp Clang :: CodeGenCXX/debug-info-windows-dtor.cpp Clang :: CodeGenCXX/dllexport-members.cpp Clang :: CodeGenCXX/dllexport.cpp Patch by Violeta Vukobrat. Differential Revision: http://reviews.llvm.org/D8437 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@235843 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r231451:Tom Stellard2015-04-201-2/+5
| | | | | | | | | | | | | | ------------------------------------------------------------------------ r231451 | nicolasweber | 2015-03-06 01:01:06 -0500 (Fri, 06 Mar 2015) | 5 lines Don't crash on non-public referenced dtors in toplevel classes. Fixes PR22793, a bug that caused self-hosting to fail after the innocuous r231254. See the bug for details. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@235308 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge r230255,231245,231280,231986:Joerg Sonnenberger2015-03-121-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | Only lower __builtin_setjmp / __builtin_longjmp to llvm.eh.sjlj.setjmp / llvm.eh.sjlj.longjmp, if the backend is known to support them outside the Exception Handling context. The default handling in LLVM codegen doesn't work and will create incorrect code. The ARM backend on the other hand will assert if the intrinsics are used. -- Adjust the changes from r230255 to bail out if the backend can't lower __builtin_setjmp/__builtin_longjmp and don't fall back to the libc functions. -- Fix test/CodeGen/builtins.c for platforms that don't lower sjlj Opt in Win64 to supporting sjlj lowering. We have the backend lowering, so I think this was just an oversight because WinX86_64TargetCodeGenInfo doesn't inherit from X86_64TargetCodeGenInfo. -- Under duress, move check for target support of __builtin_setjmp/ __builtin_longjmp to Sema as requested by John McCall. git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@232028 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r228792:Hans Wennborg2015-02-111-0/+8
| | | | | | | | | | | | | | | ------------------------------------------------------------------------ r228792 | rsmith | 2015-02-10 18:41:33 -0800 (Tue, 10 Feb 2015) | 5 lines Add a warning for direct-list-initialization of a variable with a deduced type (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. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@228799 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r228785:Hans Wennborg2015-02-111-2/+12
| | | | | | | | | | | | ------------------------------------------------------------------------ r228785 | rsmith | 2015-02-10 17:48:47 -0800 (Tue, 10 Feb 2015) | 2 lines PR21857: weaken an incorrect assertion. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@228789 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r227368:Hans Wennborg2015-01-282-6/+6
| | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r227368 | rikka | 2015-01-28 13:10:46 -0800 (Wed, 28 Jan 2015) | 9 lines Revert a change from r222797 that is no longer needed and can cause infinite recursion. Also guard against said infinite recursion by adding an assert that will trigger if CorrectDelayedTyposInExpr is called before a previous call to CorrectDelayedTyposInExpr returns (i.e. if the TreeTransform run by CorrectDelayedTyposInExpr calls a sequence of methods that end up calling CorrectDelayedTyposInExpr, as the new test case had done prior to this commit). Fixes PR22292. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@227375 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r227295:Hans Wennborg2015-01-281-0/+5
| | | | | | | | | | | | | | | ------------------------------------------------------------------------ r227295 | majnemer | 2015-01-27 21:48:06 -0800 (Tue, 27 Jan 2015) | 5 lines Sema: Ensure that __c11_atomic_fetch_add has a pointer to complete type Pointer arithmetic is only makes sense if the pointee type is complete. This fixes PR22361. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@227349 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r227278:Hans Wennborg2015-01-281-1/+1
| | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r227278 | rikka | 2015-01-27 16:46:09 -0800 (Tue, 27 Jan 2015) | 6 lines Use the real CXXScopeSpec when setting the correction SourceRange. Otherwise, in the most important case and the only case where SS and TempSS are different (which is when the CXXScopeSpec should be dropped, and TempSS is NULL) the wrong SourceRange will be used in the fixit for the typo correction. Fixes the remaining issue in PR20626. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@227280 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r227251:Hans Wennborg2015-01-272-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r227251 | rikka | 2015-01-27 14:01:39 -0800 (Tue, 27 Jan 2015) | 17 lines Fix a think-o in handling ambiguous corrections for a TypoExpr. Under certain circumstances, the identifier mentioned in the diagnostic won't match the intended correction even though the replacement expression and the note pointing to the decl are both correct. Basically, the TreeTransform assumes the TypoExpr's Consumer points to the correct TypoCorrection, but the handling of typos that appear to be ambiguous from the point of view of TransformTypoExpr would cause that assumption to be violated by altering the Consumer's correction stream. This fix allows the Consumer's correction stream to be reset to the right TypoCorrection after successfully resolving the percieved ambiguity. Included is a fix to suppress correcting the RHS of an assignment to the LHS of that assignment for non-C++ code, to prevent a regression in test/SemaObjC/provisional-ivar-lookup.m. This fixes PR22297. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@227266 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r227220:Hans Wennborg2015-01-272-15/+9
| | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r227220 | rikka | 2015-01-27 10:26:18 -0800 (Tue, 27 Jan 2015) | 7 lines Properly handle typos in the conditional of ?: expressions in C. In particular, remove the OpaqueExpr transformation from r225389 and move the correction of the conditional from CheckConditionalOperands to ActOnConditionalOp before the OpaqueExpr is created. This fixes the typo correction behavior in C code that uses the GNU extension for a binary ?: (without an expression between the "?" and the ":"). ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@227243 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r226863:Hans Wennborg2015-01-231-3/+2
| | | | | | | | | | | | | ------------------------------------------------------------------------ r226863 | joerg | 2015-01-22 13:01:00 -0800 (Thu, 22 Jan 2015) | 3 lines When reporting constraints that should be constant, the type doesn't really help. Improve diagnostics. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@226916 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r226624:Hans Wennborg2015-01-211-3/+4
| | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r226624 | rikka | 2015-01-20 16:04:19 -0800 (Tue, 20 Jan 2015) | 6 lines Correct all typos in the initialization arguments, even if one could not be corrected. This fixes PR22250, which exposed the bug where if there's more than one TypoExpr in the arguments, once one failed to be corrected none of the TypoExprs after it would be handled at all thanks to an early return. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@226635 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "r222906 - Create a new 'flag_enum' attribute."Hans Wennborg2015-01-203-159/+77
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@226593 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | | | | Sorry for the noise, I managed to miss a bunch of recent regressions of include orderings here. This should actually sort all the includes for Clang. Again, no functionality changed, this is just a mechanical cleanup that I try to run periodically to keep the #include lines as regular as possible across the project. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225979 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: It's cheaper to ask LookupResult::empty than to calculate linkageDavid Majnemer2015-01-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225960 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Check type compatibility with the most recent decl when mergingDavid Majnemer2015-01-141-1/+8
| | | | | | | | | | We would check the type information from the declaration found by lookup but we would neglect checking compatibility with the most recent declaration. This would make it possible for us to not correctly diagnose inconsistencies with declarations which were made in a different scope. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225934 91177308-0d34-0410-b5e6-96231b3b80d8
* Look through sugar when determining whether a type is a scoped enumerationRichard Smith2015-01-141-1/+1
| | | | | | | type. Patch by Stephan Bergmann! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225889 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: An extern declaration can't be a redeclaration of a parameterDavid Majnemer2015-01-141-2/+2
| | | | | | | | | | | | In the following: void f(int x) { extern int x; } The second declaration of 'x' shouldn't be considered a redeclaration of the parameter. This is a different approach to r225780. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225875 91177308-0d34-0410-b5e6-96231b3b80d8
* When attribute 'optnone' appears on the same declaration with aPaul Robinson2015-01-132-24/+16
| | | | | | | | | | | | | conflicting attribute, warn about the conflict and pick a "winning" attribute to preserve, instead of emitting an error. This matches the behavior when the conflicting attributes are on different declarations. Along the way I discovered that conflicts involving __forceinline were reported as 'always_inline' (alternate spelling, same attribute) so fixed that up to report the attribute as spelled in the source. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225813 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Sema: An extern declaration can't be a redeclaration of a parameter"David Majnemer2015-01-131-2/+4
| | | | | | | This reverts commit r225780, we can't compile line 181 in sanitizer_platform_limits_posix.cc with this commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225781 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: An extern declaration can't be a redeclaration of a parameterDavid Majnemer2015-01-131-4/+2
| | | | | | | | | | In the following: void f(int x) { extern int x; } The second declaration of 'x' shouldn't be considered a redeclaration of the parameter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225780 91177308-0d34-0410-b5e6-96231b3b80d8
* Parse: Don't crash when default argument in typedef consists of sole '='David Majnemer2015-01-131-2/+7
| | | | | | | | We'd crash trying to make the SourceRange for the tokens we'd like to highlight. Don't assume there is more than one token makes up the default argument. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225774 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark vtable used on explicit destructor definitions.Nico Weber2015-01-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two things in a C++ program that need to read the vtable pointer: Constructors and destructors. (A few other operations -- virtual calls, dynamic cast, rtti -- read the vtable pointer off a this pointer, but for this they don't need the vtable symbol.) Implicit constructors and destructors and explicit constructors already marked the vtable as used, but explicit destructors didn't. Note that the only thing sema's "mark a class's vtable used" does is to mark all final overriders of the class as referenced, it does _not_ cause emission of the vtable itself. This is done on demand by codegen, independent of sema, since sema might emit functions that are not referenced. (The exception are vtables that are forced via key functions -- these are forced onto codegen by sema.) This bug went unnoticed for years because it doesn't have observable effects (yet -- I want to change this in PR20337, which is why I noticed this). r213109 made it so that _calls_ to constructors don't mark the vtable used. Currently, _calls_ to destructors still mark the vtable used. If that wasn't the case, this program would tickle the problem: test.h: template <typename T> struct B { int* p; virtual ~B() { delete p; } virtual void f() {} }; struct __attribute__((visibility("default"))) C { C(); B<int> m; }; test2.cc: #include "test.h" int main() { C* c = new C; delete c; } test3.cc: #include "test.h" C::C() {} # This bin/clang++ binary doesn't MarkVTableUsed() for virtual dtor calls: $ bin/clang++ -shared test3.cc -std=c++11 -O2 -fvisibility=hidden \ -fvisibility-inlines-hidden -o libtest3.dylib $ bin/clang++ test2.cc -std=c++11 -O2 -fvisibility=hidden \ -fvisibility-inlines-hidden libtest3.dylib Undefined symbols for architecture x86_64: "B<int>::f()", referenced from: vtable for B<int> in test2-af8f4f.o ld: symbol(s) not found for architecture x86_64 What's happening here is that there's a copy of B's vtable hidden in libtest3.dylib, because C's constructor caused an implicit instantiation of that (and implicit constructors generate vtables). test2.cc calls C's destructDr, which destroys the B<int> member, which wants to overwrite the vtable back to B (think of B as the base of a class hierarchy, and of hierarchical destruction -- maybe we shouldn't do the vtable writing in destructors of final classes), but there's nothing in test2.cc that marks B's vtable used. So codegen writes out the vtable, but since it wasn't marked used, sema didn't mark all the virtual functions (in particular f()) as used. Note that this change makes us reject programs we didn't reject before (see the included Sema test case), but both gcc and cl also reject this code, and clang used to reject it before r213109. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225761 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Consider global named register variables as threadprivate by default.Alexey Bataev2015-01-131-3/+6
| | | | | | | Register are thread-local by default, so we have to consider them as threadprivate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225759 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend the self move warning to record types.Richard Trieu2015-01-133-86/+97
| | | | | | | | Move the logic for checking self moves into SemaChecking and add that function to Sema since it is now used in multiple places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225756 91177308-0d34-0410-b5e6-96231b3b80d8
* reverting due to build bot failureNathan Sidwell2015-01-121-17/+30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225684 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename RefersToCapturedVariable to RefersToEnclosingVariableOrCapture, NFCAlexey Bataev2015-01-125-23/+25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225624 91177308-0d34-0410-b5e6-96231b3b80d8
* fix pr18645. Correct logic concerning 'T &&' deduction against lvalues.Nathan Sidwell2015-01-101-30/+17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225587 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new warning, -Wself-move, to Clang.Richard Trieu2015-01-101-1/+87
| | | | | | | | | | -Wself-move is similiar to -Wself-assign. This warning is triggered when a value is attempted to be moved to itself. See r221008 for a bug that would have been caught with this warning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225581 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix temporary lifetime extension from an initializer using braced "functional"Richard Smith2015-01-101-7/+7
| | | | | | | cast notation T{...} when T is a reference type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225571 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Don't crash when variable is redefined as a constexpr functionDavid Majnemer2015-01-091-1/+1
| | | | | | | | | We have a diagnostic describing that constexpr changed in C++14 when compiling in C++11 mode. While doing this, it examines the previous declaration and assumes that it is a function. However it is possible, in the context of error recovery, for this to not be the case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225518 91177308-0d34-0410-b5e6-96231b3b80d8
* Parse: Don't crash when namespace is in GNU statement exprDavid Majnemer2015-01-091-5/+0
| | | | | | | | | | | Parser::ParseNamespace can get a little confused when it found itself inside a compound statement inside of a non-static data member initializer. Try to determine that the statement expression's scope makes sense before trying to parse it's contents. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225514 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash in typo correction while correcting enum within a struct in COlivier Goffart2015-01-091-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225513 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: RecordDecl shouldn't have a FunctionDecl as a DeclDavid Majnemer2015-01-091-1/+6
| | | | | | | RecordDecls should have things like CXXMethodDecls or FriendDecls as a decl but not things like FunctionDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225511 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Don't crash when specializing a global scope function in a classDavid Majnemer2015-01-091-1/+1
| | | | | | | | We assumed that class-scope specializations would result in a CXXMethodDecl for that class. However, globally qualified functions will result in normal FunctionDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225508 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Remove some dead code from CreateNewFunctionDeclDavid Majnemer2015-01-091-3/+0
| | | | | | | The same code is already in Sema::ActOnFunctionDeclarator, the only caller of CreateNewFunctionDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225506 91177308-0d34-0410-b5e6-96231b3b80d8
* PR22117: Fix a case where we would get confused about which function parameterRichard Smith2015-01-092-7/+29
| | | | | | | | | | | we're instantiating, if there's a ParmVarDecl within a FunctionDecl context that is not a parameter of that function. Add some asserts to catch this kind of issue more generally, and fix another bug exposed by those asserts where we were missing a local instantiation scope around substitution of explicitly-specified template arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225490 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't invent a '$auto-x-y' name for auto types in generic lambdas. This is noRichard Smith2015-01-091-11/+2
| | | | | | | | | | better than the 'template-parameter-x-y' name that we'd get in AST printing, and is worse in several ways (it's harder to distinguish it from a user-supplied name, it's wrong after substituting some number of outer levels, it wastes time and space constructing an IdentifierInfo, ...). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225489 91177308-0d34-0410-b5e6-96231b3b80d8
* Wrap to 80 columns. No behavior change.Nico Weber2015-01-071-29/+20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225414 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle OpaqueValueExprs more intelligently in the TransformTypos treeKaelyn Takata2015-01-072-1/+9
| | | | | | | | | | | | transform. Also diagnose typos in the initializer of an invalid C++ declaration. Both issues were hit using the same line of test code, depending on whether the code was treated as C or C++. Fixes PR22092. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225389 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix grammar-o in comment.Nico Weber2015-01-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225324 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: analyze I,J,K,M,N,O constraintsSaleem Abdulrasool2015-01-061-0/+14
| | | | | | | | | | Add additional constraint checking for target specific behaviour for inline assembly constraints. We would previously silently let all arguments through for these constraints. In cases where the constraints were violated, we could end up failing to select instructions and triggering assertions or worse, silently ignoring instructions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225244 91177308-0d34-0410-b5e6-96231b3b80d8
* Wrap to 80 columns, no behavior change.Nico Weber2015-01-041-4/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225128 91177308-0d34-0410-b5e6-96231b3b80d8
* Document that GetTypeForDeclarator() cannot return a null type.Nico Weber2015-01-041-13/+12
| | | | | | | | | | | | | | Also add a few asserts for this. The existing code assumes this in a bunch of places already (see e.g. the assert at the top of ParseTypedefDecl(), and there are many unchecked calls on the result of GetTypeForDeclarator()), and from looking through the code this should always be true from what I can tell. This allows removing ASTContext::getNullTypeSourceInfo() too as that's now unused. No behavior change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225125 91177308-0d34-0410-b5e6-96231b3b80d8
* Crash less enthusiasticially on _Atomic or __restrict__ on invalid types.Nico Weber2015-01-041-0/+6
| | | | | | | | | | | Many places in Sema cannot handle isNull() types. This is fine, because in most places the type building code recovers by falling back to IntTy. In GetFullTypeForDeclarator(), this is done at the end of the getNumTypeObjects() loop body. This function calls BuildQualifiedType() before this fallback is done though, so it explicitly needs to check for isNull() types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225124 91177308-0d34-0410-b5e6-96231b3b80d8
* Instantiation of a CXXMethodDecl may fail when the parameter type cannot be ↵Nick Lewycky2015-01-021-2/+4
| | | | | | | | | | | | | instantiated. Do not crash in this case. Fixes PR22040! The FIXME in the test is caused by TemplateDeclInstantiator::VisitCXXRecordDecl returning a nullptr instead of creating an invalid decl. This is a common pattern across all of TemplateDeclInstantiator, so I'm not comfortable changing it. The reason it's not invalid in the class template is due to support for an MSVC extension, see r137573. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225071 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a comment that appears a second time 22 lines further down.Nico Weber2014-12-301-3/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225004 91177308-0d34-0410-b5e6-96231b3b80d8