Douglas Gregor [Sat, 6 Dec 2008 00:22:45 +0000 (00:22 +0000)]
Add support for calls to dependent names within templates, e.g.,
template<typename T> void f(T x) {
g(x); // g is a dependent name, so don't even bother to look it up
g(); // error: g is not a dependent name
}
Note that when we see "g(", we build a CXXDependentNameExpr. However,
if none of the call arguments are type-dependent, we will force the
resolution of the name "g" and replace the CXXDependentNameExpr with
its result.
GCC actually produces a nice error message when you make this
mistake, and even offers to compile your code with -fpermissive. I'll
do the former next, but I don't plan to do the latter.
Douglas Gregor [Fri, 5 Dec 2008 23:32:09 +0000 (23:32 +0000)]
Introduce basic support for dependent types, type-dependent
expressions, and value-dependent expressions. This permits us to parse
some template definitions.
This is not a complete solution; we're missing type- and
value-dependent computations for most of the expression types, and
we're missing checks for dependent types and type-dependent
expressions throughout Sema.
This test checks for duplicate implementation of the same
property. It also checks for duplicate use of the same ivar
in two different iproperty implementations. It also caught
an error for a test case used in CodeGen :).
(instance/class) Method type checking between class and its implementation.
(instance/class) Method type checking between category and its implementation.
And a test case for all.
Douglas Gregor [Fri, 5 Dec 2008 18:15:24 +0000 (18:15 +0000)]
Representation of template type parameters and non-type template
parameters, with some semantic analysis:
- Template parameters are introduced into template parameter scope
- Complain about template parameter shadowing (except in Microsoft mode)
Note that we leak template parameter declarations like crazy, a
problem we'll remedy once we actually create proper declarations for
templates.
Next up: dependent types and value-dependent/type-dependent
expressions.
Ted Kremenek [Fri, 5 Dec 2008 00:47:52 +0000 (00:47 +0000)]
StoreManager::Retrieve and StoreManager::RemoveDeadBindings now take a GRState* argument instead of a Store. This allows them to use the GDM for storing other data.
Chris Lattner [Thu, 4 Dec 2008 23:50:19 +0000 (23:50 +0000)]
change getCurFunctionDecl to skip through Block contexts to find
the containing block. Introduce a new getCurFunctionOrMethodDecl
method to check to see if we're in a function or objc method.
Minor cleanups to other related places. This fixes rdar://6405429.
Chris Lattner [Thu, 4 Dec 2008 23:20:07 +0000 (23:20 +0000)]
instead of forcing blocks on by default, make them default to off, but let
specific targets default them to on. Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.
Steve Naroff [Thu, 4 Dec 2008 16:24:46 +0000 (16:24 +0000)]
Several things...
- Implement RewritePropertySetter(). While the routine is simple, there were some tricky changes to RewriteFunctionBodyOrGlobalInitializer(), the main rewriter loop. It also required some additional instance data to distinguish setters from getters, as well as some changes to RewritePropertyGetter().
- Implement FIXME: for pretty printing ObjCPropertyRefExpr's.
- Changed ObjCPropertyRefExpr::getSourceRange() to point to the end of the property name (not the beginning). Also made a minor name change from "Loc"->"IdLoc" (to make it clear the Loc does not point to the ".").
Ted Kremenek [Thu, 4 Dec 2008 02:08:27 +0000 (02:08 +0000)]
Revamp RegionStoreManager::RemoveDeadBindings. This method now does a complete mark-and-sweep of the store, removing dead regions and recording the set of live and dead symbols appropriately.
Sebastian Redl [Thu, 4 Dec 2008 00:10:55 +0000 (00:10 +0000)]
Correct CodeGen assumption that LongTy == Int32Ty in a few places. This makes several CodeGenObjC tests pass on 64-bit by fixing assertions. This doesn't mean that the result is actually what the GNU runtime expects, though.
Ted Kremenek [Wed, 3 Dec 2008 19:06:30 +0000 (19:06 +0000)]
BasicConstraintManager:
- Fix nonsensical logic in AssumeSymGE. When comparing 'sym >= constant' and the
constant is the maximum integer value, add the constraint that 'sym ==
constant' when the path is deemed feasible. All other cases are feasible.
- Improve AssumeSymGT. When comparing 'sym > constant' and constant is the
maximum integer value we know the path is infeasible.
- Add test case for this enhancement to AssumeSymGT.
Ted Kremenek [Wed, 3 Dec 2008 18:56:12 +0000 (18:56 +0000)]
BasicConstraintManager:
- Fix nonsensical logic in AssumeSymLE. When comparing 'sym <= constant' and the
constant is the minimum integer value, add the constraint that 'sym ==
constant' when the path is deemed feasible. All other cases are feasible.
- Improve AssumeSymLT to address <rdar://problem/6407949>. When comparing
'sym < constant' and constant is the minimum integer value we know the
path is infeasible.
- Add test case for <rdar://problem/6407949>.
Ted Kremenek [Wed, 3 Dec 2008 00:38:03 +0000 (00:38 +0000)]
- Remove PTHManager.cpp. Move all of its functions to PTHLexer.cpp since some of the internal methods are used by PTHLexer (their implementations are intertwined.) This enables some important inlining opportunities at -O3.
- Don't construct an std::vector<Token> prior to feeding PTH tokens to the Preprocessor. Stream them off the PTH file directly.
Ted Kremenek [Tue, 2 Dec 2008 19:46:31 +0000 (19:46 +0000)]
Preprocessor:
- Added method "setPTHManager" that will be called by the driver to install
a PTHManager for the Preprocessor.
- Fixed some comments.
- Added EnterSourceFileWithPTH to mirror EnterSourceFileWithLexer.
Ted Kremenek [Tue, 2 Dec 2008 19:44:08 +0000 (19:44 +0000)]
PTH emission:
- Output 32 bit integers using bit-shifting + write of individual bytes.
This is motivated because we aren't guaranteed to load 32-bit ints of the mmaped PTH file at 4-byte offsets.
- Don't emit flags for IdentifierInfos. These are lazily populated by the Preprocessor/Parser.
- Only write out tokens for files with absolute paths. This is potentially temporary, but simplifies things for now.
Sebastian Redl [Tue, 2 Dec 2008 16:47:35 +0000 (16:47 +0000)]
Make RegionStoreManager::InitializeArray safe against array sizes that don't have pointer width.
This may be the case on 64-bit systems. Whether that fact is a bug is a different question, but it's easy to cure the symptom.
Douglas Gregor [Tue, 2 Dec 2008 00:41:28 +0000 (00:41 +0000)]
A little more scaffolding for parsing templates:
- Template parameter scope to hold the template parameters
- Template parameter context for parsing declarators
- Actions for template type parameters and non-type template
parameters
This patch corrects problem in searching for a setter/getter method for
a property. Previous scheme of seaching in interface's list of methods
would not work because this list is not yet constructed. This is in preparation
for doing semantic check on viability of setter/getter method declarations.
Daniel Dunbar [Mon, 1 Dec 2008 18:55:22 +0000 (18:55 +0000)]
Add LangOptions marker for assembler-with-cpp mode and use to define
__ASSEMBLER__ properly. Patch from Roman Divacky (with minor
formatting changes). Thanks!