summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Add sema support for the nodebug attribute.Anders Carlsson2009-02-132-1/+19
| | | | llvm-svn: 64441
* Initial implementation of arbitrary fixed-width integer types. Eli Friedman2009-02-134-12/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently only used for 128-bit integers. Note that we can't use the fixed-width integer types for other integer modes without other changes because glibc headers redefines (u)int*_t and friends using the mode attribute. For example, this means that uint64_t has to be compatible with unsigned __attribute((mode(DI))), and uint64_t is currently defined to long long. And I have a feeling we'll run into issues if we try to define uint64_t as something which isn't either long or long long. This doesn't get the alignment right in most cases, including the 128-bit integer case; I'll file a PR shortly. The gist of the issue is that the targets don't really expose the information necessary to figure out the alignment outside of the target description, so there's a non-trivial amount of work involved in getting it working right. That said, the alignment used is conservative, so the only issue with the current implementation is ABI compatibility. This makes it trivial to add some sort of "bitwidth" attribute to make arbitrary-width integers; I'll do that in a followup. We could also use this for stuff like the following for compatibility with gcc, but I have a feeling it would be a better idea for clang to be consistent between C and C++ modes rather than follow gcc's example for C mode. struct {unsigned long long x : 33;} x; unsigned long long a(void) {return x.x+1;} llvm-svn: 64434
* GRExprEngine:Ted Kremenek2009-02-131-194/+209
| | | | | | | - Add 'EvalBind', which will be used by 'EvalStore' to pull much of the value binding logic out of GRTransferFuncs. - Rename many cases of 'St' to 'state'. llvm-svn: 64426
* Add mangling for variadic functions and conversion functionsDouglas Gregor2009-02-131-2/+8
| | | | llvm-svn: 64425
* Fix gcc warning: gcc correctly notes that const-qualifying the return Eli Friedman2009-02-131-2/+2
| | | | | | type doesn't do anything. llvm-svn: 64424
* make "floating macro bubble" output of -emit-html much prettier: Chris Lattner2009-02-131-1/+14
| | | | | | | | only insert spaces between tokens if the code had them or if they are actually required to avoid pasting. This reuses the same logic as -E mode. llvm-svn: 64421
* factor token concatenation avoidance logic out of Chris Lattner2009-02-131-0/+205
| | | | | | PrintPreprocessedOutput into its own file. No functionality change. llvm-svn: 64418
* Tighten checking of the "overloadable" attribute. If any function by aDouglas Gregor2009-02-131-14/+13
| | | | | | | | | | | | | | | | | | | given name in a given scope is marked as "overloadable", every function declaration and definition with that same name and in that same scope needs to have the "overloadable" attribute. Essentially, the "overloadable" attribute is not part of attribute merging, so it must be specified even for redeclarations. This keeps users from trying to be too sneaky for their own good: double sin(double) __attribute__((overloadable)); // too sneaky #include <math.h> Previously, this would have made "sin" overloadable, and therefore given it a mangled name. Now, we get an error inside math.h when we see a (re)declaration of "sin" that doesn't have the "overloadable" attribute. llvm-svn: 64414
* Add basic support for C++ name mangling according to the Itanium C++Douglas Gregor2009-02-138-18/+597
| | | | | | | | | | | | | | | | 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
* Honor attribute section on static block var decls.Daniel Dunbar2009-02-121-0/+4
| | | | llvm-svn: 64411
* Fix limits.h for linux, as glibc does a #include_next unlessMike Stump2009-02-121-3/+9
| | | | | | | | | _GCC_LIMITS_H_ is defined, when __GNUC__ is defined. Also, we need to stay away from possible conflicts with header guards. We should use CLANG_ to prefix all header guards. llvm-svn: 64408
* Fix assertion when input is an empty string.Daniel Dunbar2009-02-121-1/+1
| | | | llvm-svn: 64397
* Fix <rdar://problem/6499801> clang does not detect objc type mismatch in ↵Steve Naroff2009-02-121-6/+5
| | | | | | conditional expr llvm-svn: 64393
* Fix a bug with designated initializers where we were stepping out of aDouglas Gregor2009-02-121-8/+7
| | | | | | | | | union subobject initialization before checking whether the next initiailizer was actually a designated initializer. This led to spurious "excess elements in union initializer" errors. Thanks to rdivacky for reporting the bug! llvm-svn: 64392
* Fix a bug whereby, an ivar used to synthesize a property belongsFariborz Jahanian2009-02-121-4/+25
| | | | | | to a base class (nonfragile abi ir gen bug). llvm-svn: 64391
* Initial codegen for block literals. This is a work in progress. I'veMike Stump2009-02-121-6/+142
| | | | | | | | tried to put FIXMEs on the most important things to fix up. Lots left to do including more codegen, more documentation and cleaning code and style cleanups. llvm-svn: 64390
* Sema::ActOnObjCAtThrowStmt(): return from recently added errors. Thanks Chris!Steve Naroff2009-02-121-3/+3
| | | | llvm-svn: 64389
* Add a very basic implemenation of global blocks. This needs to be cleaned up.Anders Carlsson2009-02-125-13/+153
| | | | llvm-svn: 64387
* Make nonfragile-abi the default for darwin's 64bitFariborz Jahanian2009-02-121-1/+5
| | | | | | abi for objective-c programs. llvm-svn: 64386
* Several cleanups:Steve Naroff2009-02-126-41/+49
| | | | | | | | - rename isObjCIdType/isObjCClassType -> isObjCIdStructType/isObjCClassStructType. The previous name didn't do what you would expect. - add back isObjCIdType/isObjCClassType to do what you would expect. Not currently used, however many of the isObjCIdStructType/isObjCClassStructType clients could be converted over time. - move static Sema function areComparableObjCInterfaces to ASTContext (renamed to areComparableObjCPointerTypes, since it now operates on pointer types). llvm-svn: 64385
* Support __attribute__(section(<name>))Daniel Dunbar2009-02-123-2/+30
| | | | llvm-svn: 64380
* Turn warning into error. Minor incompatibility with GCC (for scalar types, ↵Steve Naroff2009-02-121-4/+2
| | | | | | GCC only produces a warning). llvm-svn: 64375
* Fix va_arg bug noticed by Eli, __builtin_va_arg is not an l-valueDaniel Dunbar2009-02-121-1/+1
| | | | | | designating an object. llvm-svn: 64371
* x86_64: Initial varargs support.Daniel Dunbar2009-02-121-1/+153
| | | | | | | | | | | | | | | | | | | | | | | | | - Doesn't yet handle case where values are passed in mixed (general purpose & floating point) registers; otherwise largely functional. Code still needs some cleaning. Fixes: MultiSource/Applications/lua/lua MultiSource/Applications/siod/siod MultiSource/Applications/sqlite3/sqlite3 SingleSource/Regression/C/PR640 SingleSource/UnitTests/2003-07-09-SignedArgs SingleSource/UnitTests/2007-03-02-VaCopy gcc compat test suite results (Darwin x86-32 & -64): -- # of expected passes 1262 # of unexpected failures 56 # of unresolved testcases 34 # of unsupported tests 2 Compare to: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090209/012050.html llvm-svn: 64370
* Re-enable PTH stat caching. All tests pass now.Ted Kremenek2009-02-121-2/+1
| | | | llvm-svn: 64356
* Fix bad reading of bytes in ReadUnalignedLE64() (copy-paste error).Ted Kremenek2009-02-121-4/+4
| | | | llvm-svn: 64355
* Temporarily disable PTH stat caching as it appears to be failing on some ↵Ted Kremenek2009-02-121-1/+2
| | | | | | machines. llvm-svn: 64354
* PTH: Cache stat information for files in the PTH file. Hook up FileManagerTed Kremenek2009-02-122-10/+106
| | | | | | | | | | | | | to use this stat information in the PTH file using a 'StatSysCallCache' object. Performance impact (Cocoa.h, PTH): - number of stat calls reduces from 1230 to 425 - fsyntax-only: time improves by 4.2% We can reduce the number of stat calls to almost zero by caching negative stat calls and directory stat calls in the PTH file as well. llvm-svn: 64353
* FileManager:Ted Kremenek2009-02-121-6/+4
| | | | | | | | | - set the 'StatSysCallCache' object using a setter method instead of FileManager's constructor. This allows the cache to be installed after the FileManager object is created. - Add 'file mode' to FileEntry (useful for stat caching) llvm-svn: 64351
* search and replaceo? Chris Lattner2009-02-121-1/+1
| | | | llvm-svn: 64348
* Add support for generating block call expressions.Anders Carlsson2009-02-123-1/+140
| | | | llvm-svn: 64346
* Add lightweight shim "clang::StatSysCallCache" that caches 'stat' system callsTed Kremenek2009-02-121-8/+10
| | | | | | | | | | for use by FileManager. FileManager now takes a StatSysCallCache* in its constructor (which defaults to NULL). This will be used for evaluating whether or not caching 'stat' system calls in PTH is a performance win. This shim adds no observable performance impact in the case where the 'StatSysCallCache*' is null. llvm-svn: 64345
* Expand the definition of a complex promotion to include complex ->Douglas Gregor2009-02-121-3/+7
| | | | | | | | complex conversions where the conversion between the real types is an integral promotion. This is how G++ handles complex promotions for its complex integer extension. llvm-svn: 64344
* Introduce _Complex conversions into the function overloadingDouglas Gregor2009-02-125-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | system. Since C99 doesn't have overloading and C++ doesn't have _Complex, there is no specification for this. Here's what I think makes sense. Complex conversions come in several flavors: - Complex promotions: a complex -> complex conversion where the underlying real-type conversion is a floating-point promotion. GCC seems to call this a promotion, EDG does something else. This is given "promotion" rank for determining the best viable function. - Complex conversions: a complex -> complex conversion that is not a complex promotion. This is given "conversion" rank for determining the best viable function. - Complex-real conversions: a real -> complex or complex -> real conversion. This is given "conversion" rank for determining the best viable function. These rules are the same for C99 (when using the "overloadable" attribute) and C++. However, there is one difference in the handling of floating-point promotions: in C99, float -> long double and double -> long double are considered promotions (so we give them "promotion" rank), while C++ considers these conversions ("conversion" rank). llvm-svn: 64343
* Last @encode'ing fix for objc2's nonfragile abi.Fariborz Jahanian2009-02-111-3/+6
| | | | | | All relevant dejagnu enocding tests pass in this mode. llvm-svn: 64341
* PTH: Have meta data be at the beginning of the PTH file, not the end.Ted Kremenek2009-02-111-6/+6
| | | | llvm-svn: 64338
* Fix comment.Mike Stump2009-02-111-1/+1
| | | | llvm-svn: 64337
* Initial implementation of function overloading in C.Douglas Gregor2009-02-118-41/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a new attribute, "overloadable", that enables C++ function overloading in C. The attribute can only be added to function declarations, e.g., int *f(int) __attribute__((overloadable)); If the "overloadable" attribute exists on a function with a given name, *all* functions with that name (and in that scope) must have the "overloadable" attribute. Sets of overloaded functions with the "overloadable" attribute then follow the normal C++ rules for overloaded functions, e.g., overloads must have different parameter-type-lists from each other. When calling an overloaded function in C, we follow the same overloading rules as C++, with three extensions to the set of standard conversions: - A value of a given struct or union type T can be converted to the type T. This is just the identity conversion. (In C++, this would go through a copy constructor). - A value of pointer type T* can be converted to a value of type U* if T and U are compatible types. This conversion has Conversion rank (it's considered a pointer conversion in C). - A value of type T can be converted to a value of type U if T and U are compatible (and are not both pointer types). This conversion has Conversion rank (it's considered to be a new kind of conversion unique to C, a "compatible" conversion). Known defects (and, therefore, next steps): 1) The standard-conversion handling does not understand conversions involving _Complex or vector extensions, so it is likely to get these wrong. We need to add these conversions. 2) All overloadable functions with the same name will have the same linkage name, which means we'll get a collision in the linker (if not sooner). We'll need to mangle the names of these functions. llvm-svn: 64336
* Patch to fix encoding in 64bit abi. With this patchFariborz Jahanian2009-02-111-2/+8
| | | | | | | all but one dejagnu encoding tests for darwin pass in nonfragile abi mode. llvm-svn: 64334
* Use EmitVAListRef instead of EmitLValue directly to handle array decayDaniel Dunbar2009-02-114-4/+3
| | | | | | case on x86_64. llvm-svn: 64333
* PTH: Replace string identifier to persistent ID lookup with a hashtable. This isTed Kremenek2009-02-111-54/+89
| | | | | | | actually *slightly* slower than the binary search. Since this is algorithmically better, further performance tuning should be able to make this faster. llvm-svn: 64326
* Support IRgen of va_arg of structure as l-value.Daniel Dunbar2009-02-112-2/+12
| | | | llvm-svn: 64325
* ir-gen for objc's @selector expression in nonfragile abi mode.Fariborz Jahanian2009-02-111-1/+26
| | | | llvm-svn: 64323
* Appease the language lawyersDouglas Gregor2009-02-111-1/+1
| | | | llvm-svn: 64321
* Fix <rdar://problem/6505139> [clang on growl]: need to allow unnamed ↵Steve Naroff2009-02-111-1/+2
| | | | | | selectors as the first argument llvm-svn: 64320
* Fix <rdar://problem/6243503> [sema] @throw; accepted outside catch block.Steve Naroff2009-02-113-5/+13
| | | | llvm-svn: 64318
* Finished semantic analysis of non-type template arguments, to checkDouglas Gregor2009-02-112-15/+169
| | | | | | | | | | | for non-external names whose address becomes the template argument. This completes C++ [temp.arg.nontype]p1. Note that our interpretation of C++ [temp.arg.nontype]p1b3 differs from EDG's interpretation (we're stricter, and GCC agrees with us). They're opening a core issue about the matter. llvm-svn: 64317
* Avoid bogus warning.Mike Stump2009-02-111-1/+2
| | | | llvm-svn: 64313
* Reverted r64307. Moved hasSameType and hasSameUnqualifiedType fromDouglas Gregor2009-02-111-5/+5
| | | | | | Sema to ASTContext. llvm-svn: 64312
* Allow the use of default template arguments when forming a classDouglas Gregor2009-02-112-2/+23
| | | | | | | | | | | | | | template specialization (e.g., std::vector<int> would now be well-formed, since it relies on a default argument for the Allocator template parameter). This is much less interesting than one might expect, since (1) we're not actually using the default arguments for anything important, such as naming an actual Decl, and (2) we'll often need to instantiate the default arguments to check their well-formedness. The real fun will come later. llvm-svn: 64310
OpenPOWER on IntegriCloud