summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement AST classes for comments, a real parser for Doxygen comments and aDmitri Gribenko2012-07-061-4/+36
| | | | | | | | | | | | | | very simple semantic analysis that just builds the AST; minor changes for lexer to pick up source locations I didn't think about before. Comments AST is modelled along the ideas of HTML AST: block and inline content. * Block content is a paragraph or a command that has a paragraph as an argument or verbatim command. * Inline content is placed within some block. Inline content includes plain text, inline commands and HTML as tag soup. llvm-svn: 159790
* Remove get(V)BaseClassOffsetInBits, the CharUnit functions should be used ↵Benjamin Kramer2012-07-041-2/+2
| | | | | | | | instead. No functionality change. llvm-svn: 159719
* PR13189: va_list broken with precompiled headersMeador Inge2012-07-011-0/+14
| | | | | | | | | | For some targets a structure named __va_list_tag is built to help define the __builtin_va_list type. However, __va_list_tag was not being treated as a predefined type thus causing problems when serializing the AST. This commit fixes that oversight by adding the necessary support to treat __va_list_tag as a predefined type. llvm-svn: 159508
* blocks: fixes a crash when encoding block typeFariborz Jahanian2012-06-301-0/+2
| | | | | | | with argument type of size 0. // rdar://11777609 PR13229. llvm-svn: 159477
* objective-c IRGen: fixes a crash when method type is being mangledFariborz Jahanian2012-06-291-4/+4
| | | | | | when an argument type size is 0. // rdar://11777609, PR13229 llvm-svn: 159472
* Remove redundant check.Dmitri Gribenko2012-06-281-0/+2
| | | | llvm-svn: 159355
* Attaching comments to declarations: don't attach comments to implicit ↵Dmitri Gribenko2012-06-281-0/+4
| | | | | | declarations. llvm-svn: 159354
* Attaching documentation comments to declarations: don't attach a comment to ↵Dmitri Gribenko2012-06-271-2/+3
| | | | | | a declaration if there is a preprocessor directive between them. llvm-svn: 159305
* Implement a lexer for structured comments.Dmitri Gribenko2012-06-261-2/+2
| | | | llvm-svn: 159223
* VC9 does not like heterogenous compare function objects.Dmitri Gribenko2012-06-211-1/+1
| | | | llvm-svn: 158936
* Restructure how the driver communicates information about theJohn McCall2012-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | target Objective-C runtime down to the frontend: break this down into a single target runtime kind and version, and compute all the relevant information from that. This makes it relatively painless to add support for new runtimes to the compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z, available at the driver level as a better and more general alternative to -fgnu-runtime and -fnext-runtime. This new concept of an Objective-C runtime also encompasses what we were previously separating out as the "Objective-C ABI", so fragile vs. non-fragile runtimes are now really modelled as different kinds of runtime, paving the way for better overall differentiation. As a sort of special case, continue to accept the -cc1 flag -fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak. I won't go so far as to say "no functionality change", even ignoring the new driver flag, but subtle changes in driver semantics are almost certainly not intended. llvm-svn: 158793
* Structured comment parsing, first step.Dmitri Gribenko2012-06-201-0/+102
| | | | | | | | | * Retain comments in the AST * Serialize/deserialize comments * Find comments attached to a certain Decl * Expose raw comment text and SourceRange via libclang llvm-svn: 158771
* Explicitly build __builtin_va_list.Meador Inge2012-06-161-8/+225
| | | | | | | The target specific __builtin_va_list types are now explicitly built instead of injecting strings into the preprocessor input. llvm-svn: 158592
* Documentation cleanup: eliminated Doxygen warnings by deleting a doc commentJames Dennett2012-06-151-8/+0
| | | | | | | on ASTContext::CreateTypeSourceInfo that duplicated information from the (more complete) version in ASTContext.h. llvm-svn: 158504
* PR13064: Store whether an in-class initializer uses direct or copyRichard Smith2012-06-101-4/+4
| | | | | | | initialization, and use that information to produce the right kind of initialization during template instantiation. llvm-svn: 158288
* 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
OpenPOWER on IntegriCloud