]> granicus.if.org Git - clang/log
clang
15 years agoSimplify run line.
Eli Friedman [Mon, 1 Jun 2009 08:55:08 +0000 (08:55 +0000)]
Simplify run line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72687 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPR4283: Don't truncate multibyte character constants in the
Eli Friedman [Mon, 1 Jun 2009 05:25:02 +0000 (05:25 +0000)]
PR4283: Don't truncate multibyte character constants in the
preprocessor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72686 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDisable type merging with gc attributes. This has a number of nasty
Eli Friedman [Mon, 1 Jun 2009 01:22:52 +0000 (01:22 +0000)]
Disable type merging with gc attributes.  This has a number of nasty
properties at the moment:

1. It allows stuff like "__strong id x; __weak id x;".

2. For constructs like "__strong id x; id x;", subsequent references to
x lose the objc_gc attribute.

3. This incorrectly allows merges involving the address_space attribute.

4. Constructs like "id x; /* some code using x */ __weak id x;" don't
apply the objc_gc attribute consistently to all uses of x.

The first three can probably be fixed relatively easily; the fourth
would be extremely difficult to fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72683 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUnify coding style.
Zhongxing Xu [Mon, 1 Jun 2009 00:50:23 +0000 (00:50 +0000)]
Unify coding style.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72682 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse a reference to modify the DeclIDs map.
Zhongxing Xu [Mon, 1 Jun 2009 00:49:11 +0000 (00:49 +0000)]
Use a reference to modify the DeclIDs map.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72681 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAfter spending 15 minutes trying to figure out why this was crashing, I realized...
Anders Carlsson [Mon, 1 Jun 2009 00:40:08 +0000 (00:40 +0000)]
After spending 15 minutes trying to figure out why this was crashing, I realized it was a bug in the test case :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72680 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix a thinko.
Anders Carlsson [Mon, 1 Jun 2009 00:26:14 +0000 (00:26 +0000)]
Fix a thinko.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72679 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCheck for null correctly for new expressions.
Anders Carlsson [Mon, 1 Jun 2009 00:05:16 +0000 (00:05 +0000)]
Check for null correctly for new expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72678 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImprove irgen of 'new' further.
Anders Carlsson [Sun, 31 May 2009 21:53:59 +0000 (21:53 +0000)]
Improve irgen of 'new' further.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72677 91177308-0d34-0410-b5e6-96231b3b80d8

15 years ago...and aggregate POD types.
Anders Carlsson [Sun, 31 May 2009 21:12:26 +0000 (21:12 +0000)]
...and aggregate POD types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72676 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSupport for complex types.
Anders Carlsson [Sun, 31 May 2009 21:07:58 +0000 (21:07 +0000)]
Support for complex types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72675 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoBetter support for scalar POD types in 'new' expressions.
Anders Carlsson [Sun, 31 May 2009 20:56:36 +0000 (20:56 +0000)]
Better support for scalar POD types in 'new' expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72674 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake sure to copy back arguments that can be changed by FindAllocationOverload. This...
Anders Carlsson [Sun, 31 May 2009 20:26:12 +0000 (20:26 +0000)]
Make sure to copy back arguments that can be changed by FindAllocationOverload. This fixes placement new. (Sebastian, please review).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72673 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoVery basic irgen support for new expressions.
Anders Carlsson [Sun, 31 May 2009 20:21:44 +0000 (20:21 +0000)]
Very basic irgen support for new expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72672 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDon't try to call getFileCharacteristic if the function declaration has an invalid...
Anders Carlsson [Sun, 31 May 2009 20:19:23 +0000 (20:19 +0000)]
Don't try to call getFileCharacteristic if the function declaration has an invalid source location (as is the case for the global allocation functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72671 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix an off by one error when trying to perform copy initialization of operator new...
Anders Carlsson [Sun, 31 May 2009 19:49:47 +0000 (19:49 +0000)]
Fix an off by one error when trying to perform copy initialization of operator new and operator delete arguments. Sebastian, please review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72670 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDowngrade an error about "return in a no-return function" from being
Chris Lattner [Sun, 31 May 2009 19:32:13 +0000 (19:32 +0000)]
Downgrade an error about "return in a no-return function" from being
an error to being a warning that defaults to error.  If you want this to
be a warning, you have to explicitly pass -Winvalid-noreturn to clang to
map it back to a warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72669 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDisallow exception specs on typedefs.
Sebastian Redl [Sun, 31 May 2009 11:47:27 +0000 (11:47 +0000)]
Disallow exception specs on typedefs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72664 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix for PR4285: allow intializing a const wchar_t array with a wide
Eli Friedman [Sun, 31 May 2009 10:54:53 +0000 (10:54 +0000)]
Fix for PR4285: allow intializing a const wchar_t array with a wide
string.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72663 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoInitial infrastructure for class template partial specialization. Here
Douglas Gregor [Sun, 31 May 2009 09:31:02 +0000 (09:31 +0000)]
Initial infrastructure for class template partial specialization. Here
we have the basics of declaring and storing class template partial
specializations, matching class template partial specializations at
instantiation time via (limited) template argument deduction, and
using the class template partial specialization's pattern for
instantiation.

This patch is enough to make a simple is_pointer type trait work, but
not much else.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72662 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a little FIXME for C++ class printing
Douglas Gregor [Sun, 31 May 2009 07:13:39 +0000 (07:13 +0000)]
Add a little FIXME for C++ class printing

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72660 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUnbreak the clang build by applying the same temporary
Duncan Sands [Sun, 31 May 2009 04:09:57 +0000 (04:09 +0000)]
Unbreak the clang build by applying the same temporary
workaround for machine code emitter changes as was used
in llvm-gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72657 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a new function for emitting new functions.
Anders Carlsson [Sun, 31 May 2009 01:40:14 +0000 (01:40 +0000)]
Add a new function for emitting new functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72656 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoEmit destructors correctly for temporaries.
Anders Carlsson [Sun, 31 May 2009 00:34:10 +0000 (00:34 +0000)]
Emit destructors correctly for temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72655 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoWhen possible, don't emit the cleanup block. Instead, just move the instructions...
Anders Carlsson [Sun, 31 May 2009 00:33:20 +0000 (00:33 +0000)]
When possible, don't emit the cleanup block. Instead, just move the instructions to the current block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72654 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement VisitCXXExprWithTemporaries for complex expressions.
Anders Carlsson [Sun, 31 May 2009 00:12:05 +0000 (00:12 +0000)]
Implement VisitCXXExprWithTemporaries for complex expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72653 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCall EmitCXXExprWithTemporaries.
Anders Carlsson [Sun, 31 May 2009 00:09:15 +0000 (00:09 +0000)]
Call EmitCXXExprWithTemporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72652 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd more getters to the new AST nodes.
Anders Carlsson [Sun, 31 May 2009 00:08:52 +0000 (00:08 +0000)]
Add more getters to the new AST nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72651 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd lvalue irgen support for CXXBindTemporaryExpr.
Anders Carlsson [Sat, 30 May 2009 23:30:54 +0000 (23:30 +0000)]
Add lvalue irgen support for CXXBindTemporaryExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72649 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMore temporary support.
Anders Carlsson [Sat, 30 May 2009 23:23:33 +0000 (23:23 +0000)]
More temporary support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72648 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoForgot the implementation. Thanks Eli.
Anders Carlsson [Sat, 30 May 2009 22:51:20 +0000 (22:51 +0000)]
Forgot the implementation. Thanks Eli.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72647 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd RemoveOutermostTemporaryBinding. Not used yet.
Anders Carlsson [Sat, 30 May 2009 22:47:03 +0000 (22:47 +0000)]
Add RemoveOutermostTemporaryBinding. Not used yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72644 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoClean up the newly added C++ AST nodes.
Anders Carlsson [Sat, 30 May 2009 22:38:53 +0000 (22:38 +0000)]
Clean up the newly added C++ AST nodes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72643 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIt's OK for a full expr to be null. This fixes the failing test cases.
Anders Carlsson [Sat, 30 May 2009 22:24:16 +0000 (22:24 +0000)]
It's OK for a full expr to be null. This fixes the failing test cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72642 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoActOnReturnStmt should also take a FullExprArg.
Anders Carlsson [Sat, 30 May 2009 21:42:34 +0000 (21:42 +0000)]
ActOnReturnStmt should also take a FullExprArg.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72641 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAddInitializerToDecl needs to take a full expression.
Anders Carlsson [Sat, 30 May 2009 21:37:25 +0000 (21:37 +0000)]
AddInitializerToDecl needs to take a full expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72640 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUpdate Xcode project
Anders Carlsson [Sat, 30 May 2009 21:32:24 +0000 (21:32 +0000)]
Update Xcode project

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72639 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd the newly created temporary to the ExprTemporaries stack.
Anders Carlsson [Sat, 30 May 2009 21:21:49 +0000 (21:21 +0000)]
Add the newly created temporary to the ExprTemporaries stack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72638 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoGet rid of CXXTempVarDecl.
Anders Carlsson [Sat, 30 May 2009 21:10:34 +0000 (21:10 +0000)]
Get rid of CXXTempVarDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72637 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSome small fixes for fields of reference type.
Eli Friedman [Sat, 30 May 2009 21:09:44 +0000 (21:09 +0000)]
Some small fixes for fields of reference type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72636 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoStop using CXXTempVarDecl and use CXXTemporary instead.
Anders Carlsson [Sat, 30 May 2009 21:05:25 +0000 (21:05 +0000)]
Stop using CXXTempVarDecl and use CXXTemporary instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72634 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove VarDecl from CXXConstructExpr.
Anders Carlsson [Sat, 30 May 2009 20:56:46 +0000 (20:56 +0000)]
Remove VarDecl from CXXConstructExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72633 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoBind temporaries correctly when instantiating expressions.
Anders Carlsson [Sat, 30 May 2009 20:52:37 +0000 (20:52 +0000)]
Bind temporaries correctly when instantiating expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72632 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove VarDecl from CheckInitializerTypes now that CXXConstructExpr doesn't need...
Anders Carlsson [Sat, 30 May 2009 20:41:30 +0000 (20:41 +0000)]
Remove VarDecl from CheckInitializerTypes now that CXXConstructExpr doesn't need to take a VarDecl anymore. (It still does, but it won't for long)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72630 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd Sema::MaybeBindToTemporary which takes an expression and (if needed) wraps it...
Anders Carlsson [Sat, 30 May 2009 20:36:53 +0000 (20:36 +0000)]
Add Sema::MaybeBindToTemporary which takes an expression and (if needed) wraps it in a CXXBindTemporaryExpr. Use this when creating CXXTemporaryObjectExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72629 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSmall fixes to CXXTemporary and CXXBindTemporaryExpr.
Anders Carlsson [Sat, 30 May 2009 20:34:37 +0000 (20:34 +0000)]
Small fixes to CXXTemporary and CXXBindTemporaryExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72628 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a CXXBindTemporaryExpr.
Anders Carlsson [Sat, 30 May 2009 20:03:25 +0000 (20:03 +0000)]
Add a CXXBindTemporaryExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72627 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a CXXTemporary class. Not used yet.
Anders Carlsson [Sat, 30 May 2009 19:54:15 +0000 (19:54 +0000)]
Add a CXXTemporary class. Not used yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72626 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoReplace a cast with a dyn_cast as suggested by Doug.
Anders Carlsson [Sat, 30 May 2009 17:26:39 +0000 (17:26 +0000)]
Replace a cast with a dyn_cast as suggested by Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72624 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCleqnup ideas from Chris, thanks.
Mike Stump [Sat, 30 May 2009 14:43:18 +0000 (14:43 +0000)]
Cleqnup ideas from Chris, thanks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72621 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAST printing for C++ base classes
Douglas Gregor [Sat, 30 May 2009 06:58:37 +0000 (06:58 +0000)]
AST printing for C++ base classes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72617 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPretty printing and improved representation for namespace alias declarations
Douglas Gregor [Sat, 30 May 2009 06:48:27 +0000 (06:48 +0000)]
Pretty printing and improved representation for namespace alias declarations

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72616 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a hack to prevent us from printing out the __builtin_va_list
Eli Friedman [Sat, 30 May 2009 06:35:22 +0000 (06:35 +0000)]
Add a hack to prevent us from printing out the __builtin_va_list
declaration in -ast-print mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72615 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPrinting for using directives, e.g.,
Douglas Gregor [Sat, 30 May 2009 06:31:56 +0000 (06:31 +0000)]
Printing for using directives, e.g.,

  using namespace std::debug;

Extended UsingDirectiveDecl to store the nested-name-specifier that
precedes the nominated namespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72614 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoNever suppress specifiers when printing the parameters of a function
Douglas Gregor [Sat, 30 May 2009 05:39:39 +0000 (05:39 +0000)]
Never suppress specifiers when printing the parameters of a function
declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72613 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPass an ASTContext into Stmt::printPretty.
Eli Friedman [Sat, 30 May 2009 05:32:46 +0000 (05:32 +0000)]
Pass an ASTContext into Stmt::printPretty.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72612 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPass an ASTContext into Stmt::printPretty.
Eli Friedman [Sat, 30 May 2009 05:19:26 +0000 (05:19 +0000)]
Pass an ASTContext into Stmt::printPretty.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72611 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a Stmt::printPretty overload which takes an ASTContext; start
Eli Friedman [Sat, 30 May 2009 05:03:24 +0000 (05:03 +0000)]
Add a Stmt::printPretty overload which takes an ASTContext; start
transitioning callers over to pass one in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72609 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoExpose an API to print a group of decls (like "int a,b;").
Eli Friedman [Sat, 30 May 2009 04:20:30 +0000 (04:20 +0000)]
Expose an API to print a group of decls (like "int a,b;").
Make StmtPrinter use DeclPrinter to print all declarations.  Merge
declarations in the limited case of an unnamed TagDecl followed by one
or more declarations using that TagDecl directly.  Change
SuppressTypeSpecifiers to the more general SuppressSpecifiers, and
use it to suppress stuff like "typedef" and "extern".  Replace
OwnedTag with SuppressTag, since it's more convenient to print
declarations from DeclPrinter at the moment.
improvements to declaration printing.  Fix pretty-printing for K&R
function definitions and __builtin_va_arg.

We're now to the point where the pretty-printing output for non-trivial
programs can actually be piped back into clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72608 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImprove __builtin_nanf support; we now can deal with them as constants.
Mike Stump [Sat, 30 May 2009 03:56:50 +0000 (03:56 +0000)]
Improve __builtin_nanf support; we now can deal with them as constants.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72607 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix some test failures involving -ast-print.
Eli Friedman [Sat, 30 May 2009 01:45:29 +0000 (01:45 +0000)]
Fix some test failures involving -ast-print.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72605 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoClean up printing for Objective-C, designated initializers.
Douglas Gregor [Sat, 30 May 2009 00:56:08 +0000 (00:56 +0000)]
Clean up printing for Objective-C, designated initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72602 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a member lookup criteria constructor for searching for overridden virtual member...
Anders Carlsson [Sat, 30 May 2009 00:52:53 +0000 (00:52 +0000)]
Add a member lookup criteria constructor for searching for overridden virtual member functions. Use this instead of regular name lookup when checking for overriding functions so we will see declarations that would otherwise be hidden. Fixes 6902298.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72601 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSome enhancements to DeclStmt printing. Some of this should
Eli Friedman [Sat, 30 May 2009 00:19:54 +0000 (00:19 +0000)]
Some enhancements to DeclStmt printing.  Some of this should
move to DeclPrinter.cpp, but I haven't quite worked out how best to do
that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72599 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support for PrintingPolicy::SuppressTypeSpecifiers to type printing.
Eli Friedman [Sat, 30 May 2009 00:10:16 +0000 (00:10 +0000)]
Add support for PrintingPolicy::SuppressTypeSpecifiers to type printing.
(I have a work-in-progress patch which uses this.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72598 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRefactor and clean up the AST printer, so that it uses a DeclVisitor,
Douglas Gregor [Sat, 30 May 2009 00:08:05 +0000 (00:08 +0000)]
Refactor and clean up the AST printer, so that it uses a DeclVisitor,
walks through DeclContexts properly, and prints more of the
information available in the AST. The functionality is still available
via -ast-print, -ast-dump, etc., and also via the new member functions
Decl::dump() and Decl::print().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72597 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake the LookupBase boolean an enum instead.
Anders Carlsson [Fri, 29 May 2009 23:42:05 +0000 (23:42 +0000)]
Make the LookupBase boolean an enum instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72594 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd code for emitting C++ destructors. Not used yet.
Anders Carlsson [Fri, 29 May 2009 21:03:38 +0000 (21:03 +0000)]
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

15 years agoCreate a new PrintingPolicy class, which we pass down through the AST
Douglas Gregor [Fri, 29 May 2009 20:38:28 +0000 (20:38 +0000)]
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

15 years agoMake sure we don't give the wrong warning, and make sure not to set
Eli Friedman [Fri, 29 May 2009 20:20:05 +0000 (20:20 +0000)]
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

15 years agoAdd an assertion so that we don't accidentally build constant arrays of
Eli Friedman [Fri, 29 May 2009 20:17:55 +0000 (20:17 +0000)]
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

15 years agoRe-add a slightly more general version of the check from r72578; it is
Eli Friedman [Fri, 29 May 2009 19:23:46 +0000 (19:23 +0000)]
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

15 years agoOops, the testcase I was thinking of is supposed to error out. I
Mike Stump [Fri, 29 May 2009 19:14:13 +0000 (19:14 +0000)]
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

15 years agoAdd a couple missing ARM defines.
Eli Friedman [Fri, 29 May 2009 19:00:15 +0000 (19:00 +0000)]
Add a couple missing ARM defines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72583 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoReduce the amount of stack space we use in SmallVectors during
Douglas Gregor [Fri, 29 May 2009 18:27:38 +0000 (18:27 +0000)]
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

15 years agoRevert r72575, which isn't really right, and fix up other code to
Eli Friedman [Fri, 29 May 2009 18:22:49 +0000 (18:22 +0000)]
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

15 years agoReject incomplete types in exception specs.
Sebastian Redl [Fri, 29 May 2009 18:02:33 +0000 (18:02 +0000)]
Reject incomplete types in exception specs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72580 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFixup codegen for composition of vla types using a normal array type.
Mike Stump [Fri, 29 May 2009 17:06:45 +0000 (17:06 +0000)]
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

15 years agoFix usage of placement new. Placement new is not actually declared implicitly.
Sebastian Redl [Fri, 29 May 2009 16:43:59 +0000 (16:43 +0000)]
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

15 years agoAvoid dumping during semantic analysis when checking array types when
Mike Stump [Fri, 29 May 2009 16:34:15 +0000 (16:34 +0000)]
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

15 years agoWe don't want to validate bad code,
Mike Stump [Fri, 29 May 2009 16:24:13 +0000 (16:24 +0000)]
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

15 years agoNote another case that doesn't work yet.
Mike Stump [Fri, 29 May 2009 16:12:36 +0000 (16:12 +0000)]
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

15 years agoFixup the rest of the trivial cases of the codegen of volatile. If
Mike Stump [Fri, 29 May 2009 15:46:01 +0000 (15:46 +0000)]
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

15 years agoDisallow exception specifications on multi-level indirections.
Sebastian Redl [Fri, 29 May 2009 15:01:05 +0000 (15:01 +0000)]
Disallow exception specifications on multi-level indirections.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72571 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSome cleanups and commenting to our declaration-name handling
Douglas Gregor [Fri, 29 May 2009 14:49:33 +0000 (14:49 +0000)]
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

15 years agoFollow-on test case for template instantiation of interesting DeclGroups
Douglas Gregor [Fri, 29 May 2009 14:26:40 +0000 (14:26 +0000)]
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

15 years agoNow that we have declared/defined tag types within DeclGroups,
Douglas Gregor [Fri, 29 May 2009 14:25:00 +0000 (14:25 +0000)]
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

15 years agoIf a declarator group declares a type, make sure to add that declaration
Eli Friedman [Fri, 29 May 2009 01:49:24 +0000 (01:49 +0000)]
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

15 years agoWhen we parse a tag specifier, keep track of whether that tag
Douglas Gregor [Thu, 28 May 2009 23:31:59 +0000 (23:31 +0000)]
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

15 years agoPR4281: Fix bogus CodeGen assertion. The issue is that
Eli Friedman [Thu, 28 May 2009 23:04:00 +0000 (23:04 +0000)]
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

15 years agoARM is a legitimate Darwin architecture; don't assert.
Eli Friedman [Thu, 28 May 2009 20:57:06 +0000 (20:57 +0000)]
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

15 years agoAdd the missing public: thanks, Fariborz
Douglas Gregor [Thu, 28 May 2009 16:41:44 +0000 (16:41 +0000)]
Add the missing public: thanks, Fariborz

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72528 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMove clang-cc's -v output to the start (vs. end) of compilation, and change
Daniel Dunbar [Thu, 28 May 2009 16:37:33 +0000 (16:37 +0000)]
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

15 years agoIntroduced DeclContext::isDependentContext, which determines whether a
Douglas Gregor [Thu, 28 May 2009 16:34:51 +0000 (16:34 +0000)]
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

15 years agoupdate test for r72519
Chris Lattner [Thu, 28 May 2009 05:41:32 +0000 (05:41 +0000)]
update test for r72519

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72520 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix the "pasting formed 'a]', an invalid preprocessing token"
Chris Lattner [Thu, 28 May 2009 05:39:39 +0000 (05:39 +0000)]
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

15 years agoNot setting all the fields is confusing...
Mike Stump [Thu, 28 May 2009 00:16:27 +0000 (00:16 +0000)]
Not setting all the fields is confusing...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72506 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix a use-of-undefined, IRgen expects the RValue for "void" to be a scalar RValue.
Daniel Dunbar [Wed, 27 May 2009 23:45:33 +0000 (23:45 +0000)]
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

15 years agoAdd a target triple, because this test depends on details of the x86-64 ABI
Douglas Gregor [Wed, 27 May 2009 23:32:34 +0000 (23:32 +0000)]
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

15 years agoReimplement much of the way that we track nested classes in the
Douglas Gregor [Wed, 27 May 2009 23:11:45 +0000 (23:11 +0000)]
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