[analyzer] Handle the M_ZERO and __GFP_ZERO flags in kernel mallocs.

Add M_ZERO awareness to malloc() static analysis in Clang for FreeBSD,
NetBSD, and OpenBSD in a similar fashion to O_CREAT for open(2).
These systems have a three-argument malloc() in the kernel where the
third argument contains flags; the M_ZERO flag will zero-initialize the
allocated buffer.

This should reduce the number of false positives when running static
analysis on BSD kernels.

Additionally, add kmalloc() (Linux kernel malloc()) and treat __GFP_ZERO
like M_ZERO on Linux.

Future work involves a better method of checking for named flags without
hardcoding values.

Patch by Conrad Meyer, with minor modifications by me.

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

This commit fixes a cast instruction assertion failure
due to the incompatible type cast.  This will only happen when
the target requires atomic libcalls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204834 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Remove the implemented Identical* checkers from the "potential" list.

Edit by Daniel Fahlgren.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204846 91177308-0d34-0410-b5e6-96231b3b80d8
Objective-C. Fixes a bogus warning on unimplemented
selectors because we were not going through entire
elements in list of all implemented selectors. 
// rdar://16428638


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204852 91177308-0d34-0410-b5e6-96231b3b80d8
Objective-C. Improve diagnostic error for '@import' 
when modules are disabled. // rdar://15505492


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204862 91177308-0d34-0410-b5e6-96231b3b80d8
PR19254: If a thread_local data member of a class is accessed via member access
syntax, don't forget to run its initializer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204869 91177308-0d34-0410-b5e6-96231b3b80d8
Try to fix arm bots by removing a superfluous __cdecl

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204872 91177308-0d34-0410-b5e6-96231b3b80d8
Just call getContextDescriptor to get the context for subprograms
instead of rolling an inefficient version of the function. This
changes some order of emission of metadata nodes, fix up those
testcases and make them more flexible to some changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204874 91177308-0d34-0410-b5e6-96231b3b80d8
MS asm: Filter out fpsw clobbers

When parsing MS inline assembly, we note that fpsw is an implicit def of
most x87 FP operations, and add it to the clobber list.  However, we
don't recognize fpsw as a gcc register name, and we assert.  Clang
always adds an fpsr clobber, which means the same thing to LLVM, so we
can just use that.

This test case was broken by my LLVM change r196939.

Reviewers: echristo

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204878 91177308-0d34-0410-b5e6-96231b3b80d8
Don't produce a L symbol in __DATA,__data.

The section __DATA,__data is atomized by the linker and cannot have L symbols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204879 91177308-0d34-0410-b5e6-96231b3b80d8
PR19252: Fix crash if alignas is used with an auto-typed variable. Don't check
the type of the variable until it's known.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204887 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "Just call getContextDescriptor to get the context for subprograms"
while I investigate as it seems to be causing issues with the gdb bot.

This reverts commit r204874.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204896 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: Correctly identify ObjC Block with return type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204905 91177308-0d34-0410-b5e6-96231b3b80d8
[cleanup] Stop specifying size overrides for BumpPtrAllocators.

These don't seem to have any real point. Let's start with
IndexingContext. I can't come up with any conceivable reason to have
many hundereds of thousands of these alive in an address space which
would make the 4x difference in allocated (but unused) memory for the
string scratch buffer a significant memory usage problem.

The EditedSource one is somewhat more surprising. This is an 8x increase
in the memory allocated (but not used) per editted source file. However,
for this to realistically be a problem, you would need to have over half
a million editted source files in a single address space, and even that
would only really have problems on 32-bit Windows where you really only
have 2gb of virtual address space. And what's more important, the fix to
this if it is actually an issue shouldn't be to shrink the allocator's
size, it is to pass a single allocator into *many* edited source file
objects and let them share the memory.

These were the only two uses of custom sized BumpPtrAllocators
(excluding ones in the JIT using a custom allocation strategy) in all of
LLVM, Clang, LLD, LLDB, or Polly. I don't think we actually need this
complexity in the primary BumpPtrAllocator at all and am planning to
remove it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204910 91177308-0d34-0410-b5e6-96231b3b80d8
Fix bool expression special case.

Clang-format now correctly formats:
  some_type<a * b> v;
  template <bool a, bool b> typename enabled_if<a && b>::type f() {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204913 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: Extract getNewLineColumn out of addTokenOnNewLine.

No functional changes intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204930 91177308-0d34-0410-b5e6-96231b3b80d8
[OPENMP] OMPExecutableDirective re-factoring

Store the number of clauses and children of OMPExecutableDirective and dynamically compute the locations of corresponding arrays.

http://llvm-reviews.chandlerc.com/D2977



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204933 91177308-0d34-0410-b5e6-96231b3b80d8
Handle and warn on aliases to weak aliases.

This produces valid IR now that llvm rejects aliases to weak aliases and warns
the user that the resolution is not changed if the weak alias is overridden.

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