summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Try harder to recognize hidden tag type names in potential declarations insteadKaelyn Uhrain2012-05-021-44/+70
| | | | | | of giving unhelpful errors about undeclared identifers and missing semicolons. llvm-svn: 155965
* Eliminate Sema::CompareMethodParamsInBaseAndSuper() entirely, byDouglas Gregor2012-05-011-55/+29
| | | | | | | | folding its one check into the normal path for checking overridden Objective-C methods. Good for another 3.6% speedup on the test case in <rdar://problem/11004361>. llvm-svn: 155961
* The semantic checking that verifies whether an Objective-C methodDouglas Gregor2012-05-011-14/+17
| | | | | | | | | | | | | | | | declared in a subclass has consistent parameter types with a method having the same selector in a superclass performs a significant number of lookups into the class hierarchy. In the example in <rdar://problem/11004361>, we spend 4.7% of -fsyntax-only time in these lookups. Optimize away most of the calls to this routine (Sema::CompareMethodParamsInBaseAndSuper) by first checking whether we have ever seen *any* method with that selector (using the global selector table). Since most selectors are unique, we can avoid the cost of this name lookup in many cases, for a 3.3% speedup. llvm-svn: 155958
* Add a missing RequireCompleteType call when synthesizing properties. ↵Eli Friedman2012-05-011-18/+36
| | | | | | | | <rdar://problem/11333367>. While I'm here, fix source locations for other diagnostics related to property synthesis. llvm-svn: 155953
* Clean up changes suggested by Douglas Gregor:Patrick Beard2012-05-011-13/+19
| | | | | | | | | | | | BuildObjCNumericLiteral() and BuildObjCBoxedExpr() now both using PerformCopyInitialization() rather than PerformImplicitConversion(), which suppresses errors. In BuildObjCBoxedExpr(): no longer calling .getCanonicalType(), ValueType->getAs() will remove the minimal amount of sugar. Using ValueType->isBuiltinType() instead of isa<BuiltinType>(ValueType). llvm-svn: 155949
* Extend the error about incompatible visibility attributes in differentRafael Espindola2012-05-011-1/+7
| | | | | | decls to work on function templates specializations. llvm-svn: 155943
* Workaround a miscompile in 483.xalancbmk while we figure it out.David Blaikie2012-05-011-1/+0
| | | | llvm-svn: 155938
* In C++11 mode, implement the C++11 semantics forDouglas Gregor2012-05-012-4/+9
| | | | | | | | | | | [basic.lookup.classref]p1 and p4, which concerns name lookup for nested-name-specifiers and template names, respectively, in a member access expression. C++98/03 forces us to look both in the scope of the object and in the current scope, then compare the results. C++11 just takes the result from the scope of the object, if something is found. Fixes <rdar://problem/11328502>. llvm-svn: 155935
* Implement simplify_type traits for redecl_iterator.David Blaikie2012-05-011-1/+1
| | | | | | Based on Chandler Carruth's feedback on r155869. llvm-svn: 155929
* PR12710 - broken default argument handling for templates.David Blaikie2012-05-011-7/+5
| | | | | | | | | | | | | | | I broke this in r155838 by not actually instantiating non-dependent default arg expressions. The motivation for that change was to avoid producing duplicate conversion warnings for such default args (we produce them once when we parse the template - there's no need to produce them at each instantiation) but without actually instantiating the default arg, things break in weird ways. Technically, I think we could still get the right diagnostic experience without the bugs if we instantiated the non-dependent args (for non-dependent params only) immediately, rather than lazily. But I'm not sure if such a refactoring/ change would be desirable so here's the conservative fix for now. llvm-svn: 155893
* Turn the mixed-sign-comparison diagnostic into a runtime behaviorDouglas Gregor2012-05-011-3/+4
| | | | | | diagnostic, from Eitan Adler! llvm-svn: 155876
* Let's use the correct bool this time.Kaelyn Uhrain2012-05-011-1/+1
| | | | llvm-svn: 155871
* A couple of very small tweaks suggested by Doug in reply to r155580 and r155163.Kaelyn Uhrain2012-05-011-1/+1
| | | | llvm-svn: 155870
* Remove ref/value inconsistency in redecl_iterator.David Blaikie2012-05-012-2/+2
| | | | | | | | | | | | | Similar to r155808 - this mistake has been made in a few iterators. Based on Chandler Carruth's feedback to r155808 I added an implicit conversion to Decl* to ease adoption/usage. Useful for the pointer comparison, but not the dyn_cast (due to template argument deduction causing the conversion not to be used) - there for future convenience, though. This idiom (op T* for iterators) seems to be fairly idiomatic within the LLVM codebase & I'll likely add it as I fix up the other iterators here. llvm-svn: 155869
* clang_getCursorLexicalParent should return a translation unit cursor for ↵Douglas Gregor2012-04-301-0/+1
| | | | | | declarations at the global scope, from Evan P. Fixes PR9083. llvm-svn: 155858
* Remove -Wc++98-compat warning for an outrageously-rare circumstance of 'this'Richard Smith2012-04-301-4/+0
| | | | | | | | | | being used in an exception specification in a way which isn't otherwise ill-formed in C++98: this warning also incorrectly triggered on uses of 'this' inside thread-safety attributes, and the mechanism required to tell these cases apart is more complex than can be justified by the (minimal) value of this part of -Wc++98-compat. llvm-svn: 155857
* When going through references to check if the function returns the addressArgyrios Kyrtzidis2012-04-301-24/+34
| | | | | | | | | | | | | | | | of a local variable, make sure we don't infinitely recurse when the reference binds to itself. e.g: int* func() { int& i = i; // assign non-exist variable to a reference which has same name. return &i; // return pointer } rdar://11345441 llvm-svn: 155856
* Add FixItHint for -Wnull-conversion to initialize with an appropriate literal.David Blaikie2012-04-304-38/+53
| | | | | | Reviewed by Doug Gregor. llvm-svn: 155839
* Fix PR12378: provide conversion warnings on default args of function templatesDavid Blaikie2012-04-302-4/+11
| | | | | | | | | | | | | Apparently we weren't checking default arguments when they were instantiated. This adds the check, fixes the lack of instantiation caching (which seems like it was mostly implemented but just missed the last step), and avoids implementing non-dependent default args (for non-dependent parameter types) as uninstantiated default arguments (so that we don't warn once for every instantiation when it's not instantiation dependent). Reviewed by Richard Smith. llvm-svn: 155838
* HandleDeclarator() returns NULL for semantic disasters. Deal with itDouglas Gregor2012-04-301-1/+1
| | | | | | | when we're in an Objective-C container context. Fixes <rdar://problem/11286701>. llvm-svn: 155836
* Add -Wloop-analysis. This warning will fire on for loops which the variablesRichard Trieu2012-04-301-0/+216
| | | | | | in the loop conditional do not change. llvm-svn: 155835
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-3012-111/+117
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* PR9546, DR1268: A prvalue cannot be reinterpret_cast to an rvalue referenceRichard Smith2012-04-291-4/+3
| | | | | | type. But a glvalue can be reinterpret_cast to either flavor of reference. llvm-svn: 155789
* [class.copy]p23: Fix an assertion caused by incorrect argument numbering in aRichard Smith2012-04-291-2/+2
| | | | | | | diagnostic, add a test for this paragraph, and tighten up the diagnostic wording a little. llvm-svn: 155784
* Currently __builtin_annotation() only annotates an i32.Julien Lerouge2012-04-281-8/+23
| | | | | | | | | | | | | | | | | | | | | | | | i32 __builtin_annotation(i32, string); Applying it to i64 (e.g., long long) generates the following IR. trunc i64 {{.*}} to i32 call i32 @llvm.annotation.i32 zext i32 {{.*}} to i64 The redundant truncation and extension make the result difficult to use. This patch makes __builtin_annotation() generic. type __builtin_annotation(type, string); For the i64 example, it simplifies the generated IR to: call i64 @llvm.annotation.i64 Patch by Xi Wang! llvm-svn: 155764
* C++11 weakens the requirement for types used with offsetof from POD to ↵Benjamin Kramer2012-04-281-2/+10
| | | | | | standard layout type. llvm-svn: 155757
* Rename isPODType (using the C++98 rules) into isCXX98PODType and make ↵Benjamin Kramer2012-04-281-1/+2
| | | | | | | | | | isPODType decide which one to use based on LangOptions. - -Wc++98-compat depends on the c++98 definition - Now __is_pod returns the right thing in c++11 and c++98 mode - All changes to the type traits test are validated against g++ 4.7 llvm-svn: 155756
* Revert "Use the C++11 definition of PODness for __is_pod in C++11 mode."Benjamin Kramer2012-04-281-2/+1
| | | | | | This is just papering over a major bug in isPODType, real fix coming up soon. llvm-svn: 155755
* Use the C++11 definition of PODness for __is_pod in C++11 mode.Benjamin Kramer2012-04-281-1/+2
| | | | | | Keep the old definition for C++98 so we don't break tr1::is_pod. llvm-svn: 155754
* [analyzer] Remove references to idx::TranslationUnit. Index is dead, ↵Jordy Rose2012-04-281-1/+1
| | | | | | cross-TU inlining never panned out. llvm-svn: 155751
* PR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode.Richard Smith2012-04-271-2/+4
| | | | | | | We do not support IRGen for these, and get some parts of the semantic analysis wrong. llvm-svn: 155728
* Imrpove the note text for when a non-type decl hides a tag typeKaelyn Uhrain2012-04-271-1/+1
| | | | llvm-svn: 155723
* Add note to help explain why a tag such as 'struct' is needed to referKaelyn Uhrain2012-04-261-0/+8
| | | | | | | to a given type, when the reason is that there is a non-type decl with the same name. llvm-svn: 155677
* Add a missing ExpressionEvaluationContext for template default arguments. ↵Eli Friedman2012-04-261-0/+1
| | | | | | Fixes PR12581. llvm-svn: 155670
* PR12647: An alias template instantiation which occurs in a SFINAE context isRichard Smith2012-04-261-1/+6
| | | | | | itself a SFINAE context. llvm-svn: 155621
* Two missing -Wc++98-compat warnings, for null pointers as non-type templateRichard Smith2012-04-262-0/+7
| | | | | | arguments, and 'this' in exception-specifications. llvm-svn: 155606
* Reject cases likeRafael Espindola2012-04-261-0/+9
| | | | | | | | | struct __attribute__((visibility("hidden"))) a; struct __attribute__((visibility("default"))) b; which gcc already rejects. llvm-svn: 155603
* If a type is non-literal by virtue of being incomplete produce notesRichard Smith2012-04-251-2/+7
| | | | | | explaining that. llvm-svn: 155598
* Add an error message with fixit hint for changing '.' to '->'.Kaelyn Uhrain2012-04-251-3/+32
| | | | | | | | | This is mainly for attempting to recover in cases where a class provides a custom operator-> and a '.' was accidentally used instead of '->' when accessing a member of the object returned by the current object's operator->. llvm-svn: 155580
* When resolving default template arguments, it should be done in the ↵Argyrios Kyrtzidis2012-04-251-0/+3
| | | | | | | | | | declaration context of the template what we are going to instantiate. Fixes various crashes of rdar://11242625 & http://llvm.org/PR11421. llvm-svn: 155576
* PR12625: Cope with classes which have incomplete base or member types:Richard Smith2012-04-251-1/+1
| | | | | | | Don't try to query whether an incomplete type has a trivial copy constructor when determining whether a move constructor should be declared. llvm-svn: 155575
* PR12629: Cope with parenthesized function types when attaching a delayedRichard Smith2012-04-241-4/+8
| | | | | | exception specification to a function. llvm-svn: 155424
* with -Wdeprecated, include a note to its deprecated declarationFariborz Jahanian2012-04-231-1/+5
| | | | | | location. // rdar://10893232 llvm-svn: 155385
* Thread safety analysis: support the use of pt_guarded_by attributesDeLesley Hutchins2012-04-231-0/+22
| | | | | | on smart pointers. Also adds test case for previous commit. llvm-svn: 155379
* Thread-safety analysis: support new "pointer to member" syntax forDeLesley Hutchins2012-04-231-1/+13
| | | | | | existentially quantified lock expressions. llvm-svn: 155357
* Teach RequireCompleteType about multi-dimensional arrays. FixesDouglas Gregor2012-04-231-1/+2
| | | | | | <rdar://problem/11284902>. llvm-svn: 155356
* Sema: Initialize NSString method cache members.Benjamin Kramer2012-04-221-1/+3
| | | | | | Found by valgrind. llvm-svn: 155324
* PR12585: When processing a friend template inside a class template, don'tRichard Smith2012-04-221-15/+12
| | | | | | | | pretend there was no previous declaration -- that can lead us to injecting a class template (with no access specifier) into a class scope. Instead, just avoid the problematic checks. llvm-svn: 155303
* Fix regression in r154844. If necessary, defer computing adjusted destructorRichard Smith2012-04-212-17/+37
| | | | | | | exception specifications in C++11 until after we've parsed the exception specifications for nested classes. llvm-svn: 155293
* Remove unneeded code.Fariborz Jahanian2012-04-211-1/+1
| | | | llvm-svn: 155290
OpenPOWER on IntegriCloud