]> granicus.if.org Git - clang/log
clang
10 years agoARM: remove dead CodeGen functions.
Tim Northover [Tue, 24 Jun 2014 12:07:44 +0000 (12:07 +0000)]
ARM: remove dead CodeGen functions.

These two are no longer being used by NEON codegen.

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

10 years agoclang-format: Understand that breaking before lambdas is fine.
Daniel Jasper [Tue, 24 Jun 2014 09:15:49 +0000 (09:15 +0000)]
clang-format: Understand that breaking before lambdas is fine.

Before:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa([](
      const aaaaaaaaaa &a) { return a; });

After:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      [](const aaaaaaaaaa &a) { return a; });

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

10 years agoDriver: Restore proper naming of crashdump files
Justin Bogner [Tue, 24 Jun 2014 08:01:01 +0000 (08:01 +0000)]
Driver: Restore proper naming of crashdump files

Based on a review of r211411 by Jordan Rose.

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

10 years agoAST: Address of dllimport functions isn't constant
David Majnemer [Tue, 24 Jun 2014 06:40:51 +0000 (06:40 +0000)]
AST: Address of dllimport functions isn't constant

The address of dllimport functions can be accessed one of two ways:
- Through the IAT which is symbolically referred to with a symbol
  starting with __imp_.
- Via the wrapper-function which ends up calling through the __imp_
  symbol.

The problem with using the wrapper-function is that it's address will
not compare as equal in all translation units.  Specifically, it will
compare unequally with the translation unit which defines the function.

This fixes PR19955.

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

10 years agoAST: Address of dllimport variables isn't constant
David Majnemer [Tue, 24 Jun 2014 05:59:13 +0000 (05:59 +0000)]
AST: Address of dllimport variables isn't constant

The address of dllimport variables isn't something that can be
meaningfully used in a constexpr context and isn't suitable for
evaluation at load-time.  They require loads from memory to properly
evaluate.

This fixes PR19955.

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

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

10 years ago[OPENMP] Added initial checking of nesting of OpenMP regions.
Alexey Bataev [Tue, 24 Jun 2014 04:39:47 +0000 (04:39 +0000)]
[OPENMP] Added initial checking of nesting of OpenMP regions.

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

10 years agoPropagate isAddressOfMember into typo correction so that we don't correct &qualified...
Nick Lewycky [Mon, 23 Jun 2014 22:57:51 +0000 (22:57 +0000)]
Propagate isAddressOfMember into typo correction so that we don't correct &qualified-id into &unqualified-id. Also make sure to set the naming class when we find the qualified-id in a different class than the nested name specifier specified so far. Fixes PR19681!

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

10 years agoFix spelling. s/overloaed/overloaded/
Jim Grosbach [Mon, 23 Jun 2014 20:28:43 +0000 (20:28 +0000)]
Fix spelling. s/overloaed/overloaded/

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

10 years agoCodeGen: Remove a stray tab character (NFC)
Justin Bogner [Mon, 23 Jun 2014 20:03:28 +0000 (20:03 +0000)]
CodeGen: Remove a stray tab character (NFC)

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

10 years agoDriver: correct behaviour of -fmsc-version=MAJOR
Saleem Abdulrasool [Mon, 23 Jun 2014 17:36:36 +0000 (17:36 +0000)]
Driver: correct behaviour of -fmsc-version=MAJOR

Ensure that we properly handle the case where just the major version component
is provided by the user.

Thanks to Alp Toker for pointing out that this was not handled correctly!

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

10 years agoMS ABI: Add an additional test for typeid
David Majnemer [Mon, 23 Jun 2014 17:30:27 +0000 (17:30 +0000)]
MS ABI: Add an additional test for typeid

This tests typeid with polymorphic arguments which have an extendable
virtual function table.

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

10 years agoStop sharing the FileManager in ASTUnit::Parse
Ben Langmuir [Mon, 23 Jun 2014 16:36:40 +0000 (16:36 +0000)]
Stop sharing the FileManager in ASTUnit::Parse

We were using old stat values for any files that had previously been
looked up, leading to badness. There might be a more elegant solution in
invalidating the cache for those file (since we already know which ones
they are), but it seems too likely there are existing references to
them hiding somewhere.

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

10 years ago[OPENMP] Reformatting and code improvement.
Alexey Bataev [Mon, 23 Jun 2014 08:21:53 +0000 (08:21 +0000)]
[OPENMP] Reformatting and code improvement.

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

10 years agoclang-format: [proto] Add required space before absolute references.
Daniel Jasper [Mon, 23 Jun 2014 07:36:25 +0000 (07:36 +0000)]
clang-format: [proto] Add required space before absolute references.

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

10 years agoclang-format: Fix corner case in pointer/reference detection.
Daniel Jasper [Mon, 23 Jun 2014 07:36:18 +0000 (07:36 +0000)]
clang-format: Fix corner case in pointer/reference detection.

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

10 years agoParse: Simplify construction of the clobber list
David Majnemer [Mon, 23 Jun 2014 02:16:41 +0000 (02:16 +0000)]
Parse: Simplify construction of the clobber list

This avoids going over the clobber list twice.

No functionality change.

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

10 years agoStaticAnalyzer: Switch a loop to a range-based for
David Majnemer [Mon, 23 Jun 2014 02:16:38 +0000 (02:16 +0000)]
StaticAnalyzer: Switch a loop to a range-based for

Merely a code simplification, no functionality change.

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

10 years agoAST: Add ranges for AsmStmt's inputs and outputs
David Majnemer [Mon, 23 Jun 2014 02:16:34 +0000 (02:16 +0000)]
AST: Add ranges for AsmStmt's inputs and outputs

No functionality change.

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

10 years agocindex.py: remove obsolete workaround and FIXME
Alp Toker [Sun, 22 Jun 2014 23:28:54 +0000 (23:28 +0000)]
cindex.py: remove obsolete workaround and FIXME

clang_getCursorSpelling() doesn't assert on non-declarations any more and the
behaviour is covered by c-index tests.

Passes nosetests.

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

10 years agoDiagnosticIDs: use diagnostic severities to simplify extension handling
Alp Toker [Sun, 22 Jun 2014 21:58:33 +0000 (21:58 +0000)]
DiagnosticIDs: use diagnostic severities to simplify extension handling

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

10 years agoFix the category name for hash-warnings and hash-errors
Alp Toker [Sun, 22 Jun 2014 21:16:50 +0000 (21:16 +0000)]
Fix the category name for hash-warnings and hash-errors

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

10 years agoDriver: Skip the -ivfsoverlay argument in driver crash diags
Justin Bogner [Sun, 22 Jun 2014 20:35:10 +0000 (20:35 +0000)]
Driver: Skip the -ivfsoverlay argument in driver crash diags

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

10 years agoRevert "Revert r211402 (and r211408,r211410), "CodeGen: Refactor dynamic_cast and...
David Majnemer [Sun, 22 Jun 2014 19:05:33 +0000 (19:05 +0000)]
Revert "Revert r211402 (and r211408,r211410), "CodeGen: Refactor dynamic_cast and typeid" It crashes msvc codegen in clang/test/SemaCXX/undefined-internal.cpp."

This reverts commit r211467 which reverted r211408,r211410, it caused
crashes in test/SemaCXX/undefined-internal.cpp for i686-win32 targets.

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

10 years ago[cxx_status] Minor wording tweaks.
Richard Smith [Sun, 22 Jun 2014 16:00:05 +0000 (16:00 +0000)]
[cxx_status] Minor wording tweaks.

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

10 years ago[cxx_status] Be a bit more precise.
Richard Smith [Sun, 22 Jun 2014 15:56:23 +0000 (15:56 +0000)]
[cxx_status] Be a bit more precise.

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

10 years agoFix dead link.
Richard Smith [Sun, 22 Jun 2014 15:54:54 +0000 (15:54 +0000)]
Fix dead link.

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

10 years agoRevert r211402 (and r211408,r211410), "CodeGen: Refactor dynamic_cast and typeid...
NAKAMURA Takumi [Sun, 22 Jun 2014 12:42:29 +0000 (12:42 +0000)]
Revert r211402 (and r211408,r211410), "CodeGen: Refactor dynamic_cast and typeid" It crashes msvc codegen in clang/test/SemaCXX/undefined-internal.cpp.

It is reproducible with:

  $ clang -cc1 -triple i686-win32 -emit-llvm-only clang/test/SemaCXX/undefined-internal.cpp

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

10 years agoRemove unused diagnostic and diagnostic group.
Benjamin Kramer [Sun, 22 Jun 2014 12:16:35 +0000 (12:16 +0000)]
Remove unused diagnostic and diagnostic group.

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

10 years agoTextDiagnosticPrinter: use the mapped level for remark flag computation
Alp Toker [Sun, 22 Jun 2014 10:08:06 +0000 (10:08 +0000)]
TextDiagnosticPrinter: use the mapped level for remark flag computation

Custom diagnostics don't have a builtin class so this wouldn't have worked.
Reduces surface area of remark-related changes.

No test coverage.

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

10 years agoEnable WindowsToolChain on all native Windows builds
Alp Toker [Sun, 22 Jun 2014 04:31:15 +0000 (04:31 +0000)]
Enable WindowsToolChain on all native Windows builds

Make binaries built by MSVC, mingw and clang functionally equivalent. The
checks are trivially performed at runtime to eliminate functional differences
between supported configurations that used to be hard-coded.

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

10 years agoWindowsToolChain: decouple build environment from the toolchain
Alp Toker [Sun, 22 Jun 2014 03:27:52 +0000 (03:27 +0000)]
WindowsToolChain: decouple build environment from the toolchain

Don't try to find the MSVC version that the binaries were built with. Doing so
defeats testing by causing invalid test passes on the build servers.

Whichever Visual Studio (or clang-cl.exe) edition was used to build the clang
package, it's strictly orthogonal and has no relation to software versions
available on the user's PC.

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

10 years agoMake WindowsToolChain portable
Alp Toker [Sun, 22 Jun 2014 03:27:45 +0000 (03:27 +0000)]
Make WindowsToolChain portable

De-conditionalize as much as possible so we can start to fix this code.

No change in functionality.

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

10 years ago[analyzer] Check for NULL passed to CFAutorelease.
Jordan Rose [Sat, 21 Jun 2014 23:50:40 +0000 (23:50 +0000)]
[analyzer] Check for NULL passed to CFAutorelease.

Patch by Sean McBride, tests adjusted by me.

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

10 years agoMake MS i128 suffix test from r211446 more robust
Alp Toker [Sat, 21 Jun 2014 23:32:05 +0000 (23:32 +0000)]
Make MS i128 suffix test from r211446 more robust

We want to catch both negative and positive failure conditions.

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

10 years agoDiagnosticRenderer: emit basic notes as real diagnostics
Alp Toker [Sat, 21 Jun 2014 23:31:59 +0000 (23:31 +0000)]
DiagnosticRenderer: emit basic notes as real diagnostics

Fixes terminal column wrapping and vestigial 'note:' prefixes that would appear
when using emitBasicNote().

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

10 years agoTextDiagnostic: print remark level diagnostics in bold too
Alp Toker [Sat, 21 Jun 2014 23:31:52 +0000 (23:31 +0000)]
TextDiagnostic: print remark level diagnostics in bold too

The purpose of bolding these is to make them visually distinct from
continuations (supplemental note diagnostics). Therefore, the bolding applies
to all severities _including_ remarks -- it's not in any way an indicator of
priority. Also simplify and comment.

No tests.

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

10 years agoThe i128 suffix isn't always available.
David Majnemer [Sat, 21 Jun 2014 22:49:50 +0000 (22:49 +0000)]
The i128 suffix isn't always available.

This Lexer test unconditionally used the i128 integer literal suffix.
This suffix is only available to targets that have 128-bit arithmetic
support.

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

10 years agoLex: Use the correct types for MS integer suffixes
David Majnemer [Sat, 21 Jun 2014 18:46:07 +0000 (18:46 +0000)]
Lex: Use the correct types for MS integer suffixes

Something went wrong with r211426, it is an older version of this code
and should not have been committed.  It was reverted with r211434.

Original commit message:
We didn't properly implement support for the sized integer suffixes.
Suffixes like i16 were essentially ignored instead of mapping them to
the appropriately sized integer type.

This fixes PR20008.

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

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

10 years ago[test] Add '-target' option to fix bot failure.
Argyrios Kyrtzidis [Sat, 21 Jun 2014 18:28:44 +0000 (18:28 +0000)]
[test] Add '-target' option to fix bot failure.

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

10 years ago[PCH] Remove the BackingIvarReferencedInAccessor field from DECL_OBJC_IVAR abbreviati...
Argyrios Kyrtzidis [Sat, 21 Jun 2014 18:16:40 +0000 (18:16 +0000)]
[PCH] Remove the BackingIvarReferencedInAccessor field from DECL_OBJC_IVAR abbreviation record.

Patch by Yiding Jia!

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

10 years agoRevert "Lex: Use the correct types for MS integer suffixes"
Rafael Espindola [Sat, 21 Jun 2014 12:39:25 +0000 (12:39 +0000)]
Revert "Lex: Use the correct types for MS integer suffixes"

This reverts commit r211426.

This broke the arm bots. The crash can be reproduced on X86 by running.
./bin/clang -cc1  -fsyntax-only -verify -fms-extensions ~/llvm/clang/test/Lexer/ms-extensions.c -triple arm-linux

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

10 years agoLex: Use the correct types for MS integer suffixes
David Majnemer [Sat, 21 Jun 2014 00:51:59 +0000 (00:51 +0000)]
Lex: Use the correct types for MS integer suffixes

We didn't properly implement support for the sized integer suffixes.
Suffixes like i16 were essentially ignored instead of mapping them to
the appropriately sized integer type.

This fixes PR20008.

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

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

10 years agoDriver: In crashdumps with -fmodule, dump the module dependencies
Justin Bogner [Fri, 20 Jun 2014 22:59:50 +0000 (22:59 +0000)]
Driver: In crashdumps with -fmodule, dump the module dependencies

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

10 years agoDriver: enhance MSC version compatibility
Saleem Abdulrasool [Fri, 20 Jun 2014 22:58:35 +0000 (22:58 +0000)]
Driver: enhance MSC version compatibility

The version information for Visual Studio is spread over multiple variables.
The newer Windows SDK has started making use of some of the extended versioning
variables that were previously undefined.  Enhance our compatibility definitions
for these cases.

_MSC_VER is defined to be the Major * 100 + Minor.  _MSC_FULL_VER is defined to
be Major * 10000000 + Minor * 100000 + Build.  And _MSC_BUILD is the build
revision of the compiler.

Extend the -fmsc-version option in a compatible manner.  If the value is the
previous form of MMmm, then we assume that the build number is 0.  Otherwise, a
specific build number may be passed by using the form MMmmbbbbb.  Due to
bitwidth limitations of the option, it is currently not possible to define a
revision value.

The version information can be passed as either the decimal encoded value
(_MSC_FULL_VER or _MSC_VER) or as a dot-delimited value.

The change to the TextDiagnostic is to deal with the updated encoding of the
version information.

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

10 years agoDriver: Record that we're in crashdump and push flags to ConstructJob
Justin Bogner [Fri, 20 Jun 2014 22:16:00 +0000 (22:16 +0000)]
Driver: Record that we're in crashdump and push flags to ConstructJob

It's more flexible and arguably better layering to set flags to modify
compiling for diagnostics in the CC1 job themselves, rather than
tweaking the driver flags and letting them propagate.

There is one visible change this causes: crash report files will now
get preprocessed names (.i and friends).

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

10 years agoCodeGen: Fix test to work with assertions as well
David Majnemer [Fri, 20 Jun 2014 22:08:59 +0000 (22:08 +0000)]
CodeGen: Fix test to work with assertions as well

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

10 years agoCodeGen: typeid/dynamic_cast tests don't need asserts
David Majnemer [Fri, 20 Jun 2014 21:44:39 +0000 (21:44 +0000)]
CodeGen: typeid/dynamic_cast tests don't need asserts

These tests relied on information that was only available for clang
builds that included asserts.  Fix these tests to lift that restriction.

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

10 years agoDriver: Remove some superfluous calls to Arg->claim()
Justin Bogner [Fri, 20 Jun 2014 21:12:53 +0000 (21:12 +0000)]
Driver: Remove some superfluous calls to Arg->claim()

Args.getLastArg() claims the Arg it returns, so calling claim on these
results is unnecessary.

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

10 years agoCodeGen: Refactor dynamic_cast and typeid
David Majnemer [Fri, 20 Jun 2014 21:11:00 +0000 (21:11 +0000)]
CodeGen: Refactor dynamic_cast and typeid

This refactors the emission of dynamic_cast and typeid expressions so
that ABI specific knowledge lives in appropriate places.  There are
quite a few benefits for having the two implementations share a common
core like sharing logic for optimization opportunities.

While we are at it, clean up the tests.

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

10 years agoC++ status page: restore the convention of saying "SVN" until we reach a release.
Richard Smith [Fri, 20 Jun 2014 20:35:42 +0000 (20:35 +0000)]
C++ status page: restore the convention of saying "SVN" until we reach a release.

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

10 years agoBe less bold.
Richard Smith [Fri, 20 Jun 2014 20:34:03 +0000 (20:34 +0000)]
Be less bold.

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

10 years ago[C++1z] Add C++1z to the C++ status page.
Richard Smith [Fri, 20 Jun 2014 20:33:10 +0000 (20:33 +0000)]
[C++1z] Add C++1z to the C++ status page.

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

10 years agoFix typo in r211394.
Richard Smith [Fri, 20 Jun 2014 19:58:05 +0000 (19:58 +0000)]
Fix typo in r211394.

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

10 years ago[C++1z] Implement N3928: message in static_assert is optional.
Richard Smith [Fri, 20 Jun 2014 19:57:12 +0000 (19:57 +0000)]
[C++1z] Implement N3928: message in static_assert is optional.

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

10 years ago[C++1z] Implement N3981: Disable trigraphs by default in C++1z mode.
Richard Smith [Fri, 20 Jun 2014 19:23:57 +0000 (19:23 +0000)]
[C++1z] Implement N3981: Disable trigraphs by default in C++1z mode.

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

10 years agoDon't crash when emitting a glvalue conditional where one arm is a
Richard Smith [Fri, 20 Jun 2014 18:43:47 +0000 (18:43 +0000)]
Don't crash when emitting a glvalue conditional where one arm is a
throw-expression. Based on a patch by Marius Wachtler!

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

10 years agoFix crash caused by unnamed union or struct when doing ast-print
Serge Pavlov [Fri, 20 Jun 2014 17:08:28 +0000 (17:08 +0000)]
Fix crash caused by unnamed union or struct when doing ast-print

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

10 years ago[PowerPC] Fix small argument stack slot offset for LE
Ulrich Weigand [Fri, 20 Jun 2014 16:37:40 +0000 (16:37 +0000)]
[PowerPC] Fix small argument stack slot offset for LE

When small arguments (structures < 8 bytes or "float") are passed in a
stack slot in the ppc64 SVR4 ABI, they must reside in the least
significant part of that slot.  On BE, this means that an offset needs
to be added to the stack address of the parameter, but on LE, the least
significant part of the slot has the same address as the slot itself.

For the most part, this is handled in the LLVM back-end, where I just
fixed the LE case in commit r211368.

However, there is one piece of the clang front-end that is also aware of
these stack-slot offsets: PPC64_SVR4_ABIInfo::EmitVAArg.  This patch
updates that routine to take endianness into account.

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

10 years agoDisable Modules/dependency-dump-dependent-module.m on win32 for now.
NAKAMURA Takumi [Fri, 20 Jun 2014 15:04:25 +0000 (15:04 +0000)]
Disable Modules/dependency-dump-dependent-module.m on win32 for now.

FIXME: This fails on win32 due to ERROR_FILENAME_EXCED_RANGE if the working directory is too deep.

We should make Win32/Path.inc capable of long pathnames with '\\?\'.

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

10 years agoThe ability to use vector initializer lists is a GNU vector extension
James Molloy [Fri, 20 Jun 2014 14:35:13 +0000 (14:35 +0000)]
The ability to use vector initializer lists is a GNU vector extension
and is unrelated to the NEON intrinsics in arm_neon.h. On little
endian machines it works fine, however on big endian machines it
exhibits surprising behaviour:

    uint32x2_t x = {42, 64};
    return vget_lane_u32(x, 0); // Will return 64.

Because of this, explicitly call out that it is unsupported on big
endian machines.

This patch will emit the following warning in big-endian mode:

    test.c:3:15: warning: vector initializers are a GNU extension and are not compatible with NEON intrinsics [-Wgnu]
    int32x4_t x = {0, 1, 2, 3};
                  ^
    test.c:3:15: note: consider using vld1q_s32() to initialize a vector from memory, or vcombine_s32(vcreate_s32(), vcreate_s32()) to initialize from integer constants
    1 warning generated.

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

10 years agoAdd file missed in r211360 commit
Ulrich Weigand [Fri, 20 Jun 2014 14:32:39 +0000 (14:32 +0000)]
Add file missed in r211360 commit

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

10 years ago[PowerPC] Fix ELF interpreter name for powerpc64le-linux
Ulrich Weigand [Fri, 20 Jun 2014 14:19:02 +0000 (14:19 +0000)]
[PowerPC] Fix ELF interpreter name for powerpc64le-linux

On PowerPC LE the system uses the /lib64/ld64.so.2 dynamic linker name
instead of /lib64/ld64.so.1 (to indicate the ELFv2 ABI version).

This fixes the clang driver to pass the appropriate -dynamic-linker
setting, and adds some more tests to linux-ld.c.

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

10 years ago[PowerPC] Add MultiarchIncludeDirs for powerpc64le
Ulrich Weigand [Fri, 20 Jun 2014 13:41:24 +0000 (13:41 +0000)]
[PowerPC] Add MultiarchIncludeDirs for powerpc64le

There was already partial support for multi-arch on powerpc64le,
but the MultiarchIncludeDirs setting was missing.  This patch
adds the appropriate definition, and also extends the
linux-header-search.cpp test case to verify an Ubuntu 14.04
powerpc64le tree.

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

10 years agoFix PR20081: Parsing templates in the presence of -x cuda -std=c++11
Eli Bendersky [Fri, 20 Jun 2014 13:09:59 +0000 (13:09 +0000)]
Fix PR20081: Parsing templates in the presence of -x cuda -std=c++11

http://reviews.llvm.org/D4222

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

10 years agoAdd module flags metadata to record the settings for enum and wchar width
Oliver Stannard [Fri, 20 Jun 2014 12:43:07 +0000 (12:43 +0000)]
Add module flags metadata to record the settings for enum and wchar width

Add module flags metadata to record the settings for enum and wchar width,
to allow correct ARM build attribute generation

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

10 years ago[OPENMP] Initial support for 'nowait' clause.
Alexey Bataev [Fri, 20 Jun 2014 11:19:47 +0000 (11:19 +0000)]
[OPENMP] Initial support for 'nowait' clause.

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

10 years agoOMPScheduleClause::OMPScheduleClause(): Fix possible typos, s/\brief/\param/g. [...
NAKAMURA Takumi [Fri, 20 Jun 2014 09:52:04 +0000 (09:52 +0000)]
OMPScheduleClause::OMPScheduleClause(): Fix possible typos, s/\brief/\param/g. [-Wdocumentation]

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

10 years ago[OPENMP] Initial support for 'ordered' clause.
Alexey Bataev [Fri, 20 Jun 2014 09:44:06 +0000 (09:44 +0000)]
[OPENMP] Initial support for 'ordered' clause.

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

10 years agoFix/Improve SourceRange of explicitly defaulted members
Daniel Jasper [Fri, 20 Jun 2014 08:44:22 +0000 (08:44 +0000)]
Fix/Improve SourceRange of explicitly defaulted members

When adding the implicit compound statement (required for Codegen?), the
end location was previously overridden by the start location, probably
based on the assumptions:

* The location of the compound statement should be the member's location
* The compound statement if present is the last element of a FunctionDecl

This patch changes the location of the compound statement to the
member's end location.

Code review: http://reviews.llvm.org/D4175

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

10 years ago[OPENMP] Initial support for 'schedule' clause.
Alexey Bataev [Fri, 20 Jun 2014 07:16:17 +0000 (07:16 +0000)]
[OPENMP] Initial support for 'schedule' clause.

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

10 years agoFrontend: Disentangle removePathTraversal from concatenating paths
Justin Bogner [Fri, 20 Jun 2014 03:28:46 +0000 (03:28 +0000)]
Frontend: Disentangle removePathTraversal from concatenating paths

This reimplements part of r211303 in a bit of a cleaner way. Doing so
allows us to use a proper absolute path when calling addFileMapping
rather than relying on a substring being one, which should fix the
tests on Windows.

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

10 years agoAvoid invalidating successfully loaded module files
Ben Langmuir [Fri, 20 Jun 2014 00:24:56 +0000 (00:24 +0000)]
Avoid invalidating successfully loaded module files

Successfully loaded module files may be referenced in other
ModuleManagers, so don't invalidate them. Two related things are fixed:

1) I thought the last module in the manager was always the one that
failed, but it isn't.  So check explicitly against the list of
vetted modules from ReadASTCore.

2) We now keep the file descriptor of pcm file open, which avoids the
possibility of having two different pcms for the same module loaded when
building in parallel with headers being modified during a build.

<rdar://problem/16835846>

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

10 years agodiagtool: refactor TreeView to resemble C++
Alp Toker [Fri, 20 Jun 2014 00:06:42 +0000 (00:06 +0000)]
diagtool: refactor TreeView to resemble C++

Replace lots of old-school parameter passing with neat class members.
No attempt made yet to modernize loops, but it's a start.

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

10 years agoObjective-C qoi. When Objective-C pointer mismatches with
Fariborz Jahanian [Thu, 19 Jun 2014 23:05:46 +0000 (23:05 +0000)]
Objective-C qoi. When Objective-C pointer mismatches with
a qualified-id type because pointer is object of a forward
class declaration, include this info in a diagnostic note.
// rdar://10751015

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

10 years agodiagtool: simplify TreeView diagnostic classification
Alp Toker [Thu, 19 Jun 2014 23:00:52 +0000 (23:00 +0000)]
diagtool: simplify TreeView diagnostic classification

This utility doesn't need to know about the specifics of diagnostic levels.

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

10 years agotest: Just check the VFS when testing module-dependency-dump
Justin Bogner [Thu, 19 Jun 2014 20:18:00 +0000 (20:18 +0000)]
test: Just check the VFS when testing module-dependency-dump

Checking the filesystem seems to be a bit unreliable. Limit the tests
to the VFS map for now.

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

10 years agoFrontend: Fix a typo
Justin Bogner [Thu, 19 Jun 2014 19:49:28 +0000 (19:49 +0000)]
Frontend: Fix a typo

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

10 years agoFrontend: Add a CC1 flag to dump module dependencies to a directory
Justin Bogner [Thu, 19 Jun 2014 19:36:03 +0000 (19:36 +0000)]
Frontend: Add a CC1 flag to dump module dependencies to a directory

This adds the -module-dependency-dir to clang -cc1, which specifies a
directory to copy all of a module's dependencies into in a form
suitable to be used as a VFS using -ivfsoverlay with the generated
vfs.yaml.

This is useful for crashdumps that involve modules, so that the module
dependencies will be intact when a crash report script is used to
reproduce a problem on another machine.

We currently encode the absolute path to the dump directory, due to
limitations in the VFS system. Until we can handle relative paths in
the VFS, users of the VFS map may need to run a simple search and
replace in the file.

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

10 years agoFixed formatting.
Yaron Keren [Thu, 19 Jun 2014 19:12:02 +0000 (19:12 +0000)]
Fixed formatting.

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

10 years agoFix PR20069: bad loop pragma arguments crash FE
Eli Bendersky [Thu, 19 Jun 2014 18:30:15 +0000 (18:30 +0000)]
Fix PR20069: bad loop pragma arguments crash FE

This patch fixes a crash when handling malformed arguments to loop pragmas such
as: "#pragma clang loop vectorize(()".  Essentially any argument which is not an
identifier or constant resulted in a crash.  This patch also changes a couple of
the error messages which weren't quite correct.  New behavior with this patch vs
old behavior:

#pragma clang loop vectorize(1)
OLD: error: missing keyword; expected 'enable' or 'disable'
NEW: error: invalid argument; expected 'enable' or 'disable'

#pragma clang loop vectorize()
OLD: error: expected ')'
NEW: error: missing argument to loop pragma 'vectorize'

#pragma clang loop vectorize_width(bad)
OLD: error: missing value; expected a positive integer value
NEW: error: invalid argument; expected a positive integer value

#pragma clang loop vectorize(bad)
OLD: invalid keyword 'bad'; expected 'enable' or 'disable'
NEW: error: invalid argument; expected 'enable' or 'disable'

http://reviews.llvm.org/D4197

Patch by Mark Heffernan

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

10 years agoDocument unroll and unroll_count directives.
Eli Bendersky [Thu, 19 Jun 2014 18:12:44 +0000 (18:12 +0000)]
Document unroll and unroll_count directives.

Extend the documentation for "#pragma clang loop" hints to include the unroll
and unroll_count directives.

Patch by Mark Heffernan [http://reviews.llvm.org/D4198]

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

10 years agoDon't call llvm_start_multithreaded() during init. As of LLVM
Zachary Turner [Thu, 19 Jun 2014 18:03:56 +0000 (18:03 +0000)]
Don't call llvm_start_multithreaded() during init.  As of LLVM
revision r211277, this function is essentially a no-op.

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

10 years agoImprove robustness of tests for module flags metadata
Oliver Stannard [Thu, 19 Jun 2014 16:10:21 +0000 (16:10 +0000)]
Improve robustness of tests for module flags metadata

Fix clang tests to not break if the ID numbers of module flags metadata
nodes change.

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

10 years agoFix assertion hit or bogus compiler error in cases when instantiating ObjC property...
Argyrios Kyrtzidis [Thu, 19 Jun 2014 14:45:16 +0000 (14:45 +0000)]
Fix assertion hit or bogus compiler error in cases when instantiating ObjC property accesses used with overloaded binary operators.

rdar://17153478

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

10 years ago[c++1z] Implement N3994: a range-based for loop can declare a variable with super...
Richard Smith [Thu, 19 Jun 2014 11:42:00 +0000 (11:42 +0000)]
[c++1z] Implement N3994: a range-based for loop can declare a variable with super-terse notation

  for (x : range) { ... }

which is equivalent to

  for (auto &&x : range) { ... }

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

10 years ago[OPENMP] Improved diagnostic messages for vars with the predetermined data sharing...
Alexey Bataev [Thu, 19 Jun 2014 09:13:45 +0000 (09:13 +0000)]
[OPENMP] Improved diagnostic messages for vars with the predetermined data sharing attributes and reformatting

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

10 years agoDiagnoseUnknownTypename always emits a diagnostic and returns true
Reid Kleckner [Thu, 19 Jun 2014 01:23:22 +0000 (01:23 +0000)]
DiagnoseUnknownTypename always emits a diagnostic and returns true

Make it return void and delete the dead code in the parser that handled
the case where it might return false.  This has been dead since 2010
when John deleted Action.h.

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

10 years agoObjective-C ARC. Allow conversion of (void*) pointers to
Fariborz Jahanian [Wed, 18 Jun 2014 23:52:49 +0000 (23:52 +0000)]
Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
in the context of pointer comparison as this is in effect
a +0 context. // rdar://16627903

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

10 years agoSema: Static redeclaration after extern declarations is a Microsoft Extension
David Majnemer [Wed, 18 Jun 2014 23:26:25 +0000 (23:26 +0000)]
Sema: Static redeclaration after extern declarations is a Microsoft Extension

CL permits static redeclarations to follow extern declarations.  The
storage specifier on the latter declaration has no effect.

This fixes PR20034.

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

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

10 years agoObjective-C. Revert my patch in r211234.
Fariborz Jahanian [Wed, 18 Jun 2014 23:22:38 +0000 (23:22 +0000)]
Objective-C. Revert my patch in r211234.

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

10 years agoObjective-C ARC. Allow conversion of (void*) pointers to
Fariborz Jahanian [Wed, 18 Jun 2014 22:50:40 +0000 (22:50 +0000)]
Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
by recognizing this as a +0 context. // rdar://16627903

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

10 years agotests: relax ms-intrinsics test
Saleem Abdulrasool [Wed, 18 Jun 2014 21:48:44 +0000 (21:48 +0000)]
tests: relax ms-intrinsics test

Relax the tests to allow for differences between release and debug builds.  This
should fix the buildbots.

Thanks to Benjamin Kramer and Eric Christo for their invaluable tip that this
was release build specific issue.

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

10 years agoRelax the cl-inputs.c test a little bit in case link.exe is on PATH
Reid Kleckner [Wed, 18 Jun 2014 21:34:36 +0000 (21:34 +0000)]
Relax the cl-inputs.c test a little bit in case link.exe is on PATH

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

10 years ago[MS-ABI] Implement typeid
Warren Hunt [Wed, 18 Jun 2014 21:15:55 +0000 (21:15 +0000)]
[MS-ABI] Implement typeid
This patch enables clang to generate calls to __RTtypeid when lowering
typeid on win32 targets.  Test cases are included.

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

10 years agoCodeGen: improve ms instrincics support
Saleem Abdulrasool [Wed, 18 Jun 2014 20:51:10 +0000 (20:51 +0000)]
CodeGen: improve ms instrincics support

Add support for _InterlockedCompareExchangePointer, _InterlockExchangePointer,
_InterlockExchange.  These are available as a compiler intrinsic on ARM and x86.
These are used directly by the Windows SDK headers without use of the intrin
header.

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

10 years agoObjective-C. Check for integer overflow in Objective-C's
Fariborz Jahanian [Wed, 18 Jun 2014 20:49:02 +0000 (20:49 +0000)]
Objective-C. Check for integer overflow in Objective-C's
boxed expression. // rdar://16417427

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

10 years ago[analyzer] Don't create new PostStmt nodes if we don't have to.
Jordan Rose [Wed, 18 Jun 2014 19:23:30 +0000 (19:23 +0000)]
[analyzer] Don't create new PostStmt nodes if we don't have to.

Doing this caused us to mistakenly think we'd seen a particular state before
when we actually hadn't, which resulted in false negatives. Credit to
Rafael Auler for discovering this issue!

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

10 years agoObjective-C. Try to fix the test in buildbot in my last patch.
Fariborz Jahanian [Wed, 18 Jun 2014 18:16:37 +0000 (18:16 +0000)]
Objective-C. Try to fix the test in buildbot in my last patch.

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

10 years agoObjective-C. Attributes on class declarations carry over
Fariborz Jahanian [Wed, 18 Jun 2014 17:58:27 +0000 (17:58 +0000)]
Objective-C. Attributes on class declarations carry over
to forward class declarations for diagnosis.
// rdar://16681279

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

10 years agoMake clang-cl accept .lib inputs (PR20065)
Hans Wennborg [Wed, 18 Jun 2014 17:21:50 +0000 (17:21 +0000)]
Make clang-cl accept .lib inputs (PR20065)

Patch by Ehsan Akhgari!

(Tiny tweak by me: renamed PathSegment to LibDir.)

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

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