Daniel Dunbar [Mon, 2 Mar 2009 06:08:11 +0000 (06:08 +0000)]
First cut at zero-cost EH support.
- Still manually generates the EH code; the parts related to cleanup
need to be integrated into the cleanup stack (for proper
interaction with VLAs, etc.).
- Some differences vs gcc in corner cases; I believe our behavior is
correct but need to verify/file bugs vs gcc.
Mike Stump [Mon, 2 Mar 2009 03:04:42 +0000 (03:04 +0000)]
Push checking down, also, give the user a hit as to which part of the
block literal is causing the problem, instead of the vague reference
to the entire block literal.
Douglas Gregor [Mon, 2 Mar 2009 00:19:53 +0000 (00:19 +0000)]
Rework the way we find locally-scoped external declarations when we
need them to evaluate redeclarations or call a function that hasn't
already been declared. We now keep a DenseMap of these locally-scoped
declarations so that they are not visible but can be quickly found,
e.g., when we're looking for previous declarations or before we go
ahead and implicitly declare a function that's being called. Fixes
PR3672.
Daniel Dunbar [Sun, 1 Mar 2009 04:46:24 +0000 (04:46 +0000)]
Obj-C non fragile ABI: Add GetInterfaceEHType for getting the Obj-C
exception typeinfo metadata, and a few other EH related types/functions.
- No functionality change.
Chris Lattner [Sun, 1 Mar 2009 00:56:52 +0000 (00:56 +0000)]
"This patch uses the new ObjCImplDecl class to merge Sema::ImplMethodsVsClassMethods and Sema::ImplCategoryMethodsVsIntfMethods methods.
And now, when clang check a class implementation to find unimplemented methods, it also checks all methods from the class extensions (unnamed categories).
There is also a test case to check this warning.
This patch contains also a minor update for ObjCImplDecl . getNameAsCString and getNameAsString now returns an empty string instead of crashing for unnamed categories."
Anders Carlsson [Sat, 28 Feb 2009 21:56:50 +0000 (21:56 +0000)]
Fix invalid VLAs/VMs in Sema::ActOnVariableDeclarator, so that the variable will have the right type by the time the initializer is checked. This ensures that code like
Chris Lattner [Sat, 28 Feb 2009 19:37:57 +0000 (19:37 +0000)]
Fix a crash in test/Parser/control-scope.c that testrunner didn't
notice because it was a negative test with a fix suggested by
Jean-Daniel Dupas. Convert the test from a negative to a positive
test to catch stuff like this.
Chris Lattner [Sat, 28 Feb 2009 18:42:10 +0000 (18:42 +0000)]
"This patch addresses two FIXME on ObjCCategoryImplDecl:
/// FIXME: Like ObjCImplementationDecl, this should not be a NamedDecl!
/// FIXME: Introduce a new common base class for ObjCImplementationDecl and ObjCCategoryImplDecl
It adds an IndentifierInfo ivar to the ObjCCategoryImplDecl, so it can inherits from Decl and not NamedDecl (I'm not sure about the memory management of this ivar).
And now that both ObjCImplementationDecl and ObjCCategoryImplDecl have the same super classes, it allow creation of a common base class: ObjCImplDecl"
Chris Lattner [Sat, 28 Feb 2009 18:18:58 +0000 (18:18 +0000)]
after going around in circles a few times, finally cave and emit structure
copies with memcpy instead of memmove. This matches what GCC does and if it
causes a problem with a particular libc we can always fix it with a target
hook.
Anders Carlsson [Sat, 28 Feb 2009 17:11:49 +0000 (17:11 +0000)]
TargetInfo::validateAsmConstraint now takes a reference to the full constraints string. This will make it possible to support multi-character constraints. No functionality change (for now).
Steve Naroff [Sat, 28 Feb 2009 16:48:43 +0000 (16:48 +0000)]
Fix <rdar://problem/6451399> problems with labels and blocks.
- Move the 'LabelMap' from Sema to Scope. To avoid layering problems, the second element is now a 'StmtTy *', which makes the LabelMap a bit more verbose to deal with.
- Add 'ActiveScope' to Sema. Managed by ActOnStartOfFunctionDef(), ObjCActOnStartOfMethodDef(), ActOnBlockStmtExpr().
- Changed ActOnLabelStmt(), ActOnGotoStmt(), ActOnAddrLabel(), and ActOnFinishFunctionBody() to use the new ActiveScope.
- Added FIXME to workaround in ActOnFinishFunctionBody() (for dealing with C++ nested functions).
Eli Friedman [Sat, 28 Feb 2009 05:41:13 +0000 (05:41 +0000)]
Start of checking for gotos which jump to an illegal destination.
As far as I know, this catches all cases of jumping into the scope of a
variable with a variably modified type (excluding statement
expressions) in C. This is missing some stuff we probably want to check
(other kinds of variably modified declarations, statement expressions,
indirect gotos/addresses of labels in a scope, ObjC @try/@finally, cleanup
attribute), the diagnostics aren't very good, and it's not particularly
efficient, but it's a decent start.
This patch is a slightly modified version of the patch I attached to
PR3259, and it fixes that bug. I was sort of planning on improving
it, but I think it's okay as-is, especially since it looks like CodeGen
doesn't have any use for this sort of data structure. The only
significant change I can think of from the version I attached to PR3259
is that this version skips running the checking code when a function
doesn't contain any labels.
This patch doesn't cover case statements, which also need similar
checking; I'm not sure how we should deal with that. Extending the goto
checking to also check case statements wouldn't be too hard; it's just a
matter of keeping track of the scope of the closest switch and checking that
the scope of every case is the same as the scope of the switch. That said,
it would likely be a performance hit to run this check on every
function (it's an extra pass over the entire function), so we probably want
some other solution.
Alignment of pointers in __objc_classlist must be on their
natural alignment. Otherwise, the excess hole confuses the
objc2 runtime (this is darwin specific).
Douglas Gregor [Sat, 28 Feb 2009 00:25:32 +0000 (00:25 +0000)]
Implement template instantiation for pointer, reference, and (some)
array types. Semantic checking for the construction of these types has
been factored out of GetTypeForDeclarator and into separate
subroutines (BuildPointerType, BuildReferenceType,
BuildArrayType). We'll be doing the same thing for all other types
(and declarations and expressions).
As part of this, moved the type-instantiation functions into a class
in an anonymous namespace.
Mike Stump [Fri, 27 Feb 2009 22:42:30 +0000 (22:42 +0000)]
Fix PR3612. We ensure that we add builtins to the GlobalDeclMap and
we ensure that things added to the module can be found even when they
are not in GlobalDeclMap. The later is for increased flexibility,
should someone want to do something tricky like extern "Ada" in the
same module.
Ted Kremenek [Fri, 27 Feb 2009 19:58:12 +0000 (19:58 +0000)]
In BuildAnonymousStructUnionMemberReference, we shouldn't invalidate OpLoc when
building nested member expressions. This location is used to determine the range
of the entire expression, and the expression itself already has its location
inherited from its Base.
Douglas Gregor [Fri, 27 Feb 2009 19:31:52 +0000 (19:31 +0000)]
Implement the basic approach for instantiating types, with a lot of FIXME'd
stubs for those types we don't yet know how to instantiate (everything
that isn't a template parameter!).
We now instantiate default arguments for template type parameters when
needed. This will be our testbed while I fill out the remaining
type-instantiation logic.
Chris Lattner [Fri, 27 Feb 2009 18:53:28 +0000 (18:53 +0000)]
upgrade various 'implicit int' warnings from an ext-warn to warning when not
in C89 mode. This makes it enabled by default instead of only enabled with
-pedantic. Clang defaults to c99 mode, so people will see this more often
than with GCC, but they can always use -std=c89 if they really want c89.
Ted Kremenek [Fri, 27 Feb 2009 17:58:43 +0000 (17:58 +0000)]
When checking printf-arguments for functions with '__attribute__ ((format (printf, X, Y)))'
set HasVAListArg to true when 'Y' is 0 (i.e., ignore the data arguments).
Eli Friedman [Fri, 27 Feb 2009 06:44:11 +0000 (06:44 +0000)]
Change the AST generated for offsetof a bit so that it looks like a
normal expression, and change Evaluate and IRGen to evaluate it like a
normal expression. This simplifies the code significantly, and fixes
PR3396.
Eli Friedman [Fri, 27 Feb 2009 04:07:58 +0000 (04:07 +0000)]
Make isICE assert when Evaluate can't evaluate an ICE, as suggested by
Daniel. Some minor fixes/cleanup. Allow __builtin_choose_expr,
__real__, and __imag__ in ICEs, following gcc's example.
Douglas Gregor [Thu, 26 Feb 2009 23:50:07 +0000 (23:50 +0000)]
Create a new TypeNodes.def file that enumerates all of the types,
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types.
Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.