summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* Emit a type record for TYPE_OBJC_OBJECT in the PCH file. I'm notJohn McCall2010-05-161-0/+1
| | | | | | entirely sure what this does, to be honest. llvm-svn: 103895
* Substantially alter the design of the Objective C type AST by introducingJohn McCall2010-05-152-27/+22
| | | | | | | | | | | | | | | | | | | | | ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. llvm-svn: 103870
* Implement semantic analysis and an AST representation for the namedDouglas Gregor2010-05-154-0/+5
| | | | | | | | | | | | return value optimization. Sema marks return statements with their NRVO candidates (which may or may not end up using the NRVO), then, at the end of a function body, computes and marks those variables that can be allocated into the return slot. I've checked this locally with some debugging statements (not committed), but there won't be any tests until CodeGen comes along. llvm-svn: 103865
* Recognize when the named return value optimization applies in aDouglas Gregor2010-05-152-0/+2
| | | | | | | | | | "return" statement and mark the corresponding CXXConstructExpr as elidable. Teach CodeGen that eliding a temporary is different from eliding an object construction. This is just a baby step toward NRVO. llvm-svn: 103849
* Revert r103770, "Added basic source locations to Elaborated and DependentNameDaniel Dunbar2010-05-142-4/+2
| | | | | | types.", it is breaking Clang bootstrap. llvm-svn: 103775
* Added basic source locations to Elaborated and DependentName types.Abramo Bagnara2010-05-142-2/+4
| | | | llvm-svn: 103770
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "used" (e.g., we will refer to the vtable in the generated code) and when they are defined (i.e., because we've seen the key function definition). Previously, we were effectively tracking "potential definitions" rather than uses, so we were a bit too eager about emitting vtables for classes without key functions. The new scheme: - For every use of a vtable, Sema calls MarkVTableUsed() to indicate the use. For example, this occurs when calling a virtual member function of the class, defining a constructor of that class type, dynamic_cast'ing from that type to a derived class, casting to/through a virtual base class, etc. - For every definition of a vtable, Sema calls MarkVTableUsed() to indicate the definition. This happens at the end of the translation unit for classes whose key function has been defined (so we can delay computation of the key function; see PR6564), and will also occur with explicit template instantiation definitions. - For every vtable defined/used, we mark all of the virtual member functions of that vtable as defined/used, unless we know that the key function is in another translation unit. This instantiates virtual member functions when needed. - At the end of the translation unit, Sema tells CodeGen (via the ASTConsumer) which vtables must be defined (CodeGen will define them) and which may be used (for which CodeGen will define the vtables lazily). From a language perspective, both the old and the new schemes are permissible: we're allowed to instantiate virtual member functions whenever we want per the standard. However, all other C++ compilers were more lazy than we were, and our eagerness was both a performance issue (we instantiated too much) and a portability problem (we broke Boost test cases, which now pass). Notes: (1) There's a ton of churn in the tests, because the order in which vtables get emitted to IR has changed. I've tried to isolate some of the larger tests from these issues. (2) Some diagnostics related to implicitly-instantiated/implicitly-defined virtual member functions have moved to the point of first use/definition. It's better this way. (3) I could use a review of the places where we MarkVTableUsed, to see if I missed any place where the language effectively requires a vtable. Fixes PR7114 and PR6564. llvm-svn: 103718
* "this patch properly addresses escaping < and > which might appearChris Lattner2010-05-121-1/+2
| | | | | | | | | | | (e.g. for C++ operators) in the xml dump. I also re-enabled the unit test for ast-print-xml (or so I think) at least, make test didn't fail..." patch by Sebastien Binet! llvm-svn: 103671
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-114-29/+22
| | | | llvm-svn: 103517
* Convert CXXTempory[] in CXXExprWithTemporaries to be allocated using ↵Ted Kremenek2010-05-101-1/+1
| | | | | | ASTContext's allocator. Fixes <rdar://problem/7961605>. llvm-svn: 103421
* Improved -ast-print-xml for C++, from Sebastien Binet!Douglas Gregor2010-05-102-4/+72
| | | | llvm-svn: 103412
* pch'ify CXXNewExpr and CXXZeroInitValueExprChris Lattner2010-05-102-2/+85
| | | | llvm-svn: 103390
* pchify CXXTemporary, CXXBindTemporaryExpr, and Chris Lattner2010-05-104-3/+67
| | | | | | CXXExprWithTemporaries. llvm-svn: 103387
* pch'ify default argument definitions and uses.Chris Lattner2010-05-093-4/+34
| | | | llvm-svn: 103376
* pch'ify 'this' and 'throw'Chris Lattner2010-05-092-0/+36
| | | | llvm-svn: 103375
* pch'ify typeid.Chris Lattner2010-05-092-0/+33
| | | | llvm-svn: 103374
* pchify CXXMemberCallExpr correctly. Before it would serializeChris Lattner2010-05-092-0/+10
| | | | | | | and deserialize as a CallExpr which is close, but ends up deserializing with the wrong stmt class. llvm-svn: 103371
* When we encounter a non-dependent type during template instantiation,Douglas Gregor2010-05-071-0/+6
| | | | | | | mark any declarations we see inside of that type as "referenced". Fixes PR7079. llvm-svn: 103323
* Introduce a recursive AST visitor that makes it trivial to recursivelyDouglas Gregor2010-05-071-1/+4
| | | | | | | | walk an entire AST, including all of the types, declarations, statements, and expressions, and allowing one to easily override the behavior of the walk at any particular node kind. llvm-svn: 103308
* add PCH support for a bunch of C++ Decls, patch byChris Lattner2010-05-074-31/+550
| | | | | | Andrew Sutton! llvm-svn: 103301
* Add missing #includeDouglas Gregor2010-05-071-0/+1
| | | | llvm-svn: 103260
* Add a stub frontend action for BoostCon, for next week's workshop.Douglas Gregor2010-05-073-0/+33
| | | | llvm-svn: 103258
* Rework our handling of temporary objects within the conditions ofDouglas Gregor2010-05-061-1/+2
| | | | | | | | | | | | | | | | | | | if/switch/while/do/for statements. Previously, we would end up either: (1) Forgetting to destroy temporaries created in the condition (!), (2) Destroying the temporaries created in the condition *before* converting the condition to a boolean value (or, in the case of a switch statement, to an integral or enumeral value), or (3) In a for statement, destroying the condition's temporaries at the end of the increment expression (!). We now destroy temporaries in conditions at the right times. This required some tweaking of the Parse/Sema interaction, since the parser was building full expressions too early in many places. Fixes PR7067. llvm-svn: 103187
* Reverted part of r103177 (repositioning of clang-builtin include/)mike-m2010-05-061-18/+20
| | | | | | which breaks clang-i686-xp-msvc9 test-clang. llvm-svn: 103180
* Reposition clang-builtin include/ to immediately precede /usr/include/,mike-m2010-05-061-64/+78
| | | | | | | | | | matching gcc compiler. Fixes #include_next <...> shenanigans that lead to file-not-found failures with <cstddef> on libstdc++ 4.3.[012]. Updated C++ include header search paths for various Debian/Ubuntu and Fedora linux distros. llvm-svn: 103177
* Remember the number of positive and negative bits used by the enumerators ofJohn McCall2010-05-062-0/+4
| | | | | | | an enum in the enum decl itself. Use some spare bits from TagDecl for this purpose. llvm-svn: 103173
* Make -analyzer-inline-call not a separate analysis. Instead it's a boolean Zhongxing Xu2010-05-062-1/+2
| | | | | | | flag now, and can be used with other analyses. Only turned it on for C++ methods for now. llvm-svn: 103160
* This patch deals with Sema Part of Setter/Getter synthesisFariborz Jahanian2010-05-052-0/+2
| | | | | | | of properties which are of C++ objects. Code Gen to follow (Radar 7468090). llvm-svn: 103123
* Test commit.mike-m2010-05-051-1/+1
| | | | llvm-svn: 103090
* Unbreak CMake build.Douglas Gregor2010-05-051-1/+2
| | | | llvm-svn: 103077
* fit in 80 colsChris Lattner2010-05-051-3/+6
| | | | llvm-svn: 103075
* add a new -fdiagnostics-show-category=none/id/name option, giving controlChris Lattner2010-05-042-2/+25
| | | | | | | | | | | | over choice of: t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat] t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1] t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,Format String] dox to come. llvm-svn: 103056
* When -fdiagnostics-print-source-range-info is specified,Chris Lattner2010-05-041-4/+29
| | | | | | | | | | | | | | | | | | | | | | | print the diagnostic category number in the [] at the end of the line. For example: $ cat t.c #include <stdio.h> void foo() { printf("%s", 4); } $ clang t.c -fsyntax-only -fdiagnostics-print-source-range-info t.c:3:11:{3:10-3:12}{3:15-3:16}: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1] printf("%s", 4); ~^ ~ 1 warning generated. Clients that want category information can now pick the number out of the output, rdar://7928231. More coming. llvm-svn: 103053
* Introduce a limit on the depth of the macro instantiation backtraceDouglas Gregor2010-05-042-23/+74
| | | | | | | | | | | | | | printed in a diagnostic, similar to the limit we already have on the depth of the template instantiation backtrace. The macro instantiation backtrace is limited to 10 "instantiated from:" diagnostics; when it's longer than that, we'll show the first half, then say how many were suppressed, then show the second half. The limit can be changed with -fmacro-instantiation-limit=N, and turned off with N=0. This eliminates a lot of note spew with libraries making use of the Boost.Preprocess library. llvm-svn: 103014
* Workaround: Don't add ObjCMethodDecls to the vector of TopLevelDecls since ↵Ted Kremenek2010-05-031-2/+10
| | | | | | | | | they don't go in the DeclContext for the translation unit. This is to workaround a fundamental issue in how ObjC decls (within an @implementation) are parsed before the ObjCContainerDecl is available. llvm-svn: 102944
* Diagnose unused exception parameters under a different warning groupDouglas Gregor2010-05-032-0/+4
| | | | | | | | (-Wunused-exception-parameter) than normal variables, since it's more common to name and then ignore an exception parameter. This warning is neither enabled by default nor by -Wall. Fixes <rdar://problem/7931045>. llvm-svn: 102931
* Bump default template instantiation depth to 1024, as required by C++0xDouglas Gregor2010-05-011-1/+1
| | | | llvm-svn: 102847
* Don't perform AnalysisBasedWarnings in Sema or run the static analyzer when aTed Kremenek2010-04-301-5/+2
| | | | | | fatal error has occurred. llvm-svn: 102778
* Remove unused trait.Zhongxing Xu2010-04-301-9/+0
| | | | llvm-svn: 102690
* Refactor the AnalysisConsumer to analyze functions after the whole Zhongxing Xu2010-04-301-125/+63
| | | | | | | | | | | | | | | | | | | | | | | | | translation unit is parsed. This enables us to inline some calls when still analyzing one function at a time. Actions are classified into Function, CXXMethod, ObjCMethod, ObjCImplementation. This does not hurt performance much. The analysis time for sqlite3.c: before: real 17m52.440s user 17m49.460s sys 0m2.010s after: real 18m0.500s user 17m56.900s sys 0m2.330s DisplayProgress option is broken now. -inine-call action is removed. It will be reenabled in another form, perhaps as an indenpendant option. llvm-svn: 102689
* Add Clang version inspection macros. Fixes PR6681.Douglas Gregor2010-04-301-1/+15
| | | | llvm-svn: 102686
* Remove a FIXME that is unlikely to be fixed (streaming code generation).Daniel Dunbar2010-04-291-20/+16
| | | | llvm-svn: 102623
* Frontend: Tie backend verification passes to CodeGenOptions::VerifyModule,Daniel Dunbar2010-04-292-10/+1
| | | | | | instead of NDEBUG. llvm-svn: 102622
* Teach __builtin_offsetof to compute the offsets of members of baseDouglas Gregor2010-04-292-0/+10
| | | | | | | | classes, since we only warn (not error) on offsetof() for non-POD types. We store the base path within the OffsetOfExpr itself, then evaluate the offsets within the constant evaluator. llvm-svn: 102571
* Completely reimplement __builtin_offsetof, based on a patch by RobertoDouglas Gregor2010-04-283-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amadini. This change introduces a new expression node type, OffsetOfExpr, that describes __builtin_offsetof. Previously, __builtin_offsetof was implemented using a unary operator whose subexpression involved various synthesized array-subscript and member-reference expressions, which was ugly and made it very hard to instantiate as a template. OffsetOfExpr represents the AST more faithfully, with proper type source information and a more compact representation. OffsetOfExpr also has support for dependent __builtin_offsetof expressions; it can be value-dependent, but will never be type-dependent (like sizeof or alignof). This commit introduces template instantiation for __builtin_offsetof as well. There are two major caveats to this patch: 1) CodeGen cannot handle the case where __builtin_offsetof is not a constant expression, so it produces an error. So, to avoid regressing in C, we retain the old UnaryOperator-based __builtin_offsetof implementation in C while using the shiny new OffsetOfExpr implementation in C++. The old implementation can go away once we have proper CodeGen support for this case, which we expect won't cause much trouble in C++. 2) __builtin_offsetof doesn't work well with non-POD class types, particularly when the designated field is found within a base class. I will address this in a subsequent patch. Fixes PR5880 and a bunch of assertions when building Boost.Python tests. llvm-svn: 102542
* add regex support for -verify mode. You can now do things likeChris Lattner2010-04-281-144/+319
| | | | | | | | expected-error-re {{someregex}} Patch by mike-m! llvm-svn: 102516
* More of Sema to implement initialization ofFariborz Jahanian2010-04-282-0/+2
| | | | | | ivar of c++ object types. llvm-svn: 102500
* Make the InjectedClassNameType the canonical type of the current instantiationJohn McCall2010-04-271-1/+2
| | | | | | | | | | | | | | | | of a class template or class template partial specialization. That is to say, in template <class T> class A { ... }; or template <class T> class B<const T*> { ... }; make 'A<T>' and 'B<const T*>' sugar for the corresponding InjectedClassNameType when written inside the appropriate context. This allows us to track the current instantiation appropriately even inside AST routines. It also allows us to compute a DeclContext for a type much more efficiently, at some extra cost every time we write a template specialization (which can be optimized, but I've left it simple in this patch). llvm-svn: 102407
* fix PR6936: don't generate line marker directives when preprocessingChris Lattner2010-04-261-3/+9
| | | | | | | | .S files. "# 123" is passed through as-is, not treated as a line marker in this mode. No testcase, because it would be nasty and isn't worth it. llvm-svn: 102391
* Introduce Type::isStructureOrClassType(), which does the obviousDouglas Gregor2010-04-261-1/+1
| | | | | | | | thing. Audit all uses of Type::isStructure(), changing those calls to isStructureOrClassType() as needed (which is alsmost everywhere). Fixes the remaining failure in Boost.Utility/Swap. llvm-svn: 102386
OpenPOWER on IntegriCloud