]> granicus.if.org Git - clang/log
clang
15 years agoTemplate instantiation for the declarations of member functions within
Douglas Gregor [Mon, 23 Mar 2009 23:06:20 +0000 (23:06 +0000)]
Template instantiation for the declarations of member functions within
a class template. At present, we can only instantiation normal
methods, but not constructors, destructors, or conversion operators.

As ever, this contains a bit of refactoring in Sema's type-checking. In
particular:

  - Split ActOnFunctionDeclarator into ActOnFunctionDeclarator
    (handling the declarator itself) and CheckFunctionDeclaration
    (checking for the the function declaration), the latter of which
    is also used by template instantiation.
  - We were performing the adjustment of function parameter types in
    three places; collect those into a single new routine.
  - When the type of a parameter is adjusted, allocate an
    OriginalParmVarDecl to keep track of the type as it was written.
  - Eliminate a redundant check for out-of-line declarations of member
    functions; hide more C++-specific checks on function declarations
    behind if(getLangOptions().CPlusPlus).

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

15 years agoDeallocate 'DeclRefExpr's in correctly formed '#pragma unused'
Ted Kremenek [Mon, 23 Mar 2009 22:50:47 +0000 (22:50 +0000)]
Deallocate 'DeclRefExpr's in correctly formed '#pragma unused'

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

15 years agoA test case to test that -warn-dead-stores does not emit a warning for stores to...
Ted Kremenek [Mon, 23 Mar 2009 22:30:58 +0000 (22:30 +0000)]
A test case to test that -warn-dead-stores does not emit a warning for stores to variables marked with '#pragma unused'.

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

15 years agoImplement '#pragma unused'.
Ted Kremenek [Mon, 23 Mar 2009 22:28:25 +0000 (22:28 +0000)]
Implement '#pragma unused'.

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

15 years agoDriver: Make argument parsing fast.
Daniel Dunbar [Mon, 23 Mar 2009 21:50:40 +0000 (21:50 +0000)]
Driver: Make argument parsing fast.

On a synthetic command line consisting of almost all defined options,
this drops wall time from .00494 to .00336 and user time from .00258
to .00105.

On the same benchmark, clang-driver is about 15% faster than the
primary gcc driver and almost twice as fast as the gcc driver driver.

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

15 years agoAdd SemaTypeInstantiateDecl.cpp
Anders Carlsson [Mon, 23 Mar 2009 20:47:43 +0000 (20:47 +0000)]
Add SemaTypeInstantiateDecl.cpp

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

15 years agoUpdate checker build.
Ted Kremenek [Mon, 23 Mar 2009 19:53:30 +0000 (19:53 +0000)]
Update checker build.

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

15 years agoDriver: Fix off by one in computation of first searchable option.
Daniel Dunbar [Mon, 23 Mar 2009 19:19:19 +0000 (19:19 +0000)]
Driver: Fix off by one in computation of first searchable option.

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

15 years agoMust allow for strong cast of floats as well (objc2 gc).
Fariborz Jahanian [Mon, 23 Mar 2009 19:10:40 +0000 (19:10 +0000)]
Must allow for strong cast of floats as well (objc2 gc).

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

15 years agoMore improvements to abstract type checking. Handle arrays correctly, and make sure...
Anders Carlsson [Mon, 23 Mar 2009 19:10:31 +0000 (19:10 +0000)]
More improvements to abstract type checking. Handle arrays correctly, and make sure to check parameter types before they decay.

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

15 years agoDriver: Add two special groups of "whitelisted" options which we know
Daniel Dunbar [Mon, 23 Mar 2009 19:03:36 +0000 (19:03 +0000)]
Driver: Add two special groups of "whitelisted" options which we know
clang doesn't support, and don't want to warn are unused. Eventually
these should disappear.

Here is a more readable list than is in the diff:

W options: -Wall, -Wcast-align, -Wchar-align, -Wchar-subscripts,
-Werror, -Wextra, -Winline, -Wint-to-pointer-cast, -Wmissing-braces,
-Wmost, -Wnested-externs, -Wno-format-y2k, -Wno-four-char-constants,
-Wno-missing-field-initializers, -Wno-trigraphs, -Wno-unknown-pragmas,
-Wno-unused-parameter, -Wparentheses, -Wpointer-arith,
-Wpointer-to-int-cast, -Wreturn-type, -Wshorten-64-to-32, -Wswitch,
-Wunused-function, -Wunused-label, -Wunused-value, -Wunused-variable,
-Wwrite-strings.

f options: -fasm-blocks, -fmessage-length=.

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

15 years agoDriver: Check that options are ordered properly (outside of
Daniel Dunbar [Mon, 23 Mar 2009 18:41:45 +0000 (18:41 +0000)]
Driver: Check that options are ordered properly (outside of
Release-Asserts mode).

Also, avoid searching through option groups (which will never match).

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

15 years agouse isa<>
Chris Lattner [Mon, 23 Mar 2009 17:57:53 +0000 (17:57 +0000)]
use isa<>

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

15 years agoIt's an error to try to allocate an abstract object using new.
Anders Carlsson [Mon, 23 Mar 2009 17:49:10 +0000 (17:49 +0000)]
It's an error to try to allocate an abstract object using new.

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

15 years agoFix PR3855. When we encounter an incompatible redeclaration of a
Douglas Gregor [Mon, 23 Mar 2009 17:47:24 +0000 (17:47 +0000)]
Fix PR3855. When we encounter an incompatible redeclaration of a
library function, accept this declaration and pretend that we do not
know that this is a library function. autoconf depends on this
(broken) behavior.

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

15 years agoThe individual pieces of an invalid paste as still candidates for expansion.
Chris Lattner [Mon, 23 Mar 2009 17:32:45 +0000 (17:32 +0000)]
The individual pieces of an invalid paste as still candidates for expansion.
This matters in assembler mode, where this is silently allowed.
This fixes rdar://6709206.

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

15 years agoanalyzer: Provide temporary workaround for false positive reported by
Ted Kremenek [Mon, 23 Mar 2009 17:10:25 +0000 (17:10 +0000)]
analyzer: Provide temporary workaround for false positive reported by
<rdar://problem/6704930> involving SimpleConstraintManager not reasoning well
about symbolic constraint values involving arithmetic operators.

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

15 years agoTighten up the determination of whether a function declaration has a
Douglas Gregor [Mon, 23 Mar 2009 16:26:51 +0000 (16:26 +0000)]
Tighten up the determination of whether a function declaration has a
prototype. Thanks Eli!

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

15 years agoif the driver decides to run clang on a .s file, treat it as a .S file.
Chris Lattner [Mon, 23 Mar 2009 16:24:37 +0000 (16:24 +0000)]
if the driver decides to run clang on a .s file, treat it as a .S file.

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

15 years agoThanks to Eli for pointing out my misreading of 6.2.2p5
Douglas Gregor [Mon, 23 Mar 2009 16:17:01 +0000 (16:17 +0000)]
Thanks to Eli for pointing out my misreading of 6.2.2p5

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

15 years agoDriver: Setup file and program search paths in tool chains.
Daniel Dunbar [Mon, 23 Mar 2009 16:15:50 +0000 (16:15 +0000)]
Driver: Setup file and program search paths in tool chains.

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

15 years agoAd FreeBSD ARM target info.
Daniel Dunbar [Mon, 23 Mar 2009 16:09:04 +0000 (16:09 +0000)]
Ad FreeBSD ARM target info.
 - Patch by Ed Schoeten!

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

15 years agoanalyzer: Fix embarrassing regression in BasicStore when invalidating struct
Ted Kremenek [Mon, 23 Mar 2009 15:42:58 +0000 (15:42 +0000)]
analyzer: Fix embarrassing regression in BasicStore when invalidating struct
values passed-by-reference to unknown functions.

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

15 years agoccc: Forward -f[no-]builtin to clang.
Daniel Dunbar [Mon, 23 Mar 2009 14:57:31 +0000 (14:57 +0000)]
ccc: Forward -f[no-]builtin to clang.

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

15 years agoMinor Evaluate cleanup; add some boilerplate implementations to
Eli Friedman [Mon, 23 Mar 2009 04:56:01 +0000 (04:56 +0000)]
Minor Evaluate cleanup; add some boilerplate implementations to
Evaluate for __extension__ and __builtin_choose_expr.

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

15 years agoMinor enhancements to Evaluate.
Eli Friedman [Mon, 23 Mar 2009 04:38:34 +0000 (04:38 +0000)]
Minor enhancements to Evaluate.

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

15 years agoSome minor fixes for complex IRGen.
Eli Friedman [Mon, 23 Mar 2009 04:08:46 +0000 (04:08 +0000)]
Some minor fixes for complex IRGen.

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

15 years agoFix a subtle bug in CodeGen for the increment of a bitfield.
Eli Friedman [Mon, 23 Mar 2009 03:00:06 +0000 (03:00 +0000)]
Fix a subtle bug in CodeGen for the increment of a bitfield.

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

15 years agoUpdate checker build.
Ted Kremenek [Mon, 23 Mar 2009 02:00:36 +0000 (02:00 +0000)]
Update checker build.

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

15 years agoAdd some FIXMEs relating to incomplete types.
Eli Friedman [Mon, 23 Mar 2009 00:24:07 +0000 (00:24 +0000)]
Add some FIXMEs relating to incomplete types.

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

15 years agoFix a few more instances of "&>".
Eli Friedman [Mon, 23 Mar 2009 00:04:01 +0000 (00:04 +0000)]
Fix a few more instances of "&>".

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

15 years agoRecognize rvalue references in C++03, but complain about them. This leads to far...
Sebastian Redl [Mon, 23 Mar 2009 00:00:23 +0000 (00:00 +0000)]
Recognize rvalue references in C++03, but complain about them. This leads to far better error recovery.

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

15 years agoPartial implementation of PR3342: break out pointer sign
Eli Friedman [Sun, 22 Mar 2009 23:59:44 +0000 (23:59 +0000)]
Partial implementation of PR3342: break out pointer sign
incompatibilities in assignments from other pointer incompatibilities.
Based off of the patch in PR3342.  (This doesn't implement -Wno-pointer-sign,
but I don't know the driver code very well.)

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

15 years agoDriver: Drop code for checking bounds in SeparateArg::render, this
Daniel Dunbar [Sun, 22 Mar 2009 23:50:14 +0000 (23:50 +0000)]
Driver: Drop code for checking bounds in SeparateArg::render, this
situation should never occur now that arguments are parsed correctly.

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

15 years agoDisallow catching exceptions by rvalue reference.
Sebastian Redl [Sun, 22 Mar 2009 23:49:27 +0000 (23:49 +0000)]
Disallow catching exceptions by rvalue reference.

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

15 years agoAdjust isModifiableLvalue to give a slightly more useful diagnostic for
Eli Friedman [Sun, 22 Mar 2009 23:26:56 +0000 (23:26 +0000)]
Adjust isModifiableLvalue to give a slightly more useful diagnostic for
attempting to illegally modify a BlockDeclRefExpr.

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

15 years agoDriver: Implement 'missing argument' error.
Daniel Dunbar [Sun, 22 Mar 2009 23:26:43 +0000 (23:26 +0000)]
Driver: Implement 'missing argument' error.

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

15 years agoFix code to mark block variables as const to actually work. Fix
Eli Friedman [Sun, 22 Mar 2009 23:00:19 +0000 (23:00 +0000)]
Fix code to mark block variables as const to actually work.  Fix
isObjCObjectPointerType to work with qualified types.  Adjust test for
changes.

If the SemaExpr changes are wrong or break existing code, feel free to
delete the "ExprTy.addConst();" line and revert my changes to
test/Sema/block-literal.c.

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

15 years ago.td files have been used for a few days without complaint. Kill the .def files.
Sebastian Redl [Sun, 22 Mar 2009 22:58:53 +0000 (22:58 +0000)]
.td files have been used for a few days without complaint. Kill the .def files.

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

15 years agoImplement static_cast from lvalue to rvalue reference.
Sebastian Redl [Sun, 22 Mar 2009 22:30:06 +0000 (22:30 +0000)]
Implement static_cast from lvalue to rvalue reference.

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

15 years agoAdd testcase for incomplete call/return types for calls.
Eli Friedman [Sun, 22 Mar 2009 22:03:03 +0000 (22:03 +0000)]
Add testcase for incomplete call/return types for calls.

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

15 years agoCheck that the return/argument types of calls are complete.
Eli Friedman [Sun, 22 Mar 2009 22:00:50 +0000 (22:00 +0000)]
Check that the return/argument types of calls are complete.

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

15 years agoswitch getBuiltinLibFunction to use the new GetOrCreateLLVMFunction
Chris Lattner [Sun, 22 Mar 2009 21:56:56 +0000 (21:56 +0000)]
switch getBuiltinLibFunction to use the new GetOrCreateLLVMFunction
functionality, fixing a crash on the attached testcase.  Eliminate the
BuiltinFunctions cache, as it can contain dangling pointers.  This fixes
a bunch of valgrind errors on test/CodeGen/builtins.c

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

15 years agoDon't use &> in tests; dash doesn't understand it.
Eli Friedman [Sun, 22 Mar 2009 21:49:20 +0000 (21:49 +0000)]
Don't use &> in tests; dash doesn't understand it.

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

15 years agoemit aliases as the definitions fly by, don't bother deferring until
Chris Lattner [Sun, 22 Mar 2009 21:47:11 +0000 (21:47 +0000)]
emit aliases as the definitions fly by, don't bother deferring until
the end of the module.

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

15 years agomake alias definition logic more similar to functions/globals.
Chris Lattner [Sun, 22 Mar 2009 21:39:12 +0000 (21:39 +0000)]
make alias definition logic more similar to functions/globals.

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

15 years agoFix build from r67476 and address the easy part of Doug's comments on rvalue refs.
Sebastian Redl [Sun, 22 Mar 2009 21:28:55 +0000 (21:28 +0000)]
Fix build from r67476 and address the easy part of Doug's comments on rvalue refs.

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

15 years agofix PR3200 by making alias emission use the new infrastructure. Fold
Chris Lattner [Sun, 22 Mar 2009 21:21:57 +0000 (21:21 +0000)]
fix PR3200 by making alias emission use the new infrastructure.  Fold
some tests into the alias.c file.

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

15 years agopull "runtime globals" into the same framework as other functions/global variables.
Chris Lattner [Sun, 22 Mar 2009 21:03:39 +0000 (21:03 +0000)]
pull "runtime globals" into the same framework as other functions/global variables.
No intended functionality change.

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

15 years agoRemove dead code.
Eli Friedman [Sun, 22 Mar 2009 20:54:47 +0000 (20:54 +0000)]
Remove dead code.

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

15 years agoDisallow abstract types where appropriate.
Anders Carlsson [Sun, 22 Mar 2009 20:18:17 +0000 (20:18 +0000)]
Disallow abstract types where appropriate.

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

15 years agofix a fixme: non-proto struct returning function definitions should be compiled
Chris Lattner [Sun, 22 Mar 2009 19:35:37 +0000 (19:35 +0000)]
fix a fixme: non-proto struct returning function definitions should be compiled
to something like:
define void @bar(%struct.foo* noalias sret %agg.result) nounwind {
instead of:
define void @bar(%struct.foo* noalias sret %agg.result, ...) nounwind {

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

15 years agoadd some missing type predicates.
Chris Lattner [Sun, 22 Mar 2009 19:29:18 +0000 (19:29 +0000)]
add some missing type predicates.

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

15 years agofix PR3859: crash with 'cc -V'
Nuno Lopes [Sun, 22 Mar 2009 17:47:44 +0000 (17:47 +0000)]
fix PR3859: crash with 'cc -V'

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

15 years agoPTHManager::Create():
Ted Kremenek [Sun, 22 Mar 2009 06:42:39 +0000 (06:42 +0000)]
PTHManager::Create():
- Make the Diagnostic::Level for PTH errors to be specified by the caller

clang (driver):
- Set the PTHManager diagnostic level to "Diagnostic::Error" for -include-pth
  (a hard error) and Diagnostic::Warning for -token-cache (we can still
  proceed).

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

15 years agoKeep track of whether a class is abstract or not. This is currently only used for...
Anders Carlsson [Sun, 22 Mar 2009 01:52:17 +0000 (01:52 +0000)]
Keep track of whether a class is abstract or not. This is currently only used for the __is_abstract type trait.

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

15 years agodon't set the name of a call instruction to "call" in release-asserts
Chris Lattner [Sun, 22 Mar 2009 00:32:22 +0000 (00:32 +0000)]
don't set the name of a call instruction to "call" in release-asserts
build.  This shaves another 3% off.

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

15 years agofix CreateTempAlloca to not set a name on the alloca for temporaries
Chris Lattner [Sun, 22 Mar 2009 00:24:14 +0000 (00:24 +0000)]
fix CreateTempAlloca to not set a name on the alloca for temporaries
in release-assert builds.  For automatic variables, explicitly set
a name with setName that does not make a temporary std::string.

This speeds up -emit-llvm-only -disable-free on PR3810 by 4.6%

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

15 years agoset function/global names with setName instead of passing the name into the
Chris Lattner [Sun, 22 Mar 2009 00:12:30 +0000 (00:12 +0000)]
set function/global names with setName instead of passing the name into the
ctor function.  This avoids creating a temporary std::string for the name,
speeding up the testcase in PR3810 by 3.8%

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

15 years agofix some warnings in release-assert mode.
Chris Lattner [Sun, 22 Mar 2009 00:10:22 +0000 (00:10 +0000)]
fix some warnings in release-assert mode.

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

15 years agofix test
Chris Lattner [Sat, 21 Mar 2009 23:59:11 +0000 (23:59 +0000)]
fix test

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

15 years agoFixup codegen for nested block literals so that we generate
Mike Stump [Sat, 21 Mar 2009 21:00:35 +0000 (21:00 +0000)]
Fixup codegen for nested block literals so that we generate
copy_helpers and dispose_helpers as necessary for them.

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

15 years agoFix a thinko in the pre-allocation strategy for structured initializer
Douglas Gregor [Sat, 21 Mar 2009 18:13:52 +0000 (18:13 +0000)]
Fix a thinko in the pre-allocation strategy for structured initializer
lists. The code wasn't accounting for the distinction between the
top-level call to getStructuredSubobjectInit and later calls that
occur deeper in the hierarchy. This problem manifested itself as
over-allocation in cases where we have large arrays of small
structures (<rdar://problem/6707362>).

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

15 years agoIssue error if variables are defined inside an objc class,
Fariborz Jahanian [Sat, 21 Mar 2009 18:06:45 +0000 (18:06 +0000)]
Issue error if variables are defined inside an objc class,
category or protocol.

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

15 years agoFrontend: Handle empty input on stdin.
Daniel Dunbar [Sat, 21 Mar 2009 17:56:30 +0000 (17:56 +0000)]
Frontend: Handle empty input on stdin.
 - PR3854.

I think it makes more sense to change MemoryBuffer::getSTDIN (return 0
should indicate error, not empty), but it is documented to return 0
for empty inputs, and some other code appears to rely on this.

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

15 years agoFrontend: Handle empty input on stdin.
Daniel Dunbar [Sat, 21 Mar 2009 17:55:43 +0000 (17:55 +0000)]
Frontend: Handle empty input on stdin.
 - PR3854.

I think it makes more sense to change MemoryBuffer::getSTDIN (return 0
should indicate error, not empty), but it is documented to return 0
for empty inputs, and some other code appears to rely on this.

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

15 years agonow that all the decl reference and creation stuff is going through two
Chris Lattner [Sat, 21 Mar 2009 09:44:56 +0000 (09:44 +0000)]
now that all the decl reference and creation stuff is going through two
very simple places, reimplement the deferred decl emission logic to not be O(N^2),
fixing PR3810.

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

15 years agofix a crash that could occur when a variable declaration became a
Chris Lattner [Sat, 21 Mar 2009 09:25:43 +0000 (09:25 +0000)]
fix a crash that could occur when a variable declaration became a
function definition.

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

15 years agosimplify and cleanup global variable creation stuff to all go through one
Chris Lattner [Sat, 21 Mar 2009 09:16:30 +0000 (09:16 +0000)]
simplify and cleanup global variable creation stuff to all go through one
code path.

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

15 years agosimplify management of llvm::Function creation to all go through
Chris Lattner [Sat, 21 Mar 2009 08:53:37 +0000 (08:53 +0000)]
simplify management of llvm::Function creation to all go through
GetAddrOfFunction.  This is simpler and more efficient.

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

15 years agocode cleanups, rename EmitForwardFunctionDefinition ->
Chris Lattner [Sat, 21 Mar 2009 08:38:50 +0000 (08:38 +0000)]
code cleanups, rename EmitForwardFunctionDefinition ->
CreateFunctionPrototypeIR, though my next patch will eliminate
it entirely.

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

15 years agofix several problems with asm renaming, by pulling it into the mangling code:
Chris Lattner [Sat, 21 Mar 2009 08:24:40 +0000 (08:24 +0000)]
fix several problems with asm renaming, by pulling it into the mangling code:

1. it wasn't applying to definitions, only declarations, e.g. int x __asm("foo")
2. multiple definitions were conflicting, they weren't getting merged.
3. the code was duplicated in several places.

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

15 years agoadd some fixmes
Chris Lattner [Sat, 21 Mar 2009 08:13:05 +0000 (08:13 +0000)]
add some fixmes

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

15 years agoreduce redundant calls of getMangledName.
Chris Lattner [Sat, 21 Mar 2009 08:06:59 +0000 (08:06 +0000)]
reduce redundant calls of getMangledName.

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

15 years agosimplify some more code.
Chris Lattner [Sat, 21 Mar 2009 08:03:33 +0000 (08:03 +0000)]
simplify some more code.

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

15 years agosimplify and comment some code better. Make BindRuntimeGlobals
Chris Lattner [Sat, 21 Mar 2009 07:48:31 +0000 (07:48 +0000)]
simplify and comment some code better.  Make BindRuntimeGlobals
more optimistic that it will work (optimizing for the common case).

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

15 years agorandom code cleanups.
Chris Lattner [Sat, 21 Mar 2009 07:12:05 +0000 (07:12 +0000)]
random code cleanups.

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

15 years agoremove obviously dead code: you can't bitcast a pointer to "Ty" (a function type).
Chris Lattner [Sat, 21 Mar 2009 06:58:21 +0000 (06:58 +0000)]
remove obviously dead code: you can't bitcast a pointer to "Ty" (a function type).

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

15 years agoavoid making constant folding logic eliminate obviously dead bitcasts, speeding up...
Chris Lattner [Sat, 21 Mar 2009 06:53:34 +0000 (06:53 +0000)]
avoid making constant folding logic eliminate obviously dead bitcasts, speeding up PR3810
by ~2%.

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

15 years agocontinue dancing around the obvious algorithm issues in PR3810:
Chris Lattner [Sat, 21 Mar 2009 06:49:19 +0000 (06:49 +0000)]
continue dancing around the obvious algorithm issues in PR3810:
This speeds up getAsIdentifierInfo from being a call to a function
with a big switch to a single testl instruction.  This speeds up
the example in PR3810 by 6.2%

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

15 years agoadd an assertion for unreachable code.
Chris Lattner [Sat, 21 Mar 2009 06:40:50 +0000 (06:40 +0000)]
add an assertion for unreachable code.

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

15 years agoAdd a fast path to CodeGenModule::getMangledName for almost all C functions,
Chris Lattner [Sat, 21 Mar 2009 06:31:09 +0000 (06:31 +0000)]
Add a fast path to CodeGenModule::getMangledName for almost all C functions,
speeding up the testcase in PR3810 by 60%.

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

15 years agopartially inline getAttrs() to speed up PR3810 (and lots of
Chris Lattner [Sat, 21 Mar 2009 06:27:31 +0000 (06:27 +0000)]
partially inline getAttrs() to speed up PR3810 (and lots of
other code presumably) by 4.3%

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

15 years agosimplify CXXNameMangler::mangle, making it exit earlier for C functions.
Chris Lattner [Sat, 21 Mar 2009 06:19:20 +0000 (06:19 +0000)]
simplify CXXNameMangler::mangle, making it exit earlier for C functions.
This speeds up a testcase in 3810 by ~16%.

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

15 years agoDriver: Give Compilation::Execute total control over the Driver result
Daniel Dunbar [Sat, 21 Mar 2009 00:40:53 +0000 (00:40 +0000)]
Driver: Give Compilation::Execute total control over the Driver result
code; and don't return an error code when -### is present, even if
errors occur.

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

15 years agoAdd back warning about a PTH file not containing any identifiers, but don't make
Ted Kremenek [Sat, 21 Mar 2009 00:25:09 +0000 (00:25 +0000)]
Add back warning about a PTH file not containing any identifiers, but don't make
it a hard error.

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

15 years agoAllow PTH files with no identifiers.
Ted Kremenek [Sat, 21 Mar 2009 00:15:11 +0000 (00:15 +0000)]
Allow PTH files with no identifiers.

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

15 years agoWhen building the structured initializer list, pre-allocate storage in
Douglas Gregor [Fri, 20 Mar 2009 23:58:33 +0000 (23:58 +0000)]
When building the structured initializer list, pre-allocate storage in
its vectors based on the subobject type we're initializing and the
(unstructured) initializer list. This eliminates some malloc thrashing
when parsing initializers (from 117 vector reallocations down to 0
when parsing Cocoa.h). We can't always pre-allocate the right amount
of storage, since designated initializers can cause us to initialize
in non-predictable patterns.

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

15 years agoccc/Driver/clang-fe: Accept -fbuiltin, and forward -f[no-]builtin to clang.
Daniel Dunbar [Fri, 20 Mar 2009 23:49:28 +0000 (23:49 +0000)]
ccc/Driver/clang-fe: Accept -fbuiltin, and forward -f[no-]builtin to clang.

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

15 years agoFix include-pth.c test case to (hopefully) more resilient to where and how tests
Ted Kremenek [Fri, 20 Mar 2009 23:45:36 +0000 (23:45 +0000)]
Fix include-pth.c test case to (hopefully) more resilient to where and how tests
are executed.

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

15 years agoccc/Driver: .s defaults to 'assembler-with-cpp' on Darwin.
Daniel Dunbar [Fri, 20 Mar 2009 23:39:23 +0000 (23:39 +0000)]
ccc/Driver: .s defaults to 'assembler-with-cpp' on Darwin.
 - <rdar://problem/6669441> ccc doesn't handle assembler-with-cpp
   semantics correctly (but clang supports it)

 - This is sad, because it requires a fairly useless target
   hook. C'est la vie.

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

15 years agoDestroy expressions properly when resizing an initializer list
Douglas Gregor [Fri, 20 Mar 2009 23:38:03 +0000 (23:38 +0000)]
Destroy expressions properly when resizing an initializer list

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

15 years agoInitListDesignations hasn't been used (ever). Eliminate it, and
Douglas Gregor [Fri, 20 Mar 2009 23:11:49 +0000 (23:11 +0000)]
InitListDesignations hasn't been used (ever). Eliminate it, and
simplify the parsing and action interface for designated
initializers.

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

15 years agoEliminate post-diagnostic hooks. Instead, implement a Sema-specific
Douglas Gregor [Fri, 20 Mar 2009 22:48:49 +0000 (22:48 +0000)]
Eliminate post-diagnostic hooks. Instead, implement a Sema-specific
variant of DiagnosticBuilder that emits the template instantiation
backtrace when needed.

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

15 years agoccc: Use -include-pth.
Daniel Dunbar [Fri, 20 Mar 2009 22:13:54 +0000 (22:13 +0000)]
ccc: Use -include-pth.

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

15 years agoFix codegen for support for super inside block literal expressions.
Mike Stump [Fri, 20 Mar 2009 21:53:12 +0000 (21:53 +0000)]
Fix codegen for support for super inside block literal expressions.

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

15 years agoFix <rdar://problem/6704086> by allowing the format string checking in Sema to
Ted Kremenek [Fri, 20 Mar 2009 21:35:28 +0000 (21:35 +0000)]
Fix <rdar://problem/6704086> by allowing the format string checking in Sema to
allow non-literal format strings that are variables that (a) permanently bind to
a string constant and (b) whose string constants are resolvable within the same
translation unit.

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

15 years agofix test/Preprocessor/macro_paste_mscomment.c.
Chris Lattner [Fri, 20 Mar 2009 21:23:42 +0000 (21:23 +0000)]
fix test/Preprocessor/macro_paste_mscomment.c.

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

15 years agoFix a crash during meta-data generation of objc2's nonfragile abi.
Fariborz Jahanian [Fri, 20 Mar 2009 20:48:19 +0000 (20:48 +0000)]
Fix a crash during meta-data generation of objc2's nonfragile abi.

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

15 years agoImprove documentation for MemberExpr
Douglas Gregor [Fri, 20 Mar 2009 20:46:52 +0000 (20:46 +0000)]
Improve documentation for MemberExpr

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