]> granicus.if.org Git - clang/log
clang
11 years agoFixed long-standing issue with incorrect length calculation of multi-line comments.
Alexander Kornienko [Wed, 19 Jun 2013 19:50:11 +0000 (19:50 +0000)]
Fixed long-standing issue with incorrect length calculation of multi-line comments.

Summary:
A trailing block comment having multiple lines would cause extremely
high penalties if the summary length of its lines is more than the column limit.
Fixed by always considering only the last line of a multi-line block comment.
Removed a long-standing FIXME from relevant tests and added a motivating test
modelled after problem cases from real code.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1010

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

11 years agoDelete dead code. (Array element types are always complete in C.)
Eli Friedman [Wed, 19 Jun 2013 19:03:14 +0000 (19:03 +0000)]
Delete dead code.  (Array element types are always complete in C.)

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

11 years agoEnhancements for the DynTypedNode
Samuel Benzaquen [Wed, 19 Jun 2013 18:45:24 +0000 (18:45 +0000)]
Enhancements for the DynTypedNode

Added ASTNodeKind as a standalone way to represent node kinds and their hierarchy.
This change is to support ongoing work on D815.

Reviewers: klimek

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

11 years agoCorrections to r184205 ('this'-return optimization) due to the wrong version of the...
Stephen Lin [Wed, 19 Jun 2013 18:10:35 +0000 (18:10 +0000)]
Corrections to r184205 ('this'-return optimization) due to the wrong version of the patch being committed originally.
1) Removed useless return value of CGCXXABI::EmitConstructorCall and CGCXXABI::EmitVirtualDestructorCall and implementations
2) Corrected last portion of CodeGenCXX/constructor-destructor-return-this to correctly test for non-'this'-return of virtual destructor calls

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

11 years agodocumentation parsing: patch to make @class work for
Fariborz Jahanian [Wed, 19 Jun 2013 18:08:03 +0000 (18:08 +0000)]
documentation parsing: patch to make @class work for
class templates; and similarly, @function  works for
function templates. // rdar://14124702

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

11 years agoRevert "Adds support for openSUSE ARM v5/v7 triples."
Renato Golin [Wed, 19 Jun 2013 17:28:50 +0000 (17:28 +0000)]
Revert "Adds support for openSUSE ARM v5/v7 triples."

This reverts commit 312e51ca484976c2b1254952ff23d5162ca8edc2.

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

11 years agoAdds support for openSUSE ARM v5/v7 triples.
Renato Golin [Wed, 19 Jun 2013 17:28:42 +0000 (17:28 +0000)]
Adds support for openSUSE ARM v5/v7 triples.

Now, with a comma.

Patch by İsmail Dönmez

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

11 years ago[CodeGen] Move EHScopeStack into its own header
Reid Kleckner [Wed, 19 Jun 2013 17:07:50 +0000 (17:07 +0000)]
[CodeGen] Move EHScopeStack into its own header

CGCleanup.h isn't meant to be included by all of CodeGen according to
John.

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

11 years ago[Windows] Fix __declspec(property) when the getter returns a ref
Reid Kleckner [Wed, 19 Jun 2013 16:37:23 +0000 (16:37 +0000)]
[Windows] Fix __declspec(property) when the getter returns a ref

This fixes an issue when parsing atlbase.h.

Patch by Will Wilson!

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

11 years agoCompletely revamp node binding for AST matchers.
Manuel Klimek [Wed, 19 Jun 2013 15:42:45 +0000 (15:42 +0000)]
Completely revamp node binding for AST matchers.

This is in preparation for the backwards references to bound
nodes, which will expose a lot more about how matches occur.  Main
changes:
- instead of building the tree of bound nodes, we build a "set" of bound
  nodes and explode all possible match combinations while running
  through the matchers; this will allow us to also implement matchers
  that filter down the current set of matches, like "equalsBoundNode"
- take the set of bound nodes at the start of the match into
  consideration when doing memoization; as part of that, reevaluated
  that memoization gives us benefits that are large enough (it still
  does - the effect on common match patterns is up to an order of
  magnitude)
- reset the bound nodes when a node does not match, thus never leaking
  information from partial sub-matcher matches for failing matchers

Effects:
- we can now correctly "explode" combinatorial matches, for example:
  allOf(forEachDescendant(...bind("a")),
  forEachDescendant(...bind("b"))) will now trigger matches for all
  combinations of matching "a" and "b"s.
- we now never expose bound nodes from partial matches in matchers that
  did not match in the end - this fixes a long-standing issue

FIXMEs:
- rename BoundNodesTreeBuilder to BoundNodesBuilder or
  BoundNodesSetBuilder, as we don't build a tree any more; this is out
  of scope for this change, though
- we're seeing some performance regressions (around 10%), but I expect
  some performance tuning will get that back, and it's easily worth
  the increase in expressiveness for now

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

11 years agoDon't depend on PathV1.h including set.
Rafael Espindola [Wed, 19 Jun 2013 15:31:27 +0000 (15:31 +0000)]
Don't depend on PathV1.h including set.

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

11 years ago[ms-cxxabi] Emit and install appropriately mangled vbtables
Reid Kleckner [Wed, 19 Jun 2013 15:20:38 +0000 (15:20 +0000)]
[ms-cxxabi] Emit and install appropriately mangled vbtables

In Itanium, dynamic classes have one vtable with several different
address points for dynamic base classes that can't share vtables.

In the MS C++ ABI, each vbtable that can't be shared gets its own
symbol, similar to how ctor vtables work in Itanium.  However, instead
of mangling the subobject offset into the symbol, the unique portions of
the inheritance path are mangled into the symbol to make it unique.

This patch implements the MSVC 2012 scheme for forming unique vbtable
symbol names.  MSVC 2010 use the same mangling with a different subset
of the path.  Implementing that mangling and possibly others is TODO.

Each vbtable is an array of i32 offsets from the vbptr that points to it
to another virtual base subobject.  The first entry of a vbtable always
points to the base of the current subobject, implying that it is the
same no matter which parent class contains it.

Reviewers: rjmccall

Differential Revision: http://llvm-reviews.chandlerc.com/D636

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

11 years ago[Driver] Don't forward source file input args to gcc
Reid Kleckner [Wed, 19 Jun 2013 15:09:06 +0000 (15:09 +0000)]
[Driver] Don't forward source file input args to gcc

gcc's inputs are already added by the InputInfoList passed to
Action::ConstructJob.

Fixes a regression from r183989.  This was manifesting when targetting
mingw as an extra input argument to gcc when assembling.  It presumably
affects other situations where clang calls gcc.

Prior to r183989, forwardToGCC() was returning false because the INPUT
option defined in OptParser.td had the DriverOption flag set on it.
LLVM's Option library does not set this flag for INPUT.

Reviewers: espindola

Differential Revision: http://llvm-reviews.chandlerc.com/D999

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

11 years agoRevert r184302 on Renato's behalf - it broke the bots and he's asked me to revert...
James Molloy [Wed, 19 Jun 2013 15:03:14 +0000 (15:03 +0000)]
Revert r184302 on Renato's behalf - it broke the bots and he's asked me to revert as he's unavailable.

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

11 years agoSplit long strings on word boundaries.
Alexander Kornienko [Wed, 19 Jun 2013 14:22:47 +0000 (14:22 +0000)]
Split long strings on word boundaries.

Summary: Split strings at word boundaries, when there are no spaces and slashes.

Reviewers: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1003

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

11 years agoAdds support for openSUSE ARM v5/v7 triples.
Renato Golin [Wed, 19 Jun 2013 14:03:51 +0000 (14:03 +0000)]
Adds support for openSUSE ARM v5/v7 triples.

Patch by İsmail Dönmez

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

11 years agoFix pr16354.
Rafael Espindola [Wed, 19 Jun 2013 13:41:54 +0000 (13:41 +0000)]
Fix pr16354.

We now reject things like

struct ABC {
  static double a;
};
register double ABC::a = 1.0;

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

11 years agoSilence 'set but not used' warning when building in release mode using gcc.
Andy Gibbs [Wed, 19 Jun 2013 13:33:37 +0000 (13:33 +0000)]
Silence 'set but not used' warning when building in release mode using gcc.

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

11 years agoUse llvm::sys::fs::can_execute.
Rafael Espindola [Wed, 19 Jun 2013 13:24:29 +0000 (13:24 +0000)]
Use llvm::sys::fs::can_execute.

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

11 years agoFix a crash in the static analyzer (bug #16307)
Pavel Labath [Wed, 19 Jun 2013 08:19:56 +0000 (08:19 +0000)]
Fix a crash in the static analyzer (bug #16307)

Summary:
When processing a call to a function, which got passed less arguments than it
expects, the analyzer would crash.

I've also added a test for that and a analyzer warning which detects these
cases.

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D994

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

11 years agoFix a warning. [-Wunused-variable]
NAKAMURA Takumi [Wed, 19 Jun 2013 06:58:20 +0000 (06:58 +0000)]
Fix a warning. [-Wunused-variable]

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

11 years agoRevert r184249, "doc. parsing: Allow parameter name "..." for variadic functions...
NAKAMURA Takumi [Wed, 19 Jun 2013 06:58:14 +0000 (06:58 +0000)]
Revert r184249, "doc. parsing: Allow parameter name "..." for variadic functions/methods."

It crashes in the case;

/// Without any "param"s in the description.
int printf(const char *format, ...);

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

11 years agoDelete dead code.
Eli Friedman [Wed, 19 Jun 2013 02:07:51 +0000 (02:07 +0000)]
Delete dead code.

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

11 years agoDebug Info: support for gdwarf-2 gdwarf-3 gdwarf-4
Manman Ren [Wed, 19 Jun 2013 01:46:49 +0000 (01:46 +0000)]
Debug Info: support for gdwarf-2 gdwarf-3 gdwarf-4

These options will add a module flag with name "Dwarf Version".
The behavior flag is currently set to Warning, so when two values disagree,
a warning will be emitted.

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

11 years agoAdd test coverage for serialization of dependent function template specializations.
Eli Friedman [Wed, 19 Jun 2013 01:38:21 +0000 (01:38 +0000)]
Add test coverage for serialization of dependent function template specializations.

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

11 years agoAdd some comments to r184252.
Adrian Prantl [Tue, 18 Jun 2013 23:32:21 +0000 (23:32 +0000)]
Add some comments to r184252.

rdar://problem/14101097

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

11 years ago[analyzer] Do not create a CompoundVal for lvalue InitListExprs.
Anna Zaks [Tue, 18 Jun 2013 23:16:20 +0000 (23:16 +0000)]
[analyzer] Do not create a CompoundVal for lvalue InitListExprs.

These should be treated like scalars. This fixes a crash reported in radar://14164698.

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

11 years ago[analyzer] Do not report uninitialized value warnings inside swap functions.
Anna Zaks [Tue, 18 Jun 2013 23:16:15 +0000 (23:16 +0000)]
[analyzer] Do not report uninitialized value warnings inside swap functions.

This silences warnings that could occur when one is swapping partially initialized structs. We suppress
not only the assignments of uninitialized members, but any values inside swap because swap could
potentially be used as a subroutine to swap class members.

This silences a warning from std::try::function::swap() on partially initialized objects.

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

11 years agoEmit forward decls for structs with declarations only when we are
Adrian Prantl [Tue, 18 Jun 2013 23:01:56 +0000 (23:01 +0000)]
Emit forward decls for structs with declarations only when we are
limiting debug info.

FIXME: There is still work left to do here, the testcase should work even with -flimit-debug-info.

rdar://problem/14101097

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

11 years agoIntroduce a new mangling for protocol-qualified ObjC types in C++. This allows
Eli Friedman [Tue, 18 Jun 2013 22:41:37 +0000 (22:41 +0000)]
Introduce a new mangling for protocol-qualified ObjC types in C++.  This allows
to provide proper overloading, and also prevents mangling conflicts with
template arguments of protocol-qualified type.

This is a non-backward-compatible mangling change, but per discussion with
John, the benefits outweigh this cost.

Fixes <rdar://problem/14074822>.

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

11 years agodoc. parsing: Allow parameter name "..." for variadic functions/methods.
Fariborz Jahanian [Tue, 18 Jun 2013 22:40:39 +0000 (22:40 +0000)]
doc. parsing: Allow parameter name "..." for variadic functions/methods.
// rdar://14124644

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

11 years agoMake sure the assembler-with-cpp hack for "#" works with multiple "#"s in
Eli Friedman [Tue, 18 Jun 2013 21:33:38 +0000 (21:33 +0000)]
Make sure the assembler-with-cpp hack for "#" works with multiple "#"s in
succession. Fixes PR16363.

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

11 years agoWhen declaring an ObjC interface decl with a @compatibility_alias alias name, change...
Argyrios Kyrtzidis [Tue, 18 Jun 2013 21:26:33 +0000 (21:26 +0000)]
When declaring an ObjC interface decl with a @compatibility_alias alias name, change the class name to the "real" one.

If we have something like

  @class NewImage;
  @compatibility_alias OldImage NewImage;
  @class OldImage;

the lookup for 'OldImage' will return the 'NewImage' decl ("@class NewImage").
In such a case, when creating the decl for "@class OldImage" use the real declaration name ("NewImage"),
instead of the alias one ("OldImage"), otherwise we will break IdentifierResolver and redecls-chain invariants.

Fixes crash of rdar://14112291.

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

11 years agoUse llvm::sys::fs::can_write.
Rafael Espindola [Tue, 18 Jun 2013 20:58:25 +0000 (20:58 +0000)]
Use llvm::sys::fs::can_write.

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

11 years agoPartially revert r184225 test changes and make a smaller and more generic fix.
Stephen Lin [Tue, 18 Jun 2013 20:51:51 +0000 (20:51 +0000)]
Partially revert r184225 test changes and make a smaller and more generic fix.

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

11 years ago[multiprecision-builtins] Added missing builtin __builtin_{add,sub}cb for {add,sub...
Michael Gottesman [Tue, 18 Jun 2013 20:40:40 +0000 (20:40 +0000)]
[multiprecision-builtins] Added missing builtin __builtin_{add,sub}cb for {add,sub} with carry for bytes.

I have had several people ask me about why this builtin was not available in
clang (since it seems like a logical conclusion). This patch implements said
builtins.

Relevant tests are included as well. I also updated the Clang language extension reference.

rdar://14192664.

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

11 years agoFix C++ constructor/destructor tests when run on ARM
Stephen Lin [Tue, 18 Jun 2013 20:24:04 +0000 (20:24 +0000)]
Fix C++ constructor/destructor tests when run on ARM

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

11 years agoDR14, DR101, and part of DR1: fix handling of extern "C" declarations in
Richard Smith [Tue, 18 Jun 2013 20:15:12 +0000 (20:15 +0000)]
DR14, DR101, and part of DR1: fix handling of extern "C" declarations in
namespaces, by treating them just like we treat extern "C" declarations in
function scope.

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

11 years agoUse llvm::sys::fs::GetUniqueID.
Rafael Espindola [Tue, 18 Jun 2013 19:40:07 +0000 (19:40 +0000)]
Use llvm::sys::fs::GetUniqueID.

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

11 years agoCorrectly compute the index of the first string format argument when deciding
Eli Friedman [Tue, 18 Jun 2013 18:10:01 +0000 (18:10 +0000)]
Correctly compute the index of the first string format argument when deciding
whether to emit a -Wformat-security warning.  <rdar://problem/14178260>.

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

11 years agoPR14503: Don't assert if a constexpr constructor temploid instantiates to a
Richard Smith [Tue, 18 Jun 2013 17:51:51 +0000 (17:51 +0000)]
PR14503: Don't assert if a constexpr constructor temploid instantiates to a
constructor that does not initialize all members, and that constructor is used
to initialize a global.

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

11 years agoObjective-C: Fixes a typo correction bug where a
Fariborz Jahanian [Tue, 18 Jun 2013 17:10:58 +0000 (17:10 +0000)]
Objective-C: Fixes a typo correction bug where a
selector would be correted to identical selector name
in certain corner cases. // rdar://7853549

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

11 years agoCodeGen: Have 'this'-returning constructors and destructors to take advantage of...
Stephen Lin [Tue, 18 Jun 2013 17:00:49 +0000 (17:00 +0000)]
CodeGen: Have 'this'-returning constructors and destructors to take advantage of the new backend 'returned' attribute.

The backend will now use the generic 'returned' attribute to form tail calls where possible, as well as avoid save-restores of 'this' in some cases (specifically the cases that matter for the ARM C++ ABI).

This patch also reverts a prior front-end only partial implementation of these optimizations, since it's no longer required.

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

11 years agoFix buildbot failure.
Fariborz Jahanian [Tue, 18 Jun 2013 15:54:30 +0000 (15:54 +0000)]
Fix buildbot failure.

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

11 years agoObjective-C [qoi]: privide typo correction for selectors
Fariborz Jahanian [Tue, 18 Jun 2013 15:31:36 +0000 (15:31 +0000)]
Objective-C [qoi]: privide typo correction for selectors
in addition of receiver having static type, but also when
receiver has dynamic type (of 'id' variety) as well as when
receiver is of 'Class' type vareity. // rdar://7853549

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

11 years agoRemove option emitter from clang-tblgen
Reid Kleckner [Tue, 18 Jun 2013 15:25:00 +0000 (15:25 +0000)]
Remove option emitter from clang-tblgen

The CMake build was still using it because I forgot to s/CLANG/LLVM/ in
the tablegen() call.  The Makefile build is already using llvm-tblgen.

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

11 years agoRemove duplicated file and directory.
Rafael Espindola [Tue, 18 Jun 2013 14:09:48 +0000 (14:09 +0000)]
Remove duplicated file and directory.

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

11 years agoUpdate to pass in pointers intead of references.
Bill Wendling [Tue, 18 Jun 2013 07:22:05 +0000 (07:22 +0000)]
Update to pass in pointers intead of references.

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

11 years agosize_t on Darwin AAPCS targets is "unsigned long". <rdar://problem/14136459>
Bob Wilson [Tue, 18 Jun 2013 05:36:04 +0000 (05:36 +0000)]
size_t on Darwin AAPCS targets is "unsigned long". <rdar://problem/14136459>

Some embedded targets use ARM's AAPCS with iOS header files that define size_t
as unsigned long, which conflicts with the usual AAPCS definition of size_t
as unsigned int.

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

11 years agoSimplify a loop in ProcessCodeCompleteResults(). Pointed out by David Blaikie
Dmitri Gribenko [Tue, 18 Jun 2013 04:41:50 +0000 (04:41 +0000)]
Simplify a loop in ProcessCodeCompleteResults().  Pointed out by David Blaikie

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

11 years agoArrayRef'ize CodeCompletionContext::getNumSelIdents()
Dmitri Gribenko [Tue, 18 Jun 2013 04:02:26 +0000 (04:02 +0000)]
ArrayRef'ize CodeCompletionContext::getNumSelIdents()

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

11 years agocontextual conversion fix: C++98 compatibility warning.
Larisse Voufo [Tue, 18 Jun 2013 03:08:53 +0000 (03:08 +0000)]
contextual conversion fix: C++98 compatibility warning.

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

11 years agoAdd support for -fpcc-struct-return. Patch by Arthur O'Dwyer!
John McCall [Tue, 18 Jun 2013 02:46:29 +0000 (02:46 +0000)]
Add support for -fpcc-struct-return.  Patch by Arthur O'Dwyer!

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

11 years agor184100 Fix -- Updated test cases for contextual conversion
Larisse Voufo [Tue, 18 Jun 2013 01:27:47 +0000 (01:27 +0000)]
r184100 Fix -- Updated test cases for contextual conversion

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

11 years agoRemove an ugly hack that was meant to eliminate the breakpoint ambiguity
Adrian Prantl [Tue, 18 Jun 2013 00:27:36 +0000 (00:27 +0000)]
Remove an ugly hack that was meant to eliminate the breakpoint ambiguity
between a block assignment and the entry of the block function. In reality
this wouldn't work anyway because blocks are predominantly created
on-the-fly inside of an ObjC method invocation.
The proper fix for the ambiguity is to use -gcolumn-info to differentiate
the breakpoints.

This is expected to break some block-related darwin-gdb tests.

rdar://problem/14039866

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

11 years agoDelete dead code.
Eli Friedman [Tue, 18 Jun 2013 00:22:17 +0000 (00:22 +0000)]
Delete dead code.

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

11 years agoAccept and ignore -fdebug-types-section for now. This will be used
Eric Christopher [Tue, 18 Jun 2013 00:03:50 +0000 (00:03 +0000)]
Accept and ignore -fdebug-types-section for now. This will be used
later with dwarf4 type hashing.

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

11 years agoFileCheck-ize.
Eric Christopher [Tue, 18 Jun 2013 00:03:46 +0000 (00:03 +0000)]
FileCheck-ize.

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

11 years agoAdd a missing testcase for ObjC ivar encoding for a C++ class with a vptr.
Eli Friedman [Mon, 17 Jun 2013 23:57:41 +0000 (23:57 +0000)]
Add a missing testcase for ObjC ivar encoding for a C++ class with a vptr.
Found by skimming over lcov report.

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

11 years agoTurn Clang 3.3 boxes on C++ status from yellow to green now we're releasing it.
Richard Smith [Mon, 17 Jun 2013 23:54:23 +0000 (23:54 +0000)]
Turn Clang 3.3 boxes on C++ status from yellow to green now we're releasing it.

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

11 years agoPoint link at correct location for Clang 3.3 release notes.
Richard Smith [Mon, 17 Jun 2013 23:53:08 +0000 (23:53 +0000)]
Point link at correct location for Clang 3.3 release notes.

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

11 years agoFix source range of CXXNewExpr with parentheses around the type. PR15569.
Eli Friedman [Mon, 17 Jun 2013 22:35:10 +0000 (22:35 +0000)]
Fix source range of CXXNewExpr with parentheses around the type.  PR15569.

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

11 years agoCompute the visibility of static local variables consistently. Fixes PR16208.
Eli Friedman [Mon, 17 Jun 2013 21:51:45 +0000 (21:51 +0000)]
Compute the visibility of static local variables consistently.  Fixes PR16208.

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

11 years agoFix Expr::Classify to correctly classify ExtVectorElementExprs. PR16204.
Eli Friedman [Mon, 17 Jun 2013 21:09:57 +0000 (21:09 +0000)]
Fix Expr::Classify to correctly classify ExtVectorElementExprs.  PR16204.

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

11 years agoCleanup linkage computation for static locals.
Rafael Espindola [Mon, 17 Jun 2013 20:04:51 +0000 (20:04 +0000)]
Cleanup linkage computation for static locals.

With this patch we assign VisibleNoLinkage to static locals in inline functions.
This lets us simplify CodeGen a bit.

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

11 years agoUse atomic instructions on Bitrig armv6. Patch by Patrick Wildt.
Rafael Espindola [Mon, 17 Jun 2013 20:00:15 +0000 (20:00 +0000)]
Use atomic instructions on Bitrig armv6. Patch by Patrick Wildt.

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

11 years agoX86 intrinsics: cmpge|gt|nge|ngt_ss|_sd
Manman Ren [Mon, 17 Jun 2013 19:42:49 +0000 (19:42 +0000)]
X86 intrinsics: cmpge|gt|nge|ngt_ss|_sd

These intrinsics should return the comparision result in the low bits and keep
the high bits of the first source operand.

When calling to builtin functions, the source operands are swapped and the high
bits of the second source operand are kept. To fix the issue, an extra
shufflevector is used.

rdar://14153896

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

11 years agoRevert "Updated test cases for contextual conversion"
Rafael Espindola [Mon, 17 Jun 2013 19:26:19 +0000 (19:26 +0000)]
Revert "Updated test cases for contextual conversion"

This reverts commit r184100.

It was faling on some bots:
http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/1973/steps/test_clang/logs/Clang%20%3A%3A%20SemaCXX__cxx1y-contextual-conversion-tweaks.cpp

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

11 years agoUpdated test cases for contextual conversion
Larisse Voufo [Mon, 17 Jun 2013 18:41:38 +0000 (18:41 +0000)]
Updated test cases for contextual conversion

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

11 years agoAvoid using __SIZE_TYPE__ in a -std=c++98 -pedantic-errors test, because that
Richard Smith [Mon, 17 Jun 2013 18:05:42 +0000 (18:05 +0000)]
Avoid using __SIZE_TYPE__ in a -std=c++98 -pedantic-errors test, because that
triggers an error on MS targets where __SIZE_TYPE__ expands to 'long long'.

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

11 years agounbreak buildbot for now.
Fariborz Jahanian [Mon, 17 Jun 2013 17:41:13 +0000 (17:41 +0000)]
unbreak buildbot for now.

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

11 years agoInclude PathV1.h only where it is used.
Rafael Espindola [Mon, 17 Jun 2013 17:23:47 +0000 (17:23 +0000)]
Include PathV1.h only where it is used.

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

11 years agoClean up empty struct/union recognition.
Serge Pavlov [Mon, 17 Jun 2013 17:18:51 +0000 (17:18 +0000)]
Clean up empty struct/union recognition.
Make use of getTypeSizeInChars to detect structs/unions of zero size. It allows
more accurate detection of types of zero size. It however has a side effect -
sequence of used types may change, that is why the test 'override-layout' was
modified.

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

11 years agoObjective-C [qoi]: Provide fixit hint when message with typo
Fariborz Jahanian [Mon, 17 Jun 2013 17:10:54 +0000 (17:10 +0000)]
Objective-C [qoi]: Provide fixit hint when message with typo
is sent to a receiver object. This is wip. // rdar://7853549

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

11 years ago[Driver] Remove the using namespace directives from headers
Reid Kleckner [Mon, 17 Jun 2013 13:59:19 +0000 (13:59 +0000)]
[Driver] Remove the using namespace directives from headers

This adds a bunch of llvm::opt name specifiers to all the uses of types
from that namespace.

Reviewers: espindola

Differential Revision: http://llvm-reviews.chandlerc.com/D983

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

11 years agoFix a problem in ExpressionParser leading to trailing comments affecting indentation...
Alexander Kornienko [Mon, 17 Jun 2013 13:19:53 +0000 (13:19 +0000)]
Fix a problem in ExpressionParser leading to trailing comments affecting indentation of an expression after a line break.

Summary:
E.g. the second line in

return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
           b; //

is indented 4 characters more than in

return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
       b;

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D984

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

11 years agoTry to fix the bots with a forward decl.
Reid Kleckner [Mon, 17 Jun 2013 13:05:47 +0000 (13:05 +0000)]
Try to fix the bots with a forward decl.

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

11 years agoFixes incorrect indentation of line comments after break and re-alignment.
Alexander Kornienko [Mon, 17 Jun 2013 12:59:44 +0000 (12:59 +0000)]
Fixes incorrect indentation of line comments after break and re-alignment.

Summary:
Selectively propagate the information about token kind in
WhitespaceManager::replaceWhitespaceInToken.For correct alignment of new
segments of line comments in order to align them correctly. Don't set
BreakBeforeParameter in breakProtrudingToken for line comments, as it introduces
a break after the _next_ parameter. Added tests for related functions.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D980

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

11 years ago[AST] Don't include RecursiveASTVisitor.h in ASTContext.h
Reid Kleckner [Mon, 17 Jun 2013 12:56:08 +0000 (12:56 +0000)]
[AST] Don't include RecursiveASTVisitor.h in ASTContext.h

The untemplated implementation of getParents() doesn't need to be in a
header file.

RecursiveASTVisitor.h is full of repeated macro expansion.  Moving this
include to ASTContext.cpp speeds up compilation of
LambdaMangleContext.cpp, a small C++ file with few includes, from 3.7s
to 2.8s for me locally.  I haven't measured a full build, but it can't
hurt.

I had to fix a few static analyzer files that were depending on
transitive includes of C++ AST headers.

Reviewers: rsmith, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D982

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

11 years agoCorrected status of support for contextual conversion from full to SVN
Larisse Voufo [Mon, 17 Jun 2013 05:37:15 +0000 (05:37 +0000)]
Corrected status of support for contextual conversion from full to SVN

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

11 years agoRemove unused file.
Richard Smith [Mon, 17 Jun 2013 01:34:23 +0000 (01:34 +0000)]
Remove unused file.

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

11 years agoC++11: don't warn about the deprecated 'register' keyword if it's combined with
Richard Smith [Mon, 17 Jun 2013 01:34:01 +0000 (01:34 +0000)]
C++11: don't warn about the deprecated 'register' keyword if it's combined with
an asm label.

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

11 years agoAdd warning group -Wdeprecated-register for C++11 warning on 'register' being
Richard Smith [Mon, 17 Jun 2013 00:01:58 +0000 (00:01 +0000)]
Add warning group -Wdeprecated-register for C++11 warning on 'register' being
deprecated.

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

11 years agoAdd tests for C++ DR100-150.
Richard Smith [Sun, 16 Jun 2013 08:00:51 +0000 (08:00 +0000)]
Add tests for C++ DR100-150.

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

11 years agoAdd testcase for DR39 from PR5916.
Richard Smith [Sun, 16 Jun 2013 05:11:56 +0000 (05:11 +0000)]
Add testcase for DR39 from PR5916.

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

11 years agoPR16339: Don't produce a diagnostic pointing at the whitespace between a '#if'
Richard Smith [Sun, 16 Jun 2013 05:05:39 +0000 (05:05 +0000)]
PR16339: Don't produce a diagnostic pointing at the whitespace between a '#if'
and a '!defined(X)' if we find a broken header guard. This is suboptimal; we
should point the diagnostic at the 'X' token not the 'if' token, but it fixes
the crash.

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

11 years agoFixed one buildbot-failure-causing bug...
Larisse Voufo [Sun, 16 Jun 2013 04:34:07 +0000 (04:34 +0000)]
Fixed one buildbot-failure-causing bug...

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

11 years agoArrayRef'ize Sema::CodeComplete*
Dmitri Gribenko [Sun, 16 Jun 2013 03:47:57 +0000 (03:47 +0000)]
ArrayRef'ize Sema::CodeComplete*

Patch by Robert Wilhelm.

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

11 years agoUpdated status of support for contextual conversion from partial to full
Larisse Voufo [Sat, 15 Jun 2013 20:26:23 +0000 (20:26 +0000)]
Updated status of support for contextual conversion from partial to full

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

11 years agoUpdated the support for contextual conversion tweaks (n3323) with a previously overlo...
Larisse Voufo [Sat, 15 Jun 2013 20:17:46 +0000 (20:17 +0000)]
Updated the support for contextual conversion tweaks (n3323) with a previously overlooked part: implicitly converting array sizes to size_t, rather than contextually converting them to some unique type.

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

11 years agoA quick fix to allow return type deduction on member templates
Faisal Vali [Sat, 15 Jun 2013 11:54:37 +0000 (11:54 +0000)]
A quick fix to allow return type deduction on member templates
by ensuring DiagnoseUseOfDecl is called both on the found decl and the
decl being used (i.e the specialization in the case of member templates) whenever they are different.
Per the exchange captured in
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130610/081636.html
a more comprehensive fix that allows both decls to be passed into DiagnoseUseOfDecl is (or should be) forthcoming relatively soon.

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

11 years agoEmit native implementations of atomic operations on FreeBSD/armv6.
Ed Schouten [Sat, 15 Jun 2013 09:40:14 +0000 (09:40 +0000)]
Emit native implementations of atomic operations on FreeBSD/armv6.

Just like on Linux, FreeBSD/armv6 assumes the system supports
ldrex/strex unconditionally. It is also used by the kernel. We can
therefore enable support for it, like we do on Linux.

While there, change one of the unit tests to explicitly test against
armv5 instead of armv7, as it actually tests whether libcalls are
emitted.

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

11 years agoPR16263: Implement current direction of core issue 1376. Binding a reference to
Richard Smith [Sat, 15 Jun 2013 00:30:29 +0000 (00:30 +0000)]
PR16263: Implement current direction of core issue 1376. Binding a reference to
the result of a cast-to-reference-type lifetime-extends the object to which the
reference inside the cast binds.

This requires us to look for subobject adjustments on both the inside and the
outside of the MaterializeTemporaryExpr when looking for a temporary to
lifetime-extend (which we also need for core issue 616, and possibly 1213).

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

11 years agoFix handling of const_cast from prvalue to rvalue reference: such a cast is
Richard Smith [Fri, 14 Jun 2013 22:27:52 +0000 (22:27 +0000)]
Fix handling of const_cast from prvalue to rvalue reference: such a cast is
only permitted if the source object is of class type, and should materialize a
temporary for the reference to bind to.

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

11 years agoFix comments referring to non-existent types.
Eli Friedman [Fri, 14 Jun 2013 21:28:56 +0000 (21:28 +0000)]
Fix comments referring to non-existent types.

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

11 years agoUnify return type checking for functions and ObjC methods. Move all the
Eli Friedman [Fri, 14 Jun 2013 21:14:10 +0000 (21:14 +0000)]
Unify return type checking for functions and ObjC methods.  Move all the
random checks for ObjC object return types to SemaType.cpp.

Fixes issue with ObjC method type checking reported on cfe-dev.

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

11 years agoSuppress the c++11 -Wdeprecated warning for 'register' if it is expanded from a
Richard Smith [Fri, 14 Jun 2013 21:05:24 +0000 (21:05 +0000)]
Suppress the c++11 -Wdeprecated warning for 'register' if it is expanded from a
macro defined in a system header. glibc uses it in macros, apparently.

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

11 years ago[Driver] Refactor clang driver to use LLVM's Option library
Reid Kleckner [Fri, 14 Jun 2013 17:17:23 +0000 (17:17 +0000)]
[Driver] Refactor clang driver to use LLVM's Option library

The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere

As discussed in the review, this change includes using directives in
header files.  I'll make follow up changes to remove those in favor of
name specifiers.

Reviewers: espindola

Differential Revision: http://llvm-reviews.chandlerc.com/D975

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

11 years agoDon't remove backslashes from block comments.
Alexander Kornienko [Fri, 14 Jun 2013 11:46:10 +0000 (11:46 +0000)]
Don't remove backslashes from block comments.

Summary:
Don't remove backslashes from block comments. Previously this
/* \    \ \ \ \ \
*/
would be turned to this:
/*
*/
which spoils some kinds of ASCII-art, people use in their comments. The behavior
was related to handling escaped newlines in block comments inside preprocessor
directives. This patch makes handling it in a more civilized way.

Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D979

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

11 years agoFix the warning for divide by zero to be a bit more robust. ;]
Chandler Carruth [Fri, 14 Jun 2013 08:57:18 +0000 (08:57 +0000)]
Fix the warning for divide by zero to be a bit more robust. ;]

Previously, it only ever fired for zeros which formed null pointers.
Now, hilariously, in C++98 this was almost anything. Including tricks
like warning on the divisor in this code:

typedef char c3[3];
size_t f(c3* ptr) {
  return (sizeof(ptr) / sizeof(*ptr)) / (size_t)(!(sizeof(ptr) % sizeof(*ptr)));
}

Why the RHS of the outer divide is a null pointer constant is a sordid
tale of sorrow. Anyways, the committee fixed this for C++11 and onward
as part of core isssue 903, and Richard recently implemented this fix
causing the warning to go away here (and elsewhere).

This patch restores the warning here and adds it for numerous other
somewhat obvious gaffes:

int g(int x) {
  return x / (int)(0.0);
}

The patch is essentially just using the full power of our constant
folding in Clang to produce the warning, but insisting that it must fold
to an *integer* which is zero so that we don't get false positives
anywhere.

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