Skip to content
  1. May 22, 2010
  2. May 15, 2010
    • John McCall's avatar
      Substantially alter the design of the Objective C type AST by introducing · 8b07ec25
      John McCall authored
      ObjCObjectType, which is basically just a pair of
        one of {primitive-id, primitive-Class, user-defined @class}
      with
        a list of protocols.
      An ObjCObjectPointerType is therefore just a pointer which always points to
      one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
      of ObjCObjectType which happens to not carry any protocols.
      
      Alter a rather large number of use sites to use ObjCObjectType instead of
      ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
      than hashing them in a FoldingSet.  Remove some number of methods that are no
      longer used, at least after this patch.
      
      By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
      pointers to Objective-C types, which is crucial for a certain kind of ObjC++
      metaprogramming common in WebKit.
      
      llvm-svn: 103870
      8b07ec25
    • Douglas Gregor's avatar
      Implement semantic analysis and an AST representation for the named · 6fd1b180
      Douglas Gregor authored
      return value optimization. Sema marks return statements with their
      NRVO candidates (which may or may not end up using the NRVO), then, at
      the end of a function body, computes and marks those variables that
      can be allocated into the return slot.
      
      I've checked this locally with some debugging statements (not
      committed), but there won't be any tests until CodeGen comes along.
      
      llvm-svn: 103865
      6fd1b180
  3. May 13, 2010
    • Douglas Gregor's avatar
      Rework when and how vtables are emitted, by tracking where vtables are · 88d292cc
      Douglas Gregor authored
      "used" (e.g., we will refer to the vtable in the generated code) and
      when they are defined (i.e., because we've seen the key function
      definition). Previously, we were effectively tracking "potential
      definitions" rather than uses, so we were a bit too eager about emitting
      vtables for classes without key functions. 
      
      The new scheme:
        - For every use of a vtable, Sema calls MarkVTableUsed() to indicate
        the use. For example, this occurs when calling a virtual member
        function of the class, defining a constructor of that class type,
        dynamic_cast'ing from that type to a derived class, casting
        to/through a virtual base class, etc.
        - For every definition of a vtable, Sema calls MarkVTableUsed() to
        indicate the definition. This happens at the end of the translation
        unit for classes whose key function has been defined (so we can
        delay computation of the key function; see PR6564), and will also
        occur with explicit template instantiation definitions.
       - For every vtable defined/used, we mark all of the virtual member
       functions of that vtable as defined/used, unless we know that the key
       function is in another translation unit. This instantiates virtual
       member functions when needed.
        - At the end of the translation unit, Sema tells CodeGen (via the
        ASTConsumer) which vtables must be defined (CodeGen will define
        them) and which may be used (for which CodeGen will define the
        vtables lazily). 
      
      From a language perspective, both the old and the new schemes are
      permissible: we're allowed to instantiate virtual member functions
      whenever we want per the standard. However, all other C++ compilers
      were more lazy than we were, and our eagerness was both a performance
      issue (we instantiated too much) and a portability problem (we broke
      Boost test cases, which now pass).
      
      Notes:
        (1) There's a ton of churn in the tests, because the order in which
        vtables get emitted to IR has changed. I've tried to isolate some of
        the larger tests from these issues.
        (2) Some diagnostics related to
        implicitly-instantiated/implicitly-defined virtual member functions
        have moved to the point of first use/definition. It's better this
        way.
        (3) I could use a review of the places where we MarkVTableUsed, to
        see if I missed any place where the language effectively requires a
        vtable.
      
      Fixes PR7114 and PR6564.
      
      llvm-svn: 103718
      88d292cc
    • Chandler Carruth's avatar
      Delete a dead function at sabre's request. · 7100860e
      Chandler Carruth authored
      llvm-svn: 103705
      7100860e
  4. May 11, 2010
  5. May 06, 2010
    • John McCall's avatar
      Rearchitect -Wconversion and -Wsign-compare. Instead of computing them · cc7e5bff
      John McCall authored
      "bottom-up" when implicit casts and comparisons are inserted, compute them
      "top-down" when the full expression is finished.  Makes it easier to
      coordinate warnings and thus implement -Wconversion for signedness
      conversions without double-warning with -Wsign-compare.  Also makes it possible
      to realize that a signedness conversion is okay because the context is
      performing the inverse conversion.  Also simplifies some logic that was
      trying to calculate the ultimate comparison/result type and getting it wrong.
      Also fixes a problem with the C++ explicit casts which are often "implemented"
      in the AST with a series of implicit cast expressions.
      
      llvm-svn: 103174
      cc7e5bff
  6. Apr 24, 2010
  7. Apr 09, 2010
  8. Mar 25, 2010
  9. Mar 23, 2010
  10. Mar 19, 2010
  11. Mar 02, 2010
    • Douglas Gregor's avatar
      Keep an explicit stack of function and block scopes, each element of · 9a28e84b
      Douglas Gregor authored
      which has the label map, switch statement stack, etc. Previously, we
      had a single set of maps in Sema (for the function) along with a stack
      of block scopes. However, this lead to funky behavior with nested
      functions, e.g., in the member functions of local classes.
      
      The explicit-stack approach is far cleaner, and we retain a 1-element
      cache so that we're not malloc/free'ing every time we enter a
      function. Fixes PR6382.
      
      Also, tweaked the unused-variable warning suppression logic to look at
      errors within a given Scope rather than within a given function. The
      prior code wasn't looking at the right number-of-errors count when
      dealing with blocks, since the block's count would be deallocated
      before we got to ActOnPopScope. This approach works with nested
      blocks/functions, and gives tighter error recovery.
      
      llvm-svn: 97518
      9a28e84b
  12. Mar 01, 2010
    • Chris Lattner's avatar
      Implement jump checking for initialized c++ variables, implementing · 30d0cfda
      Chris Lattner authored
      a fixme and PR6451.
      
      Only perform jump checking if the containing function has no errors,
      and add the infrastructure needed to do this.
      
      On the testcase in the PR, we produce:
      
      t.cc:6:3: error: illegal goto into protected scope
        goto later;
        ^
      t.cc:7:5: note: jump bypasses variable initialization
        X x;
          ^
      
      llvm-svn: 97497
      30d0cfda
  13. Feb 12, 2010
  14. Feb 09, 2010
  15. Feb 02, 2010
    • Ted Kremenek's avatar
      Add a stop gap to Sema::CorrectTypo() to correct only up to 20 typos. · 54516826
      Ted Kremenek authored
      This is to address a serious performance problem observed when running
      'clang -fsyntax-only' on really broken source files.  In one case,
      repeatedly calling CorrectTypo() caused one source file to be rejected
      after 2 minutes instead of 1 second.
      
      This patch causes typo correction to take neglible time on that file
      while still providing correction results for the first 20 cases.  I
      felt this was a reasonable number for moderately broken source files.
      
      I don't claim this is the best solution.  Comments welcome.  It is
      necessary for us to address this issue because it is a serious
      performance problem.
      
      llvm-svn: 95049
      54516826
  16. Jan 31, 2010
    • Sebastian Redl's avatar
      Add VarDecl::isThisDeclarationADefinition(), which properly encapsulates the... · 35351a95
      Sebastian Redl authored
      Add VarDecl::isThisDeclarationADefinition(), which properly encapsulates the logic for when a variable declaration is a (possibly tentativ) definition. Add a few functions building on this, and shift C tentative definition handling over to this new functionality. This shift also kills the Sema::TentativeDefinitions map and instead simply stores all declarations in the renamed list. The correct handling for multiple tentative definitions is instead shifted to the final walk of the list.
      
      llvm-svn: 94968
      35351a95
  17. Jan 13, 2010
  18. Jan 10, 2010
  19. Jan 05, 2010
  20. Dec 29, 2009
  21. Dec 19, 2009
  22. Dec 07, 2009
    • Anders Carlsson's avatar
      Rework how virtual member functions are marked. If a class has no key... · 82fccd01
      Anders Carlsson authored
      Rework how virtual member functions are marked. If a class has no key function, we now wait until the end of the translation unit to mark its virtual member functions as references. This lays the groundwork for fixing PR5557.
      
      llvm-svn: 90752
      82fccd01
    • John McCall's avatar
      DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated variables, · bcd03506
      John McCall authored
      but the results are imperfect.
      
      For posterity, I did:
      
      cat <<EOF > $cmdfile
      s/DeclaratorInfo/TypeSourceInfo/g
      s/DInfo/TInfo/g
      s/TypeTypeSourceInfo/TypeSourceInfo/g
      s/SourceTypeSourceInfo/TypeSourceInfo/g
      EOF
      
      find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \;
      find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \;
      find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \;
      
      llvm-svn: 90743
      bcd03506
  23. Nov 26, 2009
  24. Nov 23, 2009
  25. Nov 21, 2009
    • Fariborz Jahanian's avatar
      This patch implements objective-c's 'SEL' type as a built-in · 252ba5fb
      Fariborz Jahanian authored
      type and fixes a long-standing code gen. crash reported in
      at least two PRs and a radar. (radar 7405040 and pr5025). 
      There are couple of remaining issues that I would like for
      Ted. and Doug to look at:
      
      Ted, please look at failure in Analysis/MissingDealloc.m.
      I have temporarily added an expected-warning to make the
      test pass. This tests has a declaration of 'SEL' type which
      may not co-exist with the new changes.
      
      Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp.
      I think the changes which I have ifdef'ed out are correct. They
      need be considered for in a few Indexer/PCH test cases.
      
      llvm-svn: 89561
      252ba5fb
  26. Nov 19, 2009
  27. Nov 13, 2009
    • Daniel Dunbar's avatar
      Rework Sema code completion interface. · 242ea9a0
      Daniel Dunbar authored
       - Provide Sema in callbacks, instead of requiring it in constructor. This
         eliminates the need for a factory function. Clients now just pass the object
         to consume the results in directly.
      
       - CodeCompleteConsumer is cheap to construct, so building it whenever we are
         doing code completion is reasonable.
      
      Doug, please review.
      
      llvm-svn: 87099
      242ea9a0
  28. Nov 11, 2009
    • John McCall's avatar
      Fix PR 5422: handle lvalue results when evaluating 'based' ptrtoints as part of · 5055e4cd
      John McCall authored
      the -Wconversion check.
      
      llvm-svn: 86891
      5055e4cd
    • Douglas Gregor's avatar
      Improve diagnostics when a default template argument does not match · 84d49a20
      Douglas Gregor authored
      with its corresponding template parameter. This can happen when we
      performed some substitution into the default template argument and
      what we had doesn't match any more, e.g.,
      
        template<int> struct A;
        template<typename T, template<T> class X = A> class B;
      
        B<long> b;
      
      Previously, we'd emit a pretty but disembodied diagnostic showing how
      the default argument didn't match the template parameter. The
      diagnostic was good, but nothing tied it to the *use* of the default
      argument in "B<long>". This commit fixes that.
      
      Also, tweak the counting of active template instantiations to avoid
      counting non-instantiation records, such as those we create for
      (surprise!) checking default arguments, instantiating default
      arguments, and performing substitutions as part of template argument
      deduction.
      
      llvm-svn: 86884
      84d49a20
  29. Nov 07, 2009
  30. Nov 04, 2009
    • John McCall's avatar
      Change our basic strategy for avoiding deprecation warnings when the decl use · 28a6aeab
      John McCall authored
      appears in a deprecated context.  In the new strategy, we emit the warnings
      as usual unless we're currently parsing a declaration, where "declaration" is
      restricted to mean a decl group or a few special cases in Objective C.  If
      we *are* parsing a declaration, we queue up the deprecation warnings until
      the declaration has been completely parsed, and then emit them only if the
      decl is not deprecated.
      We also standardize the bookkeeping for deprecation so as to avoid special cases.
      
      llvm-svn: 85998
      28a6aeab
Loading