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

12256 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson 9e8a722914 Make the LookupBase boolean an enum instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 23:42:05 +00:00
Anders Carlsson 7267c1693a Add code for emitting C++ destructors. Not used yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 21:03:38 +00:00
Douglas Gregor d249e1d1f1 Create a new PrintingPolicy class, which we pass down through the AST
printing logic to help customize the output. For now, we use this
rather than a special flag to suppress the "struct" when printing
"struct X" and to print the Boolean type as "bool" in C++ but "_Bool"
in C.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72590 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 20:38:28 +00:00
Eli Friedman e540858b28 Make sure we don't give the wrong warning, and make sure not to set
hadError (suppressing future diagnostics) if we didn't print an 
error.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 20:20:05 +00:00
Eli Friedman 587cbdfd95 Add an assertion so that we don't accidentally build constant arrays of
VLAs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 20:17:55 +00:00
Eli Friedman bdad6b69f1 Re-add a slightly more general version of the check from r72578; it is
actually necessary in some obscure cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 19:23:46 +00:00
Mike Stump c9bb1b8e4e Oops, the testcase I was thinking of is supposed to error out. I
tried other things that might trip, but they all worked.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 19:14:13 +00:00
Eli Friedman 19262421fa Add a couple missing ARM defines.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 19:00:15 +00:00
Douglas Gregor 0ca20ac8ce Reduce the amount of stack space we use in SmallVectors during
template instantiation. This helps reduce our stack footprint when
performing deep template instantiations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72582 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 18:27:38 +00:00
Eli Friedman 8718a6a02c Revert r72575, which isn't really right, and fix up other code to
handle the construct in question correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72581 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 18:22:49 +00:00
Sebastian Redl ef65f06e8e Reject incomplete types in exception specs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72580 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 18:02:33 +00:00
Mike Stump 8ebefded18 Fixup codegen for composition of vla types using a normal array type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 17:06:45 +00:00
Sebastian Redl e47590e177 Fix usage of placement new. Placement new is not actually declared implicitly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 16:43:59 +00:00
Mike Stump 4f54f4e2f1 Avoid dumping during semantic analysis when checking array types when
a vla is used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72575 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 16:34:15 +00:00
Mike Stump 46cd81ffe2 We don't want to validate bad code,
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72574 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 16:24:13 +00:00
Mike Stump 2d3b36e302 Note another case that doesn't work yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72573 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 16:12:36 +00:00
Mike Stump 7f79f9be59 Fixup the rest of the trivial cases of the codegen of volatile. If
any body can spot codegen bugs with volatile, or knows of any in the
bug database, let me know.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72572 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 15:46:01 +00:00
Sebastian Redl 6a7330c20c Disallow exception specifications on multi-level indirections.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72571 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 15:01:05 +00:00
Douglas Gregor 00c4486243 Some cleanups and commenting to our declaration-name handling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 14:49:33 +00:00
Douglas Gregor 7b0a5723d6 Follow-on test case for template instantiation of interesting DeclGroups
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72569 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 14:26:40 +00:00
Douglas Gregor 8e92bf33ba Now that we have declared/defined tag types within DeclGroups,
instantiation of tags local to member functions of class templates
(and, eventually, function templates) works when the tag is defined as
part of the decl-specifier-seq, e.g.,

  struct S { T x, y; } s1;

Also, make sure that we don't try to default-initialize a dependent
type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 14:25:00 +00:00
Eli Friedman c1dc653b08 If a declarator group declares a type, make sure to add that declaration
to the DeclGroup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72559 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 01:49:24 +00:00
Douglas Gregor 402abb55fc When we parse a tag specifier, keep track of whether that tag
specifier resulted in the creation of a new TagDecl node, which
happens either when the tag specifier was a definition or when the tag
specifier was the first declaration of that tag type. This information
has several uses, the first of which is implemented in this commit:

  1) In C++, one is not allowed to define tag types within a type
  specifier (e.g., static_cast<struct S { int x; } *>(0) is
  ill-formed) or within the result or parameter types of a
  function. We now diagnose this.

  2) We can extend DeclGroups to contain information about any tags
  that are declared/defined within the declaration specifiers of a
  variable, e.g.,

    struct Point { int x, y, z; } p;

  This will help improve AST printing and template instantiation,
  among other things.

  3) For C99, we can keep track of whether a tag type is defined
  within the type of a parameter, to properly cope with cases like,
  e.g.,

    int bar(struct T2 { int x; } y) {
      struct T2 z;
    }

  We can also do similar things wherever there is a type specifier,
  e.g., to keep track of where the definition of S occurs in this
  legal C99 code:

    (struct S { int x, y; } *)0

  



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 23:31:59 +00:00
Eli Friedman 2dce5f8a99 PR4281: Fix bogus CodeGen assertion. The issue is that
getUnqualifiedType() doesn't strip off all qualifiers for non-canonical 
types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72552 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 23:04:00 +00:00
Eli Friedman 8ea975496c ARM is a legitimate Darwin architecture; don't assert.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72538 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 20:57:06 +00:00
Douglas Gregor c177aa2516 Add the missing public: thanks, Fariborz
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72528 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 16:41:44 +00:00
Daniel Dunbar 08e6dc65b2 Move clang-cc's -v output to the start (vs. end) of compilation, and change
clang -> clang-cc to be less confusing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 16:37:33 +00:00
Douglas Gregor bc221637f5 Introduced DeclContext::isDependentContext, which determines whether a
given DeclContext is dependent on type parameters. Use this to
properly determine whether a TagDecl is dependent; previously, we were
missing the case where the TagDecl is a local class of a member
function of a class template (phew!).

Also, make sure that, when we instantiate declarations within a member
function of a class template (or a function template, eventually),
that we add those declarations to the "instantiated locals" map so
that they can be found when instantiating declaration references.

Unfortunately, I was not able to write a useful test for this change,
although the assert() that fires when uncommenting the FIXME'd line in
test/SemaTemplate/instantiate-declref.cpp tells the "experienced user"
that we're now doing the right thing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 16:34:51 +00:00
Chris Lattner 8c0d8a2cc4 update test for r72519
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72520 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 05:41:32 +00:00
Chris Lattner 3c17b8a430 fix the "pasting formed 'a]', an invalid preprocessing token"
diagnostic to include the full instantiation location for the
invalid paste.  For:

#define foo(a, b)  a ## b
#define bar(x) foo(x, ])
bar(a)
bar(zdy)

Instead of:

t.c:3:22: error: pasting formed 'a]', an invalid preprocessing token
#define foo(a, b)  a ## b
                     ^
t.c:3:22: error: pasting formed 'zdy]', an invalid preprocessing token

we now produce:

t.c:7:1: error: pasting formed 'a]', an invalid preprocessing token
bar(a)
^
t.c:4:16: note: instantiated from:
#define bar(x) foo(x, ])
               ^
t.c:3:22: note: instantiated from:
#define foo(a, b)  a ## b
                     ^
t.c:8:1: error: pasting formed 'zdy]', an invalid preprocessing token
bar(zdy)
^
t.c:4:16: note: instantiated from:
#define bar(x) foo(x, ])
               ^
t.c:3:22: note: instantiated from:
#define foo(a, b)  a ## b
                     ^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72519 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 05:39:39 +00:00
Mike Stump 6b73568bc3 Not setting all the fields is confusing...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 00:16:27 +00:00
Daniel Dunbar eb4f81e174 Fix a use-of-undefined, IRgen expects the RValue for "void" to be a scalar RValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72504 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 23:45:33 +00:00
Douglas Gregor 1f65cd9291 Add a target triple, because this test depends on details of the x86-64 ABI
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72503 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 23:32:34 +00:00
Douglas Gregor 6569d68745 Reimplement much of the way that we track nested classes in the
parser. Rather than placing all of the delayed member function
declarations and inline definitions into a single bucket corresponding
to the top-level class, we instead mirror the nesting structure of the
nested classes and place the delayed member functions into their
appropriate place. Then, when we actually parse the delayed member
function declarations, set up the scope stack the same way as it was
when we originally saw the declaration, so that we can find, e.g.,
template parameters that are in scope.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72502 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 23:11:45 +00:00
Eli Friedman 26fa0edd63 A few tweaks to the "Differences between various standard modes"
section.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 23:02:57 +00:00
Eli Friedman 2073fd555f restrict is not a keyword in gnu89 mode. Change TokenKinds.def to
reflect that.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72500 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 22:48:34 +00:00
Eli Friedman 896ccf83eb Don't vary token concatenation based on the language options; this
behavior is more likely to be confusing than useful.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72499 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 22:33:06 +00:00
Sebastian Redl 465226e23a Reintroduce the home for exception specs, and make Sema fill it. However, keep the spec out of the canonical type this time. Net effect is currently nothing, because the spec isn't checked anywhere.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72498 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 22:11:52 +00:00
Eli Friedman cfcceab862 Make the bad paste diagnostic print the entire pasted token.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72497 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 22:00:37 +00:00
Fariborz Jahanian 14674ffb81 No write-barrier for initializations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 19:54:11 +00:00
Fariborz Jahanian 5296777032 Change a confusing variable name.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72491 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 19:48:48 +00:00
Sebastian Redl 1590d9c0fe Add a big test case for I-C-Es in C++, and a fix to make it work. The fix might not be the right way to do it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72490 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 19:34:06 +00:00
Sebastian Redl 599fe7ccc0 Fix the type of a enum non-type template argument within the instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72489 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 19:21:29 +00:00
Douglas Gregor ed961e7fff Simplify, and improve the performance of, template instantiation for
declaration references. The key realization is that dependent Decls,
which actually require instantiation, can only refer to the current
instantiation or members thereof. And, since the current context
during instantiation contains all of those members of the current
instantiation, we can simply find the real instantiate that matches up
with the "current instantiation" template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72486 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 17:54:46 +00:00
Douglas Gregor d0c8737996 Add some more tests for instantiation of declaration references. Also,
improve some error recovery with explicit template instantiation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72484 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 17:30:49 +00:00
Douglas Gregor 8dbc3c6496 Enumeration declarations that were instantiated from an enumeration
within a template now have a link back to the enumeration from which
they were instantiated. This means that we can now find the
instantiation of an anonymous enumeration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72482 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 17:20:35 +00:00
Douglas Gregor 2bba76b0ec Improve name lookup for and template instantiation of declaration
references. There are several smallish fixes here:

  - Make sure we look through template parameter scope when
    determining whether we're parsing a nested class (or nested class
    *template*). This makes sure that we delay parsing the bodies of
    inline member functions until after we're out of the outermost
    class (template) scope.
  - Since the bodies of member functions are always parsed
    "out-of-line", even when they were declared in-line, teach
    unqualified name lookup to look into the (semantic) parents.
  - Use the new InstantiateDeclRef to handle the instantiation of a
    reference to a declaration (in DeclRefExpr), which drastically
    simplifies template instantiation for DeclRefExprs.
  - When we're instantiating a ParmVarDecl, it must be in the current
    instantiation scope, so only look there.

Also, remove the #if 0's and FIXME's from the dynarray example, which
now compiles and executes thanks to Anders and Eli.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 17:07:49 +00:00
Anders Carlsson e70e8f7fef IRgen support for calls to functions that return references to aggregate exressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72479 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 16:45:02 +00:00
Anders Carlsson bffed8a98c Fix another test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72478 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 16:38:58 +00:00
Anders Carlsson 7c520cf417 Relax an assert to an if check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72477 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 16:28:34 +00:00