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

550 Коммитов

Автор SHA1 Сообщение Дата
Devang Patel 5de7a0e880 Do not emit stop point for CXXDefaultArgExpr. It results in suboptimial user experience.
21 int main() {
22  A a;

For example, here user would expect to stop at line 22, even if A's constructor leads to a call through CXXDefaultArgExpr.

This fixes ostream-defined.exp regression from gdb testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127164 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 18:29:53 +00:00
Benjamin Kramer 9de4342ef7 StringRefify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127082 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 13:45:23 +00:00
John McCall 34695856c0 Reorganize the emission of local variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126189 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-22 06:44:22 +00:00
John McCall 15e310a3b9 Warn about code that uses variables and functions with internal linkage
without defining them.  This should be an error, but I'm paranoid about
"uses" that end up not actually requiring a definition.  I'll revisit later.

Also, teach IR generation to not set internal linkage on variable
declarations, just for safety's sake.  Doing so produces an invalid module
if the variable is not ultimately defined.

Also, fix several places in the test suite where we were using internal
functions without definitions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126016 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19 02:53:41 +00:00
John McCall 5936e33bf7 Assorted cleanup:
- Have CGM precompute a number of commonly-used types
  - Have CGF copy that during initialization instead of recomputing them
  - Use TBAA info when initializing a parameter variable
  - Refactor the scalar ++/-- code



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125562 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15 09:22:45 +00:00
Rafael Espindola c4850c2aa4 Use raw_svector_ostream in more places in the mangler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125321 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 23:59:36 +00:00
Douglas Gregor a29bf41b8f When IRgen refers to a function declaration that is not a definition,
and we later find the definition, make sure that we add the definition
(not the declaration) to the list of deferred definitions to
emit. Fixes PR8864.

Thanks to Nick Lewycky for testing this	patch out



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125157 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 02:03:05 +00:00
John McCall d16c2cf1ca Reorganize CodeGen{Function,Module} to eliminate the unfortunate
Block{Function,Module} base class.  Minor other refactorings.

Fixed a few address-space bugs while I was there.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125085 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 08:22:06 +00:00
Anders Carlsson 1faa89f9c6 Re-land r124768, with a fix for PR9130.
We now emit everything except unused implicit virtual member functions when building the vtable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124935 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 04:35:53 +00:00
Fariborz Jahanian 53bad4e98e minor refactoring of -fapple-kext stuff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124837 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 00:32:39 +00:00
Fariborz Jahanian fd0f89d3d7 What was I thinking?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124835 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 00:08:13 +00:00
Fariborz Jahanian 142f9e9901 -fapple-kext cannot have 'weak' visibility in this
abi.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124834 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 00:01:24 +00:00
Rafael Espindola 01de7a44ce Revert 124768.
This reopens PR99114, but that one at least can be avoided with an #include.
PR9130 cannot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124780 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 06:30:58 +00:00
Anders Carlsson aedd9d5ad3 Don't try to mark virtual members referenced for classes where the key function
is not defined in the current translation unit. Doing so lead to compile errors
such as PR9114.

Instead, when CodeGen is building the vtable, don't try to emit a definition
for functions that aren't marked used in the current translation unit.
Fixes PR9114.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124768 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 02:08:44 +00:00
Rafael Espindola 071d3af0de Revert 124633. The linker has been told how to merge available_externally.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124651 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 05:45:26 +00:00
Rafael Espindola 517ebc6e13 Set visibility for available_externally globals. This is important for two reasons:
* llvm-link would complains about mismatched visibility
* If we produce a relocation with an available_externally, it is good to know that
it is hidden.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124633 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 00:37:17 +00:00
Anders Carlsson 6d7f8473cd When building with optimizations, emit vtables where the key is not in the
current translation unit as available_externally. 

This helps devirtualize the second example in PR3100, comment 18:

struct S { S() {}; virtual void xyzzy(); };
inline void foo(S *s) { s->xyzzy(); }
void bar() { S s; foo(&s); }

This involved four major changes:

1. In DefineUsedVTables, always mark virtual member functions as referenced for
   non-template classes and class template specializations.
2. In CodeGenVTables::ShouldEmitVTableInThisTU return true if optimizations are
   enabled, even if the key function is not implemented in this translation 
   unit. We don't ever do this for code compiled with -fapple-kext, because we
   don't ever want to devirtualize virtual member function calls in that case.
3. Give the correct linkage for vtables where the key function is not defined.
4. Update the linkage for RTTI structures when necessary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124565 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-30 20:45:54 +00:00
Anders Carlsson c7e98fabd8 Move GetLLVMVisibility to CodeGenModule.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124550 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 20:59:35 +00:00
Anders Carlsson 9a86a137b0 Add RTTIBuilder::GetAddrOfTypeName which uses the newly added CreateOrReplaceCXXRuntimeVariable.
Set the visibility for typeinfo names.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124548 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 20:36:11 +00:00
Anders Carlsson fa2e99f72f Change CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum instead of an "IsForRTTI" flag.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124546 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 20:24:48 +00:00
Anders Carlsson 934176f275 Replace an isa/cast with a dyn_cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124542 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 19:41:00 +00:00
Anders Carlsson 0ffeaad72c Get rid of an unneeded parameter from setGlobalVisibility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124541 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 19:39:23 +00:00
Anders Carlsson 96eaf2992b Use CGM.CreateOrReplaceCXXRuntimeVariable in CGVTables.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124538 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 18:25:07 +00:00
Anders Carlsson 3bd6202ea2 Add a new function, to be used by CGRTTI, CGVTables and CGVTT (which each has their own copy of this code).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124537 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 18:20:20 +00:00
Ken Dyck 3b8037a8c6 Replace a literal '8' with getCharWidth().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124536 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 17:53:12 +00:00
Anders Carlsson c93a776c89 Remove IsDefinition from CodeGenModule::setTypeVisibility; it is always true.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124529 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 05:26:32 +00:00
Anders Carlsson f502d93b0e Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the exception of explicit template instantiations, which have to be weak_odr.
This fixes PR6996.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124089 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24 00:46:19 +00:00
Benjamin Kramer 15f6765f6e Use a FunctionType::get overload that doesn't require an empty vector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124029 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-22 12:15:57 +00:00
Rafael Espindola c532b50285 Add unnamed_addr in CreateRuntimeVariable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123773 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 21:07:57 +00:00
Ken Dyck 06f486ecd0 Replace calls to CharUnits::fromQuantity() with ones to
ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123720 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 02:01:14 +00:00
Rafael Espindola d3d4e1ee39 More unnamed_addr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123681 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 22:22:52 +00:00
Rafael Espindola 803d307a53 merge strings created by
const NSConstantString *appKey =  @"MyApp";

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123680 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 22:11:21 +00:00
Rafael Espindola b266a1fce0 Add unnamed_addr to the special strings created by
__builtin___CFStringMakeConstantString
This fixes PR8993. A darwin expert might want to check that this is safe.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123658 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 16:31:00 +00:00
Peter Collingbourne 1411047788 Move name mangling support from CodeGen to AST. In the
process, perform a number of refactorings:

- Move MiscNameMangler member functions to MangleContext
- Remove GlobalDecl dependency from MangleContext
- Make MangleContext abstract and move Itanium/Microsoft functionality
  to their own classes/files
- Implement ASTContext::createMangleContext and have CodeGen use it

No (intended) functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123386 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 18:57:25 +00:00
Rafael Espindola b1c65ff108 Set unnamed_addr for type infos that we are confortable marking as hidden. I
think it is safe to mark all type infos with unnamed_addr, but I am not sure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123275 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 21:44:37 +00:00
Rafael Espindola c5f657fe30 Add unnamed_addr to constructors and destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123197 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 00:26:26 +00:00
Rafael Espindola 1257bc6ee7 Add unnamed_addr when creating artificial string globals. For example, in
static const char foo[] = "foo";
static const char *bar = "bar";

the global created to hold "bar" will have it, but foo will not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123192 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 22:34:03 +00:00
Benjamin Kramer 9f0c7cc36d Simplify mem{cpy, move, set} creation with IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122634 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-30 00:13:21 +00:00
John McCall bfdcdc8e26 Set the "implicitly inline" bit on a method as soon as we see a definition
within the class.  Teach IR gen to look for function definitions in record
lexical contexts when deciding whether to emit a function whose address    
was taken.  Fixes PR8789.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121833 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 04:00:32 +00:00
Eric Christopher a6cf1e709b Add support for the common and nocommon attributes.
rdar://8560647


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120650 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 02:45:55 +00:00
John McCall 3030eb8259 Simplify the logic for emitting guard variables for template static
data members by delaying the emission of the initializer until after
linkage and visibility have been set on the global.  Also, don't
emit a guard unless the variable actually ends up with vague linkage,
and don't use thread-safe statics in any case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118336 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-06 09:44:32 +00:00
John McCall 112c967bd5 Ensure that static local variables in function templates inherit the
visibility of their function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118065 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 21:04:24 +00:00
John McCall af14603ca6 Better solution: calculate the visibility of functions and variables
independently of whether they're definitions, then teach IR generation to
ignore non-explicit visibility when emitting declarations.  Use this to
make sure that RTTI, vtables, and VTTs get the right visibility.

More of rdar://problem/8613093



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117781 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 11:50:40 +00:00
John McCall 110e8e56af Restore r117644, this time properly ignoring -fvisibility and type visibility
for namespace-scope variable declarations.

Apply visibility in IR gen to variables that are merely declared
and never defined.  We were previously emitting these with default
visibility unless they were declared with private_extern.

Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117729 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 22:22:43 +00:00
Daniel Dunbar 034f55c1eb Revert r117644, "Apply visibility in IR gen to variables that are merely
declared", it breaks things.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117653 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 15:19:36 +00:00
John McCall 87a4ed905e Apply visibility in IR gen to variables that are merely declared
and never defined.  We were previously emitting these with default
visibility unless they were declared with private_extern.

Ignore global visibility settings when computing visibility for
a declaration's context, and key several conditions on whether a
visibility attribute exists anywhere in the hierarchy as opposed
to whether it exists at the current level.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117644 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 07:49:41 +00:00
Fariborz Jahanian 354e712c81 Do the guarding of instantiated static data members
on if its linkage is weak. Currently this is the
case but may change in the future. (part of radar 
8562966).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 16:21:54 +00:00
John McCall 1fb0caaa7b Substantially revise how clang computes the visibility of a declaration to
more closely parallel the computation of linkage.  This gets us to a state
much closer to what gcc emits, modulo bugs, which will undoubtedly arise in
abundance.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 21:05:15 +00:00
Fariborz Jahanian 4c73307c74 This patch implements Next's IRGen for -fconstant-string-class=class-name.
PR6056, //rdar: //8564463



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 17:19:29 +00:00
Dan Gohman 0b5c4fc2ae Experimental TBAA support for enum types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116613 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15 20:23:12 +00:00