summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ASTContext.h: replace include by a forward declaration.Dmitri Gribenko2012-08-021-0/+1
| | | | llvm-svn: 161186
* Comment parsing: add support for \tparam command on all levels.Dmitri Gribenko2012-07-311-1/+10
| | | | | | | | | | The only caveat is renumbering CXCommentKind enum for aesthetic reasons -- this breaks libclang binary compatibility, but should not be a problem since API is so new. This also fixes PR13372 as a side-effect. llvm-svn: 161087
* Implement resolving of HTML character references (named: &, decimal: *,Dmitri Gribenko2012-07-271-1/+2
| | | | | | | | | hex: ) during comment parsing. Now internal representation of plain text in comment AST does not contain character references, but the characters themselves. llvm-svn: 160891
* Final piece of core issue 1330: delay computing the exception specification ofRichard Smith2012-07-271-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a defaulted special member function until the exception specification is needed (using the same criteria used for the delayed instantiation of exception specifications for function temploids). EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to resolve the exception specification. This is enabled for all C++ modes: it's a little faster in the case where the exception specification isn't used, allows our C++11-in-C++98 extensions to work, and is still correct for C++98, since in that mode the computation of the exception specification can't fail. The diagnostics here aren't great (in particular, we should include implicit evaluation of exception specifications for defaulted special members in the template instantiation backtraces), but they're not much worse than before. Our approach to the problem of cycles between in-class initializers and the exception specification for a defaulted default constructor is modified a little by this change -- we now reject any odr-use of a defaulted default constructor if that constructor uses an in-class initializer and the use is in an in-class initialzer which is declared lexically earlier. This is a closer approximation to the current draft solution in core issue 1351, but isn't an exact match (but the current draft wording isn't reasonable, so that's to be expected). llvm-svn: 160847
* Implement an optimization for finding the comment that occurs just after aDmitri Gribenko2012-07-171-6/+24
| | | | | | | | | | given declaration. It is based on the observation that during parsing the comment that should be attached to the decl is usually among the last two documentation comments parsed. llvm-svn: 160400
* Related to PR11848 and core-21989: switch ContainsUnexpandedParameterPack fromRichard Smith2012-07-161-4/+11
| | | | | | | | | being a property of a canonical type to being a property of the fully-sugared type. This should only make a difference in the case where an alias template ignores one of its parameters, and that parameter is an unexpanded parameter pack. llvm-svn: 160244
* Add a per target max vector alignment field (e.g., 32-byte alignment for x86 ↵Chad Rosier2012-07-131-0/+4
| | | | | | | | | | due to AVX). Currently, if no aligned attribute is specified the alignment of a vector is inferred from its size. Thus, very large vectors will be over-aligned with no benefit. Target owners should set this target max. llvm-svn: 160209
* Attaching comments to declarations during parsing: handle more Objective-C ↵Dmitri Gribenko2012-07-131-2/+14
| | | | | | declarations. llvm-svn: 160156
* [Windows] Use thiscall as the default calling convention for class methods. ↵Timur Iskhodzhanov2012-07-121-2/+8
| | | | | | PR12785 llvm-svn: 160121
* Enable comment parsing and semantic analysis to emit diagnostics. A fewDmitri Gribenko2012-07-111-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics implemented -- see testcases. I created a new TableGen file for comment diagnostics, DiagnosticCommentKinds.td, because comment diagnostics don't logically fit into AST diagnostics file. But I don't feel strongly about it. This also implements support for self-closing HTML tags in comment lexer and parser (for example, <br />). In order to issue precise diagnostics CommentSema needs to know the declaration the comment is attached to. There is no easy way to find a decl by comment, so we match comments and decls in lockstep: after parsing one declgroup we check if we have any new, not yet attached comments. If we do -- then we do the usual comment-finding process. It is interesting that this automatically handles trailing comments. We pick up not only comments that precede the declaration, but also comments that *follow* the declaration -- thanks to the lookahead in the lexer: after parsing the declgroup we've consumed the semicolon and looked ahead through comments. Added -Wdocumentation-html flag for semantic HTML errors to allow the user to disable only HTML warnings (but not HTML parse errors, which we emit as warnings in -Wdocumentation). llvm-svn: 160078
* Restrict the set of declaration kinds for which we allow trailing comments.Dmitri Gribenko2012-07-061-1/+1
| | | | llvm-svn: 159878
* Don't store pointers into a std::vector (RawCommentList::Comments). AlthoughDmitri Gribenko2012-07-061-9/+10
| | | | | | | | currently we take address of std::vector's contents only after we finished adding all comments (so no reallocation can happen), this will change in future. llvm-svn: 159845
* Use C++ cast.Dmitri Gribenko2012-07-061-1/+2
| | | | llvm-svn: 159830
* ASTContext.cpp: Appease msvc to cast NULL to typed pointer, or msvc mistakes ↵NAKAMURA Takumi2012-07-061-1/+1
| | | | | | NULL as int. llvm-svn: 159818
* 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
OpenPOWER on IntegriCloud