Граф коммитов

619 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner be6d259a37 enhance the goto checker to reject jumps across __block variable definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-19 20:17:11 +00:00
Argyrios Kyrtzidis a2e85ada1d Set ObjCMethodDecl's EndLoc to the '}' when it's a definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76269 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18 00:33:33 +00:00
Ted Kremenek 35366a67ba Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 17:50:17 +00:00
Ted Kremenek 5cad1f7446 Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 01:20:38 +00:00
Steve Naroff f495456020 Remove ASTContext::isObjCObjectPointerType().
Convert all clients to use the new predicate on Type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 15:41:00 +00:00
Steve Naroff ea218b8e8f Add a "TypeSpecStartLoc" to FieldDecl. Patch contributed by Enea Zaffanella.
Note: One day, it might be useful to consider adding this info to DeclGroup (as the comments in FunctionDecl/VarDecl suggest). For now, I think this works fine. I considered moving this to ValueDecl (a common ancestor of FunctionDecl/VarDecl/FieldDecl), however this would add overhead to EnumConstantDecl (which would burn memory and isn't necessary).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 14:58:18 +00:00
Argyrios Kyrtzidis 9bedef6ae1 Fixes for a couple of things:
- Declaration context of ParmVarDecls (that we got from the Declarator) was not their containing function.
- C++ out-of-line method definitions didn't get an access specifier.

Both were exposed by a crash when emitting a C++ method to a PCH file (assert at Decl::CheckAccessDeclContext()).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 03:18:53 +00:00
Argyrios Kyrtzidis 07a5b282fb Pass the right brace SourceLocation from the Parser to the TagDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 03:17:52 +00:00
Steve Naroff 430ee5a4fd Fix 5 issues from Chris's feedback on http://llvm.org/viewvc/llvm-project?view=rev&revision=75314.
Still more to come...just wanted to get the no-brainers out of the way.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75477 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13 17:19:15 +00:00
Anders Carlsson 6a75cd9c1d Implement more of C++0x 'auto'. A variable with an auto type specifier must have an initializer. Also, move some tests around to match the C++0x draft better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11 00:34:39 +00:00
Steve Naroff 14108da7f7 This patch includes a conceptually simple, but very intrusive/pervasive change.
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75314 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-10 23:34:53 +00:00
Fariborz Jahanian 082b02e840 Implemented memmove_collectable API for Next runtime
when struct variables with GC'able members are copied into.
Will provide a test case later.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74984 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 01:18:33 +00:00
Sebastian Redl 23c7d06136 Implement checking of exception spec compatibility for overriding virtual functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74943 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 20:29:57 +00:00
Douglas Gregor 6bec78d58b Tighten up the conditions under which we build an implicit function
declaration for a builtin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74917 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 17:00:05 +00:00
Douglas Gregor c29f77b769 Make ASTContext explicitly keep track of the declaration for the C
FILE type, rather than using name lookup to find FILE within the
translation unit. Within precompiled headers, FILE is treated as yet
another "special type" (like __builtin_va_list).

This change should provide a performance improvement (not verified),
since the lookup into the translation unit declaration 
forces the (otherwise unneeded) construction of a large hash table.
More importantly, with precompiled headers, the construction
of that table requires deserializing most of the top-level
declarations from the precompiled header, which are then unused.

Fixes PR 4509.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74911 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 16:35:42 +00:00
Douglas Gregor 7e7eb3da05 Keep track of the Expr used to describe the size of an array type,
from Enea Zaffanella!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74831 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 15:59:29 +00:00
Argyrios Kyrtzidis 17945a0f64 De-ASTContext-ify DeclContext.
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 02:36:12 +00:00
Argyrios Kyrtzidis 6fb0aee4f9 Remove the ASTContext parameter from the getBody() methods of Decl and subclasses.
Timings showed no significant difference before and after the commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74504 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 02:35:26 +00:00
Argyrios Kyrtzidis 40b598eea1 Remove the ASTContext parameter from the attribute-related methods of Decl.
The implementations of these methods can Use Decl::getASTContext() to get the ASTContext.

This commit touches a lot of files since call sites for these methods are everywhere.
I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 02:34:44 +00:00
Fariborz Jahanian f8d736ca54 Renamed MarcDestructorReferenced -> MarkDestructorReferenced
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-27 15:05:11 +00:00
Fariborz Jahanian 8d2b35630d Patch to mark destructors when they are used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 23:49:16 +00:00
Douglas Gregor e53060fa78 Improved semantic analysis and AST respresentation for function
templates.

For example, this now type-checks (but does not instantiate the body
of deref<int>):

  template<typename T> T& deref(T* t) { return *t; }

  void test(int *ip) {
    int &ir = deref(ip);
  }

Specific changes/additions:
  * Template argument deduction from a call to a function template.
  * Instantiation of a function template specializations (just the
  declarations) from the template arguments deduced from a call.
  * FunctionTemplateDecls are stored directly in declaration contexts
  and found via name lookup (all forms), rather than finding the
  FunctionDecl and then realizing it is a template. This is
  responsible for most of the churn, since some of the core
  declaration matching and lookup code assumes that all functions are
  FunctionDecls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 22:08:12 +00:00
Argyrios Kyrtzidis 16f19306f9 Set the end range location of a FunctionDecl to the right paren.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74195 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 18:22:24 +00:00
Douglas Gregor 52591bf224 Make sure that the template parameter lists get from the parser down to ActOnFunctionDeclarator for function template definitions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74040 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:54:41 +00:00
Anders Carlsson e98da2e7af Support for [class.local]p4.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74030 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:28:53 +00:00
Douglas Gregor c5c903acd8 When declaring a function template, create a FunctionTemplateDecl node
and associate it with the FunctionDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:23:40 +00:00
Douglas Gregor e542c862bd Start propagating template parameter lists to the right places to
handle function templates. There's no actual code for function
templates yet, but at least we complain about typedef templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 23:11:28 +00:00
Douglas Gregor 2e01cdacc5 Eliminate DeclPtrTy() arguments to ActOnDeclarator that are just a very, very weird way to pass "false". No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74007 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 21:43:56 +00:00
Fariborz Jahanian b7f4cc09ea Remove ImplicitMustBeDefined, use universal 'Used' flag
instead. Do the implicit default ctor checking in MarkDeclarationReferenced.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 17:30:33 +00:00
Douglas Gregor 9cfbe48a7a Parsing and AST support for using declarations, from John Thompson!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73812 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20 00:51:54 +00:00
Douglas Gregor e0762c9211 Keep track of when declarations are "used" according to C and
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>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73797 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 23:52:42 +00:00
Fariborz Jahanian f8dcb866d3 Patch for implementation of C++'s object model. This is
work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 19:55:27 +00:00
Douglas Gregor 68584ed35a Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:11:24 +00:00
Douglas Gregor c19ee3eb08 Diagnose class members that shadow a template parameter. Fixes
<rdar://problem/6952203>. 

To do this, we actually remove a not-quite-correct optimization in the
C++ name lookup routines. We'll revisit this optimization for the
general case once more C++ is working.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 23:37:01 +00:00
Argyrios Kyrtzidis 179fe1a47d Fix some erroneous comments due to trigger-happy copy&paste.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 23:19:02 +00:00
Argyrios Kyrtzidis 1d1755348d Factor out some common code into Sema::EnterDeclaratorContext/ExitDeclaratorContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73655 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 23:15:40 +00:00
Argyrios Kyrtzidis f5cecfbdcd Move CXXMethodDecl::OutOfLineDefinition into Decl::OutOfLine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 22:49:50 +00:00
Douglas Gregor 9cdda0cf85 Support dependent extended vector types and template instantiation
thereof. Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73641 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 21:51:59 +00:00
Chris Lattner 86df27bbdb move GetBuiltinType from Builtin::Context to ASTContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 00:45:47 +00:00
Eli Friedman d7dad72aa5 PR4350: Make sure we don't create invalid printf attributes. This isn't
visible anywhere normally because the printf format checks for 
this case, and we don't print out attribute values anywhere.  Original 
patch by Roberto Bagnara.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-10 04:01:38 +00:00
Fariborz Jahanian 496b5a894c Use of DeclContext for objc's ivars. No functionality
change. More to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72951 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 18:16:35 +00:00
Eli Friedman dec7c76981 Address review comments for #pragma weak.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 06:28:29 +00:00
Eli Friedman c49f19b6d3 Start of a Sema implementation for #pragma weak. This isn't really the
right approach, but I'm still not sure what the best way to go about this is.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 02:44:36 +00:00
Eli Friedman 340a4e500f Fix up this compatibility hack to be more compatible with gcc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72901 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 23:03:07 +00:00
Eli Friedman bc4e29f307 PR4287: allow a variadic prototype to make a subsequent K&R style
definition variadic.  I'm not completely sure it's legal, but the 
standard can be interpreted as making it legal, and gcc seems to think 
it's legal, so I didn't add an extension warning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-01 09:24:59 +00:00
Sebastian Redl 3cc9726a49 Disallow exception specs on typedefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72664 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-31 11:47:27 +00:00
Anders Carlsson f5dcd38858 AddInitializerToDecl needs to take a full expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 21:37:25 +00:00
Anders Carlsson 0f5f2c669e Remove VarDecl from CheckInitializerTypes now that CXXConstructExpr doesn't need to take a VarDecl anymore. (It still does, but it won't for long)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 20:41:30 +00:00
Anders Carlsson d12ef8d142 Add a member lookup criteria constructor for searching for overridden virtual member functions. Use this instead of regular name lookup when checking for overriding functions so we will see declarations that would otherwise be hidden. Fixes 6902298.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 00:52:53 +00:00
Douglas Gregor 4fe0c8e9c7 Refactor and clean up the AST printer, so that it uses a DeclVisitor,
walks through DeclContexts properly, and prints more of the
information available in the AST. The functionality is still available
via -ast-print, -ast-dump, etc., and also via the new member functions
Decl::dump() and Decl::print().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 00:08:05 +00:00