summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Improve diagnostics when we fail to convert from a source type to aDouglas Gregor2010-04-091-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | destination type for initialization, assignment, parameter-passing, etc. The main issue fixed here is that we used rather confusing wording for diagnostics such as t.c:2:9: warning: initializing 'char const [2]' discards qualifiers, expected 'char *' [-pedantic] char *name = __func__; ^ ~~~~~~~~ We're not initializing a 'char const [2]', we're initializing a 'char *' with an expression of type 'char const [2]'. Similar problems existed for other diagnostics in this area, so I've normalized them all with more precise descriptive text to say what we're initializing/converting/assigning/etc. from and to. The warning for the code above is now: t.c:2:9: warning: initializing 'char *' from an expression of type 'char const [2]' discards qualifiers [-pedantic] char *name = __func__; ^ ~~~~~~~~ Fixes <rdar://problem/7447179>. llvm-svn: 100832
* Downgrade the "declaration does not declare anything" error to aDouglas Gregor2010-04-081-3/+2
| | | | | | | warning. It's not harmful to have such pointless declarations, and GCC does not diagnose this issue consistently. llvm-svn: 100814
* Implement method type encoding in the presenseFariborz Jahanian2010-04-081-0/+1
| | | | | | of c-style arguments. Completes radar 7445205. llvm-svn: 100813
* Explain that a template needs arguments to make it into a type, forJeffrey Yasskin2010-04-081-0/+18
| | | | | | variable declarations. llvm-svn: 100809
* Set access properly on instantiated friend class template declarations.John McCall2010-04-081-2/+7
| | | | | | Fixes PR6752. llvm-svn: 100806
* Remove micro-optimization for not issueing CFG-based warnings for 'static ↵Ted Kremenek2010-04-082-62/+3
| | | | | | | | | | inline' functions unless they are used. I discussed this with Daniel Dunbar, and we agreed that this provides an inconsistent warnings experience for the user and that there were genuine cases where we wouldn't want to do this optimization. llvm-svn: 100800
* Introduce an egregious hack to work around a bug in libstdc++ 4.2.x'sDouglas Gregor2010-04-081-4/+37
| | | | | | | | | <tr1/hashtable> header, where a friend class template std::tr1::__detail::_Map_base is declared with the wrong template parameters. GCC doesn't catch the problem, so Clang does a little back-flip to avoid diagnosing just this one instance of the problem. llvm-svn: 100790
* Make CXXScopeSpec invalid when incomplete, and propagate that into anyJeffrey Yasskin2010-04-089-69/+73
| | | | | | | Declarator that depends on it. This fixes several redundant errors and bad recoveries. llvm-svn: 100779
* Implement dependent friend function template specializations.John McCall2010-04-085-34/+115
| | | | llvm-svn: 100753
* Removed unused object.Ted Kremenek2010-04-081-1/+0
| | | | llvm-svn: 100750
* Fronted: Kill overly specialized RecordLayoutDumper, just make ↵Daniel Dunbar2010-04-081-0/+24
| | | | | | -dump-record-layouts a bit that Sema honors. llvm-svn: 100747
* Patch to implement gcc's cstyle arguments in objcFariborz Jahanian2010-04-083-4/+31
| | | | | | methods. wip. llvm-svn: 100734
* Fix a (bogus) uninitialized-member-of-local warning.John McCall2010-04-081-1/+1
| | | | llvm-svn: 100732
* Use SmallVector instead of an std::queue.Ted Kremenek2010-04-081-2/+1
| | | | llvm-svn: 100730
* When a template (without arguments) is passed as a template typeJeffrey Yasskin2010-04-081-1/+16
| | | | | | | parameter, explicitly ask the user to give it arguments. We used to complain that it wasn't a type and expect the user to figure it out. llvm-svn: 100729
* Fix some redundant errors by changing CXXScopeSpec::isSet calls intoJeffrey Yasskin2010-04-072-3/+6
| | | | | | isNotEmpty calls. llvm-svn: 100722
* Implement checking for template literal operator functions. ThisAlexis Hunt2010-04-071-4/+21
| | | | | | | code won't actually get used yet because we don't handle non-type parameter packs, but when we do, this code should jump in and work. llvm-svn: 100716
* Updated comment to reflect changes made in the most recent draft.Alexis Hunt2010-04-071-5/+3
| | | | llvm-svn: 100707
* Fixed 80-cols violationAlexis Hunt2010-04-071-1/+1
| | | | llvm-svn: 100704
* Return early from Sema::MarkDeclarationReferenced when we know thereDouglas Gregor2010-04-072-2/+11
| | | | | | | | | isn't any extra work to perform. Also, don't check for unused parameters when the warnings will be suppressed anyway. Improves performance of -fsyntax-only on 403.gcc's combine.c by ~2.5%. <rdar://problem/7836787> llvm-svn: 100686
* Improve handling of friend types in several ways:Douglas Gregor2010-04-072-64/+63
| | | | | | | | | | | - When instantiating a friend type template, perform semantic analysis on the resulting type. - Downgrade the errors concerning friend type declarations that do not refer to classes to ExtWarns in C++98/03. C++0x allows practically any type to be befriended, and ignores the friend declaration if the type is not a class. llvm-svn: 100635
* Split Sema::ActOnFriendTypeDecl into Sema::CheckFriendTypeDecl (forDouglas Gregor2010-04-072-35/+63
| | | | | | | | semantic analysis) and Sema::ActOnFriendTypeDecl (the action callback). This is a prerequisite for improving template instantiation of friend type declarations. llvm-svn: 100633
* Teach -Wsign-compare to treat 1 << blah as "idiomatically non-negative".John McCall2010-04-071-0/+11
| | | | | | Fixes a spurious warning in LLVM. llvm-svn: 100595
* Check access for the implicit calls to destructors that occur when weJohn McCall2010-04-072-2/+6
| | | | | | | | have a temporary object in C++. Also fix a tag mismatch that Doug noticed. llvm-svn: 100593
* Implement code completion for Objective-C method declarations andDouglas Gregor2010-04-073-1/+226
| | | | | | | | | | | | | | | | definitions, e.g., after - or - (id) we'll find all of the "likely" instance methods that one would want to declare or define at this point. In the latter case, we only produce results whose return types match "id". llvm-svn: 100587
* Minor clean up.Fariborz Jahanian2010-04-062-21/+0
| | | | llvm-svn: 100583
* default access for synthesize ivar is @protect.Fariborz Jahanian2010-04-061-1/+1
| | | | | | Fixes radar 7823675. llvm-svn: 100582
* Patch to not build ivar ASTs when they are ilegallyFariborz Jahanian2010-04-061-11/+17
| | | | | | declared in categories. llvm-svn: 100577
* Devote a special diagnostic to the typoJohn McCall2010-04-061-0/+17
| | | | | | | (void*) someFunction(5, 10, 15, 20); where the cast is presumably meant to be to 'void'. llvm-svn: 100574
* Implement the protected access restriction ([class.protected]), which requiresJohn McCall2010-04-066-254/+463
| | | | | | | | that protected members be used on objects of types which derive from the naming class of the lookup. My first N attempts at this were poorly-founded, largely because the standard is very badly worded here. llvm-svn: 100562
* When code completion produces an overload set as its results (e.g.,Douglas Gregor2010-04-061-3/+2
| | | | | | | while we're completing in the middle of a function call), also produce "ordinary" name results that show what can be typed at that point. llvm-svn: 100558
* Do not produce semicolons at the end of code-completion resultsDouglas Gregor2010-04-061-14/+0
| | | | llvm-svn: 100557
* Only prove macros as code-completion results when we're in a caseDouglas Gregor2010-04-061-19/+1
| | | | | | | statement or for ordinary names. This means that we won't show macros when completing, e.g., member expressions such as "p->". llvm-svn: 100555
* When sending a message to "id", apply some heuristics to try to narrowDouglas Gregor2010-04-061-0/+68
| | | | | | | down the set of code-completion results based on Objective-C conventions. llvm-svn: 100548
* Make code-completion for Objective-C message sends to "id" work in theDouglas Gregor2010-04-061-4/+34
| | | | | | | | presence of precompiled headers by forcibly loading all of the methods we know about from the PCH file before constructing our code-completion list. llvm-svn: 100535
* Implement support for code completion of an Objective-C message send toDouglas Gregor2010-04-061-9/+49
| | | | | | | | | | "id" or an expression of type "id". In these cases, we produce a list of all of the (class or instance) methods, respectively, that we know about. Note that this implementation does not yet work well with precompiled headers; that's coming soon. llvm-svn: 100528
* Use cast<> + OpaquePtr.getAs<Decl> to add extra checking of our assumptions.Ted Kremenek2010-04-051-2/+3
| | | | llvm-svn: 100496
* Fix possible null dereference by bailing out of ↵Ted Kremenek2010-04-051-1/+4
| | | | | | CheckObjCPropertyAttributes() early if the Decl* is null. llvm-svn: 100483
* Extend the type printing policy to allow one to turn off the printingDouglas Gregor2010-04-051-1/+4
| | | | | | | of file locations for anonymous tag types (e.g., "enum <anonymous at t.h:15:6>"), which can get rather long. llvm-svn: 100470
* Code completion results that refer to macros now get the cursor kindDouglas Gregor2010-04-051-2/+5
| | | | | | | of macro definitions when passed to CIndex. Add test for code completion of macros via CIndex. llvm-svn: 100431
* diagnose declaring class extension after its implementationFariborz Jahanian2010-04-021-0/+5
| | | | | | (radar 7822210). llvm-svn: 100226
* Diagnose invalid code with -fobjc-nonfragile-abi2 whenFariborz Jahanian2010-04-021-5/+0
| | | | | | | property is being accessed without the dot-syntax notation. (radar 7822344). llvm-svn: 100212
* Sema/Obj-C: Narrow type, and simplify.Daniel Dunbar2010-04-021-14/+6
| | | | llvm-svn: 100210
* Sema/Obj-C: Simplify -- eliminate dead casts & provable asserts, and narrow ↵Daniel Dunbar2010-04-021-7/+5
| | | | | | type. llvm-svn: 100197
* Rework our handling of copy construction of temporaries, which was aDouglas Gregor2010-04-022-88/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | poor (and wrong) approximation of the actual rules governing when to build a copy and when it can be elided. The correct implementation is actually simpler than the approximation. When we only enumerate constructors as part of initialization (e.g., for direct initialization or when we're copying from a class type or one of its derived classes), we don't create a copy. When we enumerate all conversion functions, we do create a copy. Before, we created some extra copies and missed some others. The new test copy-initialization.cpp shows a case where we missed creating a (required, non-elidable) copy as part of a user-defined conversion, which resulted in a miscompile. This commit also fixes PR6757, where the missing copy made us reject well-formed code in the ternary operator. This commit also cleans up our handling of copy elision in the case where we create an extra copy of a temporary object, which became necessary now that we produce the right copies. The code that seeks to find the temporary object being copied has moved into Expr::getTemporaryObject(); it used to have two different not-quite-the-same implementations, one in Sema and one in CodeGen. Note that we still do not attempt to perform the named return value optimization, so we miss copy elisions for return values and throw expressions. llvm-svn: 100196
* If a constructor is a dependent context, just set the base and member ↵Anders Carlsson2010-04-021-107/+77
| | | | | | initializers as they are written. Fixes a bug where we wouldn't show initialization order warnings when instantiating. llvm-svn: 100180
* Diagnose multiple base and member initializers in class templates.Anders Carlsson2010-04-021-46/+40
| | | | llvm-svn: 100179
* More cleanup.Anders Carlsson2010-04-022-16/+8
| | | | llvm-svn: 100175
* Constify.Anders Carlsson2010-04-021-5/+5
| | | | llvm-svn: 100174
* Minor cleanup.Anders Carlsson2010-04-021-68/+79
| | | | llvm-svn: 100173
OpenPOWER on IntegriCloud