]> granicus.if.org Git - clang/log
clang
7 years agoCMake: only try to find the Z3 package when `CLANG_ANALYZER_BUILD_Z3` is ON
Mehdi Amini [Sun, 27 Aug 2017 20:24:23 +0000 (20:24 +0000)]
CMake: only try to find the Z3 package when `CLANG_ANALYZER_BUILD_Z3` is ON

This avoids the spurious message:

 Could NOT find Z3 (missing:  Z3_LIBRARIES Z3_INCLUDE_DIR) (Required is at least version "4.5")

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

7 years agoEmit static constexpr member as available_externally definition
Mehdi Amini [Sun, 27 Aug 2017 20:24:09 +0000 (20:24 +0000)]
Emit static constexpr member as available_externally definition

By exposing the constant initializer, the optimizer can fold many
of these constructs.

Differential Revision: https://reviews.llvm.org/D34992

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

7 years agorevert changes from r311851.
Faisal Vali [Sun, 27 Aug 2017 19:00:08 +0000 (19:00 +0000)]
revert changes from r311851.

The right answers here (and how clang needs to be tweaked) require further analysis (ongoing cwg thread).

sorry.

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

7 years agoFix two typos in the doc. Patch by kamleshbhalui on github
Sylvestre Ledru [Sun, 27 Aug 2017 17:34:06 +0000 (17:34 +0000)]
Fix two typos in the doc. Patch by kamleshbhalui on github

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

7 years agoDon't see through 'using member-declarations' when determining the relation of any...
Faisal Vali [Sun, 27 Aug 2017 16:49:47 +0000 (16:49 +0000)]
Don't see through 'using member-declarations' when determining the relation of any potential implicit object expression to the parent class of the member function containing the function call.

Prior to this patch clang would not error here:

  template <class T> struct B;

  template <class T> struct A {
    void foo();
    void foo2();

    void test1() {
      B<T>::foo();  // OK, foo is declared in A<int> - matches type of 'this'.
      B<T>::foo2(); // This should be an error!
                    // foo2 is found in B<int>, 'base unrelated' to 'this'.
    }
  };

  template <class T> struct B : A<T> {
    using A<T>::foo2;
  };

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

7 years agoClangCodeGenTests: Update libdeps.
NAKAMURA Takumi [Sun, 27 Aug 2017 11:46:05 +0000 (11:46 +0000)]
ClangCodeGenTests: Update libdeps.

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

7 years agoAdd forgotten file in r311844.
Vassil Vassilev [Sun, 27 Aug 2017 11:31:01 +0000 (11:31 +0000)]
Add forgotten file in r311844.

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

7 years agoD34059: Get the file name for the symbol from the Module, not the SourceManager.
Vassil Vassilev [Sun, 27 Aug 2017 11:27:30 +0000 (11:27 +0000)]
D34059: Get the file name for the symbol from the Module, not the SourceManager.

This allows multi-module / incremental compilation environments to have unique
initializer symbols.

Patch by Axel Naumann with minor modifications by me!

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

7 years agoD34444: Teach codegen to work in incremental processing mode.
Vassil Vassilev [Sun, 27 Aug 2017 10:58:03 +0000 (10:58 +0000)]
D34444: Teach codegen to work in incremental processing mode.

When isIncrementalProcessingEnabled is on we might want to produce multiple
llvm::Modules. This patch allows the clients to start a new llvm::Module,
allowing CodeGen to continue working after a HandleEndOfTranslationUnit call.

This should give the necessary facilities to write a unittest for D34059.

As discussed in the review this is meant to give us a way to proceed forward
in our efforts to upstream our interpreter-related patches. The design of this
will likely change soon.

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

7 years agoPass the correct object argument when a member call to an 'unrelated' class is made.
Faisal Vali [Sun, 27 Aug 2017 02:21:21 +0000 (02:21 +0000)]
Pass the correct object argument when a member call to an 'unrelated' class is made.

Prior to this patch, clang would do the wrong thing here (see inline comments for pre-patch behavior):

  struct A {
    void bar(int) { }
    static void bar(double) { }

    void g(int*);
    static void g(char *);
  };

  struct B {
    void f() {
      A::bar(3);  // selects (double) ??!!
      A::g((int*)0); // Instead of no object argument, states conversion error?!!
    }
  };

The fix is as follows:  When we detect that what appears to be an implicit member function call (A::bar) is actually a call to a member of a class (A) unrelated to the type (B) that contains the member function (B::f) from which the call is being made, don't treat it (A::bar) as an Implicit Member Call Expression.

P.S. I wonder if there is an existing bug report related to this? (Surprisingly, a cursory search did not find one).

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

7 years ago[Driver] Use arch type to find compiler-rt libraries (on Linux)
Michal Gorny [Sat, 26 Aug 2017 21:35:11 +0000 (21:35 +0000)]
[Driver] Use arch type to find compiler-rt libraries (on Linux)

Use llvm::Triple::getArchTypeName() when looking for compiler-rt
libraries, rather than the exact arch string from the triple. This is
more correct as it matches the values used when building compiler-rt
(builtin-config-ix.cmake) which are the subset of the values allowed
in triples.

For example, this fixes an issue when the compiler set for
i686-pc-linux-gnu triple would not find an i386 compiler-rt library,
while this is the exact arch that is detected by compiler-rt. The same
applies to any other i?86 variant allowed by LLVM.

This also makes the special case for MSVC unnecessary, since now i386
will be used reliably for all 32-bit x86 variants.

Differential Revision: https://reviews.llvm.org/D26796

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

7 years agoAdd flag to request Clang is ABI-compatible with older versions of itself
Richard Smith [Sat, 26 Aug 2017 01:04:35 +0000 (01:04 +0000)]
Add flag to request Clang is ABI-compatible with older versions of itself

This patch adds a flag -fclang-abi-compat that can be used to request that
Clang attempts to be ABI-compatible with some older version of itself.

This is provided on a best-effort basis; right now, this can be used to undo
the ABI change in r310401, reverting Clang to its prior C++ ABI for pass/return
by value of class types affected by that change, and to undo the ABI change in
r262688, reverting Clang to using integer registers rather than SSE registers
for passing <1 x long long> vectors. The intent is that we will maintain this
backwards compatibility path as we make ABI-breaking fixes in future.

The reversion to the old behavior for r310401 is also applied to the PS4 target
since that change is not part of its platform ABI (which is essentially to do
whatever Clang 3.2 did).

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

7 years agoRevert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"
Matt Morehouse [Fri, 25 Aug 2017 22:01:21 +0000 (22:01 +0000)]
Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"

This reverts r311801 due to a bot failure.

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

7 years ago[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Matt Morehouse [Fri, 25 Aug 2017 21:18:29 +0000 (21:18 +0000)]
[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer

Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: cfe-commits, llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D37156

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

7 years ago[sanitizer-coverage] extend fsanitize-coverage=pc-table with flags for every PC
Kostya Serebryany [Fri, 25 Aug 2017 19:29:47 +0000 (19:29 +0000)]
[sanitizer-coverage] extend fsanitize-coverage=pc-table with flags for every PC

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

7 years ago[Format] Invert nestingAndIndentLevel pair in WhitespaceManager used for
Daniel Jasper [Fri, 25 Aug 2017 19:14:53 +0000 (19:14 +0000)]
[Format] Invert nestingAndIndentLevel pair in WhitespaceManager used for
alignments

Indent should be compared before nesting level to determine if a token
is on the same scope as the one we align with. Because it was inverted,
clang-format sometimes tried to align tokens with tokens from outer
scopes, causing the assert(Shift >= 0) to fire.

This fixes bug #33507. Patch by Beren Minor, thank you!

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

7 years agoFix typo in comment, no behavior change.
Nico Weber [Fri, 25 Aug 2017 18:41:41 +0000 (18:41 +0000)]
Fix typo in comment, no behavior change.

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

7 years ago[NFC] Remove a cstyle cast and replace some uses of Decl with NamedDecl during the...
Faisal Vali [Fri, 25 Aug 2017 18:24:20 +0000 (18:24 +0000)]
[NFC] Remove a cstyle cast and replace some uses of Decl with NamedDecl during the processing of TemplateParameterLists.

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

7 years ago[Frontend] Fix printing policy for AST context loaded from file
Vedant Kumar [Fri, 25 Aug 2017 18:07:03 +0000 (18:07 +0000)]
[Frontend] Fix printing policy for AST context loaded from file

In ASTUnit::LoadFromASTFile, the context object is set up using
default-constructed LangOptions (which only later get populated). As the
language options are used in the constructor of PrintingPolicy, this
needs to be updated explicitly after the language options are available.

Patch by Johann Klähn!

Differential Revision: https://reviews.llvm.org/D35271

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

7 years ago[ObjC] Add a -Wobjc-messaging-id warning
Alex Lorenz [Fri, 25 Aug 2017 16:12:17 +0000 (16:12 +0000)]
[ObjC] Add a -Wobjc-messaging-id warning

-Wobjc-messaging-id is a new, non-default warning that warns about
message sends to unqualified id in Objective-C. This warning is useful
for projects that would like to avoid any potential future compiler
errors/warnings, as the system frameworks might add a method with the same
selector which could make the message send to id ambiguous.

rdar://33303354

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

7 years ago[Basic] Add a DiagnosticError llvm::ErrorInfo subclass
Alex Lorenz [Fri, 25 Aug 2017 15:48:00 +0000 (15:48 +0000)]
[Basic] Add a DiagnosticError llvm::ErrorInfo subclass

Clang's DiagnosticError is an llvm::Error payload that stores a partial
diagnostic and its location. I'll be using it in the refactoring engine.

Differential Revision: https://reviews.llvm.org/D36969

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

7 years ago[OPENMP] Fix for PR34321: ustom OpenMP reduction in C++ template causes
Alexey Bataev [Fri, 25 Aug 2017 15:43:55 +0000 (15:43 +0000)]
[OPENMP] Fix for PR34321: ustom OpenMP reduction in C++ template causes
SEGFAULT at compile time

Compiler crashed when tried to rebuild non-template expression in
dependent context.

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

7 years ago[IRGen] Evaluate constant static variables referenced through member
Alex Lorenz [Fri, 25 Aug 2017 10:07:00 +0000 (10:07 +0000)]
[IRGen] Evaluate constant static variables referenced through member
expressions

C++ allows us to reference static variables through member expressions. Prior to
this commit, non-integer static variables that were referenced using a member
expression were always emitted using lvalue loads. The old behaviour introduced
an inconsistency between regular uses of static variables and member expressions
uses. For example, the following program compiled and linked successfully:

struct Foo {
   constexpr static const char *name = "foo";
};
int main() {
  return Foo::name[0] == 'f';
}

but this program failed to link because "Foo::name" wasn't found:

struct Foo {
   constexpr static const char *name = "foo";
};
int main() {
  Foo f;
  return f.name[0] == 'f';
}

This commit ensures that constant static variables referenced through member
expressions are emitted in the same way as ordinary static variable references.

rdar://33942261

Differential Revision: https://reviews.llvm.org/D36876

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

7 years ago[clang-diff] Remove NodeCountVisitor, NFC
Johannes Altmanninger [Fri, 25 Aug 2017 09:49:49 +0000 (09:49 +0000)]
[clang-diff] Remove NodeCountVisitor, NFC

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D37000

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

7 years agoRemove the old meeting links. Also available from the link: http://llvm.org/devmtg/
Sylvestre Ledru [Fri, 25 Aug 2017 08:47:57 +0000 (08:47 +0000)]
link: http://llvm.org/devmtg/
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311767 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang also supports C++14 & 17 + remove trailing whitespaces
Sylvestre Ledru [Fri, 25 Aug 2017 08:44:56 +0000 (08:44 +0000)]
clang also supports C++14 & 17 + remove trailing whitespaces

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

7 years ago[coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control...
Gor Nishanov [Fri, 25 Aug 2017 04:46:54 +0000 (04:46 +0000)]
[coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control transfer)

Summary:
If await_suspend returns a coroutine_handle, as in the example below:
```
  coroutine_handle<> await_suspend(coroutine_handle<> h) {
    coro.promise().waiter = h;
    return coro;
  }
```
suspensionExpression processing will resume the coroutine pointed at by that handle.
Related LLVM change rL311751 makes resume calls of this kind `musttail` at any optimization level.

This enables unlimited symmetric control transfer from coroutine to coroutine without blowing up the stack.

Reviewers: GorNishanov

Reviewed By: GorNishanov

Subscribers: rsmith, EricWF, cfe-commits

Differential Revision: https://reviews.llvm.org/D37131

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

7 years agoRename diagnostic groups from CXX1z to CXX17. No functionality change.
Richard Smith [Fri, 25 Aug 2017 02:39:05 +0000 (02:39 +0000)]
Rename diagnostic groups from CXX1z to CXX17. No functionality change.

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

7 years agoFix up the -Wc++XX-compat warnings to properly handle C++2a.
Richard Smith [Fri, 25 Aug 2017 02:25:07 +0000 (02:25 +0000)]
Fix up the -Wc++XX-compat warnings to properly handle C++2a.

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

7 years agoFix MSVC bots which include '__attribute__((thiscall))' in pretty-printed member...
Richard Smith [Fri, 25 Aug 2017 01:55:50 +0000 (01:55 +0000)]
Fix MSVC bots which include '__attribute__((thiscall))' in pretty-printed member function types.

We really shouldn't be including inferred calling conventions here, but let's get the bots green first...

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

7 years ago[c++2a] P0704R1: Allow pointers to const& member functions to be called on rvalues.
Richard Smith [Fri, 25 Aug 2017 01:47:55 +0000 (01:47 +0000)]
[c++2a] P0704R1: Allow pointers to const& member functions to be called on rvalues.

Patch by Blitz Rakete!

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

7 years agoRemove .gitattributes, add comment to lineendings.
Erich Keane [Thu, 24 Aug 2017 23:25:05 +0000 (23:25 +0000)]
Remove .gitattributes, add comment to lineendings.

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

7 years ago[clang] Remove unit test which uses reverse-iterate flag
Mandeep Singh Grang [Thu, 24 Aug 2017 22:40:32 +0000 (22:40 +0000)]
[clang] Remove unit test which uses reverse-iterate flag

Summary: This patch is in response to https://reviews.llvm.org/D35043 which removed -reverse-iterate flag.

Reviewers: dblaikie, mehdi_amini

Reviewed By: dblaikie

Subscribers: cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D36386

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

7 years ago[sanitizer-coverage] document -fsanitize-coverage=pc-table and -fsanitize-coverage...
Kostya Serebryany [Thu, 24 Aug 2017 22:40:03 +0000 (22:40 +0000)]
[sanitizer-coverage] document -fsanitize-coverage=pc-table and -fsanitize-coverage=inline-8bit-counters

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

7 years agoExpose -mllvm -accurate-sample-profile to clang.
Dehao Chen [Thu, 24 Aug 2017 21:37:33 +0000 (21:37 +0000)]
Expose -mllvm -accurate-sample-profile to clang.

Summary: With accurate sample profile, we can do more aggressive size optimization. For some size-critical application, this can reduce the text size by 20%

Reviewers: davidxl, rsmith

Reviewed By: davidxl, rsmith

Subscribers: mehdi_amini, eraman, sanjoy, cfe-commits

Differential Revision: https://reviews.llvm.org/D37091

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

7 years ago[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens...
Richard Smith [Thu, 24 Aug 2017 20:10:33 +0000 (20:10 +0000)]
[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens to be a lambda call operator, use the lambda's 'this' pointer, not the captured enclosing 'this' pointer (if any).

Do not sanitize the 'this' pointer of a member call operator for a lambda with
no capture-default, since that call operator can legitimately be called with a
null this pointer from the static invoker function. Any actual call with a null
this pointer should still be caught in the caller (if it is being sanitized).

This reinstates r311589 (reverted in r311680) with the above fix.

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

7 years ago[Preprocessor] Correct internal token parsing of newline characters in CRLF
Erich Keane [Thu, 24 Aug 2017 18:36:07 +0000 (18:36 +0000)]
[Preprocessor] Correct internal token parsing of newline characters in CRLF

Discovered due to a goofy git setup, the test system-headerline-directive.c
(and a few others) failed because the token-consumption will consume only the
'\r' in CRLF, making the preprocessor's printed value give the wrong line number
when returning from an include. For example:

(line 1):#include <noline.h>\r\n

The "file exit" code causes the printer to try to print the 'returned to the
main file' line. It looks up what the current line number is. However, since the
current 'token' is the '\n' (since only the \r was consumed), it will give the
line number as '1", not '2'. This results in a few failed tests, but more
importantly, results in error messages being incorrect when compiling a
previously preprocessed file.

Differential Revision: https://reviews.llvm.org/D37079

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

7 years agoRevert "[ubsan] PR34266: When sanitizing the 'this' value for a member function that...
Adrian Prantl [Thu, 24 Aug 2017 18:18:24 +0000 (18:18 +0000)]
Revert "[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens to be a lambda call operator, use the lambda's 'this' pointer, not the captured enclosing 'this' pointer (if any)."

This reverts commit r311589 because of bot breakage.
http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan_check/4115/consoleFull#15752874848254eaf0-7326-4999-85b0-388101f2d404.

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

7 years ago[clang-format] Emit absolute splits before lines for comments, try 2
Krasimir Georgiev [Thu, 24 Aug 2017 16:41:10 +0000 (16:41 +0000)]
[clang-format] Emit absolute splits before lines for comments, try 2

Summary:
This recommits https://reviews.llvm.org/D36956 with an update to the added test
case to not use raw string literals, since this makes gcc unhappy.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D37109

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

7 years ago[mips] Introducing option -mabs=[legacy/2008]
Petar Jovanovic [Thu, 24 Aug 2017 16:06:30 +0000 (16:06 +0000)]
[mips] Introducing option -mabs=[legacy/2008]

In patch r205628 using abs.[ds] instruction is forced, as they should behave
in accordance with flags Has2008 and ABS2008. Unfortunately for revisions
prior mips32r6 and mips64r6, abs.[ds] is not generating correct result when
working with NaNs. To generate a sequence which always produce a correct
result but also to allow user more control on how his code is compiled,
option -mabs is added where user can choose legacy or 2008.
By default legacy mode is used on revisions prior R6. Mips32r6 and mips64r6
use abs2008 mode by default.

Patch by Aleksandar Beserminji

Differential Revision: https://reviews.llvm.org/D35982

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

7 years agoFix use-after-free in Clang's ASTSelection unittest
Alex Lorenz [Thu, 24 Aug 2017 14:53:48 +0000 (14:53 +0000)]
Fix use-after-free in Clang's ASTSelection unittest

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

7 years ago[Driver][AArch64] Add tests for RDM feature.
Chad Rosier [Thu, 24 Aug 2017 14:32:55 +0000 (14:32 +0000)]
[Driver][AArch64] Add tests for RDM feature.

Differential Revision: https://reviews.llvm.org/D37106

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

7 years agoAdd missing std::move call
Alex Lorenz [Thu, 24 Aug 2017 14:08:18 +0000 (14:08 +0000)]
Add missing std::move call

This should fix
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental_build/41578/

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

7 years ago[refactor] Add the AST source selection component
Alex Lorenz [Thu, 24 Aug 2017 13:51:09 +0000 (13:51 +0000)]
[refactor] Add the AST source selection component

This commit adds the base AST source selection component to the refactoring
library. AST selection is represented using a tree of SelectedASTNode values.
Each selected node gets its own selection kind, which can actually be None even
in the middle of tree (e.g. statement in a macro whose child is in a macro
argument). The initial version constructs a "raw" selection tree, without
applying filters and canonicalisation operations to the nodes.

Differential Revision: https://reviews.llvm.org/D35012

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

7 years ago[Clang][x86][Inline Asm] support for GCC style inline asm - Y<x> constraints
Coby Tayree [Thu, 24 Aug 2017 09:07:34 +0000 (09:07 +0000)]
[Clang][x86][Inline Asm] support for GCC style inline asm - Y<x> constraints

This patch is intended to enable the use of basic double letter constraints used in GCC extended inline asm {Yi Y2 Yz Y0 Ym Yt}.
Supersedes D35205
llvm counterpart: D36369

Differential Revision: https://reviews.llvm.org/D36371

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

7 years agoRevert "[clang-format] Break non-trailing block comments"
Krasimir Georgiev [Thu, 24 Aug 2017 08:55:07 +0000 (08:55 +0000)]
Revert "[clang-format] Break non-trailing block comments"

This reverts commit r311457. It reveals some dormant bugs in comment
reflowing, like breaking a single line jsdoc type annotation before a
parameter into multiple lines.

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

7 years agoFixups to FE tests affected by D36793
Coby Tayree [Thu, 24 Aug 2017 08:47:26 +0000 (08:47 +0000)]
Fixups to FE tests affected by D36793

Differential Revision: https://reviews.llvm.org/D36794

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

7 years ago[Driver] Register effective triple before get arm float abi.
Leo Li [Thu, 24 Aug 2017 01:51:51 +0000 (01:51 +0000)]
[Driver] Register effective triple before get arm float abi.

Summary:
We need to register effective triple before calling `getARMFloatABI`.
Add missing code when `--print-libgcc-file-name` is passed.

Reviewers: atanasyan, rsmith, mgorny, peter.smith, kristof.beyls, compnerd, jroelofs

Reviewed By: compnerd

Subscribers: llvm-commits, aemerson, javed.absar, srhines, kristof.beyls, pirama

Differential Revision: https://reviews.llvm.org/D35742

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

7 years agoFix ClangFormatFuzzer.
George Karpenkov [Thu, 24 Aug 2017 00:30:28 +0000 (00:30 +0000)]
Fix ClangFormatFuzzer.

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

7 years agoObjC++: decorate ObjC interfaces in MSABI properly
Saleem Abdulrasool [Wed, 23 Aug 2017 22:38:58 +0000 (22:38 +0000)]
ObjC++: decorate ObjC interfaces in MSABI properly

`id` needs to be handled specially since it is a `TypedefType` which is
sugar for an `ObjCObjectPointerType` whose pointee is an
`ObjCObjectType` with base `BuiltinType::ObjCIdType` and no protocols
and the first level of pointer gets it own type implementation.  `Class`
is similar with the `ObjCClassType` as the base instead.

The qualifiers on the base type of the `ObjCObjectType` need to be
dropped because the innermost `mangleType` will handle the qualifiers
itself.

`id` is desugared to `struct objc_object *` which should be encoded as
`PAUobjc_object@@`.  `Class` is desugared to `struct objc_class *` which
should be encoded as `PAUobjc_class@@`.

We were previously applying an extra modifier `A` which will be handled
during the recursive call.

This now properly decorates interface types as well as `Class` and `id`.
This corrects the interactions between C++ and ObjC++ for the type
specifier decoration.

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

7 years agoFix mangling for dependent "type { expr-list }" expressions, and add mangling for...
Richard Smith [Wed, 23 Aug 2017 22:12:08 +0000 (22:12 +0000)]
Fix mangling for dependent "type { expr-list }" expressions, and add mangling for designated initializers matching recent cxx-abi-dev discussion.

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

7 years agoFix a bug in CGDebugInfo::EmitInlineFunctionStart causing DILocations to be
Adrian Prantl [Wed, 23 Aug 2017 21:24:12 +0000 (21:24 +0000)]
Fix a bug in CGDebugInfo::EmitInlineFunctionStart causing DILocations to be
parented in function declarations.

Fixes PR33997.
https://bugs.llvm.org/show_bug.cgi?id=33997

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

7 years agoParse and print DIExpressions inline to ease IR and MIR testing
Reid Kleckner [Wed, 23 Aug 2017 20:31:27 +0000 (20:31 +0000)]
Parse and print DIExpressions inline to ease IR and MIR testing

Summary:
Most DIExpressions are empty or very simple. When they are complex, they
tend to be unique, so checking them inline is reasonable.

This also avoids the need for CodeGen passes to append to the
llvm.dbg.mir named md node.

See also PR22780, for making DIExpression not be an MDNode.

Reviewers: aprantl, dexonsmith, dblaikie

Subscribers: qcolombet, javed.absar, eraman, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D37075

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

7 years ago[clang-proto-fuzzer] Fix clang-proto-to-cxx build.
Matt Morehouse [Wed, 23 Aug 2017 19:58:07 +0000 (19:58 +0000)]
[clang-proto-fuzzer] Fix clang-proto-to-cxx build.

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

7 years ago[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens...
Richard Smith [Wed, 23 Aug 2017 19:39:04 +0000 (19:39 +0000)]
[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens to be a lambda call operator, use the lambda's 'this' pointer, not the captured enclosing 'this' pointer (if any).

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

7 years agoHeaders: explicitly specify double-word alignment
Saleem Abdulrasool [Wed, 23 Aug 2017 16:57:55 +0000 (16:57 +0000)]
Headers: explicitly specify double-word alignment

GCC will interpret `__attribute__((__aligned__))` as 8-byte alignment on
ARM, but clang will not.  Explicitly specify the alignment.  This
mirrors the declaration in libunwind.

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

7 years ago[clang-diff] Properly clear the selection in HTML diff
Johannes Altmanninger [Wed, 23 Aug 2017 16:52:15 +0000 (16:52 +0000)]
[clang-diff] Properly clear the selection in HTML diff

Reviewers: arphaman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D37072

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

7 years ago[clang-diff] Reformat test, NFC
Johannes Altmanninger [Wed, 23 Aug 2017 16:32:35 +0000 (16:32 +0000)]
[clang-diff] Reformat test, NFC

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

7 years ago[clang-diff] HTML diff navigation
Johannes Altmanninger [Wed, 23 Aug 2017 16:32:13 +0000 (16:32 +0000)]
[clang-diff] HTML diff navigation

Summary:
This adds shortcuts j and k to jump between changes.
It is especially useful in diffs with few changes.

Reviewers: arphaman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36685

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

7 years ago[analyzer] Make StmtDataCollector customizable
Johannes Altmanninger [Wed, 23 Aug 2017 16:28:26 +0000 (16:28 +0000)]
[analyzer] Make StmtDataCollector customizable

Summary:
This moves the data collection macro calls for Stmt nodes
to lib/AST/StmtDataCollectors.inc

Users can subclass ConstStmtVisitor and include StmtDataCollectors.inc
to define visitor methods for each Stmt subclass. This makes it also
possible to customize the visit methods as exemplified in
lib/Analysis/CloneDetection.cpp.

Move helper methods for data collection to a new module,
AST/DataCollection.

Add data collection for DeclRefExpr, MemberExpr and some literals.

Reviewers: arphaman, teemperor!

Subscribers: mgorny, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D36664

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

7 years agoRevert "[clang-format] Emit absolute splits before lines for comments"
Krasimir Georgiev [Wed, 23 Aug 2017 15:58:10 +0000 (15:58 +0000)]
Revert "[clang-format] Emit absolute splits before lines for comments"

This reverts commit r311559, which added a test containing raw string
literals in macros, which chokes gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55971

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

7 years agoHeaders: give _Unwind_Control_Block double-word alignment
Saleem Abdulrasool [Wed, 23 Aug 2017 15:35:33 +0000 (15:35 +0000)]
Headers: give _Unwind_Control_Block double-word alignment

The C++ ABI requires that the exception object (which under AEABI is the
`_Unwind_Control_Block`) is double-word aligned.  The attribute was
applied to the `_Unwind_Exception` type, but not the
`_Unwind_Control_Block`.  This should fix the libunwind test for the
alignment of the exception type.

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

7 years agoImplement CFG construction for __try / __except / __leave.
Nico Weber [Wed, 23 Aug 2017 15:33:16 +0000 (15:33 +0000)]
Implement CFG construction for __try / __except / __leave.

This makes -Wunreachable-code work for programs containing SEH (except for
__finally, which is still missing for now).

__try is modeled like try (but simpler since it can only have a single __except
or __finally), __except is fairly similar to catch (but simpler, since it can't
contain declarations). __leave is implemented similarly to break / continue.

Use the existing addTryDispatchBlock infrastructure (which
FindUnreachableCode() in ReachableCode.cpp uses via cfg->try_blocks_begin()) to
mark things in the __except blocks as reachable.

Re-use TryTerminatedBlock. This means we add EH edges from calls to the __try
block, but not from all other statements. While this is incomplete, it matches
LLVM's SEH codegen support. Also, in practice, BuildOpts.AddEHEdges is always
false in practice from what I can tell, so we never even insert the call EH
edges either.

https://reviews.llvm.org/D36914

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

7 years ago[clang-format] Emit absolute splits before lines for comments
Krasimir Georgiev [Wed, 23 Aug 2017 15:16:47 +0000 (15:16 +0000)]
[clang-format] Emit absolute splits before lines for comments

Summary:
This patch makes the splits emitted for the beginning of comment lines during
reformatting absolute. Previously, they were relative to the start of the
non-whitespace content of the line, which messes up further TailOffset
calculations in breakProtrudingToken. This fixes an assertion failure reported
in bug 34236: https://bugs.llvm.org/show_bug.cgi?id=34236.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D36956

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

7 years agoRevert r311552: [Bash-autocompletion] Add support for static analyzer flags
Rui Ueyama [Wed, 23 Aug 2017 14:48:58 +0000 (14:48 +0000)]
Revert r311552: [Bash-autocompletion] Add support for static analyzer flags

This reverts commit r311552 because it broke ubsan and asan bots.

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

7 years ago[Bash-autocompletion] Add support for static analyzer flags
Yuka Takahashi [Wed, 23 Aug 2017 13:39:47 +0000 (13:39 +0000)]
[Bash-autocompletion] Add support for static analyzer flags

Summary:
This is a patch for clang autocomplete feature.

It will collect values which -analyzer-checker takes, which is defined in
clang/StaticAnalyzer/Checkers/Checkers.inc, dynamically.
First, from ValuesCode class in Options.td, TableGen will generate C++
code in Options.inc. Options.inc will be included in DriverOptions.cpp, and
calls OptTable's addValues function. addValues function will add second
argument to Option's Values class. Values contains string like "foo,bar,.."
which is handed to Values class
in OptTable.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: hiraditya, cfe-commits

Differential Revision: https://reviews.llvm.org/D36782

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

7 years agoFix typos, remove unused private members of CommonOptionsParser, NFC
Johannes Altmanninger [Wed, 23 Aug 2017 10:43:26 +0000 (10:43 +0000)]
Fix typos, remove unused private members of CommonOptionsParser, NFC

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

7 years ago[clang-format] Align trailing comments if ColumnLimit is 0
Krasimir Georgiev [Wed, 23 Aug 2017 07:18:36 +0000 (07:18 +0000)]
[clang-format] Align trailing comments if ColumnLimit is 0

Summary:
ColumnLimit = 0 means no limit, so comment should always be aligned if requested. This was broken with

  https://llvm.org/svn/llvm-project/cfe/trunk@304687

introduced via

  https://reviews.llvm.org/D33830

and is included in 5.0.0-rc2. This commit fixes it and adds a unittest for this property.

Should go into clang-5.0 IMHO.

Contributed by @pboettch!

Reviewers: djasper, krasimir

Reviewed By: djasper, krasimir

Subscribers: hans, klimek

Differential Revision: https://reviews.llvm.org/D36967

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

7 years agobpf: add -mcpu=# support for bpf
Yonghong Song [Wed, 23 Aug 2017 04:26:17 +0000 (04:26 +0000)]
bpf: add -mcpu=# support for bpf

-mcpu=# will support:
  . generic: the default insn set
  . v1: insn set version 1, the same as generic
  . v2: insn set version 2, version 1 + additional jmp insns
  . probe: the compiler will probe the underlying kernel to
           decide proper version of insn set.

Examples:
$ clang -target bpf -mcpu=v1 -c t.c
$ clang -target bpf -mcpu=v2 -c t.c
$ clang -target bpf -mcpu=generic -c t.c
$ clang -target bpf -mcpu=probe -c t.c
$ clang -target bpf -mcpu=v3 -c t.c
error: unknown target CPU 'v3'

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311523 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ODRHash] Diagnose differing template parameters.
Richard Trieu [Wed, 23 Aug 2017 02:43:59 +0000 (02:43 +0000)]
[ODRHash] Diagnose differing template parameters.

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

7 years agoUpdate Clang fuzzers to use libFuzzer bundled with the toolchain.
George Karpenkov [Wed, 23 Aug 2017 00:42:22 +0000 (00:42 +0000)]
Update Clang fuzzers to use libFuzzer bundled with the toolchain.

Differential Revision: https://reviews.llvm.org/D37043

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

7 years agoRemove LLVMFuzzer from list of bundled libraries for Fuchsia
George Karpenkov [Wed, 23 Aug 2017 00:09:33 +0000 (00:09 +0000)]
Remove LLVMFuzzer from list of bundled libraries for Fuchsia

As of now, libFuzzer is located in compiler-rt and is bundled with
Clang's toolchain by default.

Differential Revision: https://reviews.llvm.org/D37037

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

7 years agoDegeneralize more tests.
Dan Albert [Tue, 22 Aug 2017 21:16:22 +0000 (21:16 +0000)]
Degeneralize more tests.

As before, not every platform supports LTO. Make sure the platform
we're targeting is one that supports it (regardless of the *host*
platform).

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

7 years agoRevert "Revert "Revert "Revert "Fix LLVMgold plugin name/path for non-Linux.""""
Dan Albert [Tue, 22 Aug 2017 21:05:01 +0000 (21:05 +0000)]
Revert "Revert "Revert "Revert "Fix LLVMgold plugin name/path for non-Linux.""""

With tests fixed for Windows style paths now that they are going
through path canonicalization.

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

7 years ago[Parser] Correct initalizer typos before lambda capture type is deduced.
Volodymyr Sapsai [Tue, 22 Aug 2017 17:55:19 +0000 (17:55 +0000)]
[Parser] Correct initalizer typos before lambda capture type is deduced.

This is the same assertion as in https://reviews.llvm.org/D25206 that is
triggered when RecordLayoutBuilder tries to compute the size of a field
(for capture "typo_boo" in the test case) whose type hasn't been
deduced.

The fix is to add CorrectDelayedTyposInExpr call to the cases when we
aren't disambiguating between an Obj-C message send and a lambda
expression.

rdar://problem/31760839

Reviewers: rsmith, ahatanak

Reviewed By: arphaman

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36853

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

7 years ago[OPENMP] Fix for PR34014: OpenMP 4.5: Target construct in static method
Alexey Bataev [Tue, 22 Aug 2017 17:54:52 +0000 (17:54 +0000)]
[OPENMP] Fix for PR34014: OpenMP 4.5: Target construct in static method
of class fails to map class static variable.

If the global variable is captured and it has several redeclarations,
sometimes it may lead to a compiler crash. Patch fixes this by working
only with canonical declarations.

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

7 years ago[clang-diff] Refactor stop-after command-line flag
Jacob Gravelle [Tue, 22 Aug 2017 17:42:44 +0000 (17:42 +0000)]
[clang-diff] Refactor stop-after command-line flag

Summary:
Rename stop-after to stop-diff-after. When building LLVM with
-DLLVM_BUILD_LLVM_DYLIB=ON, stop-after collides with the stop-after
already present in LLVM.

Reviewers: johannes, arphaman

Subscribers: klimek, aheejin, cfe-commits

Differential Revision: https://reviews.llvm.org/D36989

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

7 years agoTest commit access.
Volodymyr Sapsai [Tue, 22 Aug 2017 17:39:25 +0000 (17:39 +0000)]
Test commit access.

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

7 years ago[clang-format] Break non-trailing block comments
Krasimir Georgiev [Tue, 22 Aug 2017 14:40:05 +0000 (14:40 +0000)]
[clang-format] Break non-trailing block comments

Summary:
This patch is an alternative to https://reviews.llvm.org/D36614, by resolving a
non-idempotency issue by breaking non-trailing comments:

Consider formatting the following code with column limit at `V`:
```
                    V
const /* comment comment */ A = B;
```
The comment is not a trailing comment, breaking before it doesn't bring it under
the column limit. The formatter breaks after it, resulting in:

```
                    V
const /* comment comment */
    A = B;
```
For a next reformat, the formatter considers the comment as a trailing comment,
so it is free to break it further, resulting in:

```
                    V
const /* comment
         comment */
    A = B;
```
This patch improves the situation by directly producing the third case.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D37007

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

7 years ago[clang-format] Fix lines regression in clang-format.py
Krasimir Georgiev [Tue, 22 Aug 2017 14:28:01 +0000 (14:28 +0000)]
[clang-format] Fix lines regression in clang-format.py

Summary:
This patch fixes a regression after https://reviews.llvm.org/rL305665,
which updates the structure of the `lines` variable.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D37011

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

7 years ago[mips] Rename getSupportedNanEncoding() to getIEEE754Standard()
Petar Jovanovic [Tue, 22 Aug 2017 13:35:27 +0000 (13:35 +0000)]
[mips] Rename getSupportedNanEncoding() to getIEEE754Standard()

Rename the function getSupportedNanEncoding() to getIEEE754Standard(), since
this function will be used for non-nan related features.

Patch by Aleksandar Beserminji.

Differential Revision: https://reviews.llvm.org/D36824

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

7 years agoRevert r311442 (Fix templated type alias completion when using global completion...
Erik Verbruggen [Tue, 22 Aug 2017 10:54:40 +0000 (10:54 +0000)]
Revert r311442 (Fix templated type alias completion when using global completion cache)

Failing Tests (2):
    Clang :: CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp
    Clang :: SemaCXX/alias-template.cpp

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

7 years ago[ObjC] Check written attributes only when synthesizing ambiguous property
Alex Lorenz [Tue, 22 Aug 2017 10:38:07 +0000 (10:38 +0000)]
[ObjC] Check written attributes only when synthesizing ambiguous property

This commit fixes a bug introduced in r307903. The attribute ambiguity checker
that was introduced in r307903 checked all property attributes, which caused
errors for source-compatible properties, like:

@property (nonatomic, readonly) NSObject *prop;
@property (nonatomic, readwrite) NSObject *prop;

because the readwrite property would get implicit 'strong' attribute. The
ambiguity checker should be concerned about explicitly specified attributes
only.

rdar://33748089

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

7 years agoFix templated type alias completion when using global completion cache
Erik Verbruggen [Tue, 22 Aug 2017 10:25:48 +0000 (10:25 +0000)]
Fix templated type alias completion when using global completion cache

When we have enabled cache for global completions we did not have
diagnostics for Bar and could not complete Ba as in provided code
example.

template <typename T>
struct Foo { T member; };

template<typename T> using Bar = Foo<T>;

int main() {
    Ba
}

Patch by Ivan Donchevskii!

Differential Revision: https://reviews.llvm.org/D35355

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

7 years ago[clang-diff] Fix getRelativeName
Johannes Altmanninger [Tue, 22 Aug 2017 08:59:13 +0000 (08:59 +0000)]
[clang-diff] Fix getRelativeName

Handle the case when DeclContext is null.

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

7 years ago[clang-diff] Use the relative name for NamedDecl
Johannes Altmanninger [Tue, 22 Aug 2017 08:56:26 +0000 (08:56 +0000)]
[clang-diff] Use the relative name for NamedDecl

Summary:
If a node referring to a name is within a class or namespace, do not use
the full qualified name, but strip the namespace prefix.

Reviewers: arphaman, bkramer

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D36681

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

7 years agoUpdate libprotobuf-mutator revision
Vitaly Buka [Tue, 22 Aug 2017 05:18:28 +0000 (05:18 +0000)]
Update libprotobuf-mutator revision

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

7 years agoTest fix: only add shared libraries to rpath.
George Karpenkov [Tue, 22 Aug 2017 02:10:53 +0000 (02:10 +0000)]
Test fix: only add shared libraries to rpath.

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

7 years agoFixed driver tests for -fsanitize=fuzzer.
George Karpenkov [Tue, 22 Aug 2017 00:04:05 +0000 (00:04 +0000)]
Fixed driver tests for -fsanitize=fuzzer.

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

7 years agoMoving libFuzzer to compiler-rt: required updates to the Clang driver.
George Karpenkov [Mon, 21 Aug 2017 23:25:19 +0000 (23:25 +0000)]
Moving libFuzzer to compiler-rt: required updates to the Clang driver.

Differential Revision: https://reviews.llvm.org/D36909

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

7 years ago[Driver][Darwin] Do not pass -munwind-table if -fno-excpetions is
Akira Hatanaka [Mon, 21 Aug 2017 22:46:46 +0000 (22:46 +0000)]
[Driver][Darwin] Do not pass -munwind-table if -fno-excpetions is
supplied.

With this change, -fno-exceptions disables unwind tables unless
-funwind-tables is supplied too or the target is x86-64 (x86-64 requires
emitting unwind tables).

rdar://problem/33934446

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

7 years ago[Driver] Recognize DevDiv internal builds of MSVC, with a different directory structure.
Stephan T. Lavavej [Mon, 21 Aug 2017 22:19:33 +0000 (22:19 +0000)]
[Driver] Recognize DevDiv internal builds of MSVC, with a different directory structure.

This is a reasonably non-intrusive change, which I've verified
works for both x86 and x64 DevDiv-internal builds.

The idea is to change `bool IsVS2017OrNewer` into a 3-state
`ToolsetLayout VSLayout`. Either a build is DevDiv-internal,
released VS 2017 or newer, or released VS 2015 or older. When looking at
the directory structure, if instead of `"VC"` we see `"x86ret"`, `"x86chk"`,
`"amd64ret"`, or `"amd64chk"`, we recognize this as a DevDiv-internal build.

After we get past the directory structure validation, we use this knowledge
to regenerate paths appropriately. `llvmArchToDevDivInternalArch()` knows how
we use `"i386"` subdirectories, and `MSVCToolChain::getSubDirectoryPath()`
uses that. It also knows that DevDiv-internal builds have an `"inc"`
subdirectory instead of `"include"`.

This may still not be the "right" fix in any sense, but I believe that it's
non-intrusive in the sense that if the special directory names aren't found,
no codepaths are affected. (`ToolsetLayout::OlderVS` and
`ToolsetLayout::VS2017OrNewer` correspond to `IsVS2017OrNewer` being `false`
or `true`, respectively.) I searched for all references to `IsVS2017OrNewer`,
which are places where Clang cares about VS's directory structure, and the
only one that isn't being patched is some logic to deal with
cross-compilation. I'm fine with that not working for DevDiv-internal builds
for the moment (we typically test the native compilers), so I added a comment.

Fixes D36860.

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

7 years agoEnable libfuzzer on NetBSD/amd64
Kamil Rytarowski [Mon, 21 Aug 2017 19:12:14 +0000 (19:12 +0000)]
Enable libfuzzer on NetBSD/amd64

Summary:
Enable SanitizerKind::Fuzzer and SanitizerKind::FuzzerNoLink on x86_64.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, george.karpenkov

Reviewed By: vitalybuka

Subscribers: cfe-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36935

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

7 years ago[clang] Fix tests for Emitting Single Inline Remark
Sam Elliott [Mon, 21 Aug 2017 16:40:35 +0000 (16:40 +0000)]
[clang] Fix tests for Emitting Single Inline Remark

Summary: This change depends on https://reviews.llvm.org/D36054 and should be landed at the same time.

Reviewers: anemet

Reviewed By: anemet

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36949

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

7 years ago[StaticAnalyzer] LoopUnrolling: Track a LoopStack in order to completely unroll speci...
Peter Szecsi [Mon, 21 Aug 2017 16:32:57 +0000 (16:32 +0000)]
[StaticAnalyzer] LoopUnrolling: Track a LoopStack in order to completely unroll specific loops

The LoopExit CFG information provides the opportunity to not mark the loops but
having a stack which tracks if a loop is unrolled or not. So in case of
simulating a loop we just add it and the information if it meets the
requirements to be unrolled to the top of the stack.

Differential Revision: https://reviews.llvm.org/D35684

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

7 years ago[clang-proto-fuzzer] Update README.
Matt Morehouse [Mon, 21 Aug 2017 16:18:43 +0000 (16:18 +0000)]
[clang-proto-fuzzer] Update README.

Add instructions on how to modify the compiler invocation.

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

7 years ago[StaticAnalyzer] Handle LoopExit CFGElement in the analyzer
Peter Szecsi [Mon, 21 Aug 2017 16:10:19 +0000 (16:10 +0000)]
[StaticAnalyzer] Handle LoopExit CFGElement in the analyzer

This patch adds handling of the LoopExit CFGElements to the StaticAnalyzer.
This is reached by introducing a new ProgramPoint.
Tests will be added in a following commit.

Differential Revision: https://reviews.llvm.org/D35670

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

7 years ago[mips] Remove checking of the redundant condition. NFC
Simon Atanasyan [Mon, 21 Aug 2017 14:08:29 +0000 (14:08 +0000)]
[mips] Remove checking of the redundant condition. NFC

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

7 years agoFixed a crash on replaying Preamble's PP conditional stack.
Ilya Biryukov [Mon, 21 Aug 2017 12:03:08 +0000 (12:03 +0000)]
Fixed a crash on replaying Preamble's PP conditional stack.

Summary:
The crash occurs when the first token after a preamble is a macro
expansion.
Fixed by moving replayPreambleConditionalStack from Parser into
Preprocessor. It is now called right after the predefines file is
processed.

Reviewers: erikjv, bkramer, klimek, yvvan

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36872

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

7 years ago[ObjC] Use consistent comment style in inline asm
Oliver Stannard [Mon, 21 Aug 2017 09:54:46 +0000 (09:54 +0000)]
[ObjC] Use consistent comment style in inline asm

The comment markers accepted by the assembler vary between different targets,
but '//' is always accepted, so we should use that for consistency.

Differential revision: https://reviews.llvm.org/D36666

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