llvm-project/clang/lib/Sema
David Majnemer ea5092a3b0 Sema: Do not merge new decls with invalid, old decls
Sema::MergeFunctionDecl attempts merging two decls even if the old decl
is invalid.  This can lead to interesting circumstances where we
successfully merge the decls but the result makes no sense.

Take the following for example:

template <typename T>
int main(void);

int main(void);

Sema will not consider these to be overloads of the same name because
main can't be overloaded, which means that this must be a redeclaration.

In this case the templated decl is compatible with the non-templated
decl allowing the Sema::CheckFunctionDeclaration machinery to move on
and do bizarre things like setting the previous decl of a non-templated
decl to a templated decl!

The way I see it, we should just bail from MergeFunctionDecl if the old
decl is invalid.

This fixes PR16531.

llvm-svn: 185779
2013-07-07 23:49:50 +00:00
..
AnalysisBasedWarnings.cpp Compress pairs. No functionality change. 2013-06-29 17:52:13 +00:00
AttributeList.cpp Basic support for Microsoft property declarations and 2013-04-16 07:28:30 +00:00
CMakeLists.txt Re-commit r183466 with a fix to make the TypeLoc casting machinery work 2013-06-07 20:31:48 +00:00
CodeCompleteConsumer.cpp Allow the computation of the base priority for a declaration code completion result to consider the completion context 2013-01-31 04:52:16 +00:00
DeclSpec.cpp "bool" should be a context-sensitive keyword in Altivec mode. 2013-07-03 20:54:09 +00:00
DelayedDiagnostic.cpp objective-C: when diagnosing deprecated/unavailable usage of 2012-09-21 20:46:37 +00:00
IdentifierResolver.cpp Delete dead code. 2013-06-19 02:07:51 +00:00
JumpDiagnostics.cpp Fix a couple of bugs where jump diagnostics would not notice that a variable 2013-06-03 01:05:37 +00:00
Makefile
MultiplexExternalSemaSource.cpp Simplify FindExternalVisibleDeclsByName by making it return a bool indicating 2013-02-07 03:30:24 +00:00
Scope.cpp Reapply r151638 and r151641. 2012-02-29 10:24:19 +00:00
ScopeInfo.cpp Sema for Captured Statements 2013-04-16 19:37:38 +00:00
Sema.cpp Provide suggested no-arg calls for overloaded member functions missing calls 2013-06-21 23:54:45 +00:00
SemaAccess.cpp Test commit 2013-05-07 16:56:03 +00:00
SemaAttr.cpp Adding support for MSVC #pragma detect_mismatch functionality by emitting a FAILIFMISMATCH linker command into the object file. 2013-06-04 02:07:14 +00:00
SemaCXXScopeSpec.cpp Allow typo correction to try removing nested name specifiers. 2013-07-02 23:47:44 +00:00
SemaCast.cpp Don't use unnamed local enums as template arguments. 2013-06-26 21:31:47 +00:00
SemaChecking.cpp Remove some useless declarations (found by scan-build) 2013-07-06 08:00:09 +00:00
SemaCodeComplete.cpp Compress pairs. No functionality change. 2013-06-29 17:52:13 +00:00
SemaConsumer.cpp Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch 2011-12-20 02:48:34 +00:00
SemaDecl.cpp Sema: Do not merge new decls with invalid, old decls 2013-07-07 23:49:50 +00:00
SemaDeclAttr.cpp Use SmallVectorImpl& for function arguments instead of SmallVector. 2013-07-05 19:34:19 +00:00
SemaDeclCXX.cpp Allow typo correction to try removing nested name specifiers. 2013-07-02 23:47:44 +00:00
SemaDeclObjC.cpp Remove some useless declarations (found by scan-build) 2013-07-06 08:00:09 +00:00
SemaExceptionSpec.cpp Fix regression from r184810. 2013-06-25 01:55:41 +00:00
SemaExpr.cpp Use SmallVectorImpl& for function arguments instead of SmallVector. 2013-07-05 19:34:19 +00:00
SemaExprCXX.cpp contextual conversion fix: C++98 compatibility warning. 2013-06-18 03:08:53 +00:00
SemaExprMember.cpp Allow typo correction to try removing nested name specifiers. 2013-07-02 23:47:44 +00:00
SemaExprObjC.cpp Objective-C: Fixes a typo correction bug where a 2013-06-18 17:10:58 +00:00
SemaFixItUtils.cpp s/CPlusPlus0x/CPlusPlus11/g 2013-01-02 11:42:31 +00:00
SemaInit.cpp Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily. 2013-07-04 03:08:24 +00:00
SemaLambda.cpp Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily. 2013-07-04 03:08:24 +00:00
SemaLookup.cpp Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily. 2013-07-04 03:08:24 +00:00
SemaObjCProperty.cpp Objective-C: diagnose when synthesizing an ivar of 2013-07-05 17:18:11 +00:00
SemaOpenMP.cpp OpenMP threadprivate with qualified names. 2013-05-13 04:18:18 +00:00
SemaOverload.cpp Put helper class in anonymous namespace. 2013-07-01 06:29:40 +00:00
SemaPseudoObject.cpp address some comments on r183474: 2013-06-07 22:29:12 +00:00
SemaStmt.cpp Objective-C: Warn when fast enumeration variable isn't used. 2013-07-06 18:04:13 +00:00
SemaStmtAsm.cpp [ms-inline asm] Don't diagnose an empty lookup for inline assmebly. This happen 2013-05-24 18:32:55 +00:00
SemaStmtAttr.cpp PR15300: Support C++11 attributes on base-specifiers. We don't support any such 2013-02-19 23:47:15 +00:00
SemaTemplate.cpp Part of PR15673: If a function template has a default argument in which 2013-07-04 01:01:24 +00:00
SemaTemplateDeduction.cpp Add typedefs for Densemaps containing SmallVectors to avoid repeating the SmallVector size when creating iterators for the DenseMap. 2013-07-05 04:33:53 +00:00
SemaTemplateInstantiate.cpp Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily. 2013-07-04 03:08:24 +00:00
SemaTemplateInstantiateDecl.cpp Switch Decl instantiation to DeclNodes.inc. 2013-06-27 23:21:55 +00:00
SemaTemplateVariadic.cpp Fix one place I missed that was memcpy'ing TypeLocs in a way that messes 2013-06-20 04:11:21 +00:00
SemaType.cpp Don't use unnamed local enums as template arguments. 2013-06-26 21:31:47 +00:00
TargetAttributesSema.cpp Warn on and drop dllimport attrs from variable definitions 2013-05-20 21:53:29 +00:00
TargetAttributesSema.h Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here. 2012-12-20 19:22:21 +00:00
TreeTransform.h [AST] Introduce a new DecayedType sugar node 2013-06-24 17:51:48 +00:00
TypeLocBuilder.cpp Add missing file from r183563 (the recommit of 183466). 2013-06-07 20:33:10 +00:00
TypeLocBuilder.h Re-commit r183466 with a fix to make the TypeLoc casting machinery work 2013-06-07 20:31:48 +00:00