llvm-project/clang
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
..
INPUTS
bindings Comment parsing: allow "\param ..." to describe variadic arguments 2013-06-24 04:41:32 +00:00
docs [analyzer] Add a debug checker that prints Exploded Graph 2013-06-24 18:12:12 +00:00
examples Remove unused header. 2013-06-26 13:49:47 +00:00
include Fixed source range for functional cast and unresolved construct expr nodes. 2013-07-07 06:41:54 +00:00
lib Sema: Do not merge new decls with invalid, old decls 2013-07-07 23:49:50 +00:00
runtime The makefile build system had two lists of the 32-bit runtime libraries 2013-06-23 10:10:25 +00:00
test Sema: Do not merge new decls with invalid, old decls 2013-07-07 23:49:50 +00:00
tools [libclang] Add the new function to libclang.exports 2013-07-05 20:51:44 +00:00
unittests Fixed source range for functional cast and unresolved construct expr nodes. 2013-07-07 06:41:54 +00:00
utils [NeonIntrinsicTestEmitter] vld1/vst1 do not require the :64 hint. 2013-06-24 21:25:39 +00:00
www + "For Windows Users" section 2013-06-28 19:21:11 +00:00
.arcconfig Add .arcconfig to the repository. Useful if someone wants to use phabricator's command line tool. 2012-12-01 12:08:08 +00:00
.gitignore Reverted unintendedly-committed file. 2013-01-31 19:05:31 +00:00
CMakeLists.txt Retain linker flags specified on cmake command line. 2013-06-12 20:02:59 +00:00
CODE_OWNERS.TXT Revert r185557 as it was a bit (a lot) premature. 2013-07-03 20:37:50 +00:00
INSTALL.txt Reverting test commit 2013-06-07 05:33:21 +00:00
LICENSE.TXT Update the copyright coredits -- Happy new year 2013! 2013-01-01 10:00:19 +00:00
Makefile
ModuleInfo.txt
NOTES.txt Remove an uninteresting note 2013-02-05 21:13:55 +00:00
README.txt

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:              http://clang.llvm.org/
Building and using Clang:          http://clang.llvm.org/get_started.html
Clang Static Analyzer:             http://clang-analyzer.llvm.org/
Information on the LLVM project:   http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/