Граф коммитов

9013 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson 1a7acfa0de 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
int a[(int)(1.0 / 1.0) = { 1 } will work.

Eli, please review.
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 21:56:50 +00:00
Steve Naroff b098c14c52 Remove PrevFunctionScope slot (it isn't needed)...use getParent() instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65718 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 21:01:15 +00:00
Ted Kremenek f5cae63463 Revert 65707 (causes stack memory to be referenced after it is released).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65717 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 20:50:43 +00:00
Fariborz Jahanian 7ce77920a3 Obscure code gen bug related to sending
message to 'super' in a class method declared in
cateogy (darwin specific).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 20:07:56 +00:00
Chris Lattner f306f86d2b 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65708 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 19:37:57 +00:00
Chris Lattner 56627e67a8 remove static ctor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 19:37:06 +00:00
Chris Lattner 161d36de7e improve compatibility with the VC++'08 C++ compiler. Patch by
Niklas Larsson!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 19:01:03 +00:00
Chris Lattner ab775f62ea fix inverted conditional, rdar://6633188
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65704 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 18:53:33 +00:00
Chris Lattner 3aa1861bd8 "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"

Patch by Jean-Daniel Dupas!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 18:42:10 +00:00
Chris Lattner 83c9629291 brain thinking memcpy, fingers thinking memset :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65701 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 18:31:01 +00:00
Chris Lattner ca4fc2c262 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65699 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 18:18:58 +00:00
Anders Carlsson 066d2ea752 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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65696 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 17:11:49 +00:00
Steve Naroff ebf6443a4f Minor name change (move the ObjC prefix to a more appropriate place).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65695 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 16:59:13 +00:00
Steve Naroff f3cf897379 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).  


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 16:48:43 +00:00
Gabor Greif 10b26140bc Adapt help string to what the code is doing (default is lang_gnu99). Thanks rdivacky!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 09:22:15 +00:00
Mike Stump a99038c075 First cut CodeGen support for __block variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65688 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 09:07:16 +00:00
Eli Friedman 709fa15def Check a few more kinds of declarations that make a scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 06:22:14 +00:00
Eli Friedman 8f17b66c8d 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 05:41:13 +00:00
Eli Friedman 722c717cd8 Fix obvious shortcoming in the implementations of Evaluate for
integer __real__ and __imag__.  Not sure how I missed this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65677 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 03:59:05 +00:00
Ted Kremenek 134fc37000 Update checker build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65676 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 02:04:49 +00:00
Douglas Gregor c1efaecf03 Eliminate CXXRecordType
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 01:32:25 +00:00
Douglas Gregor aca13a7df4 Add a FIXME for something I can't look at just yet
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65669 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 01:09:26 +00:00
Douglas Gregor 724651c352 Template instantiation for function types
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65668 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 01:04:19 +00:00
Fariborz Jahanian 5a1edf6c0d Alignment of pointers in __objc_classlist must be on their
natural alignment. Otherwise, the excess hole confuses the
objc2 runtime (this is darwin specific).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 00:54:00 +00:00
Douglas Gregor cd281c3ded 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. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 00:25:32 +00:00
Eli Friedman 00524e3c12 Fix enumeration in switch warnings. No behavior change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 23:15:07 +00:00
Eli Friedman 5a61f0e5c5 Fix enumeration in switch warnings, plus misc comment changes. No
behavior change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65658 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 23:04:43 +00:00
Mike Stump c136e6cf23 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 22:42:30 +00:00
Fariborz Jahanian 9bc77b2423 Diagnose gc attribute mismatch of property and its ivar.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65656 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 22:38:11 +00:00
Chris Lattner 173144affe Give a code insertion hint for how to fix 'implicit int' warnings and errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65653 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 22:31:56 +00:00
Douglas Gregor 8c633a09ec Fix a typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65652 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 22:05:23 +00:00
Ted Kremenek 9b5e5059b2 When retrieving the location of a Node, for MemberExprs use the location of the
'.' or '->'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 20:05:10 +00:00
Ted Kremenek a97b6666d2 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.

This fixes <rdar://problem/6629829>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 19:58:12 +00:00
Douglas Gregor 99ebf651f1 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 19:31:52 +00:00
Chris Lattner 34c0533a00 minor wording changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65648 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 19:31:12 +00:00
Chris Lattner 35d276f443 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65647 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 18:53:28 +00:00
Chris Lattner e64c5491d0 cleanup
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 18:38:20 +00:00
Chris Lattner 2a327d11a0 cleanup
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 18:35:46 +00:00
Mike Stump 5e301007e3 Silence warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 18:32:39 +00:00
Ted Kremenek 3d692df4b9 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).

This fixes <rdar://problem/6623513>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 17:58:43 +00:00
Douglas Gregor b2fb6de907 Clean up and document code modification hints.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65641 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 17:53:17 +00:00
Chris Lattner 51a75d0cc7 change a diagnostic message from something pedantically correct but
useless to something more vague but hopefully more clear.
rdar://6624173


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65639 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 17:15:01 +00:00
Daniel Dunbar 7fa649f984 Oops, Ted beat me to it. I'll just play angry god and remove his version!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 17:10:38 +00:00
Daniel Dunbar c8d8fa965e Add coverage of "member of anonymous union redeclares ..." diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65637 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 17:07:01 +00:00
Ted Kremenek beba7f47d8 Add test case for PR 3675.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 16:48:08 +00:00
Ted Kremenek 6028ca1f28 Update checker build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65625 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 07:16:04 +00:00
Eli Friedman 35183aca18 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65622 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 06:44:11 +00:00
Ted Kremenek 5de4092946 Don't report 'Parser Rejects' for conftest files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65619 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 06:17:38 +00:00
Ted Kremenek 6b89636db8 Correctly check for ccc-analyzer in the same directory as scan-build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65618 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 06:17:05 +00:00
Eli Friedman fd6f08525f Change the way clang generates union types a bit so it plays well
with the LLVM C backend.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65615 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 04:53:40 +00:00