]> granicus.if.org Git - clang/log
clang
15 years agoMore Sema check for constructor's member initializer along
Fariborz Jahanian [Fri, 24 Jul 2009 20:28:49 +0000 (20:28 +0000)]
More Sema check for constructor's member initializer along
with type conversion to fix ir-gen crash.

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

15 years agoIn the "use of floating point variable as loop counter" check, check
Ted Kremenek [Fri, 24 Jul 2009 20:26:31 +0000 (20:26 +0000)]
In the "use of floating point variable as loop counter" check, check
if the DeclRefExpr is a float, not just either argument.

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

15 years agoHave 'clang --analyze' run syntactic static analysis security checks.
Ted Kremenek [Fri, 24 Jul 2009 20:03:11 +0000 (20:03 +0000)]
Have 'clang --analyze' run syntactic static analysis security checks.

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

15 years agoFix 80-col violations, reflow a few comments and zap some extra
Mike Stump [Fri, 24 Jul 2009 19:02:52 +0000 (19:02 +0000)]
Fix 80-col violations, reflow a few comments and zap some extra
whitespace at ends of lines.

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

15 years agoFix a release build warning.
Anders Carlsson [Fri, 24 Jul 2009 18:20:38 +0000 (18:20 +0000)]
Fix a release build warning.

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

15 years agoMore work toward initialization of objects
Fariborz Jahanian [Fri, 24 Jul 2009 17:57:02 +0000 (17:57 +0000)]
More work toward initialization of objects
in constructors.

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

15 years agoAllow front-end 'isa' access on object's of type 'id'.
Steve Naroff [Fri, 24 Jul 2009 17:54:45 +0000 (17:54 +0000)]
Allow front-end 'isa' access on object's of type 'id'.
Enhance test case to cover 'isa' access on interface types (clang produces an error, GCC produces a warning).

Still need back-end CodeGen for ObjCIsaExpr.

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

15 years agoDon't use getLLVMFieldNo for bitfields when constructing the ivar layout maps for GC.
Anders Carlsson [Fri, 24 Jul 2009 17:23:54 +0000 (17:23 +0000)]
Don't use getLLVMFieldNo for bitfields when constructing the ivar layout maps for GC.

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

15 years agoCheck in a half finished new constant struct builder (Obviously not used yet).
Anders Carlsson [Fri, 24 Jul 2009 15:20:52 +0000 (15:20 +0000)]
Check in a half finished new constant struct builder (Obviously not used yet).

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

15 years agoFix declaration of obc_enumerationMutation function, for GNU runtime.
Daniel Dunbar [Fri, 24 Jul 2009 07:40:24 +0000 (07:40 +0000)]
Fix declaration of obc_enumerationMutation function, for GNU runtime.

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

15 years agoAdd doxygen comments and simplify expression.
Ted Kremenek [Fri, 24 Jul 2009 06:55:42 +0000 (06:55 +0000)]
Add doxygen comments and simplify expression.

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

15 years agoIntroduce a new variant type 'TryResult' to represent the result of
Ted Kremenek [Fri, 24 Jul 2009 04:47:11 +0000 (04:47 +0000)]
Introduce a new variant type 'TryResult' to represent the result of
TryEvaluateBool instead of using a raw 'int'.  This avoids any
confusion of how 'int' converts to bool, and makes the resultant code
easier to read.

Condense a bunch of 'addSuccessor()' calls in 'if ... else' to use the
ternary operator instead.

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

15 years agoAdd getDecl() to CallGraph and CallGraphNode.
Zhongxing Xu [Fri, 24 Jul 2009 03:41:11 +0000 (03:41 +0000)]
Add getDecl() to CallGraph and CallGraphNode.

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

15 years agoConstify methods.
Zhongxing Xu [Fri, 24 Jul 2009 03:38:27 +0000 (03:38 +0000)]
Constify methods.

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

15 years agoTest commit: make a little stub routine for semantic checking of main().
John McCall [Fri, 24 Jul 2009 03:03:21 +0000 (03:03 +0000)]
Test commit:  make a little stub routine for semantic checking of main().

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

15 years agoEnable the '-warn-security-syntactic' checker option by default.
Ted Kremenek [Fri, 24 Jul 2009 02:52:07 +0000 (02:52 +0000)]
Enable the '-warn-security-syntactic' checker option by default.

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

15 years agoImplement new warning for functions declared 'noreturn' when they fall off the end.
Mike Stump [Fri, 24 Jul 2009 02:49:01 +0000 (02:49 +0000)]
Implement new warning for functions declared 'noreturn' when they fall off the end.

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

15 years agoGet rid of the size parameter to AppendField. No functionality change.
Anders Carlsson [Fri, 24 Jul 2009 02:45:50 +0000 (02:45 +0000)]
Get rid of the size parameter to AppendField. No functionality change.

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

15 years agoMark destructor of Checker virtual.
Ted Kremenek [Fri, 24 Jul 2009 00:40:31 +0000 (00:40 +0000)]
Mark destructor of Checker virtual.

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

15 years agoWe now do complete semantic checking for unions
Douglas Gregor [Fri, 24 Jul 2009 00:05:42 +0000 (00:05 +0000)]
We now do complete semantic checking for unions

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

15 years agoUpdate C++ status to reflect progress on out-of-line definitions of class template...
Douglas Gregor [Thu, 23 Jul 2009 23:58:15 +0000 (23:58 +0000)]
Update C++ status to reflect progress on out-of-line definitions of class template members

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

15 years agoThis patch fixes the implementations of the __has_trivial_destructor
Douglas Gregor [Thu, 23 Jul 2009 23:49:00 +0000 (23:49 +0000)]
This patch fixes the implementations of the __has_trivial_destructor
and __has_trivial_constructor builtin pseudo-functions and
additionally implements __has_trivial_copy and __has_trivial_assign,
from John McCall!

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

15 years agoOutput UTF-16 string literals independent of host byte order.
Daniel Dunbar [Thu, 23 Jul 2009 23:41:22 +0000 (23:41 +0000)]
Output UTF-16 string literals independent of host byte order.
 - Steve, can you take a look at this? It seems like this code should live
   elsewhere, and there is a FIXME about having Sema validates the UTF-8 to
   UTF-16 conversion.

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

15 years agoDiagnose when base classes and members to be intialized
Fariborz Jahanian [Thu, 23 Jul 2009 23:32:59 +0000 (23:32 +0000)]
Diagnose when base classes and members to be intialized
with constructors don't have a matching constructor.

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

15 years agoRefactor and push the evaluation as late as possible.
Mike Stump [Thu, 23 Jul 2009 23:25:26 +0000 (23:25 +0000)]
Refactor and push the evaluation as late as possible.

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

15 years agoFactor out map lookup for CFString constants.
Daniel Dunbar [Thu, 23 Jul 2009 22:52:48 +0000 (22:52 +0000)]
Factor out map lookup for CFString constants.

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

15 years agoDon't just store the field/bit field info one field, do it for all fields in the...
Anders Carlsson [Thu, 23 Jul 2009 22:52:34 +0000 (22:52 +0000)]
Don't just store the field/bit field info one field, do it for all fields in the union.

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

15 years agoSome cleanups suggested by Daniel.
Mike Stump [Thu, 23 Jul 2009 22:40:11 +0000 (22:40 +0000)]
Some cleanups suggested by Daniel.

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

15 years agoImplement: <rdar://problem/6335715> rule request: gets() buffer overflow
Ted Kremenek [Thu, 23 Jul 2009 22:29:41 +0000 (22:29 +0000)]
Implement: <rdar://problem/6335715> rule request: gets() buffer overflow

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

15 years agoFix another thinko.
Anders Carlsson [Thu, 23 Jul 2009 21:52:03 +0000 (21:52 +0000)]
Fix another thinko.

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

15 years agoAdd comments.
Ted Kremenek [Thu, 23 Jul 2009 21:44:18 +0000 (21:44 +0000)]
Add comments.

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

15 years agoRefine checking and diagnostics for use of floating point variable as a counter.
Ted Kremenek [Thu, 23 Jul 2009 21:34:35 +0000 (21:34 +0000)]
Refine checking and diagnostics for use of floating point variable as a counter.
This implements <rdar://problem/6336718> and checks for CERT secure coding
advisory FLP30-C.

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

15 years agoCorrect a thinko in bitfield layout code. Fixes PR4611.
Anders Carlsson [Thu, 23 Jul 2009 21:16:33 +0000 (21:16 +0000)]
Correct a  thinko in bitfield layout code. Fixes PR4611.

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

15 years agoSimplify, NFC.
Daniel Dunbar [Thu, 23 Jul 2009 20:38:28 +0000 (20:38 +0000)]
Simplify, NFC.

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

15 years agoSwitch the driver back to always using clang-cc by default (for C++, and
Daniel Dunbar [Thu, 23 Jul 2009 17:48:59 +0000 (17:48 +0000)]
Switch the driver back to always using clang-cc by default (for C++, and
regardless of the architecture).
 - This is a good default for development & testing; for example without this
   any tests using 'clang' in the test suite will fail on PowerPC, since the
   driver will avoid using clang.

 - We don't want to actually ship something built this way, but that should be
   handled via some sort of configuration file.

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

15 years agoSimplify.
Daniel Dunbar [Thu, 23 Jul 2009 17:33:49 +0000 (17:33 +0000)]
Simplify.

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

15 years agoWe don't need to keep track of the packed alignment, just whether the struct is packe...
Anders Carlsson [Thu, 23 Jul 2009 17:24:40 +0000 (17:24 +0000)]
We don't need to keep track of the packed alignment, just whether the struct is packed or not. Fixes PR4610.

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

15 years agoMove the LLVM field number for bit fields into the BitFieldInfo structure, since...
Anders Carlsson [Thu, 23 Jul 2009 17:01:21 +0000 (17:01 +0000)]
Move the LLVM field number for bit fields into the BitFieldInfo structure, since it's meaning is completely different than for non-bit fields.

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

15 years agoClean up the ActOnTag action, so that there is only a single entry
Douglas Gregor [Thu, 23 Jul 2009 16:36:45 +0000 (16:36 +0000)]
Clean up the ActOnTag action, so that there is only a single entry
point that covers templates and non-templates. This should eliminate
the flood of warnings I introduced yesterday.

Removed the ActOnClassTemplate action, which is no longer used.

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

15 years agoUnbreak the CMake build
Douglas Gregor [Thu, 23 Jul 2009 15:15:06 +0000 (15:15 +0000)]
Unbreak the CMake build

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

15 years agoAdd two nodes to the call graph:
Zhongxing Xu [Thu, 23 Jul 2009 13:39:38 +0000 (13:39 +0000)]
Add two nodes to the call graph:
 - Root is the main function or 0.
 - ExternalCallingNode has edges to all external functions.

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

15 years agoAdd template specializations to view the call graph in dot format.
Zhongxing Xu [Thu, 23 Jul 2009 09:04:23 +0000 (09:04 +0000)]
Add template specializations to view the call graph in dot format.
 - change the DenseMap used in callgraph to std::map, since DenseMap cannot
   be used with mapped_iterator and friends.

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

15 years agoconstify methods.
Zhongxing Xu [Thu, 23 Jul 2009 08:32:25 +0000 (08:32 +0000)]
constify methods.

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

15 years agoAdd getter methods.
Zhongxing Xu [Thu, 23 Jul 2009 07:37:14 +0000 (07:37 +0000)]
Add getter methods.

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

15 years agoAdd newline at EOF.
Daniel Dunbar [Thu, 23 Jul 2009 07:07:43 +0000 (07:07 +0000)]
Add newline at EOF.

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

15 years agoShield clang from LLVM API changes, until the dust settles.
Daniel Dunbar [Thu, 23 Jul 2009 05:30:36 +0000 (05:30 +0000)]
Shield clang from LLVM API changes, until the dust settles.

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

15 years agoFix test case, which has a control-reaches-end-of-non-void warning that was
Daniel Dunbar [Thu, 23 Jul 2009 05:06:51 +0000 (05:06 +0000)]
Fix test case, which has a control-reaches-end-of-non-void warning that was
being masked by previous bug.

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

15 years agoUse llvm::BitVector instead of managing memory by hand.
Daniel Dunbar [Thu, 23 Jul 2009 05:01:54 +0000 (05:01 +0000)]
Use llvm::BitVector instead of managing memory by hand.
 - As it happens, this also fixes a use-of-uninitialized memory that was causing
   non-deterministic test failures.

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

15 years agoSet field info for unions.
Anders Carlsson [Thu, 23 Jul 2009 04:59:05 +0000 (04:59 +0000)]
Set field info for unions.

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

15 years agoUse arrays as union padding. Also, since the resulting struct will always contain...
Anders Carlsson [Thu, 23 Jul 2009 04:50:01 +0000 (04:50 +0000)]
Use arrays as union padding. Also, since the resulting struct will always contain a single element and either a single i8 element or an array of i8s, there's no reason to use a packed struct.

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

15 years agoRevert r76831, there are many Analyzer test failures on multiple platforms.
Daniel Dunbar [Thu, 23 Jul 2009 04:41:06 +0000 (04:41 +0000)]
Revert r76831, there are many Analyzer test failures on multiple platforms.

--- Reverse-merging r76831 into '.':
U    include/clang/Analysis/PathSensitive/GRExprEngine.h
U    lib/Analysis/GRExprEngine.cpp

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

15 years agoHandle zero width bit fields in unions correctly (by ignoring them).
Anders Carlsson [Thu, 23 Jul 2009 04:00:39 +0000 (04:00 +0000)]
Handle zero width bit fields in unions correctly (by ignoring them).

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

15 years agoImplement union layout support.
Anders Carlsson [Thu, 23 Jul 2009 03:43:54 +0000 (03:43 +0000)]
Implement union layout support.

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

15 years agoCheck in CGRecordLayoutBuilder which is a reimplementation of the record layout...
Anders Carlsson [Thu, 23 Jul 2009 03:17:50 +0000 (03:17 +0000)]
Check in  CGRecordLayoutBuilder which is a reimplementation of the record layout code. (Yay, no more packed structs unless absolutely necessary). We currently don't use the layouts being built but that will change when the new code is mature enough :)

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

15 years agoThese IRgen improvements have been done.
Daniel Dunbar [Thu, 23 Jul 2009 03:03:07 +0000 (03:03 +0000)]
These IRgen improvements have been done.

Technically we could still do a bit more to avoid deferred generation of statics
which we know are used, but I seriously doubt this is important.

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

15 years agoAdd initial implementation of checking for uses of floating point as a loop counter.
Ted Kremenek [Thu, 23 Jul 2009 01:07:19 +0000 (01:07 +0000)]
Add initial implementation of checking for uses of floating point as a loop counter.

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

15 years agoAdd instance predicate method to match static method.
Ted Kremenek [Thu, 23 Jul 2009 01:06:10 +0000 (01:06 +0000)]
Add instance predicate method to match static method.

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

15 years agoAdd 'previsit' Checker pass for ObjCMessageExprs.
Ted Kremenek [Thu, 23 Jul 2009 01:05:31 +0000 (01:05 +0000)]
Add 'previsit' Checker pass for ObjCMessageExprs.

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

15 years agoRemove a bunch of FIXME's related to ObjC type checking.
Steve Naroff [Thu, 23 Jul 2009 01:01:38 +0000 (01:01 +0000)]
Remove a bunch of FIXME's related to ObjC type checking.

- Move Sema::ObjCQualifiedIdTypesAreCompatible(), Sema::QualifiedIdConformsQualifiedId(), and a couple helper functions to ASTContext.
- Change ASTContext::canAssignObjCInterfaces() to use ASTContext:: ObjCQualifiedIdTypesAreCompatible().
- Tweak several test cases to accommodate the new/improved type checking.

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

15 years agoAdd constructor used to initialize base/member in
Fariborz Jahanian [Thu, 23 Jul 2009 00:42:24 +0000 (00:42 +0000)]
Add constructor used to initialize base/member in
CXXBaseOrMemberInitializer AST node. Needed by
its clients to do the initialization.

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

15 years agoFix case, apparently some people still build on case sensitive
Mike Stump [Thu, 23 Jul 2009 00:20:25 +0000 (00:20 +0000)]
Fix case, apparently some people still build on case sensitive
filesystems.

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

15 years agoAdd warning for falling off the end of a function that should return a
Mike Stump [Wed, 22 Jul 2009 23:56:57 +0000 (23:56 +0000)]
Add warning for falling off the end of a function that should return a
value.  This is on by default, and controlled by -Wreturn-type (-Wmost
-Wall).  I believe there should be very few false positives, though
the most interesting case would be:

  int() { bar(); }

when bar does:

  bar() { while (1) ; }

Here, we assume functions return, unless they are marked with the
noreturn attribute.  I can envision a fixit note for functions that
never return normally that don't have a noreturn attribute to add a
noreturn attribute.

If anyone spots other false positives, let me know!

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

15 years agoImplement support for out-of-line definitions of the class members of class
Douglas Gregor [Wed, 22 Jul 2009 23:48:44 +0000 (23:48 +0000)]
Implement support for out-of-line definitions of the class members of class
templates, e.g.,

  template<typename T>
  struct Outer {
    struct Inner;
  };

  template<typename T>
  struct Outer<T>::Inner {
    // ...
  };

Implementing this feature required some extensions to ActOnTag, which
now takes a set of template parameter lists, and is the precursor to
removing the ActOnClassTemplate function from the parser Action
interface. The reason for this approach is simple: the parser cannot
tell the difference between a class template definition and the
definition of a member of a class template; both have template
parameter lists, and semantic analysis determines what that template
parameter list means.

There is still some cleanup to do with ActOnTag and
ActOnClassTemplate. This commit provides the basic functionality we
need, however.

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

15 years agoFix test breakage.
Eli Friedman [Wed, 22 Jul 2009 23:24:42 +0000 (23:24 +0000)]
Fix test breakage.

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

15 years agoChange Preprocessor to keep a copy of LangOptions instead of reference, like ASTContext.
Argyrios Kyrtzidis [Wed, 22 Jul 2009 23:13:42 +0000 (23:13 +0000)]
Change Preprocessor to keep a copy of LangOptions instead of reference, like ASTContext.

Now when creating a Preprocessor we can pass it a temporary LangOptions object instead of having to remember to keep it around.

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

15 years agoImprove CFG support for C++ throw expressions.
Mike Stump [Wed, 22 Jul 2009 22:56:04 +0000 (22:56 +0000)]
Improve CFG support for C++ throw expressions.

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

15 years agoPrep for new warning.
Mike Stump [Wed, 22 Jul 2009 22:55:09 +0000 (22:55 +0000)]
Prep for new warning.

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

15 years agoRefactor 'PostStmt' and 'PreStmt' to subclass a common parent 'StmtPoint'.
Ted Kremenek [Wed, 22 Jul 2009 22:35:28 +0000 (22:35 +0000)]
Refactor 'PostStmt' and 'PreStmt' to subclass a common parent 'StmtPoint'.

Educate GRExprEngine::VisitGraph() about 'PreStmt'.

Mark the constructor of 'PostStmt' to be explicit, preventing implicit
conversions and the selection of the wrong 'generateNode' method in
GRStmtNodeBuilder.

Constify a bunch of arguments, which falls out of the changes to ProgramPoint.

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

15 years agoSlight code reorganization to allow instantiating post-inc/dec.
Eli Friedman [Wed, 22 Jul 2009 22:25:00 +0000 (22:25 +0000)]
Slight code reorganization to allow instantiating post-inc/dec.

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

15 years agoCalls to Sema::MatchTemplateParametersToScopeSpecifier should not depend on the order...
Douglas Gregor [Wed, 22 Jul 2009 22:05:02 +0000 (22:05 +0000)]
Calls to Sema::MatchTemplateParametersToScopeSpecifier should not depend on the order of evaluation of their arguments to be correct.

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

15 years agoUse SaveAndRestore in 'clang/Analysis/Support/SaveAndRestore.h'
Ted Kremenek [Wed, 22 Jul 2009 21:52:10 +0000 (21:52 +0000)]
Use SaveAndRestore in 'clang/Analysis/Support/SaveAndRestore.h'

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

15 years agoAdd AssumeDual method.
Ted Kremenek [Wed, 22 Jul 2009 21:51:00 +0000 (21:51 +0000)]
Add AssumeDual method.

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

15 years agoMigrate the path-sensitive checking of 'nonnull' arguments over to the new
Ted Kremenek [Wed, 22 Jul 2009 21:46:56 +0000 (21:46 +0000)]
Migrate the path-sensitive checking of 'nonnull' arguments over to the new
'Checker' interface. An updated test case illustrates that after calling a
function with the 'nonnull' attribute we now register the fact that the passed
pointer must be non-null. This retention of information was not possible with
the previously used GRSimpleAPICheck interface.

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

15 years agoFix the parsing of default arguments for inline member function
Eli Friedman [Wed, 22 Jul 2009 21:45:50 +0000 (21:45 +0000)]
Fix the parsing of default arguments for inline member function
definitions.

I'm not very familiar with this code, so please review.

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

15 years agoMake 'SaveAndRestore' and friends reusable classes in libAnalysis.
Ted Kremenek [Wed, 22 Jul 2009 21:45:16 +0000 (21:45 +0000)]
Make 'SaveAndRestore' and friends reusable classes in libAnalysis.

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

15 years agoAdd support for registering 'Checker' objects with GRExprEngine.
Ted Kremenek [Wed, 22 Jul 2009 21:43:51 +0000 (21:43 +0000)]
Add support for registering 'Checker' objects with GRExprEngine.
Add a 'previsit' stage (that dispatches to registered Checkers) when evaluating the effects of CallExprs.

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

15 years agoAdd new 'Checker' and 'CheckerVisitor' classes, which represent a more powerful
Ted Kremenek [Wed, 22 Jul 2009 21:42:34 +0000 (21:42 +0000)]
Add new 'Checker' and 'CheckerVisitor' classes, which represent a more powerful
interface to plug in domain-specific checker logic than the current
GRSimpleAPICheck interface. The new 'Checker' interface can actually generate
new nodes, allowing it to modify the state and refine the analysis (which
GRSimpleAPIChecks could not).

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

15 years agoAdd support for 'PreStmt' program points to GRCoreEngine and GRStmtNodeBuilder.
Ted Kremenek [Wed, 22 Jul 2009 21:40:46 +0000 (21:40 +0000)]
Add support for 'PreStmt' program points to GRCoreEngine and GRStmtNodeBuilder.

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

15 years agoAdd 'PreStmt' program point. This will be used to represent checking for
Ted Kremenek [Wed, 22 Jul 2009 21:39:25 +0000 (21:39 +0000)]
Add 'PreStmt' program point. This will be used to represent checking for
preconditions (in GRExprEngine) before the statement itself is evaluated.

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

15 years agoImplement operator= for ExplodedNodeSet.
Ted Kremenek [Wed, 22 Jul 2009 21:38:15 +0000 (21:38 +0000)]
Implement operator= for ExplodedNodeSet.

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

15 years agoFix the problems with template argument deduction and array types for
Douglas Gregor [Wed, 22 Jul 2009 21:30:48 +0000 (21:30 +0000)]
Fix the problems with template argument deduction and array types for
real. It turns out that we need to actually move all of the qualifiers
up to the array type itself, then recanonicalize the deduced template
argument type.

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

15 years agoMake -Wreturn-type be part of -Wmost and therefore -Wall.
Mike Stump [Wed, 22 Jul 2009 21:00:27 +0000 (21:00 +0000)]
Make -Wreturn-type be part of -Wmost and therefore -Wall.

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

15 years agoFix some memory allocation/deallocation issues
Douglas Gregor [Wed, 22 Jul 2009 20:55:49 +0000 (20:55 +0000)]
Fix some memory allocation/deallocation issues

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

15 years agoFix a nasty little use-after-free bug.
Eli Friedman [Wed, 22 Jul 2009 20:29:16 +0000 (20:29 +0000)]
Fix a nasty little use-after-free bug.

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

15 years agoCanonicalize the types produced by template argument deduction.
Douglas Gregor [Wed, 22 Jul 2009 20:25:36 +0000 (20:25 +0000)]
Canonicalize the types produced by template argument deduction.

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

15 years agoImproved on performance of the algorithm for proper ordering of
Fariborz Jahanian [Wed, 22 Jul 2009 20:25:00 +0000 (20:25 +0000)]
Improved on performance of the algorithm for proper ordering of
ctor's initialization of bases and fields.

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

15 years agoSlighty more testing for template argument deduction with array arguments
Douglas Gregor [Wed, 22 Jul 2009 20:07:21 +0000 (20:07 +0000)]
Slighty more testing for template argument deduction with array arguments

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

15 years agoImprove template argument deduction for array types, so that a parameter
Douglas Gregor [Wed, 22 Jul 2009 20:02:25 +0000 (20:02 +0000)]
Improve template argument deduction for array types, so that a parameter

  const T

can be matched with, e.g.,

  volatile int [5]

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

15 years agoPrep for new warning.
Mike Stump [Wed, 22 Jul 2009 20:02:03 +0000 (20:02 +0000)]
Prep for new warning.

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

15 years agoUse isa instead of dyn_cast for conditionals.
Mike Stump [Wed, 22 Jul 2009 18:58:19 +0000 (18:58 +0000)]
Use isa instead of dyn_cast for conditionals.

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

15 years agoUse DICompositeType->replaceAllUsesWith().
Devang Patel [Wed, 22 Jul 2009 18:57:00 +0000 (18:57 +0000)]
Use DICompositeType->replaceAllUsesWith().

This requires llvm rev. 76769 or higher.

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

15 years ago"This patch implements the restrictions on union members detailed in
Douglas Gregor [Wed, 22 Jul 2009 18:25:24 +0000 (18:25 +0000)]
"This patch implements the restrictions on union members detailed in
[class.union]p1", from John McCall!

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

15 years agoMove bug reporter "visitors" to their own file and make them part of the public
Ted Kremenek [Wed, 22 Jul 2009 17:55:28 +0000 (17:55 +0000)]
Move bug reporter "visitors" to their own file and make them part of the public
BugReporter API.  No real functionality change.

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

15 years agoAllocate BaseOrMemberInitializers and CXXBaseSpecifier nodes
Fariborz Jahanian [Wed, 22 Jul 2009 17:41:53 +0000 (17:41 +0000)]
Allocate BaseOrMemberInitializers and CXXBaseSpecifier nodes
via ASTContext.

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

15 years agoImplement parsing and semantic analysis for out-of-line definitions of static
Douglas Gregor [Wed, 22 Jul 2009 17:18:37 +0000 (17:18 +0000)]
Implement parsing and semantic analysis for out-of-line definitions of static
data members of class templates. We don't instantiate the definitions yet,
however.

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

15 years agoFix a couple recent ABI regressions noticed during code review (fallout from the...
Steve Naroff [Wed, 22 Jul 2009 17:14:51 +0000 (17:14 +0000)]
Fix a couple recent ABI regressions noticed during code review (fallout from the ObjC type system rewrite).

It's unfortunate that the mangling includes the low-level structs. Nevertheless, we need this for binary compatibility with GCC.

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

15 years agoSwitch some functions from using x86 builtins to using vector
Eli Friedman [Wed, 22 Jul 2009 17:08:01 +0000 (17:08 +0000)]
Switch some functions from using x86 builtins to using vector
operations.

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

15 years agoAdd some documentation, to make it so the next person doens't select
Mike Stump [Wed, 22 Jul 2009 16:55:20 +0000 (16:55 +0000)]
Add some documentation, to make it so the next person doens't select
the wrong function.  :-)

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

15 years agoFix <rdar://problem/6770276> Support Class<Proto> syntax.
Steve Naroff [Wed, 22 Jul 2009 16:07:01 +0000 (16:07 +0000)]
Fix <rdar://problem/6770276> Support Class<Proto> syntax.

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

15 years agoTest template instantiation for member functions of class templates defined
Douglas Gregor [Wed, 22 Jul 2009 15:45:39 +0000 (15:45 +0000)]
Test template instantiation for member functions of class templates defined
out of line.

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