summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Always start tag definitions before completing them. Assert same.John McCall2010-02-051-0/+5
| | | | | | Fixes latent and not-so-latent objc++ and blocks++ bugs. llvm-svn: 95340
* First stage of adding AltiVec supportJohn Thompson2010-02-051-8/+12
| | | | llvm-svn: 95335
* Fix an obscure crash found in the Boost.MPL test suite, along with aDouglas Gregor2010-02-041-16/+58
| | | | | | | | | | | | | | | | | | | | | | | | ton of potential crashes of the same kind. The fundamental problem is that type creation was following a dangerous pattern when using its FoldingSets: 1) Use FindNodeOrInsertPos to see if the type is available 2) If not, and we aren't looking at a canonical type, build the canonical type 3) Build and insert the new node into the FoldingSet The problem here is that building the canonical type can, in very rare circumstances, force the hash table inside the FoldingSet to reallocate. That invalidates the insertion position we computed in step 1, and in step 3 we end up inserting the new node into the wrong place. BOOM! I've audited all of ASTContext, fixing this problem everywhere I found it. The vast majority of wrong code was C++-specific (and *ahem* written by me), so I also audited other major folding sets in the C++ code (e.g., template specializations), but found no other instances of this problem. llvm-svn: 95315
* Allow calling convention attributes to apply to types. Patch by Chip Davis!John McCall2010-02-041-3/+3
| | | | llvm-svn: 95291
* Define two types to be "compatible" in C++ if they are the same, andDouglas Gregor2010-02-031-9/+6
| | | | | | | remove some age-old FIXMEs and C++ workarounds within the type-compatibility logic. llvm-svn: 95249
* When determining whether a function without a prototype is compatibleDouglas Gregor2010-02-031-0/+6
| | | | | | | with a function with a prototype, treat parameters of enumeration type based on the enumeration type's promotion type. llvm-svn: 95238
* Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,Ken Dyck2010-01-271-3/+3
| | | | | | | now that the "InBytes" part of the name is implied by the return type, rename it to getDeclAlign(). llvm-svn: 94681
* Patch to add 'volatile' to first argument of allFariborz Jahanian2010-01-261-0/+3
| | | | | | | | sync compare_and_swap to match them with gcc. It also fixes a few incorrect argument defitions. (fixes radar 7540291). llvm-svn: 94607
* Correct cut-and-paste error in doxygen comment for newly introducedKen Dyck2010-01-261-1/+1
| | | | | | getTypeAlignInChars(). llvm-svn: 94553
* Add getTypeAlignInChars() for use in code that works in alignments in characterKen Dyck2010-01-261-0/+9
| | | | | | units. llvm-svn: 94552
* Allocate the 'Protocols' array in ObjCInterfaceType andTed Kremenek2010-01-211-2/+3
| | | | | | | | ObjCObjectPointerType using the allocator associated with ASTContext. Not only does this fix a memory leak, but it also makes these arrays BumpPtrAllocated (in the typical case). llvm-svn: 94090
* Give UnresolvedSet the ability to store access specifiers for each declaration.John McCall2010-01-201-3/+3
| | | | | | | Change LookupResult to use UnresolvedSet. Also extract UnresolvedSet into its own header and make it templated over an inline capacity. llvm-svn: 93959
* Encoding calling conventions in the type system, from Charles Davis!Douglas Gregor2010-01-181-29/+64
| | | | llvm-svn: 93726
* Fix the CodeGen half of PR5911 by changing reference initialization toChandler Carruth2010-01-121-4/+2
| | | | | | | correctly look through arrays to see cv-qualifiers. Also enhances the routine for doing this to preserve more type sugaring for diagnostics. llvm-svn: 93252
* Change return type of getObjCEncodingTypeSize() to CharUnits as the units ↵Ken Dyck2010-01-111-6/+6
| | | | | | are in characters. llvm-svn: 93171
* Roll out ASTContext::getTypeSizeInChars(), replacing instances ofKen Dyck2010-01-111-22/+28
| | | | | | | | | | "ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits ones as appropriate. Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType, fromQuantity(), and getQuantity() for clarity. llvm-svn: 93153
* Revert r92318. Instead fix the analyzer: do not call Zhongxing Xu2010-01-051-7/+0
| | | | | | ASTContext::hasSameUnqualifiedType() when one of the type is VariableArrayType. llvm-svn: 92723
* if an arraytype is canonical, then its element is guaranteed to be canonical.Zhongxing Xu2010-01-051-1/+2
| | | | llvm-svn: 92715
* The element type should also be canonicalized. Add a case for VariableArrayType.Zhongxing Xu2009-12-301-1/+7
| | | | llvm-svn: 92318
* Correctly refer to element CVR qualifications when determining if a type isChandler Carruth2009-12-291-0/+30
| | | | | | | | | | more or less cv-qualified than another during implicit conversion and overload resolution ([basic.type.qualifier] p5). Factors the logic out of template deduction and into the ASTContext so it can be shared. This fixes several aspects of PR5542, but not all of them. llvm-svn: 92248
* Get rid of FixedWidthIntType, as suggested by Chris and Eli.Anders Carlsson2009-12-291-28/+0
| | | | llvm-svn: 92246
* Remove some dead variables clang-analyzer found.Benjamin Kramer2009-12-251-2/+0
| | | | llvm-svn: 92162
* Tidy up ~ASTContext a bit by turning orphan compound statements intoTed Kremenek2009-12-231-25/+24
| | | | | | | | for loops. Also do not manually free the Type objects when the 'FreeMemory' flag is set, as they will be deallocated when the BumpPtrAllocator is destroyed. llvm-svn: 92047
* Move the implementation of ASTContext::getTypeSizeInChars() to the .cpp file toKen Dyck2009-12-221-0/+10
| | | | | | avoid #including CharUnits.h in ASTContext.h. llvm-svn: 91903
* Factor operator new declaration checking out into a separate function.Anders Carlsson2009-12-121-1/+1
| | | | llvm-svn: 91189
* Clean up enum constants so that they're finally sane. Fixes PR3173 and aEli Friedman2009-12-101-1/+1
| | | | | | recently introduced crash. llvm-svn: 91070
* First pass at implementing C++ enum semantics: calculate (and store) anJohn McCall2009-12-091-1/+7
| | | | | | | | | | | | "integer promotion" type associated with an enum decl, and use this type to determine which type to promote to. This type obeys C++ [conv.prom]p2 and is therefore generally signed unless the range of the enumerators forces it to be unsigned. Kills off a lot of false positives from -Wsign-compare in C++, addressing rdar://7455616 llvm-svn: 90965
* Implemented an implicit conversion from "noreturn" function types (andDouglas Gregor2009-12-091-20/+30
| | | | | | | | | | | | | | pointers thereof) to their corresponding non-noreturn function types. This conversion is considered an exact match for overload-resolution purposes. Note that we are a little more strict that GCC is, because we encode noreturn in the type system, but that's a Good Thing (TM) because it does not allow us to pretend that potentially-returning function pointers are non-returning function pointers. Fxies PR5620. llvm-svn: 90913
* Move key functions to a separate map.Anders Carlsson2009-12-071-0/+14
| | | | llvm-svn: 90745
* DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated ↵John McCall2009-12-071-17/+17
| | | | | | | | | | | | | | | | | | | | | variables, but the results are imperfect. For posterity, I did: cat <<EOF > $cmdfile s/DeclaratorInfo/TypeSourceInfo/g s/DInfo/TInfo/g s/TypeTypeSourceInfo/TypeSourceInfo/g s/SourceTypeSourceInfo/TypeSourceInfo/g EOF find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \; find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \; find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \; llvm-svn: 90743
* Add rudimentary support for member pointers to CGDebugInfo.Anders Carlsson2009-12-061-4/+0
| | | | llvm-svn: 90711
* Fix "using typename" and the instantiation of non-dependent using declarations.John McCall2009-12-041-11/+30
| | | | llvm-svn: 90614
* Push overloaded function templates through the parser using a totally differentJohn McCall2009-12-021-39/+24
| | | | | | | leaked data structure than before. This kills off the last remaining explicit uses of OverloadedFunctionDecl in Sema. llvm-svn: 90306
* Fix a crash when ivar type is a __strong SEL. Fallout fromFariborz Jahanian2009-11-301-5/+5
| | | | | | recent change to make SEL a builtin type (fixes radar 7425510). llvm-svn: 90145
* Allow user re-definition of SEL as well as accessing its fields.Fariborz Jahanian2009-11-251-1/+1
| | | | | | This fixes pr5611. llvm-svn: 89895
* Helper function for turning a TemplateName into a DeclarationName.John McCall2009-11-241-0/+16
| | | | llvm-svn: 89782
* Fixe a crash in encoding of SEL type caused by recent changes.Fariborz Jahanian2009-11-231-4/+5
| | | | llvm-svn: 89696
* Intercept sizeof and alignof references before they get into ASTContext ↵Sebastian Redl2009-11-231-11/+18
| | | | | | methods. This fixes a crash when writing sizeof(Incomplete&), and lets ASTContext's methods do the right thing for CodeGen, which fixes PR5590. llvm-svn: 89668
* Encapsulate "an array of TemplateArgumentLocs and two angle bracket ↵John McCall2009-11-231-2/+3
| | | | | | | | | | locations" into a new class. Use it pervasively throughout Sema. My fingers hurt. llvm-svn: 89638
* This patch implements objective-c's 'SEL' type as a built-inFariborz Jahanian2009-11-211-16/+5
| | | | | | | | | | | | | | | | | | type and fixes a long-standing code gen. crash reported in at least two PRs and a radar. (radar 7405040 and pr5025). There are couple of remaining issues that I would like for Ted. and Doug to look at: Ted, please look at failure in Analysis/MissingDealloc.m. I have temporarily added an expected-warning to make the test pass. This tests has a declaration of 'SEL' type which may not co-exist with the new changes. Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp. I think the changes which I have ifdef'ed out are correct. They need be considered for in a few Indexer/PCH test cases. llvm-svn: 89561
* Added rudimentary C++0x attribute support.Alexis Hunt2009-11-211-2/+3
| | | | | | | | | | | | | | The following attributes are currently supported in C++0x attribute lists (and in GNU ones as well): - align() - semantics believed to be conformant to n3000, except for redeclarations and what entities it may apply to - final - semantics believed to be conformant to CWG issue 817's proposed wording, except for redeclarations - noreturn - semantics believed to be conformant to n3000, except for redeclarations - carries_dependency - currently ignored (this is an optimization hint) llvm-svn: 89543
* Cope with an amusingly little anomaly with dependent types andDouglas Gregor2009-11-191-8/+18
| | | | | | | | | | | | | | | | | | incomplete array initialization, where we have the following in a template: int a[] = { 1, 2, something-value-dependent }; // ... sizeof(a); The type of "a" appears to be a non-dependent IncompleteArrayType, but treating it as such makes the sizeof(a) fail at template definition time. We now correctly handle this by morphing the IncompleteArrayType into a DependentSizedArrayType with a NULL expression, indicating that its size has no corresponding expression (and, therefore, the type is distinct from others). llvm-svn: 89366
* Incremental progress on using declarations. Split UnresolvedUsingDecl intoJohn McCall2009-11-181-3/+6
| | | | | | | | | | two classes, one for typenames and one for values; this seems to have some support from Doug if not necessarily from the extremely-vague-on-this-point standard. Track the location of the 'typename' keyword in a using-typename decl. Make a new lookup result for unresolved values and deal with it in most places. llvm-svn: 89184
* Added block type introspection support.David Chisnall2009-11-171-0/+48
| | | | | | As per Fariborz's suggestion, committed now but can be reverted later if the used flag is problematic for Apple. llvm-svn: 89134
* First part of changes to eliminate problems with cv-qualifiers andDouglas Gregor2009-11-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sugared types. The basic problem is that our qualifier accessors (getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at the current QualType and not at any qualifiers that come from sugared types, meaning that we won't see these qualifiers through, e.g., typedefs: typedef const int CInt; typedef CInt Self; Self.isConstQualified() currently returns false! Various bugs (e.g., PR5383) have cropped up all over the front end due to such problems. I'm addressing this problem by splitting each qualifier accessor into two versions: - the "local" version only returns qualifiers on this particular QualType instance - the "normal" version that will eventually combine qualifiers from this QualType instance with the qualifiers on the canonical type to produce the full set of qualifiers. This commit adds the local versions and switches a few callers from the "normal" version (e.g., isConstQualified) over to the "local" version (e.g., isLocalConstQualified) when that is the right thing to do, e.g., because we're printing or serializing the qualifiers. Also, switch a bunch of Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType() expressions over to Context.hasSameUnqualifiedType(T1, T2) llvm-svn: 88969
* Add an internal CreateRecordDecl that will create a CXXRecordDecl when ↵Anders Carlsson2009-11-141-12/+22
| | | | | | compiling C++ and a RecordDecl otherwise. llvm-svn: 88816
* Wherein the TargetInfo argument to Preprocessor is made 'const' and propogated.Daniel Dunbar2009-11-131-1/+1
| | | | llvm-svn: 87087
* Template argument deduction for template template parameters. ThisDouglas Gregor2009-11-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | permits, among other things, ripping apart and reconstructing templates via partial specialization: template<typename T> struct DeepRemoveConst { typedef T type; }; template<typename T> struct DeepRemoveConst<const T> { typedef typename DeepRemoveConst<T>::type type; }; template<template<typename> class TT, typename T> struct DeepRemoveConst<TT<T> > { typedef TT<typename DeepRemoveConst<T>::type> type; }; Also, fix a longstanding thinko in the code handling partial ordering of class template partial specializations. We were performing the second deduction without clearing out the results of the first deduction. It's amazing we got through so much code with such a horrendous error :( llvm-svn: 86893
* Introduce a new representation for template templateDouglas Gregor2009-11-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | parameters. Rather than storing them as either declarations (for the non-dependent case) or expressions (for the dependent case), we now (always) store them as TemplateNames. The primary change here is to add a new kind of TemplateArgument, which stores a TemplateName. However, making that change ripples to every switch on a TemplateArgument's kind, also affecting TemplateArgumentLocInfo/TemplateArgumentLoc, default template arguments for template template parameters, type-checking of template template arguments, etc. This change is light on testing. It should fix several pre-existing problems with template template parameters, such as: - the inability to use dependent template names as template template arguments - template template parameter default arguments cannot be instantiation However, there are enough pieces missing that more implementation is required before we can adequately test template template parameters. llvm-svn: 86777
* Fix clang's use of DenseMap iterators after r86636 fixed their constness.Jeffrey Yasskin2009-11-101-1/+1
| | | | | | Patch by Victor Zverovich! llvm-svn: 86638
OpenPOWER on IntegriCloud