summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Provide, and document, a set of __c11_atomic_* intrinsics to implement C11'sRichard Smith2012-04-111-5/+16
| | | | | | | | | <stdatomic.h> header. In passing, fix LanguageExtensions to note that C11 and C++11 are no longer "upcoming standards" but are now actually standardized. llvm-svn: 154513
* Clean up last commit as per dgregor's comments.David Chisnall2012-04-111-7/+7
| | | | llvm-svn: 154501
* Allow c++ initialisers to initialise _Atomic fields.David Chisnall2012-04-111-0/+7
| | | | llvm-svn: 154499
* When we determine that an initialization sequence failed due to anDouglas Gregor2012-04-101-3/+3
| | | | | | | | incomplete type, keep track of the actual type that was incomplete. Otherwise, we might fail to produce a diagnostic. Fixes PR12498. llvm-svn: 154432
* Improve diagnostics in C++11 when a non-type template argument for aDouglas Gregor2012-04-101-2/+27
| | | | | | non-type template parameter of pointer type is not a constant expression. llvm-svn: 154424
* Include the Objective-C parameter- and return-passing qualifiers whenDouglas Gregor2012-04-101-5/+15
| | | | | | | providing code completions for Objective-C method declarations. Fixes <rdar://problem/11164498>. llvm-svn: 154421
* Don't include the ':' following code-completion suggestions forDouglas Gregor2012-04-101-3/+6
| | | | | | | 'public', 'private', or 'protected', unless code completion patterns are enabled. Fixes <rdar://problem/11189132>. llvm-svn: 154413
* objective-c: remove IsConstProperty as it does notFariborz Jahanian2012-04-101-17/+1
| | | | | | | seem to get called any more. Also add an assert in isModifiableLvalue. llvm-svn: 154410
* [code-complete] Introduce CodeCompletionTUInfo which will be used for cachingArgyrios Kyrtzidis2012-04-102-89/+183
| | | | | | | | | | | | | | | | | | | code-completion related strings specific to a translation unit (ASTContext and related data) CodeCompletionAllocator does such limited caching, by caching the name assigned to a DeclContext*, but that is not the appropriate place since that object has a lifetime that can extend beyond that of an ASTContext. Introduce CodeCompletionTUInfo which will be always tied to a translation unit to do this kind of caching and move the caching of CodeCompletionAllocator into this object, and propagate it to all the places where it will be needed. The plan is to extend the caching where appropriate, using CodeCompletionTUInfo, to avoid re-calculating code-completion strings. Part of rdar://10796159. llvm-svn: 154408
* Rework implementation of null non-type template arguments based onDouglas Gregor2012-04-101-118/+154
| | | | | | | Richard's feedback, to properly catch non-constant expressions and type mismatches. Finishes <rdar://problem/11193097>. llvm-svn: 154407
* objective-c: add an assertion for propertyFariborz Jahanian2012-04-101-0/+5
| | | | | | expression enterring IsConstProperty function. llvm-svn: 154406
* My original patch missed the virtual-base case for destroyingJohn McCall2012-04-091-2/+3
| | | | | | | | | | | | base-class subojects. Incidentally, thinking about virtual bases makes it clear to me that we're not appropriately computing the access to the virtual base's member because we're not computing the best possible access to the virtual base at all; in fact, we're basically assuming it's public. I'll file a separate PR about that. llvm-svn: 154346
* Fix the access check performed as part of the determination of whetherJohn McCall2012-04-092-2/+46
| | | | | | | | to define a special member function as deleted so that it properly establishes an object context for the accesses to the base subobject members. llvm-svn: 154343
* Fix bugs found by -Wconstant-conversion improvements currently under review.David Blaikie2012-04-091-1/+1
| | | | | | | | | | | | | | | | | | Specifically, using a an integer outside [0, 1] as a boolean constant seems to be an easy mistake to make with things like "x == a || b" where the author intended "x == a || x == b". The bug caused by calling SkipUntil with three token kinds was also identified by a VC diagnostic & reported by Francois Pichet as review feedback for my commit r154163. I've included test cases to verify the error recovery that was broken/poorly implemented due to this bug. The other fix (lib/Sema/SemaExpr.cpp) seems like that code was never actually reached in any of Clang's tests & is related to Objective C features I'm not familiar with, so I've not been able to construct a test case for it. Perhaps someone else can. llvm-svn: 154325
* Fix several problems with protected access control:John McCall2012-04-074-52/+153
| | | | | | | | | | | | | | | | | | | | | - The [class.protected] restriction is non-trivial for any instance member, even if the access lacks an object (for example, if it's a pointer-to-member constant). In this case, it is equivalent to requiring the naming class to equal the context class. - The [class.protected] restriction applies to accesses to constructors and destructors. A protected constructor or destructor can only be used to create or destroy a base subobject, as a direct result. - Several places were dropping or misapplying object information. The standard could really be much clearer about what the object type is supposed to be in some of these accesses. Usually it's easy enough to find a reasonable answer, but still, the standard makes a very confident statement about accesses to instance members only being possible in either pointer-to-member literals or member access expressions, which just completely ignores concepts like constructor and destructor calls, using declarations, unevaluated field references, etc. llvm-svn: 154248
* Implement support for null non-type template arguments for non-typeDouglas Gregor2012-04-064-37/+108
| | | | | | | template parameters of pointer, pointer-to-member, or nullptr_t type in C++11. Fixes PR9700 / <rdar://problem/11193097>. llvm-svn: 154219
* Thread safety analysis: downgraded requirement that mutex expressions refer ↵DeLesley Hutchins2012-04-061-21/+17
| | | | | | to a lockable type from error to warning. llvm-svn: 154198
* Fix a Sema invariant bug that I recently introduced involvingJohn McCall2012-04-062-2/+11
| | | | | | | | | the template instantiation of statement-expressions. I think it was jyasskin who had a crashing testcase in this area; hopefully this fixes it and he can find his testcase and check it in. llvm-svn: 154189
* Added a new attribute, objc_root_class, which informs the compiler when a ↵Patrick Beard2012-04-062-1/+49
| | | | | | | | | root class is intentionally declared. The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698> llvm-svn: 154187
* Fixed scoping error for late parsed attributes in nested classes.DeLesley Hutchins2012-04-061-1/+16
| | | | llvm-svn: 154173
* Point the caret at the error for the 'expected namespace name' diagnostic inRichard Smith2012-04-051-1/+1
| | | | | | a namespace alias declaration. llvm-svn: 154138
* Implement C90 pedantic warning for duplicate declaration specifiers which ↵Eli Friedman2012-04-051-0/+20
| | | | | | are duplicated via a typedef. Patch by Tim Northover. llvm-svn: 154136
* Properly implement the C rules for composite types for qualified pointers in ↵Eli Friedman2012-04-051-11/+27
| | | | | | conditionals. Patch by Tim Northover. llvm-svn: 154134
* objective-c: Don't warn when a category does not implement a methodFariborz Jahanian2012-04-051-2/+2
| | | | | | | declared in its adopted protocol when another category declares it because that category will implement it. // rdar://11186449 llvm-svn: 154132
* Improve diagnostics for invalid use of non-static members / this:Richard Smith2012-04-051-19/+27
| | | | | | | | | | | | * s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted the former by 28-2 in our diagnostics. * Fix the "use of member in static member function" diagnostic to correctly detect this situation inside a block or lambda. * Produce a more specific "invalid use of non-static member" diagnostic for the case where a nested class member refers to a member of a lexically-surrounding class. llvm-svn: 154073
* Allow a conversion from the empty initializer list {} to anDouglas Gregor2012-04-041-0/+10
| | | | | | | std::initializer_list<T> so long as <T> is known. This conversion has identity rank. llvm-svn: 154065
* Implement C++11 [temp.arg.nontype]'s permission to use the address of an objectRichard Smith2012-04-041-34/+40
| | | | | | or function with internal linkage as a non-type template argument. llvm-svn: 154053
* objc-arc: provide a warning when 'receiver' of a message is 'weak'Fariborz Jahanian2012-04-041-0/+5
| | | | | | | in arc mode and opted-in with -Wreceiver-is-weak flag. // rdar://10225276 llvm-svn: 154042
* Move the computation of the lambda mangling information (manglingDouglas Gregor2012-04-042-87/+86
| | | | | | | | | | number + context) to the point where we initially start defining the lambda, so that the linkage won't change when that information is made available. Fixes the assertion in <rdar://problem/11182962>. Plus, actually mangle the context of lambdas properly. llvm-svn: 154029
* For PR11916: Add support for g++'s __int128 keyword. Unlike __int128_t, this isRichard Smith2012-04-043-1/+10
| | | | | | | | | | a type specifier and can be combined with unsigned. This allows libstdc++4.7 to be used with clang in c++98 mode. Several other changes are still required for libstdc++4.7 to work with clang in c++11 mode. llvm-svn: 153999
* When performing template argument deduction for an initializer list,Douglas Gregor2012-04-041-8/+14
| | | | | | | | | | | | | | | | | be sure to perform the argument type adjustments in [temp.deduct.call]p2, e.g., array decay. And, when performing these deductions in the context of 'auto', make sure that we're deducing the P' in std::initializer_list<P'> rather than the whole initializer list. Together, this makes code like for( auto s : {"Deferred", "New", "Open", "Review"}) { } work properly. llvm-svn: 153998
* Dependent-sequence initialization of a single element can be directDouglas Gregor2012-04-041-1/+2
| | | | | | list-initialization. Loosen an over-eager assertion to fix PR12453. llvm-svn: 153995
* When computing the conversion sequence in overload resolutionJohn McCall2012-04-041-0/+2
| | | | | | | | for converting an empty list to a scalar, be sure to initialize the source and destination types so that comparison of conversion sequences will work in case there are multiple viable candidates. llvm-svn: 153993
* If something already instantiated is reinstantiated as an explicit definition,Nick Lewycky2012-04-041-1/+6
| | | | | | | | | keep the latter. No test. This was noticed when poking around something else with GDB. I'm not able to figure out a testcase that would break due to this bug. Sorry. llvm-svn: 153992
* Enter an expression evaluation context when parsingJohn McCall2012-04-041-0/+14
| | | | | | | statement-expressions. Prevents cleanups and such from being claimed by the first full-expression in the block. llvm-svn: 153989
* Remove dead assignment to local variable.Ted Kremenek2012-04-043-4/+0
| | | | llvm-svn: 153985
* Remove more redundant lookups. Add a new "all_lookups_iterator" which providesNick Lewycky2012-04-032-24/+7
| | | | | | | | a view over the contents of a DeclContext without exposing the implementation details of the StoredDeclsMap. Use this in LookupVisibleDecls to find the visible declarations. Fixes PR12339! llvm-svn: 153970
* Don't treat synthesized ivars as being in the base class for the purpose ofNick Lewycky2012-04-031-5/+5
| | | | | | looking up visible decls. llvm-svn: 153967
* Replace the workaround from r153445 with a proper fix.Kaelyn Uhrain2012-04-032-15/+7
| | | | | | | | | | | | | Infinite recursion was happening when DiagnoseInvalidRedeclaration called ActOnFunctionDeclarator to check if a typo correction works when the correction was just to the nested-name-specifier because the wrong DeclContext was being passed in. Unlike a number of functions surrounding typo correction, the DeclContext passed in for a function is the context of the function name after applying any nested name specifiers, not the lexical DeclContext where the function+nested-name-specifier appears. llvm-svn: 153962
* PR10217 diagnostic fix: don't say 'copy constructor' when we meanRichard Smith2012-04-021-1/+1
| | | | | | 'copy assignment operator'. llvm-svn: 153897
* Finish PR10217: Ensure we say that a special member was implicitly, notRichard Smith2012-04-023-22/+28
| | | | | | explicitly, deleted in all relevant cases, and explain why. llvm-svn: 153894
* Silence -Wunused-variable in -Asserts buildMatt Beaumont-Gay2012-04-021-0/+1
| | | | llvm-svn: 153885
* Implement DR1402: if a field or base class is not movable, the derived class'sRichard Smith2012-04-022-43/+141
| | | | | | | | | | | move constructor/move assignment operator are not declared, rather than being defined as deleted, so move operations on the derived class fall back to copying rather than moving. If a move operation on the derived class is explicitly defaulted, the unmovable subobject will be copied instead of being moved. llvm-svn: 153883
* Basic semantic analysis support for inheriting constructor declarations inRichard Smith2012-04-023-13/+19
| | | | | | dependent contexts. llvm-svn: 153858
* Properly handle explicit constructors in list-initialization. Fixes PR12120.Sebastian Redl2012-04-011-2/+27
| | | | llvm-svn: 153849
* PR10217: Provide diagnostics explaining why an implicitly-deleted specialRichard Smith2012-03-305-129/+230
| | | | | | member function is deleted. llvm-svn: 153773
* If we encounter a friend class template for which we cannot resolveDouglas Gregor2012-03-301-2/+6
| | | | | | | | | | | | | the nested-name-specifier (e.g., because it is dependent), do not error even though we can't represent it in the AST at this point. This is a horrible, horrible hack. The actual feature we still need to implement (for C++98!) is covered by PR12292. However, we used to silently accept this code, so when we recently started rejecting it we caused some regressions (e.g., <rdar://problem/11147355>). This hack brings us back to the passable-but-not-good state we had previously. llvm-svn: 153752
* Handle placeholder expressions in an ObjC for-collection loop.John McCall2012-03-301-3/+11
| | | | | | | The way we handle this implicitly removes the ability to use property l-values in this position, but that's really okay. llvm-svn: 153729
* Forbid the block and lambda copy-capture of __autoreleasing variablesJohn McCall2012-03-301-0/+21
| | | | | | in ARC, under the usual reasoning limiting the use of __autoreleasing. llvm-svn: 153725
* Make sure we perform the relevant implied conversions correctly for ObjC ↵Eli Friedman2012-03-301-18/+19
| | | | | | methods with related result types. PR12384. llvm-svn: 153716
OpenPOWER on IntegriCloud