summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a test case for the divide-by-zero fix in r137234Kaelyn Uhrain2011-08-101-0/+1
| | | | llvm-svn: 137240
* Make sure ptrarith_typesize is at least 1 to avoid division by zeroKaelyn Uhrain2011-08-101-0/+1
| | | | llvm-svn: 137234
* objective-c: Using existing infrastructure for finding Fariborz Jahanian2011-08-101-266/+51
| | | | | | | | | overridden methods to diagnose their type mismatch. This is a general solution for previous fixes for // rdar://6191214 and // rdar://9352731 and removes lots of duplicate code. llvm-svn: 137222
* When adding the base and member initializers for an implicitly-definedDouglas Gregor2011-08-101-1/+2
| | | | | | | special member function, make sure to classify an explicitly-defaulted copy constructor as a "copy" operation. Fixes PR10622. llvm-svn: 137219
* Update a comment to match the recently-changed codeDouglas Gregor2011-08-101-1/+1
| | | | llvm-svn: 137216
* For the availability attribute, allow a declaration to be deprecatedDouglas Gregor2011-08-101-3/+3
| | | | | | in the same version that it is introduced. Stuff happens. llvm-svn: 137214
* Rewrite default initialization of anonymous structs/unions within aDouglas Gregor2011-08-101-69/+111
| | | | | | | | | | | | | constructor. Previously, we did some bogus recursion into the fields of anonymous structs (recursively), which ended up building invalid ASTs that would cause CodeGen to crash due to invalid GEPs. Now, we instead build the default initializations based on the indirect field declarations at the top level, which properly generates the sequence of GEPs needed to initialize the proper member. Fixes PR10512 and <rdar://problem/9924046>. llvm-svn: 137212
* Change an assert into a check. I'm pretty sure there was a pointJohn McCall2011-08-101-3/+13
| | | | | | | | in time when this assert was valid, but it's not valid now. Also teach this code to correctly introduce function-to-pointer decay. llvm-svn: 137201
* Thread Safety: Added basic argument parsing for all new attributes.Caitlin Sadowski2011-08-091-51/+160
| | | | | | | | | | | | This patch special cases the parser for thread safety attributes so that all attribute arguments are put in the argument list (instead of a special parameter) since arguments may not otherwise resolve correctly without two-token lookahead. This patch also adds checks to make sure that attribute arguments are lockable objects. llvm-svn: 137130
* Make sure to canonicalize the argument type of a non-type templateDouglas Gregor2011-08-091-2/+3
| | | | | | argument of enumeration type when checking template arguments. Fixes PR10579. llvm-svn: 137101
* Don't emit memcpy for copying fields of arrays of volatile elements.Fariborz Jahanian2011-08-091-2/+2
| | | | | | | Use the the path that generates a loop. This fixes bogus error that clang puts out. // rdar://9894548 llvm-svn: 137080
* objective-c: diagnose protocol inconsistencies in following Fariborz Jahanian2011-08-081-1/+138
| | | | | | | | | situation. When a class explicitly or implicitly (through inheritance) "conformsTo" two protocols which conflict (have methods which conflict). This patch fixes the previous patch where warnings were coming out in non-deterministic order. This is 2nd part of // rdar://6191214. llvm-svn: 137055
* Make sure FunctionDecls aren't considered during overload resolution if thereKaelyn Uhrain2011-08-081-4/+5
| | | | | | are explicit template args. llvm-svn: 137054
* Silence the category-replacing-class-method warning for +load: categoryDavid Chisnall2011-08-081-0/+3
| | | | | | | | implementations of +load do not replace the class definition in a meaningful sense, they are run when the category loads, the +load method for class is run when the class is loaded. llvm-svn: 137053
* Do l-value conversion, etc., on a switch condition expression inJohn McCall2011-08-062-23/+21
| | | | | | | | | | ActOnStartOfSwitchStmt (i.e. before binding up a full-expression) instead of ActOnFinishSwitchStmt. Among other things, this means that property l-values are properly converted inside the full-expression. llvm-svn: 137014
* Only look at decls after the current one when checking if it's the last ↵Benjamin Kramer2011-08-061-10/+6
| | | | | | field in a record. llvm-svn: 137009
* Revert 136984 and 136927.Ted Kremenek2011-08-051-126/+1
| | | | llvm-svn: 136998
* Perform array bounds checking in more situations and properly handle specialKaelyn Uhrain2011-08-053-34/+118
| | | | | | | | | | | | | | | | case situations with the unary operators & and *. Also extend the array bounds checking to work with pointer arithmetic; the pointer arithemtic checking can be turned on using -Warray-bounds-pointer-arithmetic. The changes to where CheckArrayAccess gets called is based on some trial & error and a bunch of digging through source code and gdb backtraces in order to have the check performed under as many situations as possible (such as for variable initializers, arguments to function calls, and within conditional in addition to the simpler cases of the operands to binary and unary operator) while not being called--and triggering warnings--more than once for a given ArraySubscriptExpr. llvm-svn: 136997
* Let attribute((cdecl)) and company override -mrtd default calling convention.Roman Divacky2011-08-051-1/+1
| | | | llvm-svn: 136971
* Flesh out the -Warray-bounds detection of C89 tail-padded one-elementChandler Carruth2011-08-051-10/+39
| | | | | | | | | | | | | | | | | | | | | | | | | arrays. This now suppresses the warning only in the case of a one-element array as the last field in a struct where the array size is a literal '1' rather than any macro expansion or template parameter. This doesn't distinguish between the language standard in use to allow code which dates from C89 era to compile without the warning even in C99 and C++ builds. We could add a separate warning (under a different flag) with fixit hints to switch to a flexible array, but its not clear that this would be desirable. Much of the code using this idiom is striving for maximum portability. Tests were also fleshed out a bit, and the diagnostic itself tweaked to be more pretty w.r.t. single elment arrays. This is more ugly than I would like due to APInt's not being supported by the diagnostic rendering engine. A pseudo-patch for this was proposed by Nicola Gigante, but I reworked it both for several correctness issues and for code style. Sorry this was so long in coming. llvm-svn: 136965
* Finally getting around to re-working this to more accurately white-listChandler Carruth2011-08-051-8/+22
| | | | | | | | | 1-element character arrays which are serving as flexible arrays. This is the initial step, which is to restrict the 1-element array whitelist to arrays that are member declarations. I'll refine it from here based on the proposed patch. llvm-svn: 136964
* Extend memset/memcpy/memmove checking to include memcmpMatt Beaumont-Gay2011-08-051-6/+13
| | | | llvm-svn: 136950
* Have the typo correction in DiagnoseEmptyLookup properly handle templateKaelyn Uhrain2011-08-052-6/+10
| | | | | | functions when performing function overload resolution. llvm-svn: 136948
* Fix a small bug where DiagnoseEmptyLookup would no longer print any messagesKaelyn Uhrain2011-08-041-2/+1
| | | | | | | | | when performing typo correction involving any overloaded template functions. The added test cases, while currently demontrating sub-optimal behavior, will not trigger any messages without the 1-line change to SemaExpr.cpp. llvm-svn: 136943
* Specialize diag::warn_unused_call for the "warn_unused_result" attribute, soMatt Beaumont-Gay2011-08-041-2/+2
| | | | | | it can be controlled with a distinct flag. llvm-svn: 136941
* objective-c: diagnose protocol inconsistencies in following Fariborz Jahanian2011-08-041-1/+126
| | | | | | | | situation. When a class explicitly or implicitly (through inheritance) "conformsTo" two protocols which conflict (have methods which conflict). This is 2nd part of // rdar://6191214. llvm-svn: 136927
* Match type names and give more info for out-of-line function definition errors.Kaelyn Uhrain2011-08-041-8/+43
| | | | | | | | | | | | | | Having a function declaration and definition with different types for a parameter where the types have same (textual) name can occur when an unqualified type name resolves to types in different namespaces in each location. The error messages have been extended by adding notes that point to the first parameter of the function definition that doesn't match the declaration, instead of a generic "member declaration nearly matches". The generic message is still used in cases where the mismatch is not in the paramenter list, such as mismatched cv qualifiers on the member function itself. llvm-svn: 136891
* Refactoring of my last patch.Fariborz Jahanian2011-08-031-40/+33
| | | | llvm-svn: 136841
* Improve overloaded function handling in the typo correction code.Kaelyn Uhrain2011-08-033-11/+64
| | | | | | | | Change TypoCorrection to store a set of NamedDecls instead of a single NamedDecl. Also add initial support for performing function overload resolution to Sema::DiagnoseEmptyLookup. llvm-svn: 136807
* objective-c: Methods declared in methods must type matchFariborz Jahanian2011-08-031-86/+101
| | | | | | those declated in its protocols. First half or // rdar://6191214 llvm-svn: 136794
* Make the type of the IntegerLiteral for bitfield paddings an actualDouglas Gregor2011-08-031-3/+4
| | | | | | | | integer, and initialise its TypeSourceInfo. The initialisation fixes a crash when using pre-compiled preambles with C++ code-completion. From Erik Verbruggen! Fixes PR10511. llvm-svn: 136786
* In ARC, don't try to reclaim the result of a call to performSelectorJohn McCall2011-08-031-5/+8
| | | | | | unless done in a context where the value is used retained. llvm-svn: 136769
* disable array bounds overflow warning for cases where an array Chris Lattner2011-08-021-1/+3
| | | | | | | | | | | | | has a single element. This disables the warning in cases where there is a clear bug, but this is really rare (who uses arrays with one element?) and it also silences a large class of false positive issues with C89 code that is using tail padding in structs. A better version of this patch would detect when an array is in a tail position in a struct, but at least patch fixes the huge false positives that are hitting postgres and other code. llvm-svn: 136724
* Make helper functions static.Benjamin Kramer2011-08-021-6/+5
| | | | llvm-svn: 136679
* Fix formatting of SemaExpr.cpp, mainly fixing lines greater than 80 characters.Richard Trieu2011-08-021-109/+194
| | | | | | No functional change. llvm-svn: 136678
* objective-c: reverse patch for // rdar://9818354Fariborz Jahanian2011-08-011-8/+0
| | | | llvm-svn: 136658
* Introduce a Fix-It for the "missing sentinel" warning, adding anDouglas Gregor2011-07-301-5/+16
| | | | | | | appropriate sentinel at the end of the argument list. Also, put the sentinel warnings under -Wsentinel. Fixes <rdar://problem/8764236>. llvm-svn: 136566
* Add code completion to produce "else" blocks after an "if"Douglas Gregor2011-07-301-0/+55
| | | | | | statement. Fixes <rdar://problem/9229438>. llvm-svn: 136564
* When producing code completion results for variadic macros, fold theDouglas Gregor2011-07-301-4/+21
| | | | | | | variadic bit (", ..." or ", args...") into the prior placeholder, like we do with functions and methods. Fixes <rdar://problem/9740808>. llvm-svn: 136563
* Add the various parameter-passing keywords for Distributed ObjectsDouglas Gregor2011-07-301-5/+28
| | | | | | | (such as in, inout, byref, and oneway) to code completion results. Fixes <rdar://problem/8844158>. llvm-svn: 136562
* When performing code completion after at @interface, allow bothDouglas Gregor2011-07-302-20/+26
| | | | | | | | already-defined and forward-declared results. Already-defined results are fine because they could be the start of a category. Fixes <rdar://problem/9811691>. llvm-svn: 136559
* When complaining about a non-POD second argument to va_arg, use aDouglas Gregor2011-07-301-2/+5
| | | | | | | | special diagnostic for ARC ownership-qualified types. We wouldn't want to expose Objective-C programmers to the term "POD", would we? Fixes <rdar://problem/9772982>. llvm-svn: 136558
* Fix an inconsistency in Sema::ConvertArgumentsForCall in thatPeter Collingbourne2011-07-291-5/+12
| | | | | | | the callee note diagnostic was not emitted in the case where there were too few arguments. llvm-svn: 136437
* objective-c: warn if implementation of a method in categoryFariborz Jahanian2011-07-281-34/+142
| | | | | | | | | | masks an existing method in its primary class, class extensions, and primary class's non-optional protocol methods; as primary class, or one of its subclass's will implement this method. This warning has potential of being noisy so it has its own group. // rdar://7020493 llvm-svn: 136426
* Add a fixit for removal of unused label.Anna Zaks2011-07-281-1/+17
| | | | llvm-svn: 136389
* Added basic parsing for all remaining attributes, thread safetyCaitlin Sadowski2011-07-282-3/+240
| | | | | | | analysis. This includes checking that the attributes are applied in the correct contexts and with the correct number of arguments. llvm-svn: 136383
* Add */& mismatch fixit generation to the Sema::DiagnoseAssignmentResult().Anna Zaks2011-07-282-4/+32
| | | | llvm-svn: 136379
* Make the deserialization of Sema::PendingInstantiations lazy. At thisDouglas Gregor2011-07-281-0/+8
| | | | | | | | point, ASTReader::InitializeSema() has very little interesting work, *except* issues stemming from preloaded declarations. That's something we'll still need to cope with. llvm-svn: 136378
* Refactor the */& mismatch fixit generation out of SemaOverload and provide a ↵Anna Zaks2011-07-283-113/+177
| | | | | | simple conversion checking function. llvm-svn: 136376
* Lazily deserialize Sema::VTableUses. Plus, fix the utterly andDouglas Gregor2011-07-281-0/+26
| | | | | | | | completely broken deserialization mapping code we had for VTableUses, which would have broken horribly as soon as our local-to-global ID mapping became interesting. llvm-svn: 136371
OpenPOWER on IntegriCloud