CodeGen: Fix linkage of reference temporaries

Summary:
A reference temporary should inherit the linkage of the variable it
initializes.  Otherwise, we may hit cases where a reference temporary
wouldn't have the same value in all translation units.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D3515

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207451 91177308-0d34-0410-b5e6-96231b3b80d8
Move all CUDA testing inputs to Inputs/ subdirectory inside the tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207453 91177308-0d34-0410-b5e6-96231b3b80d8
When Driver::generateCompilationDiagnostics is filtering the list of
inputs to the preprocessor, check for invalid types first because not
all linker inputs have an option value to retrieve.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207454 91177308-0d34-0410-b5e6-96231b3b80d8
LLVM supports TLS on Windows and we can use it from Clang

Patch by Martell Malone!

Differential Revision: http://reviews.llvm.org/D3421

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207470 91177308-0d34-0410-b5e6-96231b3b80d8
Check -Werror options during module validation

This patch checks whether the diagnostic options that could lead to
errors (principally -Werror) are consistent between when a module was
built and when it is loaded.  If there are new -Werror flags, then the
module is rebuilt.  In order to canonicalize the options we do this
check at the level of the constructed DiagnosticsEngine, which contains
the final set of diag to diagnostic level mappings.  Currently we only
rebuild with the new diagnostic options, but we intend to refine this in
the future to include the union of the new and old flags, since we know
the old ones did not cause errors.  System modules are only rebuilt when
-Wsystem-headers is enabled.

One oddity is that unlike checking language options, we don’t perform
this diagnostic option checking when loading from a precompiled header.
The reason for this is that the compiler cannot rebuild the PCH, so
anything that requires it to be rebuilt effectively leaks into the build
system.  And in this case, that would mean the build system
understanding the complex relationship between diagnostic options and
the underlying diagnostic mappings, which is unreasonable.  Skipping the
check is safe, because these options do not affect the generated AST.
You simply won’t get new build errors due to changed -Werror options
automatically, which is also true for non-module cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207477 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Clean up the lists of current and potential checkers.

Patch by Anton Yartsev, modified by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207478 91177308-0d34-0410-b5e6-96231b3b80d8
Add missing triple to make -isysroot work

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207479 91177308-0d34-0410-b5e6-96231b3b80d8
Debug info: Improve line table for functions with cleanups an early exit
and no return expr at the end of the function.
The "function has only simple returns" check in FinishFunction tests
whether the number of simple return exprs equals the number of return
exprs, but so far a fallthrough at the end of a function was not counted
as a return, which would result in cleanup code being associated with the
wrong source line.

rdar://problem/16733984.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207480 91177308-0d34-0410-b5e6-96231b3b80d8
Let stddef.h redefine NULL if __need_NULL is set, as needed by glibc, PR12997.

See the bug and the cfe-commits thread "[patch] Let stddef.h redefine NULL if
__need_NULL is set" for discussion.

Fixes PR12997 and is similar to the __need_wint_t bits already in this file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207482 91177308-0d34-0410-b5e6-96231b3b80d8
Revert r207482; I fail at reading IRC.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207483 91177308-0d34-0410-b5e6-96231b3b80d8
scan-build: Don't use realpath when the user provides an explicit path.

PR19583

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207484 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Don't crash when a construction is followed by an uninitialized variable.

This could happen due to unfortunate CFG coincidences.

PR19579

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207486 91177308-0d34-0410-b5e6-96231b3b80d8
Run this test through instnamer to stop it failing on non-asserts clang builds.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207488 91177308-0d34-0410-b5e6-96231b3b80d8
Make test independent of label. Thanks to Richard Smith for catching this!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207489 91177308-0d34-0410-b5e6-96231b3b80d8
CodeGen: Reference temporaries inherit visibility

Reference temporaries inherited many properties from the variable that
they correspond to but visibility wasn't one of them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207496 91177308-0d34-0410-b5e6-96231b3b80d8
Revert r207477 (and r207479), "Check -Werror options during module validation"

It tried to introduce cyclic dependencies. Serialization shouldn't depend on Frontend, since Frontend depends on Serialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207497 91177308-0d34-0410-b5e6-96231b3b80d8
AST: Fix visibility calculation for VarTemplateSpecializationDecl

It is possible that a variable template specialization might not have a
VisibilityAttr attached to it while the template that it specializes
does, in fact, have one.

We should consider the template in such cases.

This fixes PR19597.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207498 91177308-0d34-0410-b5e6-96231b3b80d8
Pass -pie to linker when generating executable on Android
This fixes problem with LTO on Android.

Differential Revision: http://reviews.llvm.org/D2668


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207520 91177308-0d34-0410-b5e6-96231b3b80d8
Add comments regarding isPIEDefault usage for r207520

Differential Revision: http://reviews.llvm.org/D2668


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207521 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: Allow single-line function in WebKit style.

Before:
  void f() {
      return; }

After:
  void f() { return; }

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