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

318 Коммитов

Автор SHA1 Сообщение Дата
Daniel Dunbar a2b6b76f4b Suppress build warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 22:32:15 +00:00
Mike Stump 1eb4433ac4 Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Anders Carlsson 9ad5513b0f Make BuildByRefType take a ValueDecl instead of a QualType and an alignment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81315 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 02:51:03 +00:00
Anders Carlsson 622f9dc76b Remove an ErrorUnsupported call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79261 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-17 18:24:57 +00:00
Anders Carlsson 14c5cbf59c Add an IsInitializer flag to EmitAnyExpr. This is used to prevent temporaries from being destroyed when they're bound to a reference variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79179 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-16 07:36:22 +00:00
Owen Anderson 0032b2781b Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 21:57:51 +00:00
Anders Carlsson 3b2e16b3d2 Refactor some code and implement support for global destructors for static variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78507 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 21:45:14 +00:00
Owen Anderson 47a434ff3d Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 23:18:46 +00:00
Fariborz Jahanian 667f36accd assert(nyi) on attempt to destruct an array of objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77993 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-03 20:51:29 +00:00
Fariborz Jahanian 6ca0b32227 ir-gen for destructor calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-03 20:20:07 +00:00
Anders Carlsson b0d0ea0421 use CodeGenModule::EmitNullConstant in a couple of places.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 21:18:22 +00:00
Owen Anderson c9c88b4159 Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 20:28:54 +00:00
Mike Stump b3589f44c5 Canonicalize else spacing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77629 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 22:28:39 +00:00
Owen Anderson 96e0fc726c Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77514 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 22:16:19 +00:00
Owen Anderson 3c4972def9 Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 18:54:39 +00:00
Daniel Dunbar 0d9c54cc62 Switch to using llvm::Value::getName()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 08:32:30 +00:00
Owen Anderson 4a28d5deeb Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77012 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 23:12:58 +00:00
Daniel Dunbar 25b6ebf0f8 Fix thinko.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-19 07:03:11 +00:00
Daniel Dunbar d286f05f12 Avoid generation of dead code in a few more situations.
- Emit variable declarations as "simple", we want to avoid forcing the creation
   of a dummy basic block, but still need to make the variable available for
   later use.

 - With that, we can now skip IRgen for other unreachable statements (which
   don't define a label).

 - Anders, I added two fixmes on calls to EmitVLASize, can you check them?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76361 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-19 06:58:07 +00:00
Owen Anderson a1cf15f468 Update for LLVM API change, and contextify a bunch of related stuff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 23:10:40 +00:00
Owen Anderson 69243825cb Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13 04:10:07 +00:00
Owen Anderson 1c431b323d Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 19:05:04 +00:00
Owen Anderson c14f0d2302 Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 01:29:18 +00:00
Argyrios Kyrtzidis 40b598eea1 Remove the ASTContext parameter from the attribute-related methods of Decl.
The implementations of these methods can Use Decl::getASTContext() to get the ASTContext.

This commit touches a lot of files since call sites for these methods are everywhere.
I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 02:34:44 +00:00
Devang Patel bd0fec9250 typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74305 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 18:33:42 +00:00
Douglas Gregor 68584ed35a Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:11:24 +00:00
Mike Stump 3899a7fb9c As an optimization, we maintain a cache of generated
___Block_byref_id_object_dispose and ___Block_byref_id_object_copy
functions so that we can simply reuse instead of creating a new one.
Additionally, add an assert to ensure no one yet tries to align a
__block variable beyond the alignment of a pointer as the codegen is
incomplete.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 23:26:36 +00:00
Eli Friedman 4a18784dea Add IRGen support for local variables of reference type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 05:39:06 +00:00
Sanjiv Gupta 4381d4b83c Targets like PIC16 generate Static decls for automatic variables, emit the appropriate debug descriptor as well in that case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72261 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 13:54:25 +00:00
Anders Carlsson b4aa4664ec Pass the destination QualType to EmitStoreOfScalar. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 18:50:41 +00:00
Anders Carlsson cc0e354c92 Since we miscompile many cases when declaring a variable with a reference type, make them unsupported for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 19:55:29 +00:00
Mike Stump fd0e628aa8 Fixup debug information for the location information for __block
variables.  For this to work, the backend needs to handle more complex
forms for locations.

A typical utterance would be:

        %forwarding = getelementptr %0* %use_by_ref, i32 0, i32 1               ; <i8**> [#uses=1]
        %0 = load i8** %forwarding              ; <i8*> [#uses=1]
        %1 = bitcast i8* %0 to %0*              ; <%0*> [#uses=1]
        %x = getelementptr %0* %1, i32 0, i32 4         ; <i32*> [#uses=1]
        %2 = bitcast i32* %x to { }*            ; <{ }*> [#uses=1]
        call void @llvm.dbg.declare({ }* %2, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*))

Presently when selection finds something it doesn't understand, it
just avoids generating any information, which is safe, just
incomplete.  Radar 6867696


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 00:29:54 +00:00
Chris Lattner b4880bab7f push GlobalDecl through enough of the CodeGenModule interfaces
to allow us to support generation of deferred ctors/dtors.
It looks like codegen isn't emitting a call to the dtor in 
member-functions.cpp:test2, but when it does, its body should
get emitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 21:21:08 +00:00
Anders Carlsson cabec03f5d When calling the cleanup function specified by __attribute__((cleanup)), make sure to bitcast the argument so it has the same type as the first argument of the cleanup function. Fixes <rdar://problem/6827047>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 00:34:20 +00:00
Eli Friedman c62aad8f45 PR3247: Handle a couple of cases where we weren't emitting VLA sizes (and
subsequently crashed).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69567 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 03:54:15 +00:00
Eli Friedman 56ebe5082d PR3853: Add CodeGen support for __thread.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69545 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 21:05:03 +00:00
Daniel Dunbar 5466c7b0ca Audit __private_extern__ handling.
- Exposed quite a few Sema issues and a CodeGen crash.

 - See FIXMEs in test case, and in SemaDecl.cpp (PR3983).

I'm skeptical that __private_extern__ should actually be a storage
class value. I think that __private_extern__ basically amounts to
  extern A __attribute__((visibility("hidden")))
and would be better off handled (a) as that, or (b) with an extra bit
in the VarDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 02:25:56 +00:00
Daniel Dunbar b11fa0d25d Update to use hasAttr() instead of getAttr().
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 21:08:27 +00:00
Chris Lattner 11c7d32ac2 Make messages consistent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68756 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:37:08 +00:00
Chris Lattner b75863d53b reject codegen of __thread variables as unimplemented, rdar://6775265
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68755 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:35:59 +00:00
Anders Carlsson e9352cc981 Add a destination type argument to EmitConstantExpr. This will be used for when the destination has a reference type. (No functionality change yet)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68593 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 04:48:15 +00:00
Sanjiv Gupta 08ae3de4c9 Don't use static globals for params as it confuses the optimzer that their values are never being used in the function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 17:51:27 +00:00
Anders Carlsson 17c35acad1 When compiling C++ code, always mangle the names of static block var decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68280 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 03:29:47 +00:00
Fariborz Jahanian ba8639dd25 Code gen does not yet supports __asm__ on a variable
declaration. Reject it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 20:32:06 +00:00
Chris Lattner 3403084886 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
2009-03-22 00:32:22 +00:00
Chris Lattner f1466848dc 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
2009-03-22 00:24:14 +00:00
Mike Stump a8b60c9bd8 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
2009-03-21 21:00:35 +00:00
Mike Stump 6cc88f78fd 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
2009-03-20 21:53:12 +00:00
Sanjiv Gupta 863cffbaf6 Mangle param names with .arg. only.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 18:09:52 +00:00
Mike Stump f4bc312fc7 Remove some FIXMEs for block literals that should be close to working.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 06:04:31 +00:00
Mike Stump ee09422b01 Complete __Block_byref_id_object_copy cogegen for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 06:12:24 +00:00
Mike Stump 1851b68aaa Finish off __Block_byref_id_object_dispose codegen for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 04:53:30 +00:00
Mike Stump 416d92ef0b Remove extra arg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66243 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 02:45:21 +00:00
Mike Stump 45031c08c6 More codegen support for the copy/dispose helpers for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 02:29:21 +00:00
Mike Stump a4f668f3b7 Framework for codegen for copy/dispose helpers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 01:33:24 +00:00
Daniel Dunbar fe34557245 Don't mangle names of local variables.
- For one thing, this adds unneeded overhead; for another, this
   routine can be used to emit unnamed decls which we shouldn't try to
   mangle.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66212 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 22:59:19 +00:00
Mike Stump 00470a1c4c prep work for copy/destroy helpers for block literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 08:32:30 +00:00
Mike Stump d9e0fae40a Avoid dispose calls when only doing gc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66126 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 02:34:38 +00:00
Mike Stump 797b632757 Add codegen support for __block variables to call _Block_object_dispose as necessary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 01:23:13 +00:00
Eli Friedman a3460ac8a1 Continuation of PR3687: fix more places to use the right type for
booleans.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66012 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 04:25:14 +00:00
Eli Friedman 074dda6d81 Comment fix: change a question to an answer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66010 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 04:22:58 +00:00
Mike Stump dab514fc30 Improved ABI compliance for __block variables. No testcases yet as we
still give an unsupported error for them due to the fact this is a
work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66007 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 03:23:46 +00:00
Mike Stump a99038c075 First cut CodeGen support for __block variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65688 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 09:07:16 +00:00
Daniel Dunbar e5731f8149 Allow constant initializers to reference their defining decl.
- PR3662.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65472 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 20:08:33 +00:00
Daniel Dunbar a985b31fc3 Fold GeneraticStaticBlockVarDecl into callers.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65470 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 19:45:19 +00:00
Daniel Dunbar 0096acf421 Pull COdeGenFunction::CreateStaticBlockVarDecl (just for creating the
global variable) out of GenerateStaticBlockVarDecl. 
 - No intended functionality change.
 - Prep for some mild cleanups and PR3662.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65466 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 19:24:29 +00:00
Eli Friedman 9c2f06b373 Last part of PR3254: use the same alignment computation in Sema and
CodeGen.  I'm not sure whether this actually makes any visible 
difference, but it's better to be consistent anyway.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-22 03:23:43 +00:00
Mike Stump 4451bd943c Fix spacing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 00:19:45 +00:00
Douglas Gregor 6ec3668a26 Address Chris's comments regarding C++ name mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64984 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 23:53:56 +00:00
Daniel Dunbar d60f2fbf69 Change EmitConstantExpr to allow failure.
IRgen no longer relies on isConstantInitializer, instead we just try
to emit the constant. If that fails then in C we emit an error
unsupported (this occurs when Sema accepted something that it doesn't
know how to fold, and IRgen doesn't know how to emit) and in C++ we
emit a guarded initializer.

This ends up handling a few more cases, because IRgen was actually
able to emit some of the constants Sema accepts but can't Evaluate().
For example, PR3398.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64780 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 18:43:32 +00:00
Daniel Dunbar e4c9238795 Set constant bit on static block vars as well. Patch by Anders Johnson!q
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64502 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 22:58:39 +00:00
Daniel Dunbar 5c61d97ad4 IRgen support for attribute used.
- PR3566


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 22:08:43 +00:00
Anders Carlsson e896d98548 Add CodeGen support for the nodebug attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64445 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 08:11:52 +00:00
Douglas Gregor 5f2bfd4811 Add basic support for C++ name mangling according to the Itanium C++
ABI to the CodeGen library. Since C++ code-generation is so
incomplete, we can't exercise much of this mangling code. However, a
few smoke tests show that it's doing the same thing as GCC. When C++
codegen matures, we'll extend the ABI tester to verify name-mangling
as well, and complete the implementation here.

At this point, the major client of name mangling is in the uses of the
new "overloadable" attribute in C, which allows overloading. Any
"overloadable" function in C (or in an extern "C" block in C++) will
be mangled the same way that the corresponding C++ function would be
mangled.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 00:10:09 +00:00
Daniel Dunbar 30510abee6 Honor attribute section on static block var decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64411 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 23:32:54 +00:00
Sanjiv Gupta 193cdbe73e Function parameters for PIC16 are like local variables. So use the keyword ".auto." to mangle their names. The working of PIC16AsmPrinter relies on that keyword currently.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 04:17:25 +00:00
Anders Carlsson 5ecb1b9377 Use the new cleanup infrastructure for VLAs. The next iteration of patches will remove the old Obj-C EH cleanup code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64161 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-09 20:41:50 +00:00
Anders Carlsson 69c68b7454 Emit a cleanup block for the cleanup attribute
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64052 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 23:51:38 +00:00
Mike Stump 36a2ada69f Fixup goto codegen in and around VLAs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64014 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 12:52:26 +00:00
Anders Carlsson 96f214776c Follow Eli's advice and store the VLA size with the native size_t type. Fixes PR3491.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63879 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 19:43:10 +00:00
Sanjiv Gupta 45206ecf70 Targets that don't have stack use global address space for parameters.
Specify external linkage for such globals so that llvm optimizer do
not assume there values initialized as zero.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63636 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 18:07:49 +00:00
Eli Friedman c9e8f60678 Rename Expr::isConstantExpr to Expr::isConstantInitializer; this more
accurately states what the function is trying to do and how it is 
different from Expr::isEvaluatable.  Also get rid of a parameter that is both 
unused and inaccurate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62951 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-25 02:32:41 +00:00
Chris Lattner f7cf85b330 more SourceLocation lexicon change: instead of referring to the
"logical" location, refer to the "instantiation" location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 07:36:28 +00:00
Eli Friedman 8f39f5e96c Make VLAs usable, and make basic usage work correctly. Also, add a
simple test that actually does VLA codegen.

Note that despite the fact that the alloca isn't in the entry block, it 
should dominate all uses; this is guaranteed by the restrictions on goto 
into VLA scope in C99.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-20 23:11:59 +00:00
Anders Carlsson fcdbb93749 Handle typedefs to VLAs (Emit the size expr when we encounter the typedef
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61290 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-20 21:51:53 +00:00
Anders Carlsson 60d3541366 Change EmitVLASize to take a QualType that must be a variably modified type.
Emit the size even if the declared type is a variably modified type. This lets us handle

void f(int n) {
  int (*a)[n];
  
  printf("size: %d\n", sizeof(*a));
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61285 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-20 20:46:34 +00:00
Anders Carlsson f666b7780d Split up emitting of VLA sizes and getting the size of a VLA.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61284 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-20 20:27:15 +00:00
Anders Carlsson eb91f0ecb4 Add some ErrorUnsupported calls and turn on VLA codegen again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61283 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-20 19:33:21 +00:00
Chris Lattner 71e38c4860 disable Anders' recent VLA patch, this fixes PR3209.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60989 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 18:58:59 +00:00
Anders Carlsson 5d46315ca3 Implement allocation and sizeof VLAs. This is very basic for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 07:38:43 +00:00
Chris Lattner 39f34e97d6 Migrate some stuff from NamedDecl::getName() to
NamedDecl::getNameAsString() to make it more explicit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 04:00:27 +00:00
Chris Lattner 8ec03f58c3 Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier.  Update callers to do the right
thing and avoid this method in unsafe cases.  This also fixes an objc
warning that was missing a space, and migrates a couple more to taking
IdentifierInfo and QualTypes instead of std::strings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59936 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:54:41 +00:00
Douglas Gregor 2e1cd4264d Introduction the DeclarationName class, as a single, general method of
representing the names of declarations in the C family of
languages. DeclarationName is used in NamedDecl to store the name of
the declaration (naturally), and ObjCMethodDecl is now a NamedDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59441 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 14:58:09 +00:00
Chris Lattner 9c85ba33ac reimplement debug info generation in terms of DebugInfo.h instead of
using MachineModuleInfo.  This runs at about the same speed as the old
code, but fixes a bunch of bugs and is simpler and shorter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58971 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 06:08:34 +00:00
Sanjiv Gupta 31fc07df7f Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wchar
etc more generic. For some targets, long may not be equal to pointer size. For
example: PIC16 has int as i16, ptr as i16 but long as i32.

Also fixed a few build warnings in assert() functions in CFRefCount.cpp,
CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 09:52:39 +00:00
Daniel Dunbar 66031a5594 Change CGDebugInfo::setLocation to just ignore invalid locations. This
simplifies clients.

Also, add assert that RegionStack is empty when the CGDebugInfo is
destroyed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 16:15:48 +00:00
Argyrios Kyrtzidis 35bc0821c4 Simplify handling of struct/union/class tags.
Instead of using two sets of Decl kinds (Struct/Union/Class and CXXStruct/CXXUnion/CXXClass), use one 'Record' and one 'CXXRecord' Decl kind and make tag kind a property of TagDecl.
Cleans up the code a bit and better reflects that Decl class structure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 00:42:39 +00:00
Daniel Dunbar 5627377df5 Add support for ABIArgInfo::Expand
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 00:51:38 +00:00
Daniel Dunbar 662174c82e Downgrade a number of FIXME asserts to ErrorUnsupported.
- Notably VLAs


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-29 17:28:43 +00:00
Anders Carlsson 19567ee431 Handle static variables inside obj-c methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 01:38:19 +00:00
Anders Carlsson e1b29efab3 Add preliminary (and probably broken) codegen support for C++ static initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 16:00:37 +00:00
Daniel Dunbar b7ec246872 Add NeXT runtime support for generating methods.
Change CodeGenFunction::EmitParmDecl to take either a ParmVarDecl or an
  ImplicitParamDecl.

Drop hasAggregateLLVMType from CodeGenModule.cpp (use version in
  CodeGenFunction).

Change the Objective-C method generation to use EmitParmDecl for
  implicit parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54838 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 03:19:19 +00:00
Daniel Dunbar c4a1dea2dc More #include cleaning
- Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h
 - Moved Sema::getCurMethodDecl() out of line (dependent on
   ObjCMethodDecl via dyn_cast).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 05:35:13 +00:00
Daniel Dunbar de7fb8413b More #include cleaning
- Remove internal uses of AST.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54628 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 05:00:27 +00:00
Eli Friedman 1e692ace08 Basic support for volatile loads and stores. Stores the volatile
qualifier in the lvalue, and changes lvalue loads/stores to honor 
the volatile flag.  Places which need some further attention are marked 
with FIXMEs.

Patch by Cédric Venet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 23:01:12 +00:00
Argyrios Kyrtzidis a7a6dc01b7 Make CodeGenFunction::EmitDecl() recognise CXXClass/CXXStruct/CXXUnion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52162 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 23:42:47 +00:00
Eli Friedman 2659052c5d Don't crash emitting an initializer for a static local with union type.
This fix just makes sure to construct the global with the appropriate 
type, and fixes up the one user this affects to compensate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 01:23:18 +00:00
Sanjiv Gupta 686226b538 Emit debug information for global and static variables when -g is specified.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51993 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 08:59:10 +00:00
Eli Friedman 77eedd6fce Calculate alignment for local variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51826 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 21:20:41 +00:00
Sanjiv Gupta cc9b16394f Emit parameter and local variable debug information with -g.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51765 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 10:30:31 +00:00
Dan Gohman d79a726dc3 Change uses of llvm::Type::isFirstClassType to use the new
llvm::Type::isSingleValueType. Currently these two functions have
the same behavior, but soon isFirstClassType will return true for
struct and array types.

Clang may some day want to use of isFirstClassType for some of
these some day as an optimization, but it'll require some
consideration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51446 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 22:12:56 +00:00
Chris Lattner 2621fd1d6d Add basic support for the pic-* target triples and add support for
targets that do not support recursion (and thus codegen stack variables
as globals).

Patch contributed by Alireza Moshtaghi!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50844 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 05:58:21 +00:00
Nate Begeman 8bd4afeb87 Generate code for annotation attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 04:17:09 +00:00
Steve Naroff 248a753f6b Remove FileVarDecl and BlockVarDecl. They are replaced by VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl().
This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 22:42:06 +00:00
Chris Lattner 8bcfc5bef4 remove the Decl::getCanonicalType() method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49295 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 23:10:54 +00:00
Chris Lattner 9b2dc28717 Since isComplexType() no longer returns true for _Complex integers, the code
generator needs to call isAnyComplexType().  This fixes PR1960.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49220 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 16:54:41 +00:00
Chris Lattner c8aa5f1f26 Codegen assignment to self correctly, patch by David Chisnall!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49201 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 04:07:35 +00:00
Chris Lattner bda0b626e7 Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it.  This follows the main
llvm tree, and allows the libraries to be built in parallel.  The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in.  This speeds
up parallel builds, particularly incremental ones.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-15 23:59:48 +00:00