summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add ext_vector type code for builtins, from John Garvin!Douglas Gregor2012-06-071-0/+13
| | | | llvm-svn: 158156
* Plug a long standing memory leak in TemplateArgument.Benjamin Kramer2012-06-071-2/+1
| | | | | | | | | | | | | | | The integral APSInt value is now stored in a decomposed form and the backing store for large values is allocated via the ASTContext. This way its not leaked as TemplateArguments are never destructed when they are allocated in the ASTContext. Since the integral data is immutable it is now shared between instances, making copying TemplateArguments a trivial operation. Currently getting the integral data out of a TemplateArgument requires creating a new APSInt object. This is cheap when the value is small but can be expensive if it's not. If this turns out to be an issue a more efficient accessor could be added. llvm-svn: 158150
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-5/+5
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* CUDA: add CodeGen support for global variable address spaces.Peter Collingbourne2012-05-201-1/+4
| | | | | | | | | Because in CUDA types do not have associated address spaces, globals are declared in their "native" address space, and accessed by bitcasting the pointer to address space 0. This relies on address space 0 being a unified address space. llvm-svn: 157167
* Added two missing const qualifiers.Abramo Bagnara2012-05-171-2/+2
| | | | llvm-svn: 156988
* Fix handling of wint_t - we can't assume wint_t is purely an integer ↵James Molloy2012-05-041-0/+2
| | | | | | | | | | | | promotion of wchar_t - they may differ in signedness. Teach ASTContext about WIntType, and have it taken from TargetInfo like WCharType. Should fix test/Sema/format-strings.c for ARM, with the exception of one subtest which will fail if wint_t and wchar_t are the same size and wint_t is signed, wchar_t is unsigned. There'll be a followup commit to fix that. Reviewed by Chandler and Hans at http://llvm.org/reviews/r/8 llvm-svn: 156165
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-5/+5
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* When @encode'ing a C++ class that has empty base classes, we can endDouglas Gregor2012-04-271-5/+2
| | | | | | | up with gaps when the class inherits from the same empty base class more than once. Fixes <rdar://problem/11324167>. llvm-svn: 155738
* PR 12586: Fix assert while running libc++ testsuite: deal with exceptionRichard Smith2012-04-191-1/+1
| | | | | | | | | specifications on member function templates of class templates and other such nested beasties. Store the function template from which we are to instantiate an exception specification rather than trying to deduce it. Plus some additional test cases. llvm-svn: 155076
* Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.Richard Smith2012-04-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a new flavor of exception specification, EST_Uninstantiated. A function type with this exception specification carries a pointer to a FunctionDecl, and the exception specification for that FunctionDecl is instantiated (if needed) and used in the place of the function type's exception specification. When a function template declaration with a non-trivial exception specification is instantiated, the specialization's exception specification is set to this new 'uninstantiated' kind rather than being instantiated immediately. Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs on-demand. Also, any odr-use of a function triggers the instantiation of its exception specification (the exception specification could be needed by IRGen). In passing, fix two places where a DeclRefExpr was created but the corresponding function was not actually marked odr-used. We used to get away with this, but don't any more. Also fix a bug where instantiating an exception specification which refers to function parameters resulted in a crash. We still have the same bug in default arguments, which I'll be looking into next. This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to parse (and, in very limited testing, support) all of libstdc++4.7's standard headers. llvm-svn: 154886
* objective-c modern translator: buildit objc boolFariborz Jahanian2012-04-161-1/+2
| | | | | | | type for rewriter project will be BoolTy. // rdar://11231426. llvm-svn: 154861
* Implement support for null non-type template arguments for non-typeDouglas Gregor2012-04-061-2/+5
| | | | | | | template parameters of pointer, pointer-to-member, or nullptr_t type in C++11. Fixes PR9700 / <rdar://problem/11193097>. llvm-svn: 154219
* Fix a comment: kPropertyType = 'T' not 't'. <rdar://problem/11095729>Bob Wilson2012-03-221-1/+1
| | | | llvm-svn: 153264
* Report the natural alignment of unsigned long long, not the preferred alignment.Chad Rosier2012-03-211-1/+2
| | | | | | rdar://11054144 llvm-svn: 153216
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-11/+11
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* [AST] Memoize ASTContext::getTypeInfo().Daniel Dunbar2012-03-091-4/+15
| | | | | | | | | | | | | | | | | | - On -emit-llvm-only of 403.gcc/combine.c, for example, we make 160k calls to getTypeInfo but only ever deal with 680 some distinct types. I saw these speedups (user time): 403.gcc/combine.c -- 3.1% OmniGroupFrameworks/NSBezierPath-OAExtensions.m -- 3.6% JavaScriptCore/Interpreter.cpp -- 1.4% which seems pretty sweet. I ran some histograms on those compiles and we end up doing a ton of getTypeInfo() on 'char' and 'int'. I tried splitting out a fast path for builtin types, but this wasn't a win. Still kinda seems like we could be doing better here. llvm-svn: 152377
* Make sure we consistently canonicalize types when canonicalizing ↵Eli Friedman2012-03-071-3/+5
| | | | | | TemplateTemplateParmDecls. PR12179. llvm-svn: 152189
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-061-1/+4
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* Use TinyPtrVector instead of UsuallyTinyPtrVector.Argyrios Kyrtzidis2012-03-061-6/+0
| | | | | | The latter is just a worse version of the former. llvm-svn: 152096
* Properly handle non-canonical underlying types inPeter Collingbourne2012-03-051-1/+1
| | | | | | | ASTContext::getUnaryTransformType. This can happen if, for example, an enumeration's underlying type is a typedef. llvm-svn: 152031
* Avoid an unnecessary recursive loop between type canonicalization and NNS ↵Eli Friedman2012-03-031-18/+5
| | | | | | canonicalization which would (rarely) lead to memory corruption. While I'm here, simplify. Fixes PR12166. Not committing a testcase because it's impossible to reduce it. llvm-svn: 151967
* Basic support for name mangling of C++11 lambda expressions. BecauseDouglas Gregor2012-02-201-0/+7
| | | | | | | | | | | | | | | name mangling in the Itanium C++ ABI for lambda expressions is so dependent on context, we encode the number used to encode each lambda as part of the lambda closure type, and maintain this value within Sema. Note that there are a several pieces still missing: - We still get the linkage of lambda expressions wrong - We aren't properly numbering or mangling lambda expressions that occur in default function arguments or in data member initializers. - We aren't (de-)serializing the lambda numbering tables llvm-svn: 150982
* Within the body of a lambda expression, decltype((x)) for anDouglas Gregor2012-02-121-34/+3
| | | | | | | | | | | | | | | | id-expression 'x' will compute the type based on the assumption that 'x' will be captured, even if it isn't captured, per C++11 [expr.prim.lambda]p18. There are two related refactors that go into implementing this: 1) Split out the check that determines whether we should capture a particular variable reference, along with the computation of the type of the field, from the actual act of capturing the variable. 2) Always compute the result of decltype() within Sema, rather than AST, because the decltype() computation is now context-sensitive. llvm-svn: 150347
* Track whether a function type has a trailing return type as type sugar. Use thisRichard Smith2012-02-101-1/+4
| | | | | | | | | | | to pretty-print such function types better, and to fix a case where we were not instantiating templates in lexical order. In passing, move the Variadic bit from Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits. Also ensure that we always substitute the return type of a function when substituting explicitly-specified arguments, since that can cause us to bail out with a SFINAE error before we hit a hard error in parameter substitution. llvm-svn: 150241
* Revise the SplitQualType interface to make it its own thing instead ofJohn McCall2012-02-081-24/+24
| | | | | | | | | | | | | | a typedef of std::pair. This slightly improves type-safety, but mostly makes code using it clearer to read as well as making it possible to add methods to the type. Add such a method for efficiently single-step desugaring a split type. Add a method to single-step desugaring a locally-unqualified type. Implement both the SplitQualType and QualType methods in terms of that. Also, fix a typo ("ObjCGLifetime"). llvm-svn: 150028
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-7/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* objc: fixes a problem in block type comparison involvingFariborz Jahanian2012-02-061-2/+4
| | | | | | | | enums with underlying type explicitly specified (feature which is on by default in objective-c). // rdar://10798770 llvm-svn: 149888
* Added location for template keyword in TemplateSpecializationTypeLoc. In the ↵Abramo Bagnara2012-02-061-0/+1
| | | | | | process removed some naming ambiguities. llvm-svn: 149870
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | llvm-svn: 149798
* Move various diagnostic operator<< overloads out of line and remove includes ↵Benjamin Kramer2012-02-041-0/+1
| | | | | | | | | of Diagnostic.h. Fix all the files that depended on transitive includes of Diagnostic.h. With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer. llvm-svn: 149781
* Move Storage and StorageAllocator out of the PartialDiagnostic class so we ↵Benjamin Kramer2012-02-041-0/+6
| | | | | | | | | can forward declare them. Let ASTContext allocate the storage in its BumpPtrAllocator. This will help us remove ASTContext's depedency on PartialDiagnostic.h soon. llvm-svn: 149780
* When a pack expansion occurs in the template argument list of an aliasDouglas Gregor2012-02-031-12/+20
| | | | | | | | template without a corresponding parameter pack, don't immediately substitute the alias template. This is under discussion in the C++ committee, and may become ill-formed, but for now we match GCC. llvm-svn: 149697
* Move isSentinelNullExpr() from Sema to ASTContext to make it more widelyArgyrios Kyrtzidis2012-02-031-0/+18
| | | | | | available. llvm-svn: 149675
* r149587 revertedAnton Yartsev2012-02-021-3/+1
| | | | llvm-svn: 149594
* Fix for PR10657 (http://llvm.org/bugs/show_bug.cgi?id=10657)Anton Yartsev2012-02-021-1/+3
| | | | | | extern inline case considered llvm-svn: 149587
* objc: 'id' and block pointer compare in mergeTypes isFariborz Jahanian2012-01-261-3/+6
| | | | | | made symmetrical. // rdar://10734265 llvm-svn: 149065
* objc: allow block pointer matching 'id' type whenFariborz Jahanian2012-01-261-1/+5
| | | | | | | they show up as argument types of two block pointers. // rdar://10734265 llvm-svn: 149007
* Add ability to specifiy 'restrict' on parameters of builtins, and correct ↵Ted Kremenek2012-01-201-0/+3
| | | | | | this oversight for scanf functions. llvm-svn: 148573
* Delay the creation of the built-in Objective-C class 'Protocol' byDouglas Gregor2012-01-171-5/+14
| | | | | | | moving it from a "special type" to a predefined declaration, as we do for id, Class, and SEL. llvm-svn: 148313
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-8/+6
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-2/+3
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-141-5/+5
| | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. llvm-svn: 148187
* Fix canonicalization of protocol-qualified typesDouglas Gregor2012-01-021-1/+9
| | | | llvm-svn: 147421
* Use declaresSameEntity() when comparing ObjCProtocolDecls, andDouglas Gregor2012-01-011-5/+5
| | | | | | | getCanonicalDecl() when putting ObjCProtocolDecls into a set. This is groundwork for making ObjCProtocolDecl redeclarable. llvm-svn: 147406
* If there is a definition of an ObjCInterfaceDecl, make it the Decl returned ↵Douglas Gregor2011-12-161-0/+4
| | | | | | from the corresponding ObjCInterfaceType llvm-svn: 146740
* Fix chaining of ObjCInterfaceDecl redeclarationsDouglas Gregor2011-12-161-2/+8
| | | | llvm-svn: 146722
* Replace all comparisons between ObjCInterfaceDecl pointers with callsDouglas Gregor2011-12-151-1/+1
| | | | | | | | to declaresSameEntity(), as a baby step toward tracking forward declarations of Objective-C classes precisely. Part of <rdar://problem/10583531>. llvm-svn: 146618
* Added an assertion about overflow in sizeof evaluation. This does not solve ↵Abramo Bagnara2011-12-131-1/+3
| | | | | | the underlying structural issue that is waiting for a proper solution. llvm-svn: 146482
* Keep track of all of the import declarations that are parsed orDouglas Gregor2011-12-031-1/+15
| | | | | | | implicitly generated in a translation unit. Modules will need this information to identify the actual imports that occurred. llvm-svn: 145734
OpenPOWER on IntegriCloud