Skip to content
  1. Mar 28, 2009
    • Chris Lattner's avatar
      Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for a · 83f095cc
      Chris Lattner authored
      pointer.  Its purpose in life is to be a glorified void*, but which does not
      implicitly convert to void* or other OpaquePtr's with a different UID.
      
      Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>.  Change the 
      entire parser/sema interface to use DeclPtrTy instead of DeclTy*.  This
      makes the C++ compiler enforce that these aren't convertible to other opaque
      types.
      
      We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc,
      but I don't plan to do that in the short term.
      
      The one outstanding known problem with this patch is that we lose the 
      bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to
      bitmangle the success bit into the low bit of DeclPtrTy.  I will rectify
      this with a subsequent patch.
      
      llvm-svn: 67952
      83f095cc
  2. Mar 04, 2009
  3. Mar 02, 2009
    • Douglas Gregor's avatar
      Rework the way we find locally-scoped external declarations when we · 5a80bd15
      Douglas Gregor authored
      need them to evaluate redeclarations or call a function that hasn't
      already been declared. We now keep a DenseMap of these locally-scoped
      declarations so that they are not visible but can be quickly found,
      e.g., when we're looking for previous declarations or before we go
      ahead and implicitly declare a function that's being called. Fixes
      PR3672.
      
      llvm-svn: 65792
      5a80bd15
  4. Feb 17, 2009
  5. Jan 30, 2009
    • Douglas Gregor's avatar
      Eliminated LookupCriteria, whose creation was causing a bottleneck for · ed8f2887
      Douglas Gregor authored
      LookupName et al. Instead, use an enum and a bool to describe its
      contents.
      
      Optimized the C/Objective-C path through LookupName, eliminating any
      unnecessarily C++isms. Simplify IdentifierResolver::iterator, removing
      some code and arguments that are no longer used.
      
      Eliminated LookupDeclInScope/LookupDeclInContext, moving all callers
      over to LookupName, LookupQualifiedName, or LookupParsedName, as
      appropriate.
      
      All together, I'm seeing a 0.2% speedup on Cocoa.h with PTH and
      -disable-free. Plus, we're down to three name-lookup routines.
      
      llvm-svn: 63354
      ed8f2887
  6. Jan 20, 2009
    • Douglas Gregor's avatar
      Remove ScopedDecl, collapsing all of its functionality into Decl, so · 6e6ad602
      Douglas Gregor authored
      that every declaration lives inside a DeclContext.
      
      Moved several things that don't have names but were ScopedDecls (and,
      therefore, NamedDecls) to inherit from Decl rather than NamedDecl,
      including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't
      store empty DeclarationNames for these things, nor do we try to insert
      them into DeclContext's lookup structure.
      
      The serialization tests are temporarily disabled. We'll re-enable them
      once we've sorted out the remaining ownership/serialiazation issues
      between DeclContexts and TranslationUnion, DeclGroups, etc.
      
      llvm-svn: 62562
      6e6ad602
  7. Jan 08, 2009
    • Douglas Gregor's avatar
      Unify the code for defining tags in C and C++, so that we always · 82ac25e4
      Douglas Gregor authored
      introduce a Scope for the body of a tag. This reduces the number of
      semantic differences between C and C++ structs and unions, and will
      help with other features (e.g., anonymous unions) in C. Some important
      points:
      
        - Fields are now in the "member" namespace (IDNS_Member), to keep
          them separate from tags and ordinary names in C. See the new test
          in Sema/member-reference.c for an example of why this matters. In
          C++, ordinary and member name lookup will find members in both the
          ordinary and member namespace, so the difference between
          IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but
          only in C++!). 
        - We always introduce a Scope and push a DeclContext when we're
          defining a tag, in both C and C++. Previously, we had different
          actions and different Scope/CurContext behavior for enums, C
          structs/unions, and C++ structs/unions/classes. Now, it's one pair
          of actions. (Yay!)
      
      There's still some fuzziness in the handling of struct/union/enum
      definitions within other struct/union/enum definitions in C. We'll
      need to do some more cleanup to eliminate some reliance on CurContext
      before we can solve this issue for real. What we want is for something
      like this:
      
        struct X {
          struct T { int x; } t;
        };
      
      to introduce T into translation unit scope (placing it at the
      appropriate point in the IdentifierResolver chain, too), but it should
      still have struct X as its lexical declaration
      context. PushOnScopeChains isn't smart enough to do that yet, though,
      so there's a FIXME test in nested-redef.c
      
      llvm-svn: 61940
      82ac25e4
    • Steve Naroff's avatar
      This is a large/messy diff that unifies the ObjC AST's with DeclContext. · 35c62ae6
      Steve Naroff authored
      - ObjCContainerDecl's (ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl), ObjCCategoryImpl, & ObjCImplementation are all DeclContexts.
      - ObjCMethodDecl is now a ScopedDecl (so it can play nicely with DeclContext).
      - ObjCContainerDecl now does iteration/lookup using DeclContext infrastructure (no more linear search:-)
      - Removed ASTContext argument to DeclContext::lookup(). It wasn't being used and complicated it's use from an ObjC AST perspective.
      - Added Sema::ProcessPropertyDecl() and removed Sema::diagnosePropertySetterGetterMismatch().
      - Simplified Sema::ActOnAtEnd() considerably. Still more work to do.
      - Fixed an incorrect casting assumption in Sema::getCurFunctionOrMethodDecl(), now that ObjCMethodDecl is a ScopedDecl.
      - Removed addPropertyMethods from ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl.
      
      This passes all the tests on my machine. Since many of the changes are central to the way ObjC finds it's methods, I expect some fallout (and there are still a handful of FIXME's). Nevertheless, this should be a step in the right direction.
      
      llvm-svn: 61929
      35c62ae6
  8. Jan 07, 2009
  9. Jan 05, 2009
    • Douglas Gregor's avatar
      Introduce support for "transparent" DeclContexts, which are · 07665a69
      Douglas Gregor authored
      DeclContexts whose members are visible from enclosing DeclContexts up
      to (and including) the innermost enclosing non-transparent
      DeclContexts. Transparent DeclContexts unify the mechanism to be used
      for various language features, including C enumerations, anonymous
      unions, C++0x inline namespaces, and C++ linkage
      specifications. Please refer to the documentation in the Clang
      internals manual for more information.
      
      Only enumerations and linkage specifications currently use transparent
      DeclContexts.
      
      Still to do: use transparent DeclContexts to implement anonymous
      unions and GCC's anonymous structs extension, and, later, the C++0x
      features. We also need to tighten up the DeclContext/ScopedDecl link
      to ensure that every ScopedDecl is in a single DeclContext, which
      will ensure that we can then enforce ownership and reduce the memory
      footprint of DeclContext.
      
      llvm-svn: 61735
      07665a69
  10. Dec 21, 2008
  11. Dec 11, 2008
    • Douglas Gregor's avatar
      Unifies the name-lookup mechanisms used in various parts of the AST · 91f84216
      Douglas Gregor authored
      and separates lexical name lookup from qualified name lookup. In
      particular:
        * Make DeclContext the central data structure for storing and
          looking up declarations within existing declarations, e.g., members
          of structs/unions/classes, enumerators in C++0x enums, members of
          C++ namespaces, and (later) members of Objective-C
          interfaces/implementations. DeclContext uses a lazily-constructed
          data structure optimized for fast lookup (array for small contexts,
          hash table for larger contexts). 
      
        * Implement C++ qualified name lookup in terms of lookup into
          DeclContext.
      
        * Implement C++ unqualified name lookup in terms of
          qualified+unqualified name lookup (since unqualified lookup is not
          purely lexical in C++!)
      
        * Limit the use of the chains of declarations stored in
          IdentifierInfo to those names declared lexically.
      
        * Eliminate CXXFieldDecl, collapsing its behavior into
          FieldDecl. (FieldDecl is now a ScopedDecl).
      
        * Make RecordDecl into a DeclContext and eliminates its
          Members/NumMembers fields (since one can just iterate through the
          DeclContext to get the fields).
      
      llvm-svn: 60878
      91f84216
  12. Dec 05, 2008
  13. Nov 17, 2008
    • Douglas Gregor's avatar
      Updated IdentifierResolver to deal with DeclarationNames. The names of · ae2fbad3
      Douglas Gregor authored
      C++ constructors, destructors, and conversion functions now have a
      FETokenInfo field that IdentifierResolver can access, so that these
      special names are handled just like ordinary identifiers. A few other
      Sema routines now use DeclarationNames instead of IdentifierInfo*'s.
      
      To validate this design, this code also implements parsing and
      semantic analysis for id-expressions that name conversion functions,
      e.g.,
      
        return operator bool();
      
      The new parser action ActOnConversionFunctionExpr takes the result of
      parsing "operator type-id" and turning it into an expression, using
      the IdentifierResolver with the DeclarationName of the conversion
      function. ActOnDeclarator pushes those conversion function names into
      scope so that the IdentifierResolver can find them, of course.
      
      llvm-svn: 59462
      ae2fbad3
  14. Nov 11, 2008
  15. Oct 21, 2008
  16. Sep 09, 2008
  17. Jul 17, 2008
  18. May 15, 2008
  19. May 10, 2008
    • Argyrios Kyrtzidis's avatar
      -Implement proper name lookup for namespaces. · fa8e15bf
      Argyrios Kyrtzidis authored
      -identifierResolver exposes an iterator interface to get all decls through the scope chain.
      -The semantic staff (checking IdentifierNamespace and Doug's checking for shadowed tags were moved out of IdentifierResolver and back into Sema. IdentifierResolver just gives an iterator for all reachable decls of an identifier.
      
      llvm-svn: 50923
      fa8e15bf
  20. Apr 14, 2008
  21. Apr 13, 2008
  22. Apr 12, 2008
  23. Apr 11, 2008
Loading