summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Some cleanups and commenting to our declaration-name handlingDouglas Gregor2009-05-291-11/+5
| | | | llvm-svn: 72570
* Now that we have declared/defined tag types within DeclGroups,Douglas Gregor2009-05-292-7/+1
| | | | | | | | | | | | | 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. llvm-svn: 72568
* If a declarator group declares a type, make sure to add that declaration Eli Friedman2009-05-295-6/+13
| | | | | | to the DeclGroup. llvm-svn: 72559
* When we parse a tag specifier, keep track of whether that tagDouglas Gregor2009-05-288-15/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 72555
* PR4281: Fix bogus CodeGen assertion. The issue is that Eli Friedman2009-05-281-8/+5
| | | | | | | getUnqualifiedType() doesn't strip off all qualifiers for non-canonical types. llvm-svn: 72552
* ARM is a legitimate Darwin architecture; don't assert.Eli Friedman2009-05-281-1/+2
| | | | llvm-svn: 72538
* Introduced DeclContext::isDependentContext, which determines whether aDouglas Gregor2009-05-283-13/+22
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 72526
* fix the "pasting formed 'a]', an invalid preprocessing token"Chris Lattner2009-05-281-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ^ llvm-svn: 72519
* Not setting all the fields is confusing...Mike Stump2009-05-281-0/+3
| | | | llvm-svn: 72506
* Fix a use-of-undefined, IRgen expects the RValue for "void" to be a scalar ↵Daniel Dunbar2009-05-271-2/+2
| | | | | | RValue. llvm-svn: 72504
* Reimplement much of the way that we track nested classes in theDouglas Gregor2009-05-276-38/+124
| | | | | | | | | | | | | 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. llvm-svn: 72502
* Don't vary token concatenation based on the language options; this Eli Friedman2009-05-271-6/+3
| | | | | | behavior is more likely to be confusing than useful. llvm-svn: 72499
* Reintroduce the home for exception specs, and make Sema fill it. However, ↵Sebastian Redl2009-05-277-17/+72
| | | | | | keep the spec out of the canonical type this time. Net effect is currently nothing, because the spec isn't checked anywhere. llvm-svn: 72498
* Make the bad paste diagnostic print the entire pasted token.Eli Friedman2009-05-271-1/+1
| | | | llvm-svn: 72497
* No write-barrier for initializations.Fariborz Jahanian2009-05-271-0/+2
| | | | llvm-svn: 72492
* Change a confusing variable name.Fariborz Jahanian2009-05-271-3/+3
| | | | llvm-svn: 72491
* Add a big test case for I-C-Es in C++, and a fix to make it work. The fix ↵Sebastian Redl2009-05-271-1/+2
| | | | | | might not be the right way to do it. llvm-svn: 72490
* Fix the type of a enum non-type template argument within the instantiation.Sebastian Redl2009-05-271-1/+1
| | | | llvm-svn: 72489
* Simplify, and improve the performance of, template instantiation forDouglas Gregor2009-05-274-30/+32
| | | | | | | | | | | 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. llvm-svn: 72486
* Add some more tests for instantiation of declaration references. Also,Douglas Gregor2009-05-272-1/+6
| | | | | | improve some error recovery with explicit template instantiation. llvm-svn: 72484
* Enumeration declarations that were instantiated from an enumerationDouglas Gregor2009-05-273-1/+6
| | | | | | | | 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. llvm-svn: 72482
* Improve name lookup for and template instantiation of declarationDouglas Gregor2009-05-274-28/+21
| | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 72481
* IRgen support for calls to functions that return references to aggregate ↵Anders Carlsson2009-05-271-0/+5
| | | | | | exressions. llvm-svn: 72479
* Fix another test case.Anders Carlsson2009-05-271-0/+8
| | | | llvm-svn: 72478
* Relax an assert to an if check.Anders Carlsson2009-05-271-3/+3
| | | | llvm-svn: 72477
* Convert ObjC qualified type clients over to using iterators.Steve Naroff2009-05-274-28/+34
| | | | | | | | This allows me to remove some API that I don't want to carry over to ObjCObjectPointerType. No functionality change. llvm-svn: 72475
* Create CXXConstructExprs when constructing via copy initialization.Anders Carlsson2009-05-273-4/+15
| | | | llvm-svn: 72474
* Fix up constant expression handling to deal with the address Eli Friedman2009-05-272-18/+15
| | | | | | of a reference correctly. llvm-svn: 72463
* Add IRGen support for local variables of reference type.Eli Friedman2009-05-271-6/+4
| | | | llvm-svn: 72462
* Initial stab at a generalized operation for determining theDouglas Gregor2009-05-274-19/+161
| | | | | | | | | | | | instantiation of a declaration from the template version (or version that lives in a template) and a given set of template arguments. This needs much, much more testing, but it suffices for simple examples like typedef T* iterator; iterator begin(); llvm-svn: 72461
* Don't drop the computed implicit conversions when building a call toDouglas Gregor2009-05-271-0/+3
| | | | | | | overloaded operator[] or overloaded postfix unary operator (++, --). Thanks to Eli for finding this bug! llvm-svn: 72460
* Add IRGen support for return statements in functions with reference Eli Friedman2009-05-271-0/+4
| | | | | | type. llvm-svn: 72459
* Handle operator call expressions where the callee is a member function.Anders Carlsson2009-05-273-0/+27
| | | | llvm-svn: 72458
* Functions that return references can be rvalues as well.Anders Carlsson2009-05-272-0/+6
| | | | llvm-svn: 72457
* Add support for emitting calls to functions that return references (as ↵Anders Carlsson2009-05-271-1/+10
| | | | | | lvalues only for now) llvm-svn: 72449
* Fix typo. I also fixed the hard to read case differences, so that noMike Stump2009-05-271-3/+3
| | | | | | one else is tempted to copy the style, incorrectly. llvm-svn: 72448
* Rename an EmitCallExpr function to EmitCall to make it clear that it doesn't ↵Anders Carlsson2009-05-273-16/+14
| | | | | | emit an expr. llvm-svn: 72446
* Template instantiation for "typeof" for both types and expressions.Douglas Gregor2009-05-262-7/+18
| | | | llvm-svn: 72440
* Fixup codegen for volatile structs in the trivial cases (a a=a and a=a=a).Mike Stump2009-05-264-23/+29
| | | | llvm-svn: 72439
* Make sure that CodeGen sees template instantiations.Douglas Gregor2009-05-262-0/+8
| | | | llvm-svn: 72433
* Use .data() instead of &...[0].Daniel Dunbar2009-05-261-5/+5
| | | | | | - Just SmallVectors this time. llvm-svn: 72432
* Esnure that if we have a volatile structure as the destination, thatMike Stump2009-05-261-3/+6
| | | | | | we actually have a destination. llvm-svn: 72429
* When evaluating a VarDecl as a constant or determining whether it isDouglas Gregor2009-05-267-11/+47
| | | | | | | | an integral constant expression, maintain a cache of the value and the is-an-ICE flag within the VarDecl itself. This eliminates exponential-time behavior of the Fibonacci template metaprogram. llvm-svn: 72428
* When trying to pass an argument on the stack, assume LLVM will do the rightDaniel Dunbar2009-05-261-3/+19
| | | | | | | | | | | | | thing for non-aggregate types. - Otherwise we unnecessarily pin values to the stack and currently end up triggering a backend bug in one case. - This loose cooperation with LLVM to implement the ABI is pretty ugly. - <rdar://problem/6918722> [irgen] clang miscompile of many pointer varargs on x86-64 llvm-svn: 72419
* An Obj-C message send expression can never have a reference type.Anders Carlsson2009-05-261-0/+7
| | | | llvm-svn: 72417
* Simplify printing of the statistics for types.Douglas Gregor2009-05-262-95/+19
| | | | llvm-svn: 72415
* Fix for PR4140: Add the start of a Linux toolchain (basically, just Eli Friedman2009-05-264-0/+82
| | | | | | barely enough to get the given usage of -print-file-name working). llvm-svn: 72412
* Add a new CallExpr::getCallReturnType and use it in Expr::isLvalueInternal. ↵Anders Carlsson2009-05-261-9/+13
| | | | | | No intended functionality change. llvm-svn: 72410
* A block that returns a reference is an lvalue.Anders Carlsson2009-05-261-0/+3
| | | | llvm-svn: 72409
* Handle the edge case of a weak function with incomplete type correctly. Eli Friedman2009-05-262-8/+12
| | | | | | Found by code inspection; I haven't seen this in real-world code. llvm-svn: 72408
OpenPOWER on IntegriCloud