| Commit message (Collapse) | Author | Age | Files | Lines | 
| | 
| 
| 
| 
| 
|  | 
this weekend).
llvm-svn: 55862
 | 
| | 
| 
| 
| 
| 
|  | 
comments below it were stale, so I accidently removed the whole thing).
llvm-svn: 55841
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
RecordDecls, as opposed to creating a single RecordDecl and reusing it.
This change effects both RecordDecls and CXXRecordDecls, but does not effect EnumDecls (yet).
The motivation of this patch is as follows:
- Capture more source information, necessary for refactoring/rewriting clients.
- Pave the way to resolve ownership issues with RecordDecls with the forthcoming
  addition of DeclGroups.
Current caveats:
- Until DeclGroups are in place, we will leak RecordDecls not explicitly
  referenced by the AST.  For example:
    typedef struct { ... } x;  
  The RecordDecl for the struct will be leaked because the TypedefDecl doesn't
  refer to it.  This will be solved with DeclGroups.
  
- This patch also (temporarily) breaks CodeGen.  More below.
High-level changes:
- As before, TagType still refers to a TagDecl, but it doesn't own it.  When
  a struct/union/class is first referenced, a RecordType and RecordDecl are
  created for it, and the RecordType refers to that RecordDecl.  Later, if
  a new RecordDecl is created, the pointer to a RecordDecl in RecordType is
  updated to point to the RecordDecl that defines the struct/union/class.
- TagDecl and RecordDecl now how a method 'getDefinition()' to return the
  TagDecl*/RecordDecl* that refers to the TagDecl* that defines a particular
  enum/struct/class/union. This is useful from going from a RecordDecl* that
  defines a forward declaration to the RecordDecl* that provides the actual
  definition. Note that this also works for EnumDecls, except that in this case
  there is no distinction between forward declarations and definitions (yet).
- Clients should no longer assume that 'isDefinition()' returns true from a
  RecordDecl if the corresponding struct/union/class has been defined.
  isDefinition() only returns true if a particular RecordDecl is the defining
  Decl. Use 'getDefinition()' instead to determine if a struct has been defined.
- The main changes to Sema happen in ActOnTag. To make the changes more
  incremental, I split off the processing of enums and structs et al into two
  code paths. Enums use the original code path (which is in ActOnTag) and
  structs use the ActOnTagStruct. Eventually the two code paths will be merged,
  but the idea was to preserve the original logic both for comparison and not to
  change the logic for both enums and structs all at once.
- There is NO CHAINING of RecordDecls for the same RecordType. All RecordDecls
  that correspond to the same type simply have a pointer to that type. If we
  need to figure out what are all the RecordDecls for a given type we can build
  a backmap.
- The diff in CXXRecordDecl.[cpp,h] is actually very small; it just mimics the
  changes to RecordDecl. For some reason 'svn' marks the entire file as changed.
Why is CodeGen broken:
- Codegen assumes that there is an equivalence between RecordDecl* and
  RecordType*. This was true before because we only created one RecordDecl* for
  a given RecordType*, but it is no longer true. I believe this shouldn't be too
  hard to change, but the patch was big enough as it is.
  
I have tested this patch on both the clang test suite, and by running the static analyzer over Postgresql and a large Apple-internal project (mix of Objective-C and C).  
llvm-svn: 55839
 | 
| | 
| 
| 
|  | 
llvm-svn: 55822
 | 
| | 
| 
| 
| 
| 
| 
| 
|  | 
where RecordDecl or CXXRecordDecl was constructed, always with an argument of 'NULL' for the previous declaration.
The motivation behind this change is that chaining the RecordDecls is simply unnecessary.  Once we create multiple RecordDecls for the same struct/union/class, clients that care about all the declarations of the same struct can build a back map by seeing which Decls refer to the same RecordType.
llvm-svn: 55821
 | 
| | 
| 
| 
| 
| 
|  | 
which are inherited from base clases or protocols.
llvm-svn: 55790
 | 
| | 
| 
| 
| 
| 
| 
| 
|  | 
check for block pointers.
Added a couple FIXME's wrt PointLikeType. If the author reads this, it would be great to get some background on this class (thanks in advance).
llvm-svn: 55778
 | 
| | 
| 
| 
|  | 
llvm-svn: 55768
 | 
| | 
| 
| 
|  | 
llvm-svn: 55767
 | 
| | 
| 
| 
| 
| 
|  | 
spaces
llvm-svn: 55765
 | 
| | 
| 
| 
| 
| 
|  | 
- PR2730
llvm-svn: 55739
 | 
| | 
| 
| 
| 
| 
| 
|  | 
- Currently CodeGen always returns a conservative value for this (-1
   or 0 depending on the context).
llvm-svn: 55735
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
Highlights...
- 4 new AST nodes, BlockExpr, BlockStmtExpr, BlockExprExpr, BlockDeclRefExpr.
- Sema::ActOnBlockStart(), ActOnBlockError(), ActOnBlockStmtExpr(), ActOnBlockExprExpr(), ActOnBlockReturnStmt().
Next steps...
- hack Sema::ActOnIdentifierExpr() to deal with block decl refs.
- add attribute handler for byref decls.
- add test cases.
llvm-svn: 55710
 | 
| | 
| 
| 
|  | 
llvm-svn: 55707
 | 
| | 
| 
| 
| 
| 
| 
|  | 
- Allow any Objective-C object types to devolve to type id in a ?:
   expression. This matches gcc behavior more closely.
llvm-svn: 55705
 | 
| | 
| 
| 
| 
| 
| 
| 
|  | 
- Now also searches for correct setter method.
 - There are still some issues regarding validation of the setter
   method and access of read-only properties.
llvm-svn: 55686
 | 
| | 
| 
| 
| 
| 
|  | 
new [CXX]RecordDecl with the RecordDecl chain.
llvm-svn: 55652
 | 
| | 
| 
| 
| 
| 
|  | 
offset-of-like expressions.
llvm-svn: 55627
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
|  | 
anywhere near correct in terms of missing cases and missing 
diagnostics, but it's good enough to handle the uses in the 
Linux system headers, which are currently a constant pain for compiling 
applications on Linux.
llvm-svn: 55621
 | 
| | 
| 
| 
| 
| 
| 
|  | 
type-checking pointer subtraction; if the canonical types aren't used,
the qualifiers won't always get stripped off correctly.
llvm-svn: 55620
 | 
| | 
| 
| 
| 
| 
|  | 
I'll try to come up with a correct fix for the testcase sometime soon.
llvm-svn: 55614
 | 
| | 
| 
| 
| 
| 
| 
| 
|  | 
- warn about nonnull being applied to functions with no pointer arguments
- continue processing argument list in the attribute when we encounter a non-pointer parameter being marked as nonnull
- when no argument list is specified, only mark pointers as nonnull.  This fixes PR 2732 and radar 6188814.
llvm-svn: 55610
 | 
| | 
| 
| 
|  | 
llvm-svn: 55609
 | 
| | 
| 
| 
|  | 
llvm-svn: 55607
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
- Change Obj-C runtime message API, drop the ObjCMessageExpr arg in
   favor of just result type and selector. Necessary so it can be
   reused in situations where we don't want to cons up an
   ObjCMessageExpr.
 - Update aggregate binary assignment to know about special property
   ref lvalues.
 - Add CodeGenFunction::EmitCallArg overload which takes an already
   emitted rvalue.
Add CodeGenFunction::StoreComplexIntoAddr.
Disabled logic in Sema for parsing Objective-C dot-syntax that
accesses methods. This code does not search in the correct order and
the AST node has no way of properly representing its results.
Updated StmtDumper to print a bit more information about
ObjCPropertyRefExprs.
llvm-svn: 55561
 | 
| | 
| 
| 
|  | 
llvm-svn: 55538
 | 
| | 
| 
| 
| 
| 
|  | 
This commit adds the declaration syntax (and associated type).
llvm-svn: 55417
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
- It is not clear that this is the right approach, but this is at
   least consistent with how interfaces are handled.
 - This means NeXT now emits the correct metadata for properties in
   protocols.
 - This currently introduces a spurious warning involving inherited
   properties in protocols or categories; however, it also fixes some
   situations where we were failing to emit a warning. I will scrub
   this code tomorrow and fix this issue as well as number of other
   missed warnings / error situations that appear to exist.
llvm-svn: 55407
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
- Add ObjCMethodDecl::createImplicitParams.
 - Remove ObjCMethodDecl::set{Self,Cmd}Decl
 - Remove Sema::CreateImplicitParameter
No (intended) functionality change.
llvm-svn: 55356
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
|  | 
- Change enum name to Kind.
 - Change enum constants to English strings.
Also, fix getPropertyImplementation (which probably should be renamed)
llvm-svn: 55354
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
of RHSs to id type instead of void* if either has Objective-C object
type.
 - This ensures the result can still be used in normal places an
   object can be used, like a message send.
Add implicit conversions for ?: applied to qualified id types to
ensure that the RHSs are compatible. 
 - This prevents a codegen crash (creating invalid PHI nodes).
 - Again, this relates to the fact that qualified id types have no
   canonical types.
 - Note that the implicit type casted to is incorrect, however this
   doesn't currently cause problems because of the flexibility of the
   id type.
Test cases for above.
llvm-svn: 55346
 | 
| | 
| 
| 
| 
| 
| 
|  | 
correctly.  Not a regression, but made more obvious by my recent fix 
which made function type compatibility checking a bit more strict.
llvm-svn: 55339
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
casting pointers to integers.
Eventually, we should check whether we can evaluate an expression 
using Expr::tryEvaluate, and this codepath should be tightened to only 
handle standard-compliant cases.
llvm-svn: 55331
 | 
| | 
| 
| 
|  | 
llvm-svn: 55316
 | 
| | 
| 
| 
|  | 
llvm-svn: 55286
 | 
| | 
| 
| 
|  | 
llvm-svn: 55284
 | 
| | 
| 
| 
|  | 
llvm-svn: 55269
 | 
| | 
| 
| 
| 
| 
|  | 
declarations. This lets us compile Cocoa.h as Objective-C++
llvm-svn: 55261
 | 
| | 
| 
| 
|  | 
llvm-svn: 55222
 | 
| | 
| 
| 
|  | 
llvm-svn: 55216
 | 
| | 
| 
| 
|  | 
llvm-svn: 55207
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
-The Parser calls a new "ActOnCXXTypeConstructExpr" action.
-Sema, depending on the type and expressions number:
   -If the type is a class, it will treat it as a class constructor. [TODO]
   -If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node
   -If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node.
llvm-svn: 55177
 | 
| | 
| 
| 
|  | 
llvm-svn: 55166
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
|  | 
testing compatibility.  This is necessary for some constructs, like merging
redeclarations.
Also, there are some ObjC changes to make sure that 
typesAreCompatible(a,b) == typesAreCompatible(b,a).  I don't have any 
ObjC code beyond the testsuite, so please tell me if there are any cases 
where this doesn't behave as expected.
llvm-svn: 55158
 | 
| | 
| 
| 
| 
| 
|  | 
"+=".
llvm-svn: 55131
 | 
| | 
| 
| 
|  | 
llvm-svn: 55083
 | 
| | 
| 
| 
| 
| 
| 
|  | 
- Drop MethodAttrs parameter to ObjCMethodDecl
 - Call ProcessDeclAttributeList for interface & method decls.
llvm-svn: 55068
 | 
| | 
| 
| 
| 
| 
| 
| 
| 
|  | 
- UsualUnaryConversions takes an Expr *& and may modify its argument,
   this broke when it was refactored into Sema::CheckCastTypes. This
   meant that we were missing implicit casts in some places.
 - Seems pretty sad that this got through our tests.
llvm-svn: 55039
 | 
| | 
| 
| 
|  | 
llvm-svn: 55038
 | 
| | 
| 
| 
| 
| 
|  | 
This fixes an ownership issue where FieldDecls could be owned both by an ObjCInterfaceDecl and a RecordDecl.
llvm-svn: 55037
 |