summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Improve the specification of spellings in Attr.td.Alexis Hunt2012-06-195-216/+216
| | | | | | | | | | | | | | | | | Note that this is mostly a structural patch that handles the change from the old spelling style to the new one. One consequence of this is that all AT_foo_bar enum values have changed to not be based off of the first spelling, but rather off of the class name, so they are now AT_FooBar and the like (a straw poll on IRC showed support for this). Apologies for code churn. Most attributes have GNU spellings as a temporary solution until everything else is sorted out (such as a Keyword spelling, which I intend to add if someone else doesn't beat me to it). This is definitely a WIP. I've also killed BaseCheckAttr since it was unused, and I had to go through every attribute anyway. llvm-svn: 158700
* Improve the error message when a function overload candidate is rejectedKaelyn Uhrain2012-06-191-5/+20
| | | | | | | | | | | | | | | | | because it expects a reference and receives a non-l-value. For example, given: int foo(int &); template<int x> void b() { foo(x); } clang will now print "expects an l-value for 1st argument" instead of "no known conversion from 'int' to 'int &' for 1st argument". The change in wording (and associated code to detect the case) was prompted by comment #5 in PR3104, and should be the last bit of work needed for the bug. llvm-svn: 158691
* Change -Winternal-linkage-in-inline from ExtWarn to Warning in C++.Jordan Rose2012-06-181-8/+16
| | | | | | | | | | Per post-commit review, it's not appropriate to use ExtWarn in C++, because we can't prove that the inline function will actually be defined in more than one place (and thus we can't prove that this violates the ODR). This removes the warning entirely from uses in the main source file in C++. llvm-svn: 158689
* Support -Winternal-linkage-in-inline in C++ code.Jordan Rose2012-06-181-36/+98
| | | | | | | | This includes treating anonymous namespaces like internal linkage, and allowing const variables to be used even if internal. The whole thing's been broken out into a separate function to avoid nested ifs. llvm-svn: 158683
* Allow internal decls in inline functions if the function is in the main file.Jordan Rose2012-06-181-1/+7
| | | | | | | | | | | This handles the very common case of people writing inline functions in their main source files and not tagging them as inline. These cases should still behave as the user intended. (The diagnostic is still emitted as an extension.) I'm reworking this code anyway to account for C++'s equivalent restriction in [basic.def.odr]p6, but this should get some bots back to green. llvm-svn: 158666
* fix PR13071 / rdar://problem/11634669 :Nuno Lopes2012-06-181-0/+6
| | | | | | crash on invalid function decl with alloc_size attribute llvm-svn: 158663
* alloc_size attribute: there's nothing wrong with alloc_size(1,1). It just ↵Nuno Lopes2012-06-181-14/+2
| | | | | | means the function allocates x^2 bytes. GCC also accepts this syntax llvm-svn: 158662
* Handle C++11 attribute namespaces automatically.Alexis Hunt2012-06-183-9/+14
| | | | | | | | Now, as long as the 'Namespaces' variable is correct inside Attr.td, the generated code will correctly admit a C++11 attribute only when it has the appropriate namespace(s). llvm-svn: 158661
* [MSExtensions] Add support for __forceinline.Michael J. Spencer2012-06-181-0/+10
| | | | | | __forceinline is a combination of the inline keyword and __attribute__((always_inline)) llvm-svn: 158653
* Don't warn about address-to-member used as part of initialisation, ifJoerg Sonnenberger2012-06-171-1/+1
| | | | | | the member expression is in parentheses. llvm-svn: 158651
* Documentation cleanup: fix two typos, rief -> brief and Descripts -> DescribesJames Dennett2012-06-171-2/+2
| | | | llvm-svn: 158630
* Documentation cleanup: fixing a typo from my previous 'fix'.James Dennett2012-06-171-1/+1
| | | | llvm-svn: 158617
* Explicitly build __builtin_va_list.Meador Inge2012-06-162-2/+4
| | | | | | | The target specific __builtin_va_list types are now explicitly built instead of injecting strings into the preprocessor input. llvm-svn: 158592
* Fix Sema and IRGen for atomic compound assignment so it has the right ↵Eli Friedman2012-06-163-51/+22
| | | | | | | | semantics when promotions are involved. (As far as I can tell, this only affects some edge cases.) llvm-svn: 158591
* [AST/libclang] Fix the selector locations that are reported for aArgyrios Kyrtzidis2012-06-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | method definition that has its '{' attached to the method name without a space. With a method like: -(id)meth{ ..... } the logic in ObjCMethodDecl that determined the selector locations got confused because it was initialized based on an end location for '{' but that end location changed to '}' after the method was finished. Fix this by having an immutable end location for the declarator and for getLocEnd() get the end location from the body itself. Fixes rdar://11659739. llvm-svn: 158583
* Recover when correcting an unknown type name to a keyword like "struct".Kaelyn Uhrain2012-06-151-12/+16
| | | | llvm-svn: 158573
* Move isCXXSimpleTypeSpecifier from Parser to Sema and tweak it for wider use.Kaelyn Uhrain2012-06-151-0/+36
| | | | llvm-svn: 158572
* Documentation cleanup:James Dennett2012-06-154-18/+18
| | | | | | | | | * Escaped "::" and "<" as needed in Doxygen comments; * Marked up code examples with \code...\endcode; * Documented a \param that is current, instead of a few that aren't; * Fixed up some \file and \brief comments. llvm-svn: 158562
* Stop referring to functions as methods in per-function fallthrough-checking.Alexis Hunt2012-06-151-7/+7
| | | | llvm-svn: 158545
* [completion] Add completions for @"..." and @(...), and tidy up @[] and @{}.Jordan Rose2012-06-151-2/+20
| | | | | | | | | | | | | Specifically, @[] and @{} didn't have a type associated with them; we now use "NSArray *" and "NSDictionary *", respectively. @"" has the type "NSString *". @(), unfortunately, has type "id", since it (currently) may be either an NSNumber or an NSString. Add a test for all the Objective-C at-expression completions. <rdar://problem/11507708&11507668&11507711> llvm-svn: 158533
* Warn when a static variable is referenced in a non-static inline function.Jordan Rose2012-06-151-0/+32
| | | | | | | | | | | | | This is explicitly forbidden in C99 6.7.4p3. This is /not/ forbidden in C++, probably because by default file-scope const/constexpr variables have internal linkage, while functions have external linkage. There's also the issue of anonymous namespaces to consider. Nevertheless, there should probably be a similar warning, since the semantics of inlining a function that references a variable with internal linkage do not seem well-defined. <rdar://problem/11577619> llvm-svn: 158531
* Check the parameter lists and return type of both blocks and lambdasDouglas Gregor2012-06-152-2/+32
| | | | | | | for unexpanded parameter packs. Fixes the crash-on-invalid in PR13117. llvm-svn: 158525
* Documentation cleanup:James Dennett2012-06-156-23/+16
| | | | | | | | | * Removed \param comments for parameters that no longer exist; * Fixed a "\para" typo to "\param"; * Escaped @, # and \ symbols as needed in Doxygen comments; * Added use of \brief to output short summaries. llvm-svn: 158498
* Fix T* p to T *pRichard Trieu2012-06-141-2/+2
| | | | llvm-svn: 158478
* Use a proper visitor to recursively check for uninitialized use in constructors.Richard Trieu2012-06-141-67/+88
| | | | llvm-svn: 158477
* Still more Doxygen documentation fixes:James Dennett2012-06-149-23/+18
| | | | | | | | * Escape #, < and @ symbols where Doxygen would try to interpret them; * Fix several function param documentation where names had got out of sync; * Delete param documentation referring to parameters that no longer exist. llvm-svn: 158472
* Look at incomplete FunctionTemplateDecls in order to determine whetherDaniel Jasper2012-06-141-0/+2
| | | | | | a CXXRecordDecl is complete. Fixes Bug 13086. llvm-svn: 158469
* This makes SemaCodeComplete.cpp more Doxygen-friendly by changing theJames Dennett2012-06-141-30/+31
| | | | | | | | | | | | | | | | OBJC_AT_KEYWORD_NAME take a string literal argument where previously its second argument was an unquoted token; macro invocations such as OBJC_AT_KEYWORD_NAME(NeedAt,{) confuse Doxygen's parser. While I'm wary of changing code (rather than just comments) to work around Doxygen's limitations, in this case the change makes the code more readable for human beings as well, and the macro derived no benefit from using the preprocessor's stringification operator, as it never has need of the unquoted token. I've also included a couple of trivial drive-by fixes to doc comments. llvm-svn: 158440
* Allow __attribute__((unused)) for fields and make it silenceDaniel Jasper2012-06-132-1/+2
| | | | | | -Wunused-private-field. llvm-svn: 158411
* PR13099: Teach -Wformat about raw string literals, UTF-8 strings and Unicode ↵Richard Smith2012-06-131-1/+1
| | | | | | escape sequences. llvm-svn: 158390
* Add missing narrowing check: converting from a signed integral type to a widerRichard Smith2012-06-131-5/+11
| | | | | | unsigned type is narrowing if the source is non-constant or negative. llvm-svn: 158377
* When code completion walks the members of a protocol or interface,Douglas Gregor2012-06-121-13/+45
| | | | | | make sure that we walk the definition. Fixes <rdar://problem/11427742>. llvm-svn: 158357
* If parsing a trailing-return-type fails, don't pretend we didn't have one atRichard Smith2012-06-123-12/+16
| | | | | | all. Suppresses follow-on errors mentioned in PR13074. llvm-svn: 158348
* Etch out the code path for MS-style inline assembly.Chad Rosier2012-06-113-0/+33
| | | | llvm-svn: 158325
* PR12964: __int128 and unsigned __int128 are promoted integral types, be sure toRichard Smith2012-06-101-17/+23
| | | | | | consider them when enumerating builtin operator candidates. llvm-svn: 158293
* Remove CXXRecordDecl flags which are unused after r158289.Richard Smith2012-06-101-24/+16
| | | | | | | | | | | | | | | | | | | | | We need an efficient mechanism to determine whether a defaulted default constructor is constexpr, in order to determine whether a class is a literal type, so keep the incrementally-built form on CXXRecordDecl. Remove the on-demand computation of same, so that we only have one method for determining whether a default constructor is constexpr. This doesn't affect correctness, since default constructor lookup is much simpler than selecting a constructor for copying or moving. We don't need a corresponding mechanism for defaulted copy or move constructors, since they can't affect whether a type is a literal type. Conversely, checking whether such functions are constexpr can require non-trivial effort, so we defer such checks until the copy or move constructor is required. Thus we now only compute whether a copy or move constructor is constexpr on demand, and only compute whether a default constructor is constexpr in advance. This is unfortunate, but seems like the best solution. llvm-svn: 158290
* Fix PR13052 properly, by performing special member lookup to determine whetherRichard Smith2012-06-101-15/+128
| | | | | | | | | | an explicitly-defaulted default constructor would be constexpr. This is necessary in weird (but well-formed) cases where a class has more than one copy or move constructor. Cleanup of now-unused parts of CXXRecordDecl to follow. llvm-svn: 158289
* PR13064: Store whether an in-class initializer uses direct or copyRichard Smith2012-06-106-22/+24
| | | | | | | initialization, and use that information to produce the right kind of initialization during template instantiation. llvm-svn: 158288
* Convert comments to proper Doxygen comments.Dmitri Gribenko2012-06-081-3/+3
| | | | llvm-svn: 158241
* Warn in ObjC++ when an 'auto' variable deduces type 'id'.Jordan Rose2012-06-081-0/+11
| | | | | | | | | | | | | | | | | | | | This could happen for cases like this: - (NSArray *)getAllNames:(NSArray *)images { NSMutableArray *results = [NSMutableArray array]; for (auto img in images) { [results addObject:img.name]; } return results; } Here the property access will fail because 'img' has type 'id', rather than, say, NSImage. This warning will not fire in templated code, since the 'id' could have come from a template parameter. llvm-svn: 158239
* PR13051: Only suggest the 'template' and 'operator' keywords when performingRichard Smith2012-06-081-2/+11
| | | | | | typo-correction after a scope specifier. llvm-svn: 158231
* Disallow using ObjC literals in direct comparisons (== and friends).Jordan Rose2012-06-081-0/+157
| | | | | | | | | | | | | | | Objective-C literals conceptually always create new objects, but may be optimized by the compiler or runtime (constant folding, singletons, etc). Comparing addresses of these objects is relying on this optimization behavior, which is really an implementation detail. In the case of == and !=, offer a fixit to a call to -isEqual:, if the method is available. This fixit is directly on the error so that it is automatically applied. Most of the time, this is really a newbie mistake, hence the fixit. llvm-svn: 158230
* Remove a commented out variable declaration. This was originally a debuggingRichard Trieu2012-06-081-1/+0
| | | | | | variable which wasn't removed when the original patch was committed. llvm-svn: 158225
* [libclang/AST]Argyrios Kyrtzidis2012-06-081-1/+1
| | | | | | | | | | | | | AST: For auto-synthesized ivars give them the location of the related property (previously they had no source location). This allows them to be indexed by libclang. libclang: Make sure synthesized ivars are indexed before the methods that may reference them. Fixes rdar://11607001. llvm-svn: 158189
* Allow friend declarations of defaulted special member functions. OnlyRichard Smith2012-06-081-1/+1
| | | | | | definitions of such members are prohibited, not mere declarations. llvm-svn: 158186
* Fix up the 'typename' suggestion logic introduced in r157085, based onKaelyn Uhrain2012-06-081-11/+9
| | | | | | feedback from Doug Gregor. llvm-svn: 158185
* Teach the FixIt in DiagnoseInvalidRedeclaration how to replace the writtenKaelyn Uhrain2012-06-071-5/+9
| | | | | | | nested name specifiers in addition to the function's identifier when the correction has a different nested name specifier. llvm-svn: 158178
* Ignore corrections to functions with bodies when deciding whichKaelyn Uhrain2012-06-071-9/+27
| | | | | | correction to use for an invalid function redeclaration. llvm-svn: 158177
* Plug a long standing memory leak in TemplateArgument.Benjamin Kramer2012-06-073-11/+13
| | | | | | | | | | | | | | | The integral APSInt value is now stored in a decomposed form and the backing store for large values is allocated via the ASTContext. This way its not leaked as TemplateArguments are never destructed when they are allocated in the ASTContext. Since the integral data is immutable it is now shared between instances, making copying TemplateArguments a trivial operation. Currently getting the integral data out of a TemplateArgument requires creating a new APSInt object. This is cheap when the value is small but can be expensive if it's not. If this turns out to be an issue a more efficient accessor could be added. llvm-svn: 158150
* Attach fixits for CFBridgingRetain/Release outside any casts.Jordan Rose2012-06-071-2/+4
| | | | | | | | | Before, the note showed the location where you could insert __bridge variants, but the actual fixit edit came after the cast. No functionality change. llvm-svn: 158131
OpenPOWER on IntegriCloud