summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Support for implementation of property in the case whereFariborz Jahanian2008-12-091-2/+4
| | | | | | | the synthesis is in an implementation of s subclass of a super class where the property has been declared. llvm-svn: 60792
* Fix a serious null termination bug found by David Chisnall!Chris Lattner2008-12-091-1/+1
| | | | llvm-svn: 60778
* If a global var decl has an initializer, make sure to always set its linkage ↵Anders Carlsson2008-12-031-0/+2
| | | | | | to external. llvm-svn: 60462
* Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of Chris Lattner2008-11-241-7/+5
| | | | | | | | | | | uses of getName() with uses of getDeclName(). This upgrades a bunch of diags to take DeclNames instead of std::strings. This also tweaks a couple of diagnostics to be cleaner and changes CheckInitializerTypes/PerformInitializationByConstructor to pass around DeclarationNames instead of std::strings. llvm-svn: 59947
* reapply the (corrected) patch to use the new llvm intrinsics for ↵Chris Lattner2008-11-211-24/+6
| | | | | | memcpy/memmove etc. llvm-svn: 59824
* temporarily revert Sangiv's patch.Chris Lattner2008-11-211-3/+24
| | | | llvm-svn: 59821
* mem[cpy,set,move] intrinsics are now overloaded.Sanjiv Gupta2008-11-211-24/+3
| | | | llvm-svn: 59806
* Pointer width for PIC16 is 16 bits. Modify getMemCpy, getMemMove and ↵Sanjiv Gupta2008-11-191-0/+3
| | | | | | getMemSet accordingly. llvm-svn: 59613
* Discard unused runtime function declarations (for readability).Daniel Dunbar2008-11-191-0/+6
| | | | llvm-svn: 59594
* This reworks some of the Diagnostic interfaces a bit to change how diagnosticsChris Lattner2008-11-181-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are formed. In particular, a diagnostic with all its strings and ranges is now packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a ton of random stuff. This has the benefit of simplifying the interface, making it more extensible, and allowing us to do more checking for things like access past the end of the various arrays passed in. In addition to introducing DiagnosticInfo, this also substantially changes how Diagnostic::Report works. Instead of being passed in all of the info required to issue a diagnostic, Report now takes only the required info (a location and ID) and returns a fresh DiagnosticInfo *by value*. The caller is then free to stuff strings and ranges into the DiagnosticInfo with the << operator. When the dtor runs on the DiagnosticInfo object (which should happen at the end of the statement), the diagnostic is actually emitted with all of the accumulated information. This is a somewhat tricky dance, but it means that the accumulated DiagnosticInfo is allowed to keep pointers to other expression temporaries without those pointers getting invalidated. This is just the minimal change to get this stuff working, but this will allow us to eliminate the zillions of variant "Diag" methods scattered throughout (e.g.) sema. For example, instead of calling: Diag(BuiltinLoc, diag::err_overload_no_match, typeNames, SourceRange(BuiltinLoc, RParenLoc)); We will soon be able to just do: Diag(BuiltinLoc, diag::err_overload_no_match) << typeNames << SourceRange(BuiltinLoc, RParenLoc)); This scales better to support arbitrary types being passed in (not just strings) in a type-safe way. Go operator overloading?! llvm-svn: 59502
* Change the diagnostics interface to take an array of pointers to Chris Lattner2008-11-181-3/+4
| | | | | | | | strings instead of array of strings. This reduces string copying in some not-very-important cases, but paves the way for future improvements. llvm-svn: 59494
* Handle padding in the constant CFString struct. Fixes PR3046.Anders Carlsson2008-11-151-8/+46
| | | | llvm-svn: 59372
* Codegen support for fastcall & stdcall CC.Anton Korobeynikov2008-11-111-1/+4
| | | | | | Patch by Ilya Okonsky! llvm-svn: 59080
* LinkageSpecDecl is c++ specific, move it to DeclCXXChris Lattner2008-11-041-0/+1
| | | | llvm-svn: 58704
* Don't run the verifier as part of IRgen, this is now down (per module)Daniel Dunbar2008-10-281-6/+0
| | | | | | in the driver (this means we no longer run the verifier per function, however). llvm-svn: 58307
* Add attribute always_inline support.Daniel Dunbar2008-10-281-0/+3
| | | | llvm-svn: 58304
* Add option argument to GetAddrOfConstantString to use for name ofDaniel Dunbar2008-10-171-7/+12
| | | | | | | (first) global holding the string. - No functionality change. llvm-svn: 57736
* Change CGDebugInfo::setLocation to just ignore invalid locations. ThisDaniel Dunbar2008-10-171-2/+1
| | | | | | | | | simplifies clients. Also, add assert that RegionStack is empty when the CGDebugInfo is destroyed. llvm-svn: 57684
* Add simple interface for protecting runtime functions from nameDaniel Dunbar2008-10-011-0/+43
| | | | | | | | | | | | | | | | | collisions. - Provide CodeGenModule::CreateRuntimeFunction which guarantees that the function it creates will have the provided name in the final module. This allows the runtime to have its functions protected from declarations of the same name in the source code. - One could argue that this is a reason to abuse the llvm::Module namespace for dealing with function redeclarations. However, that approach seems conceptually flawed to me. This one also happens to be somewhat more efficient. No functionality change. llvm-svn: 56899
* Prefer llvm::Function::addFnAttr(...) to F->addAttribute(~0, ...).Daniel Dunbar2008-09-271-1/+1
| | | | llvm-svn: 56753
* Now Attributes are divided in three groupsDevang Patel2008-09-261-1/+1
| | | | | | | | | | | - return attributes - inreg, zext and sext - parameter attributes - function attributes - nounwind, readonly, readnone, noreturn Return attributes use 0 as the index. Function attributes use ~0U as the index. llvm-svn: 56705
* Large mechanical patch.Devang Patel2008-09-251-9/+9
| | | | | | | | | | | | | s/ParamAttr/Attribute/g s/PAList/AttrList/g s/FnAttributeWithIndex/AttributeWithIndex/g s/FnAttr/Attribute/g This sets the stage - to implement function notes as function attributes and - to distinguish between function attributes and return value attributes. llvm-svn: 56623
* Move FunctionType conversion into CGCall.cpp:Daniel Dunbar2008-09-101-7/+8
| | | | | | | | | | | | | - Added CodeGenTypes::GetFunctionType, taking a CGFunctionInfo. - Updated Obj-C runtimes to use this instead of rolling the llvm::FunctionType by hand. - Killed CodeGenTypes::{ConvertReturnType, DecodeArgumentTypes}. Add ABIArgInfo class to encapsulate ABI decision of how to lower types to LLVM. - Will move to target sometime soon. llvm-svn: 56047
* Tweak CGCall functions again:Daniel Dunbar2008-09-101-5/+5
| | | | | | | | - Realized these functions will eventually need access to more data, moved to CodeGenModule. Eventually they should probably live together in some other helper class. llvm-svn: 56039
* Tweak CGCall functions:Daniel Dunbar2008-09-101-1/+4
| | | | | | | | - Move actual param attr list creation to CodeGenFunction::ConstructParamAttrList. - Make ReturnTypeUsesSret static. llvm-svn: 56038
* Fix a number of issues w.r.t. emission of global for functions andDaniel Dunbar2008-09-081-63/+109
| | | | | | | | | | | | | | aliases. - Attributes specific to a definition are only set when the definition is seen. - Alias generation is delayed until the end of the module; necessary since the alias may reference forward. - Fixes: PR2743, <rdr://6140807&6094512> - Improves: <rdr://6095112> (added XFAIL) Also, print module on verification failures. llvm-svn: 55966
* Refactor parameter attribute handling:Daniel Dunbar2008-09-081-77/+27
| | | | | | | | | - Add CGCall.h for dealing with ABI issues related to calls. - Add CGFunctionInfo and CGCallInfo for capturing ABI relevant information about functions and calls. - Isolate LLVM parameter attribute handling inside CGCall.cpp llvm-svn: 55963
* Set sext/zext on function result.Daniel Dunbar2008-09-051-5/+12
| | | | | | - <rdar://problem/6156739> llvm-svn: 55815
* Set function attributes (sext, zext, etc.) on Objective-C methods.Daniel Dunbar2008-09-041-29/+62
| | | | llvm-svn: 55812
* Avoid superfluous errors regarding variable-length arrays (casts).Daniel Dunbar2008-09-041-2/+8
| | | | llvm-svn: 55759
* codegen constant data as such. add QualType::isConstant()Nuno Lopes2008-09-011-0/+1
| | | | llvm-svn: 55603
* Downgrade a number of FIXME asserts to ErrorUnsupported.Daniel Dunbar2008-08-291-3/+7
| | | | | | - Notably VLAs llvm-svn: 55544
* Objective-C @synthesize support.Daniel Dunbar2008-08-261-6/+34
| | | | | | | | | | | - Only supports simple assignment and atomic semantics are ignored. - Not quite usable yet because the methods do not actually get added to the class metadata. - Added ObjCPropertyDecl::getSetterKind (one of Assign, Copy, Retain). - Rearrange CodeGenFunction so synthesis can reuse function prolog / epilog code. llvm-svn: 55365
* Use DenseMap on IdentifierInfo instead of StringMap.Daniel Dunbar2008-08-251-5/+5
| | | | llvm-svn: 55303
* NeXT: Clean up constant CFString handling.Daniel Dunbar2008-08-231-17/+26
| | | | | | | | - Use CodeGenModule::GetAddrOfConstantCFString Some tweaks of CodeGenModule::GetAddrOfConstantCFString llvm-svn: 55243
* Add NeXT runtime support for generating methods.Daniel Dunbar2008-08-161-6/+1
| | | | | | | | | | | | | 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. llvm-svn: 54838
* Change WarnUnsupported to ErrorUnsupported (in name and in practice).Daniel Dunbar2008-08-161-7/+7
| | | | | | | - We are beyond the point where this shows up often and when it does generating miscompiled files is bad. llvm-svn: 54836
* Clean up CodeGenModule interface.Daniel Dunbar2008-08-151-24/+91
| | | | | | | | | | | - Add CodeGenModule::EmitTopLevelDecl which uses switch on kind instead of ugly & slow dyn_cast chains. - Drop some simple forwarding methods into the ObjC runtime. - Privatize appropriate methods. llvm-svn: 54827
* Change CGObjCRuntime methods to take appropriate clang Decls.Daniel Dunbar2008-08-151-118/+5
| | | | | | | | | - This is in prep for implementation class support for the NeXT runtime, for which the existing methods don't provide enough information (and additionally make too many assumptions about how things should be emitted). llvm-svn: 54824
* Infinite loops considered harmful. Daniel Dunbar2008-08-151-1/+1
| | | | | | - Thanks Thomas llvm-svn: 54818
* Add GetAddrOfConstantCString methodDaniel Dunbar2008-08-131-12/+34
| | | | | | | | | | | | | | | | | | - Returns addr of constant for argument + '\0'. - I couldn't think of a better name. - Move appropriate users of GetAddrOfConstantString to this. Rename getStringForStringLiteral to GetStringForStringLiteral. Add GetAddrOfConstantStringFromLiteral - This combines GetAddrOfConstantString and GetStringForStringLiteral. This method can be, but is not yet, more efficient. Change GetAddrOfConstantString to not add terminating '\0' - <rdar://problem/6140956> llvm-svn: 54768
* Change ObjCRuntime GenerateProtocol[Ref] methods to takeDaniel Dunbar2008-08-131-27/+2
| | | | | | | | | | | ObjCProtocolDecl directly. Implement CodeGen support for forward protocol decls (no-ops are so nice to implement). Also moved CGObjCRuntime.h out of CodeGenModule.h llvm-svn: 54709
* Fix compilation warning with help from David Chisnall.Mike Stump2008-08-111-1/+4
| | | | llvm-svn: 54654
* Add LangOptions::NeXTRuntime.Daniel Dunbar2008-08-111-4/+2
| | | | | | | | | - Wired to -fnext-runtime and -fgnu-runtime options. - Defaults to GNU, no autoselection for NeXT. Emit NeXT OBJC_IMAGE_INFO marker. llvm-svn: 54651
* Change CodeGenModule to only create ObjC runtime for ObjC filesDaniel Dunbar2008-08-111-9/+12
| | | | | | | - Changed CodeGenModule::getObjCRuntime to return reference. - Added CodeGenModule::hasObjCRuntime predicate. llvm-svn: 54645
* Add -fexceptions to DriverDaniel Dunbar2008-08-111-0/+6
| | | | | | | | | | | - Maps to LangOptions.Exceptions - Currently always off, should autoselect based on language. Update CodeGen to set unwind attribute on functions definitions based on LangOptions.Exceptions. - Still need to set attributes appropriately on calls. llvm-svn: 54643
* More #include cleaningDaniel Dunbar2008-08-111-5/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* More #include cleaningDaniel Dunbar2008-08-111-0/+1
| | | | | | | | - Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h - Moved Sema::getCurMethodDecl() out of line (dependent on ObjCMethodDecl via dyn_cast). llvm-svn: 54629
* Add dummy Mac Objective-C runtime interface.Daniel Dunbar2008-08-111-2/+7
| | | | | | - Not currently accessible and completely non-functional. llvm-svn: 54624
OpenPOWER on IntegriCloud