Merge pull request #62 from eras/global_scope_private

WebCLAnalyser:handleVarDecl: global scope private variables are now collected
Added missing #include <stdlib.h>
Merge pull request #65 from toaarnio/master

Add missing #include <stdlib.h>
WebCLReporter::isFromMainFile: use isWrittenInMainFile instead for Clang 3.4
Fixed lit.cfg and lit.site.cfg.in to work with Clang 3.4
WebCLTransformer::addRecordParameter: Handle difference in casting from clang::TypeLoc to clang::FunctionTypeLoc
Implemented OpenCL image access qualifiers using the Clang3.4 interface.

As Clang system doesn't allow retrieving robustly the image2d_t
qualifiers from a plain variable declaration (it doesn't see the
qualifiers through typedefs) a function WebCLTypes::imageKind was
added to do that (it traverses through typedefs). The types
PointerKind and ImageKind were also moved to WebCLTypes to accompany
the new function.

Also a check was added that code like:

  typedef __read_only image2d_t ro_image;
  typedef __write_only ro_image wr_image;

  __kernel void k(wr_image image)

will not be passed by preventing using qualifiers for typedefs that
resolve to image2d_t as kernel arguments. The typedef itself is not
blocked, but blocking that would remove the need to do the check at
kernel argument construction site. Also other uses of that typedef are
not prevented.

The test case was revised to not use qualifiers on typedefs, but a new
test case was added to check that the error is triggered in that case.
WebCLTool: use clang::tooling::loadFromCommandLine from release 3.2

It needs to be resolved why the current loadFromCommandLine doesn't
return a proper FixedCompilationDatabase
kernel.cl: Removed some types introduced by the new clang
WebCLRestrictor::check3dImageParameter: updated for image3d_t from new clang (not a pointer)

This means 3d-images.cl should now pass. And it does pass when
executed from command line, but the test suite returns an error?!
lit.site.cfg.in: disable pipefail

We only care about the (ie.) FileCheck result, not all the intermediate
parts of the pipeline.
image2d-type-as-argument: split test into two parts for clang3.4

Clang3.4 now catches more errors which prevents it from getting to the
WebCL validator phase. Now the new errors from clang are triggered in
the first part of the test and the WebCL-specific errors in the
second, allowing both errors to be tested.
TypeAccessChecker::validateParmVarAccess: argument type is now clang::ParmVarDecl&

It used to be clang::ValueDecl& although it was known by the caller
it's also clang::ParmVarDecl&.
read-image, read-image-address-none: don't use CLK_* sampler_t as argument

Instead sampler_t can only by constructed during the initialization of
a sampler_t value. Clang currently prevents constructing values of
type sampler_t otherwise, so it is sufficient to check that the
initialization is safe.
sampler-type-errors?.cl: clang now handles certain errors before wcl pass

Moved tests to separate passes so that all errors get properly
generated, otherwise processing my stop early. The first pass includes
only clang-generated errors.
sampler-type-transformations: removed transformations that cannot occur

The transformations for read_image parameters cannot happen currently,
as they are flagged as errors by Clang.
unsupported-builtin-as-kernel-arg: the format of error messages has changed

Clang has changed the format of the error messages; updated test case
accordingly.
WebCLPass: fixed a typo
test/radix-sort: replaced __constant input with __global const

In issue #69 it reads "The size of buffer passed as "__constant uint
*unsorted_elements" is 320 kB, whereas minimum that needs to be
supported is 64 kB." This problem has been addressed by replacing the
__constant input data with __global const input data, as changing the
input data size isn't simple.

This change also moves the original input.cl/output.cl pair to
doc/radix-sort-example as the hand-instrumented output.cl no longer
matches the input.cl. Updating output.cl manually (or with
webcl-validator) would result in the example of handling constant
address space data, which I deem as a worthwhile example to preserve.
test/variable-global-scope: split into two to support new clang3.4 errors

Clang3.4 errors now earlier in the test. Split into two to allow our
checks to be executed as well.