clang-format: [JS] support free-standing functions again.

This worked initially but was broken by r210887.

Before:
  function outer1(a, b) {
    function inner1(a, b) { return a; } inner1(a, b);
  } function outer2(a, b) { function inner2(a, b) { return a; } inner2(a, b); }

After:
  function outer1(a, b) {
    function inner1(a, b) { return a; }
    inner1(a, b);
  }
  function outer2(a, b) {
    function inner2(a, b) { return a; }
    inner2(a, b);
  }

Thanks to Adam Strzelecki for working on this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212038 91177308-0d34-0410-b5e6-96231b3b80d8
Fixing a few typos in the documentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212039 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: Improve expression heuristics.

Upon encountering a binary operator inside parentheses, assume that the
parentheses contain an expression.

Before:
  MACRO('0' <= c&& c <= '9');

After:
  MACRO('0' <= c && c <= '9');

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212040 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: Support member function reference qualifiers.

Before:
  string // break
      operator()() &
  {}

After:
  string // break
  operator()() & {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212041 91177308-0d34-0410-b5e6-96231b3b80d8
Removed unused typedef for recursive_directory_iterator

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212047 91177308-0d34-0410-b5e6-96231b3b80d8
[x86] Add Clang support for intrinsic __rdpmc.

This patch adds intrinsic __rdpmc to header file 'ia32intrin.h'.
Intrinsic __rdmpc can be used to read performance monitoring counters. It is
implemented as a direct call to __builtin_ia32_rdpmc.

It takes as input a value representing the index of the performance counter to
read. The value of the performance counter is then returned as a unsigned
64-bit quantity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212053 91177308-0d34-0410-b5e6-96231b3b80d8
Use the newly added FindInEnvPath helper in clang

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212058 91177308-0d34-0410-b5e6-96231b3b80d8
Consider module depedencies when checking a preamble in libclang

Add module dependencies (header files, module map files) to the list of
files to check when deciding whether to rebuild a preamble. That fixes
using preambles with module imports so long as they are in
non-overridden files.

My intent is to use to unify the existing dependency collectors to the
new “DependencyCollectory” interface from this commit, starting with the
DependencyFileGenerator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212060 91177308-0d34-0410-b5e6-96231b3b80d8
[UBSan] Don't link UBSan runtime into shared libraries.

It used to be a feature of UBSan (it could sanitize a standalone
shared object instead of the whole program), but now it causes
more problems, like PR20165.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212064 91177308-0d34-0410-b5e6-96231b3b80d8
Do not define __STRICT_ANSI__ in clang-cl

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212066 91177308-0d34-0410-b5e6-96231b3b80d8
clang-interpreter: interpret instead of JITing

Fixes the build when no targets are selected, or no native target is built.

This also better matches up with the description/title of the example and
demonstrates how clang can be used to run C++ on constrained environments
without file IO or executable memory permissions (e.g. iOS apps).

A comment is added explaining how to extend the demo with JIT support as
needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212083 91177308-0d34-0410-b5e6-96231b3b80d8
driver: add link dependency on CodeGen

Fix the build when no targets are enabled. This dependency is incurred by two
unfortunate entries in LinkAllPasses.h included from cc1_main.cpp:

  llvm::createJumpInstrTablesPass();
  llvm::createCodeGenPreparePass();

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212084 91177308-0d34-0410-b5e6-96231b3b80d8
clang-interpreter: use LLVM interpreter if JIT is unavailable

Update the strategy in r212083 to try JIT first and otherwise fall back to the
interpreter. This gives the best of both worlds and still builds fine with no
targets enabled.

Requires supporting changes from LLVM r212086.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212087 91177308-0d34-0410-b5e6-96231b3b80d8
PR15677 - Crash in template diffing. Check that expression is evaluatable before evaluating it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212090 91177308-0d34-0410-b5e6-96231b3b80d8
Temporarily disable the indirect-goto.c test.

llvm r212077 causes this test to fail. We need to reorder some passes and
possibly make other changes to reenable the optimization being tested here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212091 91177308-0d34-0410-b5e6-96231b3b80d8
Enable test/CodeGen/indirect-goto.c in 64b for local arrays

In 32b mode the reference count for block addresses
is not zero. This prevents inlining and constant
folding and causes the test to fail. Changing
the triple allows runnning the test in 64b mode.

The array in foo2 is now local instead of static until
at lower optimization levels the interprocedural constant
propagator is invoked before the global optimizer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212092 91177308-0d34-0410-b5e6-96231b3b80d8
[Driver][Mips] MIPS ABI names "32" and "64" used as arguments of the "-mabi"
command line option only. Internally we convert them to the "o32" and "n64"
respectively. So we do not need to refer them anywhere after that conversion.

No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212096 91177308-0d34-0410-b5e6-96231b3b80d8
Remove CleanupHackLevel from CGException.

This patch removes the dead code, and refines the
getEHResumeBlock() slightly.

The CleanupHackLevel was a hack to the old exception
handling intrinsics, which have several issues with function
inliner.

Since LLVM 3.0, the new landingpad and resume instructions
are added to LLVM IR.  With the new exception handling
mechanism, most of the issues are fixed now.  We should
always use these instructions to implement the exception
handling code nowadays, and we don't need the hack any more.

Besides, the `CleanupHackLevel` is a compile-time constant,
thus other cases have been considered as dead code for a while.


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