summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Make it possible for builtins to expression FILE* arguments, so thatDouglas Gregor2009-02-141-1/+4
| | | | | | | | we can define builtins such as fprintf, vfprintf, and __builtin___fprintf_chk. Give a nice error message when we need to implicitly declare a function like fprintf. llvm-svn: 64526
* Implicitly declare certain C library functions (malloc, strcpy, memmove,Douglas Gregor2009-02-131-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | etc.) when we perform name lookup on them. This ensures that we produce the correct signature for these functions, which has two practical impacts: 1) When we're supporting the "implicit function declaration" feature of C99, these functions will be implicitly declared with the right signature rather than as a function returning "int" with no prototype. See PR3541 for the reason why this is important (hint: GCC always predeclares these functions). 2) If users attempt to redeclare one of these library functions with an incompatible signature, we produce a hard error. This patch does a little bit of work to give reasonable error messages. For example, when we hit case #1 we complain that we're implicitly declaring this function with a specific signature, and then we give a note that asks the user to include the appropriate header (e.g., "please include <stdlib.h> or explicitly declare 'malloc'"). In case #2, we show the type of the implicit builtin that was incorrectly declared, so the user can see the problem. We could do better here: for example, when displaying this latter error message we say something like: 'strcpy' was implicitly declared here with type 'char *(char *, char const *)' but we should really print out a fake code line showing the declaration, like this: 'strcpy' was implicitly declared here as: char *strcpy(char *, char const *) This would also be good for printing built-in candidates with C++ operator overloading. The set of C library functions supported by this patch includes all functions from the C99 specification's <stdlib.h> and <string.h> that (a) are predefined by GCC and (b) have signatures that could cause codegen issues if they are treated as functions with no prototype returning and int. Future work could extend this set of functions to other C library functions that we know about. llvm-svn: 64504
* Simplify predicate.Daniel Dunbar2009-02-131-3/+1
| | | | llvm-svn: 64500
* IRgen support for attribute used.Daniel Dunbar2009-02-131-7/+19
| | | | | | - PR3566 llvm-svn: 64492
* Pull MayDeferGeneration out of EmitGlobal.Daniel Dunbar2009-02-131-16/+34
| | | | | | | | - Fix emission of static functions with constructor attribute while I was here. <rdar://problem/6140899> [codegen] "static" and attribute-constructor interact poorly llvm-svn: 64488
* Rename EmitStatics (etc) to EmitDeferred; provide basic infrastructureDaniel Dunbar2009-02-131-13/+36
| | | | | | | for attribute used support. - No functionality change. llvm-svn: 64487
* Let the backend unique these.Mike Stump2009-02-131-1/+0
| | | | llvm-svn: 64486
* Move DescriptorUniqueCount into CGM.Mike Stump2009-02-131-0/+1
| | | | llvm-svn: 64481
* Move GlobalUniqueCount up into CGM.Mike Stump2009-02-131-1/+3
| | | | llvm-svn: 64473
* Move GenericBlockLiteralType into CGM.Mike Stump2009-02-131-1/+1
| | | | llvm-svn: 64452
* Move BlockDescriptorType into CGM.Mike Stump2009-02-131-1/+2
| | | | llvm-svn: 64451
* Add basic support for C++ name mangling according to the Itanium C++Douglas Gregor2009-02-131-14/+40
| | | | | | | | | | | | | | | | 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. llvm-svn: 64413
* Add a very basic implemenation of global blocks. This needs to be cleaned up.Anders Carlsson2009-02-121-2/+1
| | | | llvm-svn: 64387
* Support __attribute__(section(<name>))Daniel Dunbar2009-02-121-0/+6
| | | | llvm-svn: 64380
* Use 'compile' instead of 'codegen' when reporting error to user.Daniel Dunbar2009-02-061-2/+2
| | | | llvm-svn: 63952
* Add -femit-all-decls codegen option.Daniel Dunbar2009-02-041-1/+1
| | | | | | | | - Emits all declarations, even unused (static) ones. - Useful when doing minimization of codegen problems (otherwise problems localized to a static function aren't minimized well). llvm-svn: 63776
* Thread CGFunctionInfo construction through CodeGenTypes.Daniel Dunbar2009-02-021-2/+2
| | | | | | - Inefficient & leaks memory currently, will be cleaned up subsequently. llvm-svn: 63567
* More ABI API cleanup.Daniel Dunbar2009-02-021-1/+1
| | | | | | | - Lift CGFunctionInfo creation above ReturnTypeUsesSret and EmitFunction{Epi,Pro}log. llvm-svn: 63553
* Kill off CGCallInfo, always use CGFunctionInfo for encapsulatingDaniel Dunbar2009-01-311-2/+1
| | | | | | function/call info. llvm-svn: 63466
* Use NonFragileABI as name of new Next abi. More comments Fariborz Jahanian2009-01-221-1/+1
| | | | | | for the new meta-data. llvm-svn: 62806
* Refactoring ObjC Next's runtime classes in preparation forFariborz Jahanian2009-01-211-1/+2
| | | | | | the new ObjC's abi. llvm-svn: 62721
* more SourceLocation lexicon change: instead of referring to theChris Lattner2009-01-161-1/+1
| | | | | | "logical" location, refer to the "instantiation" location. llvm-svn: 62316
* Bug fix, __private_extern__ globals were always introducing a definition.Daniel Dunbar2009-01-131-10/+31
| | | | llvm-svn: 62139
* Objc's compatibility-alias semantics and codeFariborz Jahanian2009-01-081-1/+1
| | | | | | gen issue fix. llvm-svn: 61901
* Silence a GCC warningSebastian Redl2009-01-051-1/+2
| | | | llvm-svn: 61747
* Fix the bug that would cause Python to crash at startup.Anders Carlsson2009-01-041-10/+11
| | | | | | | When emitting the static variables we need to make sure that the order is preserved. Fix this by making StaticDecls a std::list which has O(1) random removal. llvm-svn: 61621
* Add full dllimport / dllexport support: both sema checks and codegen.Anton Korobeynikov2008-12-261-7/+20
| | | | | | Patch by Ilya Okonsky llvm-svn: 61437
* 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
OpenPOWER on IntegriCloud