]> granicus.if.org Git - clang/log
clang
15 years agoexplicitly cast integers to double. This a) silences any
Chris Lattner [Tue, 17 Feb 2009 02:41:36 +0000 (02:41 +0000)]
explicitly cast integers to double.  This a) silences any
possible future "data loss" warnings, and b) makes it intensely
obvious to the user what the impl of these functions do in a
ambiguity error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64724 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoasin support. No we don't care about complex int :)
Chris Lattner [Tue, 17 Feb 2009 02:37:35 +0000 (02:37 +0000)]
asin support.  No we don't care about complex int :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64723 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agohand macro expand this to make "candidate" set printing more useful. However,
Chris Lattner [Tue, 17 Feb 2009 02:30:54 +0000 (02:30 +0000)]
hand macro expand this to make "candidate" set printing more useful.  However,
Now no candidates are printed because the 'notes' are in a system header. :(

#include <tgmath-sofar.h>
 double foo2(short *x) {
  return acos(x);
}

t.c:10:10: error: no matching function for call to '__tg_acos'; candidates are:
  return acos(x);
         ^~~~
1 diagnostic generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64722 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd support for integers to tgmath functions. I apparently need to provide
Chris Lattner [Tue, 17 Feb 2009 02:22:33 +0000 (02:22 +0000)]
add support for integers to tgmath functions.  I apparently need to provide
all the integer types other than char/short to avoid overload ambiguities.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64721 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agostart converting over to attr(overloadable). Unfortunately, this
Chris Lattner [Tue, 17 Feb 2009 02:14:31 +0000 (02:14 +0000)]
start converting over to attr(overloadable).  Unfortunately, this
produces really horrible diagnostics when overload ambiguities
happen:

t.c:10:10: error: call to '__tg_acos' is ambiguous; candidates are:
  return acos(x);
         ^~~~
In file included from t.c:1:
/Users/sabre/llvm/Debug/Headers/tgmath-sofar.h:49:1: note: candidate function
__TG_RC_1(x, acos, cacos)
^
/Users/sabre/llvm/Debug/Headers/tgmath-sofar.h:49:1: note: candidate function
__TG_RC_1(x, acos, cacos)
^
/Users/sabre/llvm/Debug/Headers/tgmath-sofar.h:49:1: note: candidate function
__TG_RC_1(x, acos, cacos)
^
/Users/sabre/llvm/Debug/Headers/tgmath-sofar.h:49:1: note: candidate function
__TG_RC_1(x, acos, cacos)
^
/Users/sabre/llvm/Debug/Headers/tgmath-sofar.h:49:1: note: candidate function
__TG_RC_1(x, acos, cacos)
^
/Users/sabre/llvm/Debug/Headers/tgmath-sofar.h:49:1: note: candidate function
__TG_RC_1(x, acos, cacos)
^

A possible fix is to just not use macros for this, which I'll probably go for,
but it would be nice to emit the type at the call, so we know what we asked for!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64720 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake PragmaPackStack be a private class in SemaAttr and make its
Chris Lattner [Tue, 17 Feb 2009 01:09:29 +0000 (01:09 +0000)]
Make PragmaPackStack be a private class in SemaAttr and make its
instance in Sema be a pimpl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64718 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdded ClassTemplateSpecializationDecl, which is a subclass of
Douglas Gregor [Tue, 17 Feb 2009 01:05:43 +0000 (01:05 +0000)]
Added ClassTemplateSpecializationDecl, which is a subclass of
CXXRecordDecl that is used to represent class template
specializations. These are canonical declarations that can refer to
either an actual class template specialization in the code, e.g.,

  template<> class vector<bool> { };

or to a template instantiation. However, neither of these features is
actually implemented yet, so really we're just using (and uniqing) the
declarations to make sure that, e.g., A<int> is a different type from
A<float>. Note that we carefully distinguish between what the user
wrote in the source code (e.g., "A<FLOAT>") and the semantic entity it
represents (e.g., "A<float, int>"); the former is in the sugared Type,
the latter is an actual Decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64716 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocopying and assignment of sema seem unwise :)
Chris Lattner [Tue, 17 Feb 2009 00:58:30 +0000 (00:58 +0000)]
copying and assignment of sema seem unwise :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64712 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomove attribute(packed) sema support out of SemaDecl into a new SemaAttr.cpp file.
Chris Lattner [Tue, 17 Feb 2009 00:57:29 +0000 (00:57 +0000)]
move attribute(packed) sema support out of SemaDecl into a new SemaAttr.cpp file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64711 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosimplify this code and make it use highlight range. This
Chris Lattner [Tue, 17 Feb 2009 00:51:07 +0000 (00:51 +0000)]
simplify this code and make it use highlight range.  This
makes -emit-html do nice things for code like:

#define FOO(X) y

int FOO(4
);

highlighting the FOO instance as well as the ) on the next line properly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64710 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoccc: Pass -f[no-]math-errno to clang.
Daniel Dunbar [Tue, 17 Feb 2009 00:42:05 +0000 (00:42 +0000)]
ccc: Pass -f[no-]math-errno to clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64709 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd support for -fno-math-errno, and validate that it affects sema properly.
Chris Lattner [Tue, 17 Feb 2009 00:35:09 +0000 (00:35 +0000)]
add support for -fno-math-errno, and validate that it affects sema properly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64708 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosema no longer explodes, yay!
Chris Lattner [Tue, 17 Feb 2009 00:32:04 +0000 (00:32 +0000)]
sema no longer explodes, yay!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64707 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoremove extraneous .
Chris Lattner [Tue, 17 Feb 2009 00:30:31 +0000 (00:30 +0000)]
remove extraneous .

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64706 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agox86_64 ABI: Handle va_arg arguments with alignment > 8.
Daniel Dunbar [Mon, 16 Feb 2009 23:38:56 +0000 (23:38 +0000)]
x86_64 ABI: Handle va_arg arguments with alignment > 8.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64701 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDiagnose non-power-of-2 arguments to attribute aligned.
Daniel Dunbar [Mon, 16 Feb 2009 23:37:57 +0000 (23:37 +0000)]
Diagnose non-power-of-2 arguments to attribute aligned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64700 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support for throwing exceptions to the nonfragile ABI
Anders Carlsson [Mon, 16 Feb 2009 22:59:18 +0000 (22:59 +0000)]
Add support for throwing exceptions to the nonfragile ABI

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64692 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdded implementation of objc2's gc API calls for
Fariborz Jahanian [Mon, 16 Feb 2009 22:52:32 +0000 (22:52 +0000)]
Added implementation of objc2's gc API calls for
nonfragile abi.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64690 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSupport IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.
Daniel Dunbar [Mon, 16 Feb 2009 22:43:43 +0000 (22:43 +0000)]
Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.

 - Define pow[lf]?, sqrt[lf]? as builtins.

 - Add -fmath-errno option which binds to LangOptions.MathErrno

 - Add new builtin flag Builtin::Context::isConstWithoutErrno for
   functions which can be marked as const if errno isn't respected for
   math functions. Sema automatically marks these functions as const
   when they are defined, if MathErrno=0.

 - IRgen uses const attribute on sqrt and pow library functions to
   decide if it can use the llvm intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64689 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUnbreak clang.
Daniel Dunbar [Mon, 16 Feb 2009 22:42:44 +0000 (22:42 +0000)]
Unbreak clang.

Doug: please verify that it is expected that LastIdx can be less that
NumInits. And perhaps add a comment so that Chris doesn't break your
code. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64688 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake "implicit int" an error in C++ (unless we're allowing Microsoft
Douglas Gregor [Mon, 16 Feb 2009 22:38:20 +0000 (22:38 +0000)]
Make "implicit int" an error in C++ (unless we're allowing Microsoft
extensions). This caught a couple bugs in our test suite :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64686 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix long lines.
Chris Lattner [Mon, 16 Feb 2009 22:33:34 +0000 (22:33 +0000)]
fix long lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64684 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix volatile handling with ExtVectorElementExpr, so that we
Chris Lattner [Mon, 16 Feb 2009 22:25:49 +0000 (22:25 +0000)]
fix volatile handling with ExtVectorElementExpr, so that we
emit two volatile loads for:
typedef __attribute__(( ext_vector_type(4) )) float float4;

float test(volatile float4 *P) {
  return P->x+P->y;
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64683 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoModify getMaxValue/getMinValue to take pointer values as well.
Ted Kremenek [Mon, 16 Feb 2009 22:21:33 +0000 (22:21 +0000)]
Modify getMaxValue/getMinValue to take pointer values as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64682 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agointroduce and use a new ExtVectorElementExpr::isArrow method, at Eli's suggestion
Chris Lattner [Mon, 16 Feb 2009 22:14:05 +0000 (22:14 +0000)]
introduce and use a new ExtVectorElementExpr::isArrow method, at Eli's suggestion

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64681 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse isa<...> instead of dyn_cast<...> where result is not needed.
Fariborz Jahanian [Mon, 16 Feb 2009 22:09:26 +0000 (22:09 +0000)]
Use isa<...> instead of dyn_cast<...> where result is not needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64680 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodiagnose uses of deprecated typenames and tags.
Chris Lattner [Mon, 16 Feb 2009 22:07:16 +0000 (22:07 +0000)]
diagnose uses of deprecated typenames and tags.
We now pass all the deprecation tests in the objc.dg suite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64679 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoBasicValueFactory: Add utility methods 'Add1' and 'Sub1' to get a persistent APSInt...
Ted Kremenek [Mon, 16 Feb 2009 22:07:07 +0000 (22:07 +0000)]
BasicValueFactory: Add utility methods 'Add1' and 'Sub1' to get a persistent APSInt value that is 1 greater or 1 less than the provided value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64678 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoBasicValueFactory: Add getMaxValue and getMinValue variants that take QualTypes.
Ted Kremenek [Mon, 16 Feb 2009 22:00:30 +0000 (22:00 +0000)]
BasicValueFactory: Add getMaxValue and getMinValue variants that take QualTypes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64677 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSupply the header corresponding to a library builtin as a separate argument to the...
Douglas Gregor [Mon, 16 Feb 2009 21:58:21 +0000 (21:58 +0000)]
Supply the header corresponding to a library builtin as a separate argument to the LIBBUILTIN macro

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64676 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd getSymbolManager() and getBasicVals() accessors to GRStateRef.
Ted Kremenek [Mon, 16 Feb 2009 21:57:23 +0000 (21:57 +0000)]
Add getSymbolManager() and getBasicVals() accessors to GRStateRef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64675 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix IRgen of __builtin_memset.
Daniel Dunbar [Mon, 16 Feb 2009 21:52:05 +0000 (21:52 +0000)]
Fix IRgen of __builtin_memset.
 - Fix test case to not only have negative tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64674 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorandom cleanup
Chris Lattner [Mon, 16 Feb 2009 21:43:00 +0000 (21:43 +0000)]
random cleanup

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64673 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFixes a bug in property type encoding.
Fariborz Jahanian [Mon, 16 Feb 2009 21:41:04 +0000 (21:41 +0000)]
Fixes a bug in property type encoding.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64672 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agowarn about interfaces that inherit from deprecated classes.
Chris Lattner [Mon, 16 Feb 2009 21:33:09 +0000 (21:33 +0000)]
warn about interfaces that inherit from deprecated classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64671 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agowarn about categories that implement deprecated interfaces.
Chris Lattner [Mon, 16 Feb 2009 21:30:01 +0000 (21:30 +0000)]
warn about categories that implement deprecated interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64670 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoearly exit on error. This code is creating an invalid decl on error. This is
Chris Lattner [Mon, 16 Feb 2009 21:26:43 +0000 (21:26 +0000)]
early exit on error.  This code is creating an invalid decl on error.  This is
dubious, but at least mark it as an invalid decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64668 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoenhance ExtVectorElementExpr to allow V->xxyy to work like (*V).xxyy
Chris Lattner [Mon, 16 Feb 2009 21:11:58 +0000 (21:11 +0000)]
enhance ExtVectorElementExpr to allow V->xxyy  to work like (*V).xxyy

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64667 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoWhen merging from a function with a prototype to a function without a
Douglas Gregor [Mon, 16 Feb 2009 20:58:07 +0000 (20:58 +0000)]
When merging from a function with a prototype to a function without a
prototype, synthesize ParmVarDecls for prototype-less FunctionDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64666 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTest passes with -analyzer-range-contraints.
Ted Kremenek [Mon, 16 Feb 2009 19:43:20 +0000 (19:43 +0000)]
Test passes with -analyzer-range-contraints.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64663 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove an unused variable (which caused a warning).
Fariborz Jahanian [Mon, 16 Feb 2009 19:40:26 +0000 (19:40 +0000)]
Remove an unused variable (which caused a warning).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64660 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodo not warn about uses of deprecated decls when in an out-of-line objc method
Chris Lattner [Mon, 16 Feb 2009 19:35:30 +0000 (19:35 +0000)]
do not warn about uses of deprecated decls when in an out-of-line objc method
whose declaration was declared as deprecated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64658 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove FindIvarDeclaration. Use lookupInstanceVariable is is functionally
Fariborz Jahanian [Mon, 16 Feb 2009 19:35:27 +0000 (19:35 +0000)]
Remove FindIvarDeclaration. Use lookupInstanceVariable is is functionally
the same.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64657 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocleanup, add a getMethod() that takes a bool to indicate whether
Chris Lattner [Mon, 16 Feb 2009 19:30:12 +0000 (19:30 +0000)]
cleanup, add a getMethod() that takes a bool to indicate whether
the caller wants class or instance methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64654 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoWhen inside an Objective-C++ method, name lookup should look into the
Douglas Gregor [Mon, 16 Feb 2009 19:28:42 +0000 (19:28 +0000)]
When inside an Objective-C++ method, name lookup should look into the
interface for ivars before assuming that this is an unresolved
function name.

Fixes <rdar://problem/6590445>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64653 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd assertion
Chris Lattner [Mon, 16 Feb 2009 19:27:54 +0000 (19:27 +0000)]
add assertion

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64652 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocode cleanup
Chris Lattner [Mon, 16 Feb 2009 19:25:52 +0000 (19:25 +0000)]
code cleanup

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64651 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agowrap long lines.
Chris Lattner [Mon, 16 Feb 2009 19:24:31 +0000 (19:24 +0000)]
wrap long lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64650 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoassert/ErrorUnsupported in unimplemented stub functions instead of
Daniel Dunbar [Mon, 16 Feb 2009 18:48:45 +0000 (18:48 +0000)]
assert/ErrorUnsupported in unimplemented stub functions instead of
miscompiling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64647 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd pretty-printing (for GraphViz) support for RangeConstraintManager.
Ted Kremenek [Mon, 16 Feb 2009 18:42:56 +0000 (18:42 +0000)]
Add pretty-printing (for GraphViz) support for RangeConstraintManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64646 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support for deprecating ObjC properties. Unlike GCC, we warn that the
Chris Lattner [Mon, 16 Feb 2009 18:35:08 +0000 (18:35 +0000)]
Add support for deprecating ObjC properties.  Unlike GCC, we warn that the
property is deprecated, not the getter/setter if the attribute is on
the property.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64644 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agopropagate attributes onto property decls.
Chris Lattner [Mon, 16 Feb 2009 18:32:47 +0000 (18:32 +0000)]
propagate attributes onto property decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64643 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodefine __OBJC2__ for objc's nonfragile abi.
Fariborz Jahanian [Mon, 16 Feb 2009 18:28:48 +0000 (18:28 +0000)]
define __OBJC2__ for objc's nonfragile abi.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64642 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoWhen a function with a prototype is redeclared without a prototype,
Douglas Gregor [Mon, 16 Feb 2009 18:20:44 +0000 (18:20 +0000)]
When a function with a prototype is redeclared without a prototype,
merge the prototype into the redeclaration (and make a note in the
declaration). Fixes PR3588.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64641 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoccc: @<filename> arguments are only treated specially if <filename>
Daniel Dunbar [Mon, 16 Feb 2009 18:18:43 +0000 (18:18 +0000)]
ccc: @<filename> arguments are only treated specially if <filename>
exists, otherwise gcc just treats as an input.
 - PR3591

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64640 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdopt a more principled approach to invalid declarations:
Douglas Gregor [Mon, 16 Feb 2009 17:45:42 +0000 (17:45 +0000)]
Adopt a more principled approach to invalid declarations:
  - If a declaration is an invalid redeclaration of an existing name,
    complain about the invalid redeclaration then avoid adding it to
    the AST (we can still parse the definition or initializer, if any).
  - If the declaration is invalid but there is no prior declaration
    with that name, introduce the invalid declaration into the AST
    (for later error recovery).
  - If the declaration is an invalid redeclaration of a builtin that
    starts with __builtin_, we produce an error and drop the
    redeclaration. If it is an invalid redeclaration of a library
    builtin (e.g., malloc, printf), warn (don't error!) and drop the
    redeclaration.

If a user attempts to define a builtin, produce an error and (if it's
a library builtin like malloc) suggest -ffreestanding.

This addresses <rdar://problem/6097585> and PR2892. However, PR3588 is
still going to cause some problems when builtins are redeclared
without a prototype.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64639 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRangeConstraintManager is not on by default.
Ted Kremenek [Mon, 16 Feb 2009 17:26:11 +0000 (17:26 +0000)]
RangeConstraintManager is not on by default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64638 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd support for deprecated objc ivars.
Chris Lattner [Mon, 16 Feb 2009 17:19:12 +0000 (17:19 +0000)]
add support for deprecated objc ivars.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64637 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agospecify a triple to use, otherwise we get errors on this test for
Chris Lattner [Mon, 16 Feb 2009 17:11:14 +0000 (17:11 +0000)]
specify a triple to use, otherwise we get errors on this test for
hosts with a different size_t type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64636 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoupdate expected-warning line.
Chris Lattner [Mon, 16 Feb 2009 17:08:46 +0000 (17:08 +0000)]
update expected-warning line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64635 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support for deprecated members of RecordDecls (e.g. struct fields).
Chris Lattner [Mon, 16 Feb 2009 17:07:21 +0000 (17:07 +0000)]
Add support for deprecated members of RecordDecls (e.g. struct fields).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64634 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocastToDeclContext/castFromDeclContext are only required to be included in the class...
Argyrios Kyrtzidis [Mon, 16 Feb 2009 14:31:00 +0000 (14:31 +0000)]
castToDeclContext/castFromDeclContext are only required to be included in the class of decls that directly derive from DeclContext.
Their subclasses don't need them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64632 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocastToDeclContext/castFromDeclContext are not meant to be used directly; they are...
Argyrios Kyrtzidis [Mon, 16 Feb 2009 14:29:59 +0000 (14:29 +0000)]
castToDeclContext/castFromDeclContext are not meant to be used directly; they are used indirectly by cast/dyn_cast.
All Decl <-> DeclContext casting should be done through cast/dyn_cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64631 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDeclContext had its "casting machinery" inside the class definition so that if a...
Argyrios Kyrtzidis [Mon, 16 Feb 2009 14:29:28 +0000 (14:29 +0000)]
DeclContext had its "casting machinery" inside the class definition so that if a new declaration context Decl appeared, the necessary changes
would be in one place. Since, now, only DeclNodes.def needs to be modified, move things out-of-line and simplify the DeclContext class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64630 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake DeclContexts maintenance a bit easier.
Argyrios Kyrtzidis [Mon, 16 Feb 2009 14:28:33 +0000 (14:28 +0000)]
Make DeclContexts maintenance a bit easier.

-In DeclNodes.def, only mark as DeclContexts the top classes that directly derive from DeclContext. If the Decl has subclasses,
 it should be marked with DECL_CONTEXT_BASE.

-Use DeclNodes.def to automate the DeclContext::classof and DeclContext::CastTo definitions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64629 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUntabify.
Ben Laurie [Mon, 16 Feb 2009 09:18:41 +0000 (09:18 +0000)]
Untabify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64628 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDo not register 'RangeConstraintManager' as the default ConstraintManager.
Ted Kremenek [Mon, 16 Feb 2009 04:54:20 +0000 (04:54 +0000)]
Do not register 'RangeConstraintManager' as the default ConstraintManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64627 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDon't allow taking the address of an element in an ext_vector
Nate Begeman [Sun, 15 Feb 2009 22:45:20 +0000 (22:45 +0000)]
Don't allow taking the address of an element in an ext_vector

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64614 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agolots of trailing whitespace
Chris Lattner [Sun, 15 Feb 2009 22:44:22 +0000 (22:44 +0000)]
lots of trailing whitespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64613 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRefactor the deprecated and unavailable checks into a new
Chris Lattner [Sun, 15 Feb 2009 22:43:40 +0000 (22:43 +0000)]
Refactor the deprecated and unavailable checks into a new
DiagnoseUseOfDeprecatedDecl method.  This ensures that they
are treated consistently.  This gets us 'unavailable' support
on a few new types of decls, and makes sure we consistently
silence deprecated when the caller is also deprecated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64612 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimplement gcc/testsuite/objc.dg/method-attribute-3.m, by improving error recovery.
Chris Lattner [Sun, 15 Feb 2009 22:24:30 +0000 (22:24 +0000)]
implement gcc/testsuite/objc.dg/method-attribute-3.m, by improving error recovery.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64609 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodon't pass a random english string in as a string argument to Diag.
Chris Lattner [Sun, 15 Feb 2009 22:21:03 +0000 (22:21 +0000)]
don't pass a random english string in as a string argument to Diag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64608 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix a fixme in -emit-html output: highlight the entire range of a macro
Chris Lattner [Sun, 15 Feb 2009 21:32:34 +0000 (21:32 +0000)]
fix a fixme in -emit-html output: highlight the entire range of a macro
instantiation, which highlights the arguments of a function like macro
as well as its identifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64607 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd a new SourceManager::getInstantiationRange helper method.
Chris Lattner [Sun, 15 Feb 2009 21:26:50 +0000 (21:26 +0000)]
add a new SourceManager::getInstantiationRange helper method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64606 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix build on systems where uint64_t != unsigned long long
Chris Lattner [Sun, 15 Feb 2009 21:20:13 +0000 (21:20 +0000)]
fix build on systems where uint64_t != unsigned long long

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64605 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix PR3579: __LINE__ expands to the presumed location of the
Chris Lattner [Sun, 15 Feb 2009 21:06:39 +0000 (21:06 +0000)]
fix PR3579: __LINE__ expands to the presumed location of the
*end* of a macro instantiation, not the start of it.  This is
really all about bug-for-bug compatibility with GCC, but not
doing this breaks the FreeBSD kernel.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64604 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix PR3579: __LINE__ expands to the presumed location of the
Chris Lattner [Sun, 15 Feb 2009 21:06:15 +0000 (21:06 +0000)]
fix PR3579: __LINE__ expands to the presumed location of the
*end* of a macro instantiation, not the start of it.  This is
really all about bug-for-bug compatibility with GCC, but not
doing this breaks the FreeBSD kernel.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64603 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agotrack "just a little more" location information for macro instantiations.
Chris Lattner [Sun, 15 Feb 2009 20:52:18 +0000 (20:52 +0000)]
track "just a little more" location information for macro instantiations.
Now instead of just tracking the expansion history, also track the full
range of the macro that got replaced.  For object-like macros, this doesn't
change anything.  For _Pragma and function-like macros, this means we track
the locations of the ')'.

This is required for PR3579 because apparently GCC uses the line of the ')'
of a function-like macro as the location to expand __LINE__ to.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64601 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPR3589: Don't simplify libcalls with -ffreestanding.
Daniel Dunbar [Sun, 15 Feb 2009 20:00:15 +0000 (20:00 +0000)]
PR3589: Don't simplify libcalls with -ffreestanding.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64599 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove accidental duplication of content in .h file.
Ted Kremenek [Sun, 15 Feb 2009 18:24:51 +0000 (18:24 +0000)]
Remove accidental duplication of content in .h file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64596 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix pasto noticed by Anders Johnsen.
Daniel Dunbar [Sun, 15 Feb 2009 18:23:07 +0000 (18:23 +0000)]
Fix pasto noticed by Anders Johnsen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64595 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimplement support for attribute(unavailable) on objc methods.
Chris Lattner [Sun, 15 Feb 2009 07:50:52 +0000 (07:50 +0000)]
implement support for attribute(unavailable) on objc methods.
This implements gcc/testsuite/objc.dg/method-attribute-1.m

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64581 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoObj-C non-fragile ABI: Fix types of a few globals; these were not
Daniel Dunbar [Sun, 15 Feb 2009 07:36:20 +0000 (07:36 +0000)]
Obj-C non-fragile ABI: Fix types of a few globals; these were not
creating valid LLVM structures (although they work fined).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64580 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoccc: Pass -P to clang.
Daniel Dunbar [Sun, 15 Feb 2009 05:59:37 +0000 (05:59 +0000)]
ccc: Pass -P to clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64578 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoallow implementations of deprecated functions to use deprecated symbols.
Chris Lattner [Sun, 15 Feb 2009 01:38:09 +0000 (01:38 +0000)]
allow implementations of deprecated functions to use deprecated symbols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64572 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse getNameAsCString instead of getNameAsString and reflow the type.
Mike Stump [Sat, 14 Feb 2009 22:49:33 +0000 (22:49 +0000)]
Use getNameAsCString instead of getNameAsString and reflow the type.
Thanks Anders.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64571 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoGenerate the helper function for blocks. Now basic codegen is
Mike Stump [Sat, 14 Feb 2009 22:16:35 +0000 (22:16 +0000)]
Generate the helper function for blocks.  Now basic codegen is
starting to work for blocks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64570 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFixed a bad ir-gen bug which caused a dejagnu test to fail.
Fariborz Jahanian [Sat, 14 Feb 2009 21:25:36 +0000 (21:25 +0000)]
Fixed a bad ir-gen bug which caused a dejagnu test to fail.
Now we are pretty close to be in sync with objc's classic
abi when it comes to passing dejagnu objc executable tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64569 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a test case for -ffreestanding that redefines malloc.
Douglas Gregor [Sat, 14 Feb 2009 21:06:05 +0000 (21:06 +0000)]
Add a test case for -ffreestanding that redefines malloc.

Warn that complex numbers are an extension in a freestanding C99
implementation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64568 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd -ffreestanding to suppress the implicit declaration of library builtins like...
Douglas Gregor [Sat, 14 Feb 2009 20:49:29 +0000 (20:49 +0000)]
Add -ffreestanding to suppress the implicit declaration of library builtins like printf and malloc. Fixes PR3586

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64566 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd expected note. Surely people test before the check in stuff.
Mike Stump [Sat, 14 Feb 2009 20:35:19 +0000 (20:35 +0000)]
Add expected note.  Surely people test before the check in stuff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64565 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd svn:eol-style=native to some files
Cedric Venet [Sat, 14 Feb 2009 20:20:19 +0000 (20:20 +0000)]
Add svn:eol-style=native to some files
Correct two files with inconsistent lines endings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64564 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFixed a problem caused by foreward @class use
Fariborz Jahanian [Sat, 14 Feb 2009 20:13:28 +0000 (20:13 +0000)]
Fixed a problem caused by foreward @class use
which consequently caused a Seg fault. during meta-data
generation. It also addresses an issue related to
late binding of newly synthesize ivars (when we support it).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64563 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support for deprecated Obj-C methods. The semantics mostly match what gcc has.
Anders Carlsson [Sat, 14 Feb 2009 19:08:58 +0000 (19:08 +0000)]
Add support for deprecated Obj-C methods. The semantics mostly match what gcc has.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64562 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd hook to add attributes to function declarations that we know
Douglas Gregor [Sat, 14 Feb 2009 18:57:46 +0000 (18:57 +0000)]
Add hook to add attributes to function declarations that we know
about, whether they are builtins or not. Use this to add the
appropriate "format" attribute to NSLog, NSLogv, asprintf, and
vasprintf, and to translate builtin attributes (from Builtins.def)
into actual attributes on the function declaration.

Use the "printf" format attribute on function declarations to
determine whether we should do format string checking, rather than
looking at an ad hoc list of builtins and "known" function names.

Be a bit more careful about when we consider a function a "builtin" in
C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64561 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPass the location of the start of the selector to ActOnClassMessage/ActOnInstanceMessage.
Anders Carlsson [Sat, 14 Feb 2009 18:21:46 +0000 (18:21 +0000)]
Pass the location of the start of the selector to ActOnClassMessage/ActOnInstanceMessage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64560 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix 80col violations.
Mike Stump [Sat, 14 Feb 2009 18:02:21 +0000 (18:02 +0000)]
Fix 80col violations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64559 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPatch by Ben Laurie:
Ted Kremenek [Sat, 14 Feb 2009 17:08:39 +0000 (17:08 +0000)]
Patch by Ben Laurie:

ConstraintManager:
- constify getSymVal()

BasicConstraintManager:
- Pull out logic that would be common to ConstraintManagers of a similar nature
  and put them in a parent class called 'SimpleConstraintManager'.

RangeConstraintManager:
- Added a new prototype ConstraintManager to track ranges of variables! This
  ConstraintManager keeps tracks of ranges of concrete integers that a symbolic
  integer may have.

AnalysisConsumer:
- Add driver option to use RangeConstraintManager with GRExprEngine-based
  analyses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64558 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDefine __ELF__ on FreeBSD. Patch by Roman Divacky!
Anton Korobeynikov [Sat, 14 Feb 2009 16:42:50 +0000 (16:42 +0000)]
Define __ELF__ on FreeBSD. Patch by Roman Divacky!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64557 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix the build on win32.
Cedric Venet [Sat, 14 Feb 2009 16:15:20 +0000 (16:15 +0000)]
Fix the build on win32.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64556 91177308-0d34-0410-b5e6-96231b3b80d8