summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Make the static type of the exception variable in an Objective-CDouglas Gregor2010-04-262-2/+2
| | | | | | | @catch a VarDecl. The dynamic type is still a ParmVarDecl, but that will change soon. No effective functionality change. llvm-svn: 102341
* Switch this to new API.Nick Lewycky2010-04-241-1/+1
| | | | llvm-svn: 102280
* Add BasePath arguments to all cast expr constructors.Anders Carlsson2010-04-241-1/+1
| | | | llvm-svn: 102258
* NeXT: Clean up dispatch method policy selection.Daniel Dunbar2010-04-241-3/+23
| | | | | | | | | | - Replace -cc1 level -fobjc-legacy-dispatch with -fobjc-dispatch-method={legacy,non-legacy,mixed}. - Lift "mixed" vs "non-mixed" policy choice up to driver level, instead of being buried in CGObjCMac.cpp. - No intended functionality change. llvm-svn: 102255
* CastExpr should not hold a pointer to the base path. More cleanup.Anders Carlsson2010-04-241-1/+1
| | | | llvm-svn: 102249
* Update prototypes.Benjamin Kramer2010-04-241-3/+4
| | | | llvm-svn: 102241
* Recommit r102215, this time being more careful to only set the "principalJohn McCall2010-04-241-0/+5
| | | | | | | declaration" (i.e. the only which will actually be looked up) to have the non-member-operator bit. llvm-svn: 102231
* Teach clang -fixit to modify files in-place, or -fixit=suffix to create newNick Lewycky2010-04-243-137/+40
| | | | | | files with the additional suffix in the middle. llvm-svn: 102230
* Revert r102215. This causes clang crash while compiling a test case from gdb ↵Devang Patel2010-04-241-5/+0
| | | | | | testsuite. llvm-svn: 102224
* Improve the AST representation of Objective-C @try/@catch/@finallyDouglas Gregor2010-04-233-24/+36
| | | | | | | | | | statements. Instead of the @try having a single @catch, where all of the @catch's were chained (using an O(n^2) algorithm nonetheless), @try just holds an array of its @catch blocks. The resulting AST is slightly more compact (not important) and better represents the actual language semantics (good). llvm-svn: 102221
* Add an InheritancePath parameter to the ImplicitCastExpr constructor.Anders Carlsson2010-04-231-4/+4
| | | | llvm-svn: 102218
* Transition the last acceptable-result filter kind in LookupResult over to useJohn McCall2010-04-231-0/+5
| | | | | | a simple IDNS mask by introducing a namespace for non-member operators. llvm-svn: 102215
* More work toward implementingFariborz Jahanian2010-04-232-10/+7
| | | | | | NeXt's -fno-constant-cfstrings - wip. llvm-svn: 102189
* add GNU C++ include paths for Fedora 11,12 x86_64,Chris Lattner2010-04-231-1/+13
| | | | | | patch by mikem! llvm-svn: 102177
* Check for -fno-constant-cfstrings consistencyFariborz Jahanian2010-04-222-0/+4
| | | | | | in pch. llvm-svn: 102130
* Support for -fno-constant-cfstrings option - wip.Fariborz Jahanian2010-04-221-0/+4
| | | | llvm-svn: 102112
* Sink the _GNU_SOURCE definition down into the target configuration,Douglas Gregor2010-04-211-24/+0
| | | | | | | and only define it where we know we need it---Linux and Cygwin. Thanks to Chris for the prodding. llvm-svn: 101989
* Overhaul the AST representation of Objective-C message sendDouglas Gregor2010-04-213-229/+299
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expressions, to improve source-location information, clarify the actual receiver of the message, and pave the way for proper C++ support. The ObjCMessageExpr node represents four different kinds of message sends in a single AST node: 1) Send to a object instance described by an expression (e.g., [x method:5]) 2) Send to a class described by the class name (e.g., [NSString method:5]) 3) Send to a superclass class (e.g, [super method:5] in class method) 4) Send to a superclass instance (e.g., [super method:5] in instance method) Previously these four cases where tangled together. Now, they have more distinct representations. Specific changes: 1) Unchanged; the object instance is represented by an Expr*. 2) Previously stored the ObjCInterfaceDecl* referring to the class receiving the message. Now stores a TypeSourceInfo* so that we know how the class was spelled. This both maintains typedef information and opens the door for more complicated C++ types (e.g., dependent types). There was an alternative, unused representation of these sends by naming the class via an IdentifierInfo *. In practice, we either had an ObjCInterfaceDecl *, from which we would get the IdentifierInfo *, or we fell into the case below... 3) Previously represented by a class message whose IdentifierInfo * referred to "super". Sema and CodeGen would use isStr("super") to determine if they had a send to super. Now represented as a "class super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). 4) Previously represented by an instance message whose receiver is a an ObjCSuperExpr, which Sema and CodeGen would check for via isa<ObjCSuperExpr>(). Now represented as an "instance super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). Note that ObjCSuperExpr only has one remaining use in the AST, which is for "super.prop" references. The new representation of ObjCMessageExpr is 2 pointers smaller than the old one, since it combines more storage. It also eliminates a leak when we loaded message-send expressions from a precompiled header. The representation also feels much cleaner to me; comments welcome! This patch attempts to maintain the same semantics we previously had with Objective-C message sends. In several places, there are massive changes that boil down to simply replacing a nested-if structure such as: if (message has a receiver expression) { // instance message if (isa<ObjCSuperExpr>(...)) { // send to super } else { // send to an object } } else { // class message if (name->isStr("super")) { // class send to super } else { // send to class } } with a switch switch (E->getReceiverKind()) { case ObjCMessageExpr::SuperInstance: ... case ObjCMessageExpr::Instance: ... case ObjCMessageExpr::SuperClass: ... case ObjCMessageExpr::Class:... } There are quite a few places (particularly in the checkers) where send-to-super is effectively ignored. I've placed FIXMEs in most of them, and attempted to address send-to-super in a reasonable way. This could use some review. llvm-svn: 101972
* change FullSourceLoc to have a *const* SourceManager&, eliminatingChris Lattner2010-04-201-1/+1
| | | | | | a const_cast. llvm-svn: 101940
* push some source location information down through the compiler,Chris Lattner2010-04-205-19/+11
| | | | | | | | into ContentCache::getBuffer. This allows it to produce diagnostics on the broken #include line instead of without a location. llvm-svn: 101939
* Keep proper source location information for the type in an Objective-CDouglas Gregor2010-04-202-2/+2
| | | | | | @encode expression. llvm-svn: 101907
* Introduce a limit on the depth of the template instantiation backtraceDouglas Gregor2010-04-202-0/+9
| | | | | | | | | | | | | | | | we will print with each error that occurs during template instantiation. When the backtrace is longer than that, we will print N/2 of the innermost backtrace entries and N/2 of the outermost backtrace entries, then skip the middle entries with a note such as: note: suppressed 2 template instantiation contexts; use -ftemplate-backtrace-limit=N to change the number of template instantiation entries shown This should eliminate some excessively long backtraces that aren't providing any value. llvm-svn: 101882
* Keep track of the actual storage specifier written on a variable orDouglas Gregor2010-04-193-19/+37
| | | | | | | | function declaration, since it may end up being changed (e.g., "extern" can become "static" if a prior declaration was static). Patch by Enea Zaffanella and Paolo Bolzoni. llvm-svn: 101826
* Fix -Wcast-qual warnings.Dan Gohman2010-04-193-4/+6
| | | | llvm-svn: 101786
* Add support for '-fgnu-keywords' and '-fasm' to Clang's driver. They are notChandler Carruth2010-04-173-0/+15
| | | | | | | | implemented precisely the same as GCC, but the distinction GCC makes isn't useful to represent. This allows parsing code which uses GCC-specific keywords ('asm', etc.) without parsing in a fully GNU mode. llvm-svn: 101667
* Vtable -> VTable renames across the board.Anders Carlsson2010-04-171-2/+2
| | | | llvm-svn: 101666
* Add raw_ostream operators to NamedDecl for convenience. Switch over all ↵Benjamin Kramer2010-04-172-24/+24
| | | | | | | | users of getNameAsString on a stream. The next step is to print the name directly into the stream, avoiding a temporary std::string copy. llvm-svn: 101632
* Add a write(raw_ostream&) method to RewriteBuffer. This uses an inefficientNick Lewycky2010-04-161-1/+1
| | | | | | | implementation today but is the right place if we want to make it faster some day. llvm-svn: 101521
* Remove this hard-coded buffer size. In some basic experiments preprocessingDan Gohman2010-04-161-2/+0
| | | | | | | | | | | large files, this doesn't seem significantly better than just letting raw_ostream pick a buffer size. This code predates raw-ostream's automatic buffer sizing; in fact, it was introduced as part of the code which would eventually become raw_ostream. llvm-svn: 101473
* Only predefine the macro _GNU_SOURCE in C++ mode when we're on aDouglas Gregor2010-04-161-2/+24
| | | | | | | platform that typically uses glibc. Fixes a Boost.Thread compilation failure. llvm-svn: 101450
* Fix a bug in caret-line-pruning logic that only happens when we have aDouglas Gregor2010-04-161-3/+10
| | | | | | | | source line wider than the terminal where the associated fix-it line is longer than the caret line. Previously, we would crash in this case, which was rather unfortunate. Fixes <rdar://problem/7856226>. llvm-svn: 101426
* clang -cc1: Add a -fno-bitfield-type-align option, for my own testing purposes.Daniel Dunbar2010-04-151-0/+9
| | | | llvm-svn: 101370
* Teach -fixit to modify all of its inputs instead of just the main file, unlessNick Lewycky2010-04-152-31/+76
| | | | | | -fixit-at specified a particular fixit to fix, or the -o flag was used. llvm-svn: 101359
* Driver/Frontend: Add support for -mllvm, which forwards options to the LLVM ↵Daniel Dunbar2010-04-151-0/+5
| | | | | | | | option parser. - Note that this is a behavior change, previously -mllvm at the driver level forwarded to clang -cc1. The driver does a little magic to make sure that '-mllvm -disable-llvm-optzns' works correctly, but other users will need to be updated to use -Xclang. llvm-svn: 101354
* Once we've emitted a fatal diagnostic, keep counting errors but with aDouglas Gregor2010-04-141-1/+2
| | | | | | | | | | | | | | separate count of "suppressed" errors. This way, semantic analysis bits that depend on the error count to determine whether problems occured (e.g., some template argument deduction failures, jump-scope checking) will not get confused. The actual problem here is that a missing #include (which is a fatal error) could cause the jump-scope checker to run on invalid code, which it is not prepared to do. Trivial fix for both <rdar://problem/7775941> and <rdar://problem/7775709>. llvm-svn: 101297
* Improve line marker directive locations, patch by Jordy RoseChris Lattner2010-04-141-1/+1
| | | | llvm-svn: 101226
OpenPOWER on IntegriCloud