- Oct 20, 2009
-
-
Chris Lattner authored
implements a framework that allows us to use information about previously substituted values to simplify subsequent ones. Maybe this would be useful for C++'y stuff, who knows. We now get: t.c:4:21: error: invalid operands to binary expression ('size_t' (aka 'unsigned long *') and 'size_t') return (size_t) 0 + (size_t) 0; ~~~~~~~~~~ ^ ~~~~~~~~~~ on the testcase. Note that size_t is only aka'd once. llvm-svn: 84604
-
Chris Lattner authored
pass them down into the ArgToStringFn implementation. This allows redundancy across operands to a diagnostic to be eliminated. This isn't used yet, so no functionality change. llvm-svn: 84602
-
Chris Lattner authored
llvm-svn: 84599
-
- Oct 18, 2009
-
-
John McCall authored
TemplateTypeParmType with the substituted type directly; instead, replace it with a SubstTemplateTypeParmType which will note that the type was originally written as a template type parameter. This makes it reasonable to preserve source information even through template substitution. Also define the new SubstTemplateTypeParmType class, obviously. For consistency with current behavior, we stringize these types as if they were the underlying type. I'm not sure this is the right thing to do. At any rate, I paled at adding yet another clause to the don't-desugar 'if' statement, so I extracted a function to do it. The new function also does The Right Thing more often, I think: e.g. if we have a chain of typedefs leading to a vector type, we will now desugar all but the last one. llvm-svn: 84412
-
- Oct 16, 2009
-
-
John McCall authored
TypeLoc records for declarations; it should not be necessary to represent it directly in the type system. Please complain if you were using these classes and feel you can't replicate previous functionality using the TypeLoc API. llvm-svn: 84222
-
- Oct 14, 2009
-
-
Douglas Gregor authored
unknown type name, e.g., foo::bar x; when "bar" does not refer to a type in "foo". With this change, the parser now calls into the action to perform diagnostics and can try to recover by substituting in an appropriate type. For example, this allows us to easily diagnose some missing "typename" specifiers, which we now do: test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename' prior to dependent type name 'A<T>::type' A<T>::type A<T>::f() { return type(); } ^~~~~~~~~~ typename Fixes PR3990. llvm-svn: 84053
-
- Oct 13, 2009
-
-
Douglas Gregor authored
what we found when we looked into <blah>", where <blah> is a DeclContext*. We can now format DeclContext*'s in nice ways, e.g., "namespace N", "the global namespace", "'class Foo'". This is part of PR3990, but we're not quite there yet. llvm-svn: 84028
-
- Sep 30, 2009
-
-
John McCall authored
concrete types. Use unqualified desugaring for getAs<> and sundry. Fix a few users to either not desugar or use qualified desugar, as seemed appropriate. Removed Type's qualified desugar method, as it was easy to accidentally use instead of QualType's. llvm-svn: 83116
-
- Sep 24, 2009
-
-
John McCall authored
Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our use of qualifiers and fix a few places that weren't dealing with qualifiers quite right; many more remain. llvm-svn: 82705
-
- Sep 17, 2009
-
-
Douglas Gregor authored
essence, code completion is triggered by a magic "code completion" token produced by the lexer [*], which the parser recognizes at certain points in the grammar. The parser then calls into the Action object with the appropriate CodeCompletionXXX action. Sema implements the CodeCompletionXXX callbacks by performing minimal translation, then forwarding them to a CodeCompletionConsumer subclass, which uses the results of semantic analysis to provide code-completion results. At present, only a single, "printing" code completion consumer is available, for regression testing and debugging. However, the design is meant to permit other code-completion consumers. This initial commit contains two code-completion actions: one for member access, e.g., "x." or "p->", and one for nested-name-specifiers, e.g., "std::". More code-completion actions will follow, along with improved gathering of code-completion results for the various contexts. [*] In the current -code-completion-dump testing/debugging mode, the file is truncated at the completion point and EOF is translated into "code completion". llvm-svn: 82166
-
- Sep 16, 2009
-
-
Douglas Gregor authored
give them the appropriate exception specifications. This, unfortunately, requires us to maintain and/or implicitly generate handles to namespace "std" and the class "std::bad_alloc". However, every other approach I've come up with was more hackish, and this standard requirement itself is quite the hack. Fixes PR4829. llvm-svn: 81939
-
- Sep 15, 2009
-
-
Anders Carlsson authored
llvm-svn: 81841
-
Anders Carlsson authored
llvm-svn: 81839
-
- Sep 11, 2009
-
-
John McCall authored
specialization types differently. llvm-svn: 81512
-
- Sep 09, 2009
-
-
Mike Stump authored
llvm-svn: 81346
-
- Sep 08, 2009
-
-
Chris Lattner authored
order because it was doing so while iterating over a densemap. There are still similar problems in other places, for example WeakUndeclaredIdentifiers is still written to the PCH file in a nondeterminstic order, and we emit warnings about #pragma weak in nondeterminstic order. llvm-svn: 81236
-
- Sep 05, 2009
-
-
John McCall authored
ways: remove elab types during desugaring, enhance pretty-printing to allow tags to be suppressed without suppressing scopes, look through elab types when associating a typedef name with an anonymous record type. llvm-svn: 81065
-
- Aug 30, 2009
-
-
Anders Carlsson authored
llvm-svn: 80489
-
Anders Carlsson authored
Improve diagnostics for missing members. This renames the err_typecheck_no_member to err_typecheck_no_member_deprecated. The idea is that err_typecheck_no_member_deprecated should be phased out and any call sites that reference it should call DiagnoseMissingMember instead. llvm-svn: 80469
-
- Aug 27, 2009
-
-
Anders Carlsson authored
Add a RequireCompleteType variant that takes a PartialDiagnostic. The old RequireCompleteType now creates a PartialDiagnostic and calls the new function. llvm-svn: 80165
-
- Aug 26, 2009
-
-
Douglas Gregor authored
qualified name does not actually refer into a class/class template/class template partial specialization. Improve printing of nested-name-specifiers to eliminate redudant qualifiers. Also, make it possible to output a nested-name-specifier through a DiagnosticBuilder, although there are relatively few places that will use this leeway. llvm-svn: 80056
-
- Aug 17, 2009
-
-
David Chisnall authored
This currently breaks test/SemaObjC/id-isa-ref.m and issues some spurious warnings when you attempt to assign a struct objc_class* value to a Class variable. The test case probably should fail as it's written, because without the definition of Class the compiler should not assume struct objc_class* is a valid receiver type, but it's left broken because it would be nice if we could get that passing too for the special case of isa. Approved by snaroff. llvm-svn: 79248
-
- Aug 10, 2009
-
-
Anders Carlsson authored
Add a CastInfo struct that will be used for cast information when constructing cast expressions. Right now it only stores the cast kind, but in the future it might store conversion functions and constructors. llvm-svn: 78599
-
- Aug 08, 2009
-
-
Anders Carlsson authored
getFunctionLevelDeclContext needs to get the previous DeclContext if EnterDeclaratorContext has been called. Fixes PR4694. (Doug, please review) llvm-svn: 78480
-
Anders Carlsson authored
llvm-svn: 78478
-
- Jul 31, 2009
-
-
Anders Carlsson authored
llvm-svn: 77652
-
Anders Carlsson authored
llvm-svn: 77650
-
- Jul 30, 2009
-
-
Ryan Flynn authored
llvm-svn: 77573
-
- Jul 15, 2009
-
-
Steve Naroff authored
Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective). This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-). This patch also adds Type::isObjCBuiltinType(). This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small. llvm-svn: 75808
-
- Jul 11, 2009
-
-
Steve Naroff authored
The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
-
- Jul 06, 2009
-
-
Douglas Gregor authored
from Enea Zaffanella! llvm-svn: 74831
-
- Jul 02, 2009
-
-
Douglas Gregor authored
declaration in the AST. The new ASTContext::getCommentForDecl function searches for a comment that is attached to the given declaration, and returns that comment, which may be composed of several comment blocks. Comments are always available in an AST. However, to avoid harming performance, we don't actually parse the comments. Rather, we keep the source ranges of all of the comments within a large, sorted vector, then lazily extract comments via a binary search in that vector only when needed (which never occurs in a "normal" compile). Comments are written to a precompiled header/AST file as a blob of source ranges. That blob is only lazily loaded when one requests a comment for a declaration (this never occurs in a "normal" compile). The indexer testbed now supports comment extraction. When the -point-at location points to a declaration with a Doxygen-style comment, the indexer testbed prints the associated comment block(s). See test/Index/comments.c for an example. Some notes: - We don't actually attempt to parse the comment blocks themselves, beyond identifying them as Doxygen comment blocks to associate them with a declaration. - We won't find comment blocks that aren't adjacent to the declaration, because we start our search based on the location of the declaration. - We don't go through the necessary hops to find, for example, whether some redeclaration of a declaration has comments when our current declaration does not. Similarly, we don't attempt to associate a \param Foo marker in a function body comment with the parameter named Foo (although that is certainly possible). - Verification of my "no performance impact" claims is still "to be done". llvm-svn: 74704
-
- Jun 23, 2009
-
-
Douglas Gregor authored
specialization. At present, all implicit instantiations occur at the end of the translation unit. llvm-svn: 73915
-
- Jun 22, 2009
-
-
Douglas Gregor authored
compilation, and (hopefully) introduce RAII objects for changing the "potentially evaluated" state at all of the necessary places within Sema and Parser. Other changes: - Set the unevaluated/potentially-evaluated context appropriately during template instantiation. - We now recognize three different states while parsing or instantiating expressions: unevaluated, potentially evaluated, and potentially potentially evaluated (for C++'s typeid). - When we're in a potentially potentially-evaluated context, queue up MarkDeclarationReferenced calls in a stack. For C++ typeid expressions that are potentially evaluated, we will play back these MarkDeclarationReferenced calls when we exit the corresponding potentially potentially-evaluated context. - Non-type template arguments are now parsed as constant expressions, so they are not potentially-evaluated. llvm-svn: 73899
-
- Jun 20, 2009
-
-
Douglas Gregor authored
C++. This logic is required to trigger implicit instantiation of function templates and member functions of class templates, which will be implemented separately. This commit includes support for -Wunused-parameter, printing warnings for named parameters that are not used within a function/Objective-C method/block. Fixes <rdar://problem/6505209>. llvm-svn: 73797
-
- Jun 18, 2009
-
-
rdar://problem/6613046Steve Naroff authored
Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType). This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types). No functionality change. llvm-svn: 73649
-
- Jun 16, 2009
-
-
Steve Naroff authored
llvm-svn: 73450
-
- Jun 14, 2009
-
-
Douglas Gregor authored
that were suppressed due to SFINAE. By checking whether any errors occur at the end of template argument deduction, we avoid the possibility of suppressing an error (due to SFINAE) and then recovering so well that template argument deduction never detects that there was a problem. Thanks to Eli for the push in this direction. llvm-svn: 73336
-
Douglas Gregor authored
Implement support for C++ Substitution Failure Is Not An Error (SFINAE), which says that errors that occur during template argument deduction do *not* produce diagnostics and do not necessarily make a program ill-formed. Instead, template argument deduction silently fails. This is currently implemented for template argument deduction during matching of class template partial specializations, although the mechanism will also apply to template argument deduction for function templates. The scheme is simple: - If we are in a template argument deduction context, any diagnostic that is considered a SFINAE error (or warning) will be suppressed. The error will be propagated up the call stack via the normal means. - By default, all warnings and errors are SFINAE errors. Add the NoSFINAE class to a diagnostic in the .td file to make it a hard error (e.g., for access-control violations). Note that, to make this fully work, every place in Sema that emits an error *and then immediately recovers* will need to check Sema::isSFINAEContext() to determine whether it must immediately return an error rather than recovering. llvm-svn: 73332
-
- Jun 03, 2009
-
-
Argyrios Kyrtzidis authored
llvm-svn: 72747
-