]> granicus.if.org Git - clang/log
clang
11 years agoSema for Captured Statements
Tareq A. Siraj [Tue, 16 Apr 2013 19:37:38 +0000 (19:37 +0000)]
Sema for Captured Statements

Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic
analysis. Currently captures all variables by reference.

TODO: templates

Author: Ben Langmuir <ben.langmuir@intel.com>

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

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

11 years agorewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency.
Benjamin Kramer [Tue, 16 Apr 2013 19:08:41 +0000 (19:08 +0000)]
rewrite-includes: Rewrite __has_include(_next) to get rid of a host dependency.

This broke e.g. compiling a crash report from a glibc system on Darwin. Sadly,
the implementation had to game the lexer a lot as we're not using a real
preprocessor here. It also doesn't handle special cases like arbitrary macros in
__has_include, but since this macro isn't common outside of clang's headers we
can get away with that.

Fixes PR14422.

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

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

11 years agoImplement CapturedStmt AST
Tareq A. Siraj [Tue, 16 Apr 2013 18:53:08 +0000 (18:53 +0000)]
Implement CapturedStmt AST

CapturedStmt can be used to implement generic function outlining as described in
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html.

CapturedStmt is not exposed to the C api.

Serialization and template support are pending.

Author: Wei Pan <wei.pan@intel.com>

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

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

11 years agoParser support for #pragma clang __debug captured
Tareq A. Siraj [Tue, 16 Apr 2013 18:41:26 +0000 (18:41 +0000)]
Parser support for #pragma clang __debug captured

This patch implements parsing ‘#pragma clang __debug’ as a first step for
implementing captured statements. Captured statements are a mechanism for
doing outlining in the AST.
see http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html.

Currently returns StmtEmpty

Author: Andy Zhang <andy.zhang@intel.com>

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

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

11 years ago[Modules] Convert module specific -fno-modules-autolink into -fno-autolink.
Daniel Dunbar [Tue, 16 Apr 2013 18:21:19 +0000 (18:21 +0000)]
[Modules] Convert module specific -fno-modules-autolink into -fno-autolink.

 - There is no reason to have a modules specific flag for disabling
   autolinking. Instead, convert the existing flag into -fno-autolink (which
   should cover other autolinking code generation paths like #pragmas if and
   when we support them).

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

11 years agomodify test to try to make buildbot happy.
Fariborz Jahanian [Tue, 16 Apr 2013 17:18:37 +0000 (17:18 +0000)]
modify test to try to make buildbot happy.

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

11 years agoRemove setjmp.h header file from Sema/return.c test and include necessary
Jyotsna Verma [Tue, 16 Apr 2013 16:10:38 +0000 (16:10 +0000)]
Remove setjmp.h header file from Sema/return.c test and include necessary
declarations explicitly in the test.

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

11 years agoFix PR4296: Add parser detection/error recovery for nested functions, from Serve...
Douglas Gregor [Tue, 16 Apr 2013 16:01:32 +0000 (16:01 +0000)]
Fix PR4296: Add parser detection/error recovery for nested functions, from Serve Pavlov!

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

11 years agoUse -emit-llvm for the following tests to stop them from failing for Hexagon:
Jyotsna Verma [Tue, 16 Apr 2013 15:55:41 +0000 (15:55 +0000)]
Use -emit-llvm for the following tests to stop them from failing for Hexagon:

CodeGenCXX/vtable-debug-info.cpp
Driver/objc++-cpp-output.mm
Driver/objc-cpp-output.m

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

11 years agoFix handling of atomic shift operations, from Serge Pavlov.
Douglas Gregor [Tue, 16 Apr 2013 15:41:08 +0000 (15:41 +0000)]
Fix handling of atomic shift operations, from Serge Pavlov.

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

11 years agoObjective-C IRGen. Use llvm::WeakVH
Fariborz Jahanian [Tue, 16 Apr 2013 15:25:39 +0000 (15:25 +0000)]
Objective-C IRGen. Use llvm::WeakVH
for caching couple of global symbols used
for generation of CF/NS string meta-data
so they are not released prematuely in certain
corner cases. // rdar:// 13598026.
Reviewed by John M.

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

11 years agoSuppress unused warning on static inline function template specializations.
Rafael Espindola [Tue, 16 Apr 2013 15:21:30 +0000 (15:21 +0000)]
Suppress unused warning on static inline function template specializations.

Patch by Halfdan Ingvarsson!

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

11 years agoAdd support for sparcv9 targets.
Jakob Stoklund Olesen [Tue, 16 Apr 2013 15:17:49 +0000 (15:17 +0000)]
Add support for sparcv9 targets.

The SPARC v8 and SPARC v8 architectures are very similar, so use a base
class to share most information between them.

Include operating systems with known SPARC v9 ports.

Also fix two issues with the SPARC v8 data layout string: SPARC v8 is a
big endian target with a 64-bit aligned stack.

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

11 years agoBasic support for Microsoft property declarations and
John McCall [Tue, 16 Apr 2013 07:28:30 +0000 (07:28 +0000)]
Basic support for Microsoft property declarations and
references thereto.

Patch by Tong Shen!

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

11 years agoCorrectly propagate the storage class to function template instantiations.
Rafael Espindola [Tue, 16 Apr 2013 02:29:15 +0000 (02:29 +0000)]
Correctly propagate the storage class to function template instantiations.

This fixes pr15753. This is another case of the fuzzy definition of the
"as written" storage class of an instantiation.

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

11 years ago[analyzer] Improve the malloc checker stack hint message
Anna Zaks [Tue, 16 Apr 2013 00:22:55 +0000 (00:22 +0000)]
[analyzer] Improve the malloc checker stack hint message

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

11 years ago[analyzer] Do not crash when processing binary "?:" in C++
Anna Zaks [Mon, 15 Apr 2013 22:38:07 +0000 (22:38 +0000)]
[analyzer] Do not crash when processing binary "?:" in C++

When computing the value of ?: expression, we rely on the last expression in
the previous basic block to be the resulting value of the expression. This is
not the case for binary "?:" operator (GNU extension) in C++. As the last
basic block has the expression for the condition subexpression, which is an
R-value, whereas the true subexpression is the L-value.

Note the operator evaluation just happens to work in C since the true
subexpression is an R-value (like the condition subexpression). CFG is the
same in C and C++ case, but the AST nodes are different, which the LValue to
Rvalue conversion happening after the BinaryConditionalOperator evaluation.

Changed the logic to only use the last expression from the predecessor only
if it matches either true or false subexpression. Note, the logic needed
fortification anyway: L and R were passed but not even used by the function.

Also, change the conjureSymbolVal to correctly compute the type, when the
expression is an LG-value.

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

11 years ago[analyzer] Add pretty printing to CXXBaseObjectRegion.
Anna Zaks [Mon, 15 Apr 2013 22:38:04 +0000 (22:38 +0000)]
[analyzer] Add pretty printing to CXXBaseObjectRegion.

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

11 years ago[analyzer] Address code review for r179395
Anna Zaks [Mon, 15 Apr 2013 22:37:59 +0000 (22:37 +0000)]
[analyzer] Address code review for r179395

Mostly refactoring + handle the nested fields by printing the innermost field only.

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

11 years ago[analyzer] Add more specialized error messages for corner cases as per Jordan's code...
Anna Zaks [Mon, 15 Apr 2013 22:37:53 +0000 (22:37 +0000)]
[analyzer] Add more specialized error messages for corner cases as per Jordan's code review for r179396

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

11 years agoBreak after multiline parameters.
Daniel Jasper [Mon, 15 Apr 2013 22:36:37 +0000 (22:36 +0000)]
Break after multiline parameters.

We do this in general, but missed a few cases.

Before:
void aaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbb bbbb);

After:
void aaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
    bbbb bbbb);

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

11 years ago[analyzer] Don't assert on a temporary of pointer-to-member type.
Jordan Rose [Mon, 15 Apr 2013 22:03:38 +0000 (22:03 +0000)]
[analyzer] Don't assert on a temporary of pointer-to-member type.

While we don't do anything intelligent with pointers-to-members today,
it's perfectly legal to need a temporary of pointer-to-member type to, say,
pass by const reference. Tweak an assertion to allow this.

PR15742 and PR15747

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

11 years agoRemove some dead code that has not been used since 2010.
Joey Gouly [Mon, 15 Apr 2013 21:13:33 +0000 (21:13 +0000)]
Remove some dead code that has not been used since 2010.

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

11 years ago[analyzer] Be lazy about struct/array global invalidation too.
Jordan Rose [Mon, 15 Apr 2013 20:39:48 +0000 (20:39 +0000)]
[analyzer] Be lazy about struct/array global invalidation too.

Structs and arrays can take advantage of the single top-level global
symbol optimization (described in the previous commit) just as well
as scalars.

No intended behavioral change.

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

11 years ago[analyzer] Re-enable using global regions as a symbolic base.
Jordan Rose [Mon, 15 Apr 2013 20:39:45 +0000 (20:39 +0000)]
[analyzer] Re-enable using global regions as a symbolic base.

Now that we're invalidating global regions properly, we want to continue
taking advantage of a particular optimization: if all global regions are
invalidated together, we can represent the bindings of each region with
a "derived region value" symbol. Essentially, this lazily links each
global region with a single symbol created at invalidation time, rather
than binding each region with a new symbolic value.

We used to do this, but haven't been for a while; the previous commit
re-enabled this code path, and this handles the fallout.

<rdar://problem/13464044>

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

11 years ago[analyzer] Properly invalidate global regions on opaque function calls.
Jordan Rose [Mon, 15 Apr 2013 20:39:41 +0000 (20:39 +0000)]
[analyzer] Properly invalidate global regions on opaque function calls.

This fixes a regression where a call to a function we can't reason about
would not actually invalidate global regions that had explicit bindings.

  void test_that_now_works() {
    globalInt = 42;
    clang_analyzer_eval(globalInt == 42); // expected-warning{{TRUE}}

    invalidateGlobals();
    clang_analyzer_eval(globalInt == 42); // expected-warning{{UNKNOWN}}
  }

This has probably been around since the initial "cluster" refactoring of
RegionStore, if not longer.

<rdar://problem/13464044>

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

11 years ago[analyzer] Tests: move system functions into system header simulator files.
Jordan Rose [Mon, 15 Apr 2013 20:39:37 +0000 (20:39 +0000)]
[analyzer] Tests: move system functions into system header simulator files.

Some checkers ascribe different behavior to functions declared in system
headers, so when working with standard library functions it's probably best
to always have them in a standard location.

Test change only (no functionality change), but necessary for the next commit.

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

11 years agoRevert "Speed-up ObjCMethodDecl::getOverriddenMethods()."
Argyrios Kyrtzidis [Mon, 15 Apr 2013 18:47:22 +0000 (18:47 +0000)]
Revert "Speed-up ObjCMethodDecl::getOverriddenMethods()."

This reverts commit r179436.

Due to caching, it was possible that we could miss overridden methods that
were introduced by categories later on.

Along with reverting the commit I also included a test case that would have caught this.

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

11 years agoRemove XFAIL now that the test is standalone.
Rafael Espindola [Mon, 15 Apr 2013 17:06:15 +0000 (17:06 +0000)]
Remove XFAIL now that the test is standalone.

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

11 years ago[PCH/test] Make test/PCH/cxx-typeid.cpp self-contained by including the relevant...
Argyrios Kyrtzidis [Mon, 15 Apr 2013 16:52:57 +0000 (16:52 +0000)]
[PCH/test] Make test/PCH/cxx-typeid.cpp self-contained by including the relevant standard library declarations
instead of depending on a system header inclusion.

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

11 years agoFix unused variable warning with assertions disabled.
Alexander Kornienko [Mon, 15 Apr 2013 15:47:34 +0000 (15:47 +0000)]
Fix unused variable warning with assertions disabled.

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

11 years agoUse llvm::sys::IsBigEndianHost.
Rafael Espindola [Mon, 15 Apr 2013 15:10:35 +0000 (15:10 +0000)]
Use llvm::sys::IsBigEndianHost.

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

11 years agoUnified token breaking logic for strings and block comments.
Alexander Kornienko [Mon, 15 Apr 2013 14:28:00 +0000 (14:28 +0000)]
Unified token breaking logic for strings and block comments.

Summary:
Both strings and block comments are broken into lines in
breakProtrudingToken. Logic specific for strings or block comments is abstracted
in implementations of the BreakToken interface. Among other goodness, this
change fixes placement of backslashes after a block comment inside a
preprocessor directive (see removed FIXMEs in unit tests).

The code is far from being polished, and some parts of it will be changed for
line comments support.

Reviewers: klimek

Reviewed By: klimek

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

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

11 years agoAdd a missing space
Timur Iskhodzhanov [Mon, 15 Apr 2013 14:16:31 +0000 (14:16 +0000)]
Add a missing space

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

11 years agoRemove hasExternalLinkageUncached.
Rafael Espindola [Mon, 15 Apr 2013 12:49:13 +0000 (12:49 +0000)]
Remove hasExternalLinkageUncached.

It was being used correctly, but it is a very dangerous API to have around.
Instead, move the logic from the filtering to when we are deciding if we should
link two decls.

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

11 years agoFix the storage class of method instantiations.
Rafael Espindola [Mon, 15 Apr 2013 12:38:20 +0000 (12:38 +0000)]
Fix the storage class of method instantiations.

We keep the "as written" storage class, but that is a fuzzy concept for
instantiations. With this patch instantiations of methods of class templates
now get a storage class that is based on the semantics of isStatic(). With this
can simplify isStatic() itself.

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

11 years agoRemove reference to MSVC only building X86 backend.
Tim Northover [Mon, 15 Apr 2013 11:55:27 +0000 (11:55 +0000)]
Remove reference to MSVC only building X86 backend.

This is no longer true.

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

11 years agoLocal thread_local variables are implicitly 'static'. (This doesn't apply to _Thread_...
Richard Smith [Mon, 15 Apr 2013 08:33:22 +0000 (08:33 +0000)]
Local thread_local variables are implicitly 'static'. (This doesn't apply to _Thread_local nor __thread.)

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

11 years agoProperly check for a constant initializer for a thread-local variable.
Richard Smith [Mon, 15 Apr 2013 08:07:34 +0000 (08:07 +0000)]
Properly check for a constant initializer for a thread-local variable.

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

11 years agoAdd triple to another test.
Richard Smith [Mon, 15 Apr 2013 08:02:05 +0000 (08:02 +0000)]
Add triple to another test.

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

11 years agoAdd triples to these tests since they're now using TLS, which isn't available on...
Richard Smith [Mon, 15 Apr 2013 08:00:15 +0000 (08:00 +0000)]
Add triples to these tests since they're now using TLS, which isn't available on all targets.

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

11 years agoAdd a new flag -vectorize-slp-aggressive to enable Hals BB vectorizer.
Nadav Rotem [Mon, 15 Apr 2013 05:38:41 +0000 (05:38 +0000)]
Add a new flag -vectorize-slp-aggressive to enable Hals BB vectorizer.

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

11 years agoRename the slp-vectorizer clang/llvm flags. No functionality change.
Nadav Rotem [Mon, 15 Apr 2013 04:57:18 +0000 (04:57 +0000)]
Rename the slp-vectorizer clang/llvm flags. No functionality change.

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

11 years agoComment command table: use inheritance instead of duplicating code
Dmitri Gribenko [Mon, 15 Apr 2013 02:31:50 +0000 (02:31 +0000)]
Comment command table: use inheritance instead of duplicating code

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

11 years agoCodeGen support for function-local static thread_local variables with
Richard Smith [Sun, 14 Apr 2013 23:01:42 +0000 (23:01 +0000)]
CodeGen support for function-local static thread_local variables with
non-constant constructors or non-trivial destructors. Plus bugfixes for
thread_local references bound to temporaries (the temporaries themselves are
lifetime-extended to become thread_local), and the corresponding case for
std::initializer_list.

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

11 years agoRemoved #if 0 code that doesn't compiled if uncommented.
Rafael Espindola [Sun, 14 Apr 2013 22:08:07 +0000 (22:08 +0000)]
Removed #if 0 code that doesn't compiled if uncommented.

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

11 years agoDiagnose if a __thread or _Thread_local variable has a non-constant initializer
Richard Smith [Sun, 14 Apr 2013 20:11:31 +0000 (20:11 +0000)]
Diagnose if a __thread or _Thread_local variable has a non-constant initializer
or non-trivial destructor.

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

11 years ago[analyzer] Add a link to the Building a Checker in 24 Hours talk to the developer...
Anna Zaks [Sun, 14 Apr 2013 18:36:51 +0000 (18:36 +0000)]
[analyzer] Add a link to the Building a Checker in 24 Hours talk to the developer manual

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

11 years ago[Mips] Support -mmicromips / -mno-micromips command line options.
Simon Atanasyan [Sun, 14 Apr 2013 14:07:51 +0000 (14:07 +0000)]
[Mips] Support -mmicromips / -mno-micromips command line options.

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

11 years ago[Mips] Fix indentation.
Simon Atanasyan [Sun, 14 Apr 2013 14:07:41 +0000 (14:07 +0000)]
[Mips] Fix indentation.

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

11 years ago[Mips] Follow-up to r179481. Reduce code duplication. Use
Simon Atanasyan [Sun, 14 Apr 2013 14:07:36 +0000 (14:07 +0000)]
[Mips] Follow-up to r179481. Reduce code duplication. Use
AddTargetFeature() routine to handle -msingle-float / -mdouble-float
options.

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

11 years ago[Mips] Follow-up to r179481. Consider "single-float" as a separate
Simon Atanasyan [Sun, 14 Apr 2013 14:07:30 +0000 (14:07 +0000)]
[Mips] Follow-up to r179481. Consider "single-float" as a separate
independent of float ABI feature in the MipsTargetInfoBase class.

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

11 years agoAdd driver support for fedora 18 on ARM.
Rafael Espindola [Sun, 14 Apr 2013 10:14:21 +0000 (10:14 +0000)]
Add driver support for fedora 18 on ARM.

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

11 years agoHandle incompatible redeclarations of library builtins better.
John McCall [Sun, 14 Apr 2013 08:50:55 +0000 (08:50 +0000)]
Handle incompatible redeclarations of library builtins better.
Invalid redeclarations of valid explicit declarations shouldn't
take the same path as redeclarations of implicit declarations,
and invalid local extern declarations shouldn't foul things up
for everybody else.

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

11 years ago[Mips] Remove "single" from the list of valid MIPS float ABI names. Add
Simon Atanasyan [Sun, 14 Apr 2013 08:37:15 +0000 (08:37 +0000)]
[Mips] Remove "single" from the list of valid MIPS float ABI names. Add
two new options –msingle-float and –mdouble-float. These options can be
used simultaneously with float ABI selection options (-mfloat-abi,
-mhard-float, -msoft-float). They mark whether a floating-point
coprocessor supports double-precision operations.

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

11 years agoSimplify test so that it is more portable.
Rafael Espindola [Sat, 13 Apr 2013 22:26:02 +0000 (22:26 +0000)]
Simplify test so that it is more portable.

I have checked that the test still fails when the "|| !P.isRegularFile()" from
the original patch is removed.

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

11 years agoRemove duplicated comment.
Simon Atanasyan [Sat, 13 Apr 2013 06:43:15 +0000 (06:43 +0000)]
Remove duplicated comment.

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

11 years agoAnnotate flavor of TLS variable (statically or dynamically initialized) onto the...
Richard Smith [Sat, 13 Apr 2013 02:43:54 +0000 (02:43 +0000)]
Annotate flavor of TLS variable (statically or dynamically initialized) onto the AST.

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

11 years agoUse MapVector rather than simulating it.
Richard Smith [Sat, 13 Apr 2013 01:28:18 +0000 (01:28 +0000)]
Use MapVector rather than simulating it.

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

11 years agoSpeed-up ObjCMethodDecl::getOverriddenMethods().
Argyrios Kyrtzidis [Sat, 13 Apr 2013 01:04:01 +0000 (01:04 +0000)]
Speed-up ObjCMethodDecl::getOverriddenMethods().

Use an newly introduce ASTContext::getBaseObjCCategoriesAfterInterface() which caches its
results instead of re-calculating the categories multiple times.

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

11 years agoIntroduce SourceManager::getDecomposedIncludedLoc, that returns the "included/expande...
Argyrios Kyrtzidis [Sat, 13 Apr 2013 01:03:57 +0000 (01:03 +0000)]
Introduce SourceManager::getDecomposedIncludedLoc, that returns the "included/expanded in" decomposed location of the given FileID.

The main benefit is to speed-up SourceManager::isBeforeInTranslationUnit which is common to query
the included/expanded location of the same FileID multiple times.

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

11 years agoGive this test a triple so that its use of thread_local doesn't make it fail on the...
Richard Smith [Sat, 13 Apr 2013 00:34:48 +0000 (00:34 +0000)]
Give this test a triple so that its use of thread_local doesn't make it fail on the MSVC bot.

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

11 years agoDon't replace an existing decl in the scope chains with its
John McCall [Sat, 13 Apr 2013 00:20:21 +0000 (00:20 +0000)]
Don't replace an existing decl in the scope chains with its
local-extern redeclaration;  type refinements, default arguments,
etc. must all be locally scoped.

rdar://13535367

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

11 years agoHeaders: Don't try to use RSIZE_MAX unless we are freestanding.
Daniel Dunbar [Fri, 12 Apr 2013 23:41:08 +0000 (23:41 +0000)]
Headers: Don't try to use RSIZE_MAX unless we are freestanding.
 - We don't want to depend on the platforms stdint.h.

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

11 years ago[analyzer] Enable NewDelete checker if NewDeleteLeaks checker is enabled.
Anton Yartsev [Fri, 12 Apr 2013 23:25:40 +0000 (23:25 +0000)]
[analyzer] Enable NewDelete checker if NewDeleteLeaks checker is enabled.

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

11 years agoHeaders: Add support for ISO9899:2011 rsize_t.
Daniel Dunbar [Fri, 12 Apr 2013 23:24:56 +0000 (23:24 +0000)]
Headers: Add support for ISO9899:2011 rsize_t.

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

11 years agoNewDeleteLeaks is a subchecker of NewDelete checker; it is tested in NewDelete-checke...
Anton Yartsev [Fri, 12 Apr 2013 23:18:46 +0000 (23:18 +0000)]
NewDeleteLeaks is a subchecker of NewDelete checker; it is tested in NewDelete-checker-test.cpp

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

11 years agoParsing support for thread_local and _Thread_local. We give them the same
Richard Smith [Fri, 12 Apr 2013 22:46:28 +0000 (22:46 +0000)]
Parsing support for thread_local and _Thread_local. We give them the same
semantics as __thread for now.

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

11 years agotl;dr: Teach Clang to work around g++ changing its workaround to glibc's
Richard Smith [Fri, 12 Apr 2013 22:11:07 +0000 (22:11 +0000)]
tl;dr: Teach Clang to work around g++ changing its workaround to glibc's
implementation of C99's attempt to control the C++ standard. *sigh*

The C99 standard says that certain macros in <stdint.h>, such as SIZE_MAX,
should not be defined when the header is included in C++ mode, unless
__STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined. The C++11 standard
says "Thanks, but no thanks" and C11 removed this rule, but various C library
implementations (such as glibc) follow C99 anyway.

g++ prior to 4.8 worked around the C99 / glibc behavior by defining
__STDC_*_MACROS in <cstdint>, which was incorrect, because <stdint.h> is
supposed to provide these macros too. g++ 4.8 works around it by defining
__STDC_*_MACROS in its builtin <stdint.h> header.

This change makes Clang act like g++ 4.8 in this regard: our <stdint.h> now
countermands any attempt by the C library to implement the undesired C99 rules,
by defining the __STDC_*_MACROS first. Unlike g++, we do this even in C++98
mode, since that was the intent of the C++ committee, matches the behavior
required in C11, and matches our built-in implementation of <stdint.h>.

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

11 years ago<rdar://problem/13643854> Only emit ambiguous-expansion warnings when at least one...
Douglas Gregor [Fri, 12 Apr 2013 21:00:54 +0000 (21:00 +0000)]
<rdar://problem/13643854> Only emit ambiguous-expansion warnings when at least one of the macro definitions comes from a non-system header.

This slightly weakens the heuristic introduced in r178109.

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

11 years ago[analyzer] Makes NewDeleteLeaks checker work independently from NewDelete.
Anton Yartsev [Fri, 12 Apr 2013 20:48:49 +0000 (20:48 +0000)]
[analyzer] Makes NewDeleteLeaks checker work independently from NewDelete.

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

11 years agoDefine Neon intrinsics as "static inline" to avoid warning. rdar://13108414
Bob Wilson [Fri, 12 Apr 2013 20:17:20 +0000 (20:17 +0000)]
Define Neon intrinsics as "static inline" to avoid warning. rdar://13108414

We had been defining Neon intrinsics as "static" with always_inline attributes.
If you use them from an extern inline function, you get a warning, e.g.:

static function 'vadd_u8' is used in an inline function with external linkage

This change simply adds the inline keyword to avoid that warning.

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

11 years agoAdd test case for r179403.
Chad Rosier [Fri, 12 Apr 2013 19:52:07 +0000 (19:52 +0000)]
Add test case for r179403.

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

11 years agoAdd test case for r179399.
Chad Rosier [Fri, 12 Apr 2013 18:54:40 +0000 (18:54 +0000)]
Add test case for r179399.

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

11 years ago[analyzer] Print a diagnostic note even if the region cannot be printed.
Anna Zaks [Fri, 12 Apr 2013 18:40:27 +0000 (18:40 +0000)]
[analyzer] Print a diagnostic note even if the region cannot be printed.

There are few cases where we can track the region, but cannot print the note,
which makes the testing limited. (Though, I’ve tested this manually by making
all regions non-printable.) Even though the applicability is limited now, the enhancement
will be more relevant as we start tracking more regions.

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

11 years ago[analyzer]Print field region even when the base region is not printable
Anna Zaks [Fri, 12 Apr 2013 18:40:21 +0000 (18:40 +0000)]
[analyzer]Print field region even when the base region is not printable

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

11 years agoAdd test case for r179383 and r179393.
Chad Rosier [Fri, 12 Apr 2013 18:22:08 +0000 (18:22 +0000)]
Add test case for r179383 and r179393.

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

11 years agoDisable following tests for Hexagon:
Jyotsna Verma [Fri, 12 Apr 2013 17:25:02 +0000 (17:25 +0000)]
Disable following tests for Hexagon:

1) Driver/output-file-is-dir.c - Checks for object file which can't
be created for Hexagon since assembler is unavailable.
2) PCH/cxx-typeid.cpp - 'typeinfo' include file is unavailable for Hexagon.

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

11 years ago[libclang] Introduce clang_Location_isInSystemHeader to check if a location resides...
Argyrios Kyrtzidis [Fri, 12 Apr 2013 17:06:51 +0000 (17:06 +0000)]
[libclang] Introduce clang_Location_isInSystemHeader to check if a location resides in a system header.

This is a modified patch provided from Mikołaj Siedlarek!

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

11 years agoSema: Give a typically small DenseMap some inline capacity.
Benjamin Kramer [Fri, 12 Apr 2013 15:22:25 +0000 (15:22 +0000)]
Sema: Give a typically small DenseMap some inline capacity.

Also reflow code a bit, no change in functionality.

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

11 years agoRevamps structural error detection / handling.
Manuel Klimek [Fri, 12 Apr 2013 14:13:36 +0000 (14:13 +0000)]
Revamps structural error detection / handling.

Previously we'd only detect structural errors on the very first level.
This leads to incorrectly balanced braces not being discovered, and thus
incorrect indentation.

This change fixes the problem by:
- changing the parser to use an error state that can be detected
  anywhere inside the productions, for example if we get an eof on
  SOME_MACRO({ some block <eof>
- previously we'd never break lines when we discovered a structural
  error; now we break even in the case of a structural error if there
  are two unwrapped lines within the same line; thus,
  void f() { while (true) { g(); y(); } }
  will still be re-formatted, even if there's missing braces somewhere
  in the file
- still exclude macro definitions from generating structural error;
  macro definitions are inbalanced snippets

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

11 years agoFix clang-format-diff.py script.
Daniel Jasper [Fri, 12 Apr 2013 13:42:36 +0000 (13:42 +0000)]
Fix clang-format-diff.py script.

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

11 years agoProvide better emacs integration.
Daniel Jasper [Fri, 12 Apr 2013 10:12:01 +0000 (10:12 +0000)]
Provide better emacs integration.

The new emacs integration is simpler, does not save the current file
before reformatting and ensures that emacs does not scroll as a result
of formatting.

Also explicitly set the style in clang-format tests to make them more
robust.

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

11 years ago[analyzer] Fix grammar in comment.
Jordan Rose [Fri, 12 Apr 2013 00:44:24 +0000 (00:44 +0000)]
[analyzer] Fix grammar in comment.

By Adam Schnitzer!

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

11 years ago[analyzer] Show "Returning from ..." note at caller's depth, not callee's.
Jordan Rose [Fri, 12 Apr 2013 00:44:17 +0000 (00:44 +0000)]
[analyzer] Show "Returning from ..." note at caller's depth, not callee's.

Before:
  1. Calling 'foo'
    2. Doing something interesting
    3. Returning from 'foo'
  4. Some kind of error here

After:
  1. Calling 'foo'
    2. Doing something interesting
  3. Returning from 'foo'
  4. Some kind of error here

The location of the note is already in the caller, not the callee, so this
just brings the "depth" attribute in line with that.

This only affects plist diagnostic consumers (i.e. Xcode). It's necessary
for Xcode to associate the control flow arrows with the right stack frame.

<rdar://problem/13634363>

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

11 years ago[analyzer] Don't emit extra context arrow after returning from an inlined call.
Jordan Rose [Fri, 12 Apr 2013 00:44:01 +0000 (00:44 +0000)]
[analyzer] Don't emit extra context arrow after returning from an inlined call.

In this code

  int getZero() {
    return 0;
  }

  void test() {
    int problem = 1 / getZero(); // expected-warning {{Division by zero}}
  }

we generate these arrows:

    +-----------------+
    |                 v
    int problem = 1 / getZero();
                  ^   |
                  +---+

where the top one represents the control flow up to the first call, and the
bottom one represents the flow to the division.* It turns out, however, that
we were generating the top arrow twice, as if attempting to "set up context"
after we had already returned from the call. This resulted in poor
highlighting in Xcode.

* Arguably the best location for the division is the '/', but that's a
  different problem.

<rdar://problem/13326040>

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

11 years agoRemove REQUIRES now that r179237 fixed the real problem.
Rafael Espindola [Fri, 12 Apr 2013 00:32:20 +0000 (00:32 +0000)]
Remove REQUIRES now that r179237 fixed the real problem.

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

11 years agoMake sure we have the include paths we need
Douglas Gregor [Fri, 12 Apr 2013 00:23:25 +0000 (00:23 +0000)]
Make sure we have the include paths we need

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

11 years ago<rdar://problem/13615607> Include SDK version information in the module hash.
Douglas Gregor [Fri, 12 Apr 2013 00:18:53 +0000 (00:18 +0000)]
<rdar://problem/13615607> Include SDK version information in the module hash.

This is a Darwin-SDK-specific hash criteria used to identify a
particular SDK without having to hash the contents of all of its
headers. If other platforms have such versioned files, we should add
those checks here.

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

11 years agoAdd test case for r179343.
Chad Rosier [Thu, 11 Apr 2013 23:57:29 +0000 (23:57 +0000)]
Add test case for r179343.

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

11 years agoTest case for r179339.
Chad Rosier [Thu, 11 Apr 2013 23:37:53 +0000 (23:37 +0000)]
Test case for r179339.

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

11 years agoFlail at trying to appease various linuxy buildbots.
John McCall [Thu, 11 Apr 2013 23:25:27 +0000 (23:25 +0000)]
Flail at trying to appease various linuxy buildbots.

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

11 years agoStruct-path aware TBAA: uniformize scalar tag and path tag.
Manman Ren [Thu, 11 Apr 2013 23:02:56 +0000 (23:02 +0000)]
Struct-path aware TBAA: uniformize scalar tag and path tag.

For struct-path aware TBAA, we used to use scalar type node as the scalar tag,
which has an incompatible format with the struct path tag. We now use the same
format: base type, access type and offset.

We also uniformize the scalar type node and the struct type node: name, a list
of pairs (offset + pointer to MDNode). For scalar type, we have a single pair.
These are to make implementaiton of aliasing rules easier.

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

11 years agoFix the driver logic for recent versions of DragonFly.
John McCall [Thu, 11 Apr 2013 22:55:55 +0000 (22:55 +0000)]
Fix the driver logic for recent versions of DragonFly.

Patch by John Marino.

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

11 years agoUpdate test case for r179323.
Chad Rosier [Thu, 11 Apr 2013 21:49:48 +0000 (21:49 +0000)]
Update test case for r179323.

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

11 years agoWiden the checks in the ms abi memptr test to work under NDEBUG
Reid Kleckner [Thu, 11 Apr 2013 19:01:17 +0000 (19:01 +0000)]
Widen the checks in the ms abi memptr test to work under NDEBUG

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

11 years agoExclude test30 of Sema/return.c for Hexagon since setjmp.h include file
Jyotsna Verma [Thu, 11 Apr 2013 18:56:34 +0000 (18:56 +0000)]
Exclude test30 of Sema/return.c for Hexagon since setjmp.h include file
is unavailable for Hexagon.

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

11 years agoAdd a new -mimplicit-float option for symmetry with -mno-implicit-float.
Bob Wilson [Thu, 11 Apr 2013 18:53:25 +0000 (18:53 +0000)]
Add a new -mimplicit-float option for symmetry with -mno-implicit-float.

This new option is the default, but it is useful to have a flag to override
-mno-implicit-float by putting -mimplicit-float later on the command line.

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

11 years agoFollow Jordan's advice and use {{^}} and {{$}} for this test
Reid Kleckner [Thu, 11 Apr 2013 18:39:10 +0000 (18:39 +0000)]
Follow Jordan's advice and use {{^}} and {{$}} for this test

This is a better way of ensuring that we match the output of the
rewriter and not the CHECK line.

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

11 years ago[ms-cxxabi] Implement member pointer emission and dereferencing
Reid Kleckner [Thu, 11 Apr 2013 18:13:19 +0000 (18:13 +0000)]
[ms-cxxabi] Implement member pointer emission and dereferencing

Summary:
Handles all inheritance models for both data and function member
pointers.

Also implements isZeroInitializable() and refactors some of the null
member pointer code.

MSVC supports converting member pointers through virtual bases, which
clang does not (yet?) support.  Implementing that extension is covered
by http://llvm.org/15713

Reviewers: rjmccall

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

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