[Tooling] Restore current directory after processing each file.

Summary:
If we actually change directory before processing a file, we need to
restore it afterwards. This was broken in r216620.

Added a comment for the changes in r216620.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221605 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: Document that --assume-filename affects the language.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221606 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: [Java] Never treat @interface as annotation.

'@' followed by any keyword can't be an annotation, but @interface is currently
the only combination of '@' and a keyword that's allowed, so limit it to this
case. `@interface Foo` without a leading `public` was misformatted prior to
this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221607 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: Fix pointer formatting.

Before:
  void f(Bar* a = nullptr, Bar * b);
After:
  void f(Bar* a = nullptr, Bar* b);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221609 91177308-0d34-0410-b5e6-96231b3b80d8
Only build iOS runtime libraries when the iOS SDKs are available.

This was already set up for the iOS simulator ASan dylib simulator,
and this change extends that to the other iOS runtime libraries.
This is in preparation for building all those iOS libraries against
the real SDKs instead of the fake SDKs in compiler-rt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221614 91177308-0d34-0410-b5e6-96231b3b80d8
Update fold-expression mangling to match cxx-abi-dev discussion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221623 91177308-0d34-0410-b5e6-96231b3b80d8
Remove change to set SDKROOT when building compiler-rt on Darwin.

This reverts the runtime library portion of r194168. As of r221621,
the libclang_rt libraries for Darwin build with explicit SDK options
so there is no need to set SDKROOT here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221625 91177308-0d34-0410-b5e6-96231b3b80d8
Improve diagnostics if _Noreturn is placed after a function declarator. (This sometimes happens when a macro is used that expands to either the GNU noreturn attribute or _Noreturn.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221630 91177308-0d34-0410-b5e6-96231b3b80d8
AArch64: set all processor features from -arch if nothing else present

Darwin's "-arch arm64" option implies full Cyclone CPU, for both architectural
and tuning purposes. So if neither of the explicit options have been given,
forward that on to the proper invocation.

rdar://problem/18906227

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221631 91177308-0d34-0410-b5e6-96231b3b80d8
Validate user headers even if -fmodules-validate-once-per-build-session

is enabled. Unlike system headers, we want to be more careful about
modifications to user headers, because it's still easy to edit a header
while you're building.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221634 91177308-0d34-0410-b5e6-96231b3b80d8
Propagate SanitizerKind into CodeGenFunction::EmitCheck() call.

Make sure CodeGenFunction::EmitCheck() knows which sanitizer
it emits check for. Make CheckRecoverableKind enum an
implementation detail and move it away from header.

Currently CheckRecoverableKind is determined by the type of
sanitizer ("unreachable" and "return" are unrecoverable,
"vptr" is always-recoverable, all the rest are recoverable).
This will change in future if we allow to specify which sanitizers
are recoverable, and which are not by -fsanitize-recover= flag.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221635 91177308-0d34-0410-b5e6-96231b3b80d8
[libclang] When initializing an ObjC object via the "[[ClassName alloc] init*]" pattern,
report the 'init*' invocation as non-dynamic via clang_Cursor_isDynamicCall.

Of course it is dynamic at runtime, but for purposes of indexing we can treat as an invocation to ClassName's init*.

Addresses rdar://18916871.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221641 91177308-0d34-0410-b5e6-96231b3b80d8
Move SanitizerKind class to a separate header. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221645 91177308-0d34-0410-b5e6-96231b3b80d8
Move CodeGenOptions constructor out-of-line and add missing headers. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221646 91177308-0d34-0410-b5e6-96231b3b80d8
[Sanitizer] Refactor sanitizer options in LangOptions.

Get rid of ugly SanitizerOptions class thrust into LangOptions:
* Make SanitizeAddressFieldPadding a regular language option,
  and rely on default behavior to initialize/reset it.
* Make SanitizerBlacklistFile a regular member LangOptions.
* Introduce the helper class "SanitizerSet" to represent the
  set of enabled sanitizers and make it a member of LangOptions.
  It is exactly the entity we want to cache and modify in CodeGenFunction,
  for instance. We'd also be able to reuse SanitizerSet in
  CodeGenOptions for storing the set of recoverable sanitizers,
  and in the Driver to represent the set of sanitizers
  turned on/off by the commandline flags.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221653 91177308-0d34-0410-b5e6-96231b3b80d8
CGExpr.cpp: Suppress a warning. [-Wunused-variable]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221655 91177308-0d34-0410-b5e6-96231b3b80d8
InstrProf: Remove an unnecessary helper function (NFC)

VisitSubStmtRBraceState is really just Visit, as long as
VisitCompoundStatement handles braces correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221659 91177308-0d34-0410-b5e6-96231b3b80d8
Fix parsing of fold-expressions within a cast expression. We parse the
parenthesized expression a bit differently in this case, just in case the
commas have special meaning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221661 91177308-0d34-0410-b5e6-96231b3b80d8
[OPENMP] Codegen for threadprivate variables
For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); 
In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>);
Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info.
Differential Revision: http://reviews.llvm.org/D4002


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