summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Rework DiagnoseInvalidRedeclaration to add the ability to correct typos whenKaelyn Uhrain2011-08-181-23/+69
| | | | | | diagnosing invalid function redeclarations. llvm-svn: 137966
* Track in the AST whether a function is constexpr.Richard Smith2011-08-151-4/+52
| | | | llvm-svn: 137653
* Implement function template specialization at class scope extension in ↵Francois Pichet2011-08-141-9/+35
| | | | | | | | | | | | | | | | | Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization. Example: template <class T> class A { public: template <class U> void f(U p) { } template <> void f(int p) { } // <== class scope specialization }; This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code. BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error. llvm-svn: 137573
* Fix some comments.Richard Smith2011-08-121-5/+3
| | | | llvm-svn: 137491
* Overriding the predefined Protocol isn't something that's actuallyDouglas Gregor2011-08-121-5/+0
| | | | | | | done and is likely to not work well anyway; take away this unnecessary complexity. llvm-svn: 137465
* Encapsulate the Objective-C id/Class/SEL "redefinition" types inDouglas Gregor2011-08-111-3/+3
| | | | | | | | | ASTContext with accessors/mutators. The only functional change is that the AST writer won't bother writing the id/Class/SEL redefinition type if it hasn't been explicitly set; previously, it ended up being written as a synonym for the built-in id/Class/SEL. llvm-svn: 137349
* 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
* 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
* Add a fixit for removal of unused label.Anna Zaks2011-07-281-1/+17
| | | | llvm-svn: 136389
* Make Sema::LocallyScopedExternalDecls lazily deserialized. In theory,Douglas Gregor2011-07-281-3/+20
| | | | | | | | | we could turn this into an on-disk hash table so we don't load the whole thing the first time we need it. However, it tends to be very, very small (i.e., empty) for most precompiled headers, so it isn't all that interesting. llvm-svn: 136352
* Provide fixit for static use of objective-c typeFariborz Jahanian2011-07-261-9/+22
| | | | | | | in few more places and in each instance, fix up the type to the expected type. // rdar://9603056 llvm-svn: 136103
* objective-c: Provide a 'fixit' when class was usedFariborz Jahanian2011-07-251-1/+2
| | | | | | to declare a static object. // rdar://9603056 llvm-svn: 135970
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-13/+13
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* In Objective-C, pull arbitrary attributes from overriddenJohn McCall2011-07-221-3/+12
| | | | | | | | | | | | | | | methods, including indirectly overridden methods like those declared in protocols and categories. There are mismatches that we would like to diagnose but aren't yet, but this is fine for now. I looked at approaches that avoided doing this lookup unless we needed it, but the infer-related-result-type checks were doing it anyway, so I left it with the same fast-path check for no previous declartions of that selector. llvm-svn: 135743
* Add a hackaround to avoid the crash in PR10355. However, our recoveryDouglas Gregor2011-07-141-2/+4
| | | | | | | is still terrible here because typo correction is not behaving well in the presence of overloaded functions. llvm-svn: 135128
* Add 'mutable' to the function declarator chunk, to be used whenDouglas Gregor2011-07-131-0/+1
| | | | | | parsing lambda expressions, from John Freeman! llvm-svn: 135090
* Fix an incorrect namespace typo-correction diagnostic, from KaelynDouglas Gregor2011-07-131-3/+0
| | | | | | Uhrain! Fixes PR10318. llvm-svn: 135086
* Fix a bug where a local variable named 'self' is causingFariborz Jahanian2011-07-121-0/+1
| | | | | | | implicit ivar accesses to go through the 'self' variable rather than the real 'self' for the method. // rdar://9730771 llvm-svn: 134992
* Centralize the getCanonicalType() calls in the Itanium C++ manglingDouglas Gregor2011-07-121-1/+2
| | | | | | code so that they only occur in a single place. No functionality change. llvm-svn: 134961
* Don't complain about missing return statements for nakedDouglas Gregor2011-07-111-0/+4
| | | | | | functions. Fixes <rdar://problem/9731999>. llvm-svn: 134897
* Remove unused parameter from ActOnDeclarator.Anders Carlsson2011-07-041-3/+2
| | | | llvm-svn: 134377
* Fix a typo, remove a tab, canonicalize some spacing. No functional change.Nick Lewycky2011-07-021-3/+3
| | | | llvm-svn: 134305
* Fix for PR7410. Allow functions in a derived class that improperly overwrite ↵Richard Trieu2011-07-011-1/+1
| | | | | | a virtual function in the base class to be inserted into the derived class function list to prevent extra errors every time the derived class is used. llvm-svn: 134251
* Fix AST representations of alias-declarations which define tag types. Inside ↵Richard Smith2011-07-011-1/+6
| | | | | | classes, the tag types need to have an associated access specifier, and inside function definitions, they need to be included in the declarations of the DeclStmt. These issues manifested as assertions during template instantiation, and also in a WIP constexpr patch. llvm-svn: 134250
* When redeclaring a local extern in the same scope, make sure that weDouglas Gregor2011-06-291-2/+12
| | | | | | | replace the existing declaration appropriately. Patch by Jordy Rose, fixes PR10013 / <rdar://problem/9584157>. llvm-svn: 134097
* Add support for C++ namespace-aware typo correction, e.g., correctingDouglas Gregor2011-06-281-32/+46
| | | | | | | | | | | | | | | vector<int> to std::vector<int> Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes PR5776/<rdar://problem/8652971>. Thanks Kaelyn! llvm-svn: 134007
* Centralize all checks for a C++ tag definition inside a typename inArgyrios Kyrtzidis2011-06-281-1/+1
| | | | | | | | Sema::GetTypeForDeclarator and remove its 'OwnedDecl' out parameter. No functionality change. llvm-svn: 133986
* Centralize the check for a tag definition in a Declarator::PrototypeContext ↵Argyrios Kyrtzidis2011-06-281-9/+1
| | | | | | | | inside GetTypeForDeclarator. No functionality change. llvm-svn: 133985
* Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about ↵Argyrios Kyrtzidis2011-06-241-5/+5
| | | | | | | | 'ownership', not 'lifetime'. rdar://9477613. llvm-svn: 133779
* Remove multiple use of weak_import attribute onFariborz Jahanian2011-06-231-1/+1
| | | | | | same declaration. Templatize dropAttr for general use. llvm-svn: 133724
* Remove weak_import attribute on new declaration.Fariborz Jahanian2011-06-231-3/+1
| | | | | | // rdar://9538608 llvm-svn: 133721
* Issue warning if weak_import attribute is added to an alreadyFariborz Jahanian2011-06-221-4/+9
| | | | | | declared variable and ignore it. // rdar://9538608 llvm-svn: 133654
* llvm-gcc treats a tentative definition with a previousFariborz Jahanian2011-06-201-0/+6
| | | | | | | | | (or follow up) extern declaration with weak_import as an actual definition. make clang follows this behavior. // rdar://9538608 llvm-gcc treats an extern declaration with weak_import llvm-svn: 133450
* When an explicit specialization has a storage specifier, error if thatDouglas Gregor2011-06-171-3/+12
| | | | | | | | | storage specifier is different from the storage specifier on the template. If that storage specifier is the same, then we only warn. Thanks to John for the prodding. llvm-svn: 133236
* Downgrade the error complaining about presence of a storage classDouglas Gregor2011-06-171-1/+1
| | | | | | | specifier on an explicit specialization to a warning, since neither EDG nor GCC diagnose this code as ill-formed. llvm-svn: 133232
* Automatic Reference Counting.John McCall2011-06-151-18/+222
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Don't add redundant FormatAttr, ConstAttr, or NoThrowAttr attributes,Douglas Gregor2011-06-151-2/+5
| | | | | | | either imlicitly (for builtins) or explicitly (due to multiple specification of the same attributes). Fixes <rdar://problem/9612060>. llvm-svn: 133045
* fix rdar://9204520 - Accept int(0.85 * 10) as an initializer in a class memberChris Lattner2011-06-141-9/+17
| | | | | | as an extension. llvm-svn: 132980
* Make __gnu_inline__ functions in gnu99 mode work the same way as inline ↵Eli Friedman2011-06-131-1/+2
| | | | | | | | functions in gnu89 mode in terms of redefinitions. rdar://9559708 . llvm-svn: 132953
* Don't assert on initialized typedef declarations in classes:Richard Smith2011-06-121-6/+2
| | | | | | | | | | | | struct { typedef int A = 0; }; According to the C++11 standard, this is not ill-formed, but does not have any ascribed meaning. We can't reasonably accept it, so treat it as ill-formed. Also switch C++ from an incorrect 'fields can only be initialized in constructors' diagnostic for this case to C's 'illegal initializer (only variables can be initialized)' llvm-svn: 132890
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-20/+22
| | | | llvm-svn: 132878
* Implement Objective-C Related Result Type semantics.Douglas Gregor2011-06-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related result types apply Cocoa conventions to the type of message sends and property accesses to Objective-C methods that are known to always return objects whose type is the same as the type of the receiving class (or a subclass thereof), such as +alloc and -init. This tightens up static type safety for Objective-C, so that we now diagnose mistakes like this: t.m:4:10: warning: incompatible pointer types initializing 'NSSet *' with an expression of type 'NSArray *' [-Wincompatible-pointer-types] NSSet *array = [[NSArray alloc] init]; ^ ~~~~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:72:1: note: instance method 'init' is assumed to return an instance of its receiver type ('NSArray *') - (id)init; ^ It also means that we get decent type inference when writing code in Objective-C++0x: auto array = [[NSMutableArray alloc] initWithObjects:@"one", @"two",nil]; // ^ now infers NSMutableArray* rather than id llvm-svn: 132868
* Made changes to how 'struct'/'class' mismatches are handled in ↵Richard Trieu2011-06-101-8/+62
| | | | | | | | | | | | | | | | | -Wmismatched-tags. - Removed fix-it hints from template instaniations since changes to the templates are rarely helpful. - Changed the caret in template instaniations from the class/struct name to the class/struct keyword, matching the other warnings. - Do not offer fix-it hints when multiple declarations disagree. Warnings are still given. - Once a definition is found, offer a fix-it hint to all previous declarations with wrong tag. - Declarations that disagree with a previous definition will get a fix-it hint to change the declaration. llvm-svn: 132831
* More coherent diagnostic when a stack variable isFariborz Jahanian2011-06-071-2/+6
| | | | | | declared __weak objc-gc mode. // rdar://9666091. llvm-svn: 132731
* Diagnose the condition in C++ [temp.expl.spec]p16 that prohibitsDouglas Gregor2011-06-061-3/+5
| | | | | | | specializing a member of an unspecialized template, and recover from such errors without crashing. Fixes PR10024 / <rdar://problem/9509761>. llvm-svn: 132677
* Revert r132544. Accidental commit. I got confused with the Tortoise SVN menu.Francois Pichet2011-06-031-1/+1
| | | | llvm-svn: 132546
* (no commit message)Francois Pichet2011-06-031-1/+1
| | | | llvm-svn: 132544
* Correctly revert r131347: function explicit specialization at class scope.Francois Pichet2011-06-031-1/+1
| | | | | | I'll try to implement this functionality again soon. llvm-svn: 132536
* Implement -fgnu89-inline. Fixes PR10041.Rafael Espindola2011-06-021-1/+1
| | | | llvm-svn: 132460
* Microsoft friend acting as a forward declaration; try#2. Now only 2 lines.Francois Pichet2011-06-011-3/+7
| | | | llvm-svn: 132387
OpenPOWER on IntegriCloud