]> granicus.if.org Git - clang/log
clang
8 years ago[MSVC Compat] Accept elided commas in macro function arguments
Ehsan Akhgari [Fri, 22 Jan 2016 19:26:44 +0000 (19:26 +0000)]
[MSVC Compat] Accept elided commas in macro function arguments

Summary:
This fixes PR25875.  When the trailing comma in a macro argument list is
elided, we need to treat it similarly to the case where a variadic macro
misses one actual argument.

Reviewers: rnk, rsmith

Subscribers: cfe-commits

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

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

8 years agoRephrase this test to help debug a buildbot issue
Adrian Prantl [Fri, 22 Jan 2016 19:14:24 +0000 (19:14 +0000)]
Rephrase this test to help debug a buildbot issue

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

8 years agoMerge templated static member variables, fixes http://llvm.org/pr26179.
Yaron Keren [Fri, 22 Jan 2016 19:03:27 +0000 (19:03 +0000)]
Merge templated static member variables, fixes http://llvm.org/pr26179.

Patch by Vassil Vassilev!
Reviewed by Richard Smith.

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

8 years agoFix a typo in r258507 and change the PCH dwoid constant to ~1UL.
Adrian Prantl [Fri, 22 Jan 2016 18:46:45 +0000 (18:46 +0000)]
Fix a typo in r258507 and change the PCH dwoid constant to ~1UL.

rdar://problem/24290667

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

8 years agoFix 80-column violations.
Adrian Prantl [Fri, 22 Jan 2016 18:46:40 +0000 (18:46 +0000)]
Fix 80-column violations.

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

8 years ago[analyzer] SATestBuild.py: Handle spaces in path passed to --use-analyzer.
Devin Coughlin [Fri, 22 Jan 2016 18:45:22 +0000 (18:45 +0000)]
[analyzer] SATestBuild.py: Handle spaces in path passed to --use-analyzer.

I missed this one in r258493.

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

8 years agoModule Debugging: Use a nonzero DWO id for precompiled headers.
Adrian Prantl [Fri, 22 Jan 2016 17:43:43 +0000 (17:43 +0000)]
Module Debugging: Use a nonzero DWO id for precompiled headers.
PCH files don't have a module signature and LLVM uses a nonzero DWO id as
an indicator for skeleton / module CUs. This change pins the DWO id for PCH
files to a known constant value.
The correct long-term solution here is to implement a module signature
that is an actual dterministic hash (at the moment module signatures are
just random nonzero numbers) and then enable this for PCH files as well.

<rdar://problem/24290667>

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

8 years ago[MSVC Compat] Don't provide /volatile:ms semantics to types > pointer
David Majnemer [Fri, 22 Jan 2016 16:36:44 +0000 (16:36 +0000)]
[MSVC Compat] Don't provide /volatile:ms semantics to types > pointer

Volatile loads of type wider than a pointer get split by MSVC because
the base x86 ISA doesn't provide loads which are wider than pointer
width.  LLVM assumes that it can emit an cmpxchg8b but this is
problematic if the memory is in a CONST memory segment.

Instead, provide behavior compatible with MSVC: split loads wider than a
pointer.

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

8 years agoTry to pacify MSVC.
Nico Weber [Fri, 22 Jan 2016 15:49:53 +0000 (15:49 +0000)]
Try to pacify MSVC.

I'm not sure why it needs these braces, but they help locally.

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

8 years agoChange of UserLabelPrefix default value from "_" to ""
Andrey Bokhanko [Fri, 22 Jan 2016 15:24:34 +0000 (15:24 +0000)]
Change of UserLabelPrefix default value from "_" to ""

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

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

8 years agoLet RecursiveASTVisitor visit array index VarDecls
Nico Weber [Fri, 22 Jan 2016 15:11:54 +0000 (15:11 +0000)]
Let RecursiveASTVisitor visit array index VarDecls

An implicit copy ctor creates loop VarDecls that hang off CXXCtorInitializer.
RecursiveASTVisitor used to not visit them, so that they didn't show up in the
parent map used by ASTMatchers, causing asserts() when the implicit
DeclRefExpr() in a CXXCtorInitializer referred to one of these VarDecls.

Fixes PR26227.
http://reviews.llvm.org/D16413

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

8 years ago[OpenMP] Sema for depend clause on target exit data directive.
Arpith Chacko Jacob [Fri, 22 Jan 2016 14:58:21 +0000 (14:58 +0000)]
[OpenMP] Sema for depend clause on target exit data directive.

Summary:
Accept depend clause on target exit data directive in sema and add test cases.

Reviewers: ABataev

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

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

8 years agoReplace some tabs with spaces.
Nico Weber [Fri, 22 Jan 2016 14:12:44 +0000 (14:12 +0000)]
Replace some tabs with spaces.

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

8 years ago[OPENMP] Generalize codegen for 'sections'-based directive.
Alexey Bataev [Fri, 22 Jan 2016 08:56:50 +0000 (08:56 +0000)]
[OPENMP] Generalize codegen for 'sections'-based directive.
If 'sections' directive has only one sub-section, the code for 'single'-based directive was emitted. Removed this codegen, because it causes crashes in different cases.

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

8 years ago[analyzer] Update SATestBuild.py to handle spaces in paths.
Devin Coughlin [Fri, 22 Jan 2016 07:08:06 +0000 (07:08 +0000)]
[analyzer] Update SATestBuild.py to handle spaces in paths.

The Jenkins workspace on the new Green Dragon builder for the static analyzer has spaces
in its path.

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

8 years ago2 missing intrinsics _cvtss_sh and _mm_cvtps_ph were added to the intrinsics header...
Ekaterina Romanova [Fri, 22 Jan 2016 06:50:50 +0000 (06:50 +0000)]
2 missing intrinsics _cvtss_sh and _mm_cvtps_ph were added to the intrinsics header f16intrin.h
Differential Revision: http://reviews.llvm.org/D16177

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

8 years ago[Docs] Slightly update LSan documentation.
Alexey Samsonov [Fri, 22 Jan 2016 01:35:45 +0000 (01:35 +0000)]
[Docs] Slightly update LSan documentation.

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

8 years ago[OpenMP] Sema for depend clause on target enter data directive.
Arpith Chacko Jacob [Fri, 22 Jan 2016 01:09:37 +0000 (01:09 +0000)]
[OpenMP] Sema for depend clause on target enter data directive.

Summary:
Accept depend clause on target enter data directive in sema and add test cases.

Reviewers: ABataev

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

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

8 years ago[analyzer] Suppress nullability warning for defensive super initializer idiom.
Devin Coughlin [Fri, 22 Jan 2016 01:01:11 +0000 (01:01 +0000)]
[analyzer] Suppress nullability warning for defensive super initializer idiom.

A common idiom in Objective-C initializers is for a defensive nil-check on the
result of a call to a super initializer:
  if (self = [super init]) {
     ...
  }
  return self;

To avoid warning on this idiom, the nullability checker now suppress diagnostics
for returns of nil on syntactic 'return self' even in initializers with non-null
return types.

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

8 years ago[OpenMP] Sema for depend clause on target directive.
Arpith Chacko Jacob [Fri, 22 Jan 2016 00:49:21 +0000 (00:49 +0000)]
[OpenMP] Sema for depend clause on target directive.

Summary:
Accept depend clause on target directive in sema and add test cases.

Reviewers: ABataev

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

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

8 years ago[OpenMP] Parsing + Sema for nowait clause on target exit data directive.
Arpith Chacko Jacob [Fri, 22 Jan 2016 00:22:05 +0000 (00:22 +0000)]
[OpenMP] Parsing + Sema for nowait clause on target exit data directive.

Summary:
Accept nowait clause on target exit data directive in sema and add test cases.

Reviewers: ABataev

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

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

8 years ago[OpenMP] Parsing + Sema for nowait clause on target enter data directive.
Arpith Chacko Jacob [Fri, 22 Jan 2016 00:03:50 +0000 (00:03 +0000)]
[OpenMP] Parsing + Sema for nowait clause on target enter data directive.

Summary:
Accept nowait clause on target enter data directive in sema and add test cases.

Reviewers: ABataev

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

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

8 years ago[MSVC Compat] Don't omit frame pointers if /Oy- is specified before /O2
David Majnemer [Thu, 21 Jan 2016 23:01:11 +0000 (23:01 +0000)]
[MSVC Compat] Don't omit frame pointers if /Oy- is specified before /O2

Microsoft's documentation states that specifying
/Oy- after the /O[12x] options disables frame-pointer omission.
What it does *not* state is that it also disables frame-pointer omission
if /Oy- is specified before /O[12x].

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

8 years ago[OpenMP] Parsing + Sema for nowait clause on target directive
Arpith Chacko Jacob [Thu, 21 Jan 2016 22:18:28 +0000 (22:18 +0000)]
[OpenMP] Parsing + Sema for nowait clause on target directive

Summary:
Allow nowait clause on target directive in sema and add test cases.

Reviewers: ABataev

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

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

8 years ago[driver] Enable some static analyzer "unix" checkers on Windows.
Devin Coughlin [Thu, 21 Jan 2016 20:09:49 +0000 (20:09 +0000)]
[driver] Enable some static analyzer "unix" checkers on Windows.

Many of the "unix" checkers are not actually unix-specific and would be valuable
to run on Windows. This commit explicitly enables those checkers on
Windows.

A patch by Alexander Riccio!

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

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

8 years ago[OpenMP] Check for at least one map clause on target data directive.
Arpith Chacko Jacob [Thu, 21 Jan 2016 19:57:55 +0000 (19:57 +0000)]
[OpenMP] Check for at least one map clause on target data directive.

Summary:
Adds the following restriction in the OpenMP specifications.

OpenMP [2.10.1, Restrictions, p. 97]
At least one map clause must appear on the directive.

Reviewers: ABataev

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

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

8 years ago[Coverage] Reduce complexity of adding function mapping records
Vedant Kumar [Thu, 21 Jan 2016 19:25:35 +0000 (19:25 +0000)]
[Coverage] Reduce complexity of adding function mapping records

Replace a string append operation in addFunctionMappingRecord with a
vector append. The existing behavior is quadratic in the worst case:
this patch makes it linear.

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

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

8 years agoAdd an isVirtualAsWritten AST matcher.
Nico Weber [Thu, 21 Jan 2016 17:56:24 +0000 (17:56 +0000)]
Add an isVirtualAsWritten AST matcher.

http://reviews.llvm.org/D16394

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

8 years agoWhen dumping documentation for AST matchers, do something more useful with \see doxyg...
Aaron Ballman [Thu, 21 Jan 2016 15:18:25 +0000 (15:18 +0000)]
When dumping documentation for AST matchers, do something more useful with \see doxygen commands. Ideally this would link to the target of \see, but for now it translates \see into "See also: "

Regenerate the AST documentation for this new functionality.

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

8 years agoFix crash for typedefs for arrays of runtime bounds in Lambdas/Captured Statements...
Alexey Bataev [Thu, 21 Jan 2016 12:54:48 +0000 (12:54 +0000)]
Fix crash for typedefs for arrays of runtime bounds in Lambdas/Captured Statements, used in sizeof() expression only.

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

8 years ago[OPENMP] Fix crash on reduction for complex variables.
Alexey Bataev [Thu, 21 Jan 2016 12:35:58 +0000 (12:35 +0000)]
[OPENMP] Fix crash on reduction for complex variables.
reworked codegen for reduction operation for complex types to avoid crash

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

8 years agoRegister the isCopyAssignmentOperator AST matcher so that it can be used dynamically.
Aaron Ballman [Wed, 20 Jan 2016 20:47:58 +0000 (20:47 +0000)]
Register the isCopyAssignmentOperator AST matcher so that it can be used dynamically.

Path by Jonathan Coe.

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

8 years agoclang-format-diff: Replace hard-code default for clang-format binary with flag.
Daniel Jasper [Wed, 20 Jan 2016 18:55:57 +0000 (18:55 +0000)]
clang-format-diff: Replace hard-code default for clang-format binary with flag.

Patch by Kwasi Mensah, thank you.

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

8 years agoAdd AST matcher support for FunctionDecls with the hasBody matcher.
Aaron Ballman [Wed, 20 Jan 2016 16:26:48 +0000 (16:26 +0000)]
Add AST matcher support for FunctionDecls with the hasBody matcher.

Patch by Aleksei Sidorin.

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

8 years agoAdd AST matcher for paren expressions.
Aaron Ballman [Wed, 20 Jan 2016 16:17:39 +0000 (16:17 +0000)]
Add AST matcher for paren expressions.

Patch by Adrian ZgorzaƂek.

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

8 years agoSilencing several -Wcast-qual warnings; NFC.
Aaron Ballman [Wed, 20 Jan 2016 15:25:30 +0000 (15:25 +0000)]
Silencing several -Wcast-qual warnings; NFC.

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

8 years ago[OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' directive.
Alexey Bataev [Wed, 20 Jan 2016 12:29:47 +0000 (12:29 +0000)]
[OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' directive.
Allow to emit code for 'cancel' directive within 'sections' directive with single sub-section.

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

8 years ago[OPENMP 4.5] Allow to use non-static data members in non-static member functions...
Alexey Bataev [Wed, 20 Jan 2016 09:07:54 +0000 (09:07 +0000)]
[OPENMP 4.5] Allow to use non-static data members in non-static member functions in 'private' clause.
OpenMP 4.5 allows to use non-static members of current class in non-static member functions in 'private' clause. Patch adds initial support for privatizing data members.

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

8 years agoFix infinite loop when ::new or ::delete are found in member initializer list, by...
Alexey Bataev [Wed, 20 Jan 2016 05:25:51 +0000 (05:25 +0000)]
Fix infinite loop when ::new or ::delete are found in member initializer list, by Denis Zobnin
Fix for an infinite loop on parsing ::new or ::delete in member initializer list, found by fuzzing PR23057, comment #33. Skip the rest of the member initializers if the previous initializer was invalid.
Differential Revision: http://reviews.llvm.org/D16216

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

8 years agoModule Debugging: Fine-tune the condition that determines whether a type
Adrian Prantl [Wed, 20 Jan 2016 01:29:34 +0000 (01:29 +0000)]
Module Debugging: Fine-tune the condition that determines whether a type
can be found in a module.

There are externally visible anonymous types that can be found:
  typedef struct { } s; // I can be found via the typedef.
There are anonymous internal types that can be found:
  namespace { struct s {}; } // I can be found by name.

rdar://problem/24199640

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

8 years ago[CUDA] Bail, rather than crash, on va_arg in device code.
Justin Lebar [Wed, 20 Jan 2016 00:27:00 +0000 (00:27 +0000)]
[CUDA] Bail, rather than crash, on va_arg in device code.

Reviewers: tra

Subscribers: echristo, jhen, cfe-commits

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

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

8 years ago[CUDA] Only allow __global__ on free functions and static member functions.
Justin Lebar [Wed, 20 Jan 2016 00:26:57 +0000 (00:26 +0000)]
[CUDA] Only allow __global__ on free functions and static member functions.

Summary:
Warn for NVCC compatibility if you declare a static member function or
inline function as __global__.

Reviewers: tra

Subscribers: jhen, echristo, cfe-commits

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

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

8 years agoReference the updated function name /NFC
Xinliang David Li [Wed, 20 Jan 2016 00:24:52 +0000 (00:24 +0000)]
Reference the updated function name /NFC

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

8 years agoModule Debugging: Add Objective-C testcases for anonymous tag decls. (NFC)
Adrian Prantl [Tue, 19 Jan 2016 23:42:56 +0000 (23:42 +0000)]
Module Debugging: Add Objective-C testcases for anonymous tag decls. (NFC)

rdar://problem/24199640

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

8 years agoModule Debugging: Don't emit external type references to anonymous types.
Adrian Prantl [Tue, 19 Jan 2016 23:42:53 +0000 (23:42 +0000)]
Module Debugging: Don't emit external type references to anonymous types.
Even if they exist in the module, they can't be matched with the forward
declaration in the object file.
<rdar://problem/24199640>

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

8 years agoModule Debugging: Make sure that anonymous tag decls that define global
Adrian Prantl [Tue, 19 Jan 2016 23:42:44 +0000 (23:42 +0000)]
Module Debugging: Make sure that anonymous tag decls that define global
variables are visited.

This shouldn't encourage anyone to put global variables into clang modules.
rdar://problem/24199640

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

8 years agoStmtOpenMP.h: Fix a warning in r258177. [-Wdocumentation]
NAKAMURA Takumi [Tue, 19 Jan 2016 23:21:18 +0000 (23:21 +0000)]
StmtOpenMP.h: Fix a warning in r258177. [-Wdocumentation]

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

8 years agoStmtOpenMP.h: Fix a warning in r258165. [-Wdocumentation]
NAKAMURA Takumi [Tue, 19 Jan 2016 23:21:13 +0000 (23:21 +0000)]
StmtOpenMP.h: Fix a warning in r258165. [-Wdocumentation]

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

8 years ago[CMake] Don't apply Export set to clang tools
Chris Bieneman [Tue, 19 Jan 2016 23:01:38 +0000 (23:01 +0000)]
[CMake] Don't apply Export set to clang tools

I can't apply export to tools without getting some strange CMake spew. The behavior here is a bit unexpected. CMake is complaining about static link dependencies not being in the same export set, which shouldn't matter.

In the short term it is easier to just remove the export set (which was just added in r258209) while I sort this out.

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

8 years agoAllow __attribute__((mode)) to appertain to field declarations again. Corrects compil...
Aaron Ballman [Tue, 19 Jan 2016 22:54:26 +0000 (22:54 +0000)]
Allow __attribute__((mode)) to appertain to field declarations again. Corrects compile issues with LibreOffice.

Patch by Stephan Bergmann

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

8 years ago[CMake] Creating add_clang_tool macro to wrap add_clang_executable and generate insta...
Chris Bieneman [Tue, 19 Jan 2016 22:41:51 +0000 (22:41 +0000)]
[CMake] Creating add_clang_tool macro to wrap add_clang_executable and generate install actions and targets.

This change brings forward the LLVM convention that "executables" are just runnable binaries, and "tools" are executables that are part of the project's install.

Having this abstraction will allow us to simplify some of the tool CMakeLists files, and it will standardize some of the install behaviors.

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

8 years ago[OpenMP] Detect implicit map type to report unspecified map type for target enter...
Samuel Antao [Tue, 19 Jan 2016 20:40:49 +0000 (20:40 +0000)]
[OpenMP] Detect implicit map type to report unspecified map type for target enter/exit data directives.

Support for the following OpenMP 4.5 restriction on 'target enter data' and 'target exit data':

  - A map-type must be specified in all map clauses.

I have to save 'IsMapTypeImplicit' when parsing a map clause to support this constraint and for more informative error messages. This helps me support the following case:

  #pragma omp target enter data map(r) // expected-error {{map type must be specified for '#pragma omp target enter data'}}

and distinguish it from:

  #pragma omp target enter data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target enter data'}}

Patch by Arpith Jacob. Thanks!

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

8 years ago[OpenMP] Parsing + sema for "target exit data" directive.
Samuel Antao [Tue, 19 Jan 2016 20:04:50 +0000 (20:04 +0000)]
[OpenMP] Parsing + sema for "target exit data" directive.

Patch by Arpith Jacob. Thanks!

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

8 years ago[CUDA] Handle -O options (more) correctly.
Justin Lebar [Tue, 19 Jan 2016 19:52:21 +0000 (19:52 +0000)]
[CUDA] Handle -O options (more) correctly.

Summary:
Previously we'd crash the driver if you passed -O0.  Now we try to
handle all of clang's various optimization flags in a sane way.

Reviewers: tra

Subscribers: cfe-commits, echristo, jhen

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

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

8 years ago[OpenMP] Parsing + sema for "target enter data" directive.
Samuel Antao [Tue, 19 Jan 2016 19:15:56 +0000 (19:15 +0000)]
[OpenMP] Parsing + sema for "target enter data" directive.

Patch by Arpith Jacob. Thanks!

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

8 years agoModule Debugging: Defer the emission of anonymous tag decls
Adrian Prantl [Tue, 19 Jan 2016 18:02:47 +0000 (18:02 +0000)]
Module Debugging: Defer the emission of anonymous tag decls
until we are visiting their declcontext.

This fixes a regression introduced in r256962:
When building debug info for a typdef'd anonymous tag type, we would be
visiting the inner anonymous type first thus creating a "typedef changes
linkage of anonymous type, but linkage was already computed" error.

rdar://problem/24199640

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

8 years ago[CMake] Properly respect the CLANG_APPEND_VC_REV option
Chris Bieneman [Tue, 19 Jan 2016 17:06:12 +0000 (17:06 +0000)]
[CMake] Properly respect the CLANG_APPEND_VC_REV option

Only set -DSVN_REVISION if CLANG_APPEND_VC_REV=On

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

8 years agoActivate OpenMP private clause for target construct and a regression test.
Carlo Bertolli [Tue, 19 Jan 2016 16:53:55 +0000 (16:53 +0000)]
Activate OpenMP private clause for target construct and a regression test.

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

8 years agoRename -Wexpansion-to-undefined to -Wexpansion-to-defined.
Nico Weber [Tue, 19 Jan 2016 15:32:55 +0000 (15:32 +0000)]
Rename -Wexpansion-to-undefined to -Wexpansion-to-defined.

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

8 years agoAdd -Wexpansion-to-undefined: warn when using `defined` in a macro definition.
Nico Weber [Tue, 19 Jan 2016 15:15:31 +0000 (15:15 +0000)]
Add -Wexpansion-to-undefined: warn when using `defined` in a macro definition.

[cpp.cond]p4:
  Prior to evaluation, macro invocations in the list of preprocessing
  tokens that will become the controlling constant expression are replaced
  (except for those macro names modified by the 'defined' unary operator),
  just as in normal text. If the token 'defined' is generated as a result
  of this replacement process or use of the 'defined' unary operator does
  not match one of the two specified forms prior to macro replacement, the
  behavior is undefined.

This isn't an idle threat, consider this program:
  #define FOO
  #define BAR defined(FOO)
  #if BAR
  ...
  #else
  ...
  #endif
clang and gcc will pick the #if branch while Visual Studio will take the
#else branch.  Emit a warning about this undefined behavior.

One problem is that this also applies to function-like macros. While the
example above can be written like

    #if defined(FOO) && defined(BAR)
    #defined HAVE_FOO 1
    #else
    #define HAVE_FOO 0
    #endif

there is no easy way to rewrite a function-like macro like `#define FOO(x)
(defined __foo_##x && __foo_##x)`.  Function-like macros like this are used in
practice, and compilers seem to not have differing behavior in that case. So
this a default-on warning only for object-like macros. For function-like
macros, it is an extension warning that only shows up with `-pedantic`.
(But it's undefined behavior in both cases.)

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

8 years agoFix formatting of fully qualified names in array subscripts.
Manuel Klimek [Tue, 19 Jan 2016 14:05:32 +0000 (14:05 +0000)]
Fix formatting of fully qualified names in array subscripts.

Before:
  a[ ::b::c];

After:
  a[::b::c];

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

8 years agoFix PR26134: When substituting into default template arguments, keep CurContext uncha...
Faisal Vali [Tue, 19 Jan 2016 03:58:55 +0000 (03:58 +0000)]
Fix PR26134: When substituting into default template arguments, keep CurContext unchanged.

Or, do not set Sema's CurContext to the template declaration's when substituting into default template arguments of said template declaration.
If we do push the template declaration context on to Sema, and the template declaration is at namespace scope, Sema can get confused and try and do odr analysis when substituting into default template arguments, even though the substitution could be occurring within a dependent context.
I'm not sure why this was being done, perhaps there was concern that if a default template argument referred to a previous template parameter, it might not be found during substitution - but all regression tests pass, and I can't craft a test that would cause it to fails (if some one does, please inform me, and i'll craft a different fix for the PR).

This patch removes a single line of code, but unfortunately adds more than it removes, because of the tests.  Some day I still hope to commit a patch that removes far more lines than it adds, while leaving clang better for it ;)

Sorry that r253590 ("Change the expression evaluation context from Unevaluated to ConstantEvaluated while substituting into non-type template argument defaults") caused the PR!

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

8 years ago[AVX512] Fix typo in r226298
Adam Nemet [Tue, 19 Jan 2016 02:02:25 +0000 (02:02 +0000)]
[AVX512] Fix typo in r226298

Hal noticed that the double/float got mixed up on the parameters for
these.

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

8 years agoFix local variable name /NFC
Xinliang David Li [Tue, 19 Jan 2016 00:49:06 +0000 (00:49 +0000)]
Fix local variable name /NFC

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

8 years agofix formatting; NFC
Sanjay Patel [Mon, 18 Jan 2016 22:15:33 +0000 (22:15 +0000)]
fix formatting; NFC

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

8 years agoThe destructor name should be matched to ~Foo instead of Foo.
Aaron Ballman [Mon, 18 Jan 2016 20:47:02 +0000 (20:47 +0000)]
The destructor name should be matched to ~Foo instead of Foo.

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

8 years agoAdd an AST matcher for checking whether a function is defaulted.
Aaron Ballman [Mon, 18 Jan 2016 20:37:44 +0000 (20:37 +0000)]
Add an AST matcher for checking whether a function is defaulted.

Patch by Jonathan Coe.

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

8 years agoAugments r258042; changes the AST matcher tests to use matchesNot and EXPECT_TRUE...
Aaron Ballman [Mon, 18 Jan 2016 20:28:57 +0000 (20:28 +0000)]
Augments r258042; changes the AST matcher tests to use matchesNot and EXPECT_TRUE instead of EXPECT_FALSE. Adds a matcher test to ensure that static member functions are properly handled. Generates the documentation from the matcher.

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

8 years ago[TableGen] Merge the SuperClass Record and SMRange vector a single vector. This remov...
Craig Topper [Mon, 18 Jan 2016 19:52:54 +0000 (19:52 +0000)]
[TableGen] Merge the SuperClass Record and SMRange vector a single vector. This removes the state needed to manage the extract vector. NFC

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

8 years ago[analyzer] Nullability: Look through implicit casts when suppressing warnings on...
Devin Coughlin [Mon, 18 Jan 2016 18:53:33 +0000 (18:53 +0000)]
[analyzer] Nullability: Look through implicit casts when suppressing warnings on return.

In r256567 I changed the nullability checker to suppress warnings about returning a null
value from a function/method with a non-null return type when the type of the returned
expression is itself nonnull. This enables the programmer to silence nullability warnings
by casting to _Nonnull:

  return (SomeObject * _Nonnull)nil;

Unfortunately, under ObjC automated reference counting, Sema adds implicit casts to
_Nonnull to return expressions of nullable or unspecified types in functions with
non-null function/method return types. With r256567, these casts cause all nullability
warnings for returns of reference-counted types to be suppressed under ARC, leading to
false negatives.

This commit updates the nullability checker to look through implicit casts before
determining the type of the returned expression. It also updates the tests to turn on
ARC for the nullability_nullonly.mm testfile and adds a new testfile to test when ARC
is turned off.

rdar://problem/24200117

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

8 years agoAdd forEachArgumentWithParam AST matcher.
Manuel Klimek [Mon, 18 Jan 2016 11:20:09 +0000 (11:20 +0000)]
Add forEachArgumentWithParam AST matcher.

The new matcher allows users to provide a matcher for both the argument
of a CallExpr/CxxConstructExpr a well as the ParmVarDecl of the
argument.

Patch by Felix Berger.

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

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

8 years ago[analyzer] Fix an off-by-one in evalIntegralCast()
Artem Dergachev [Mon, 18 Jan 2016 10:17:16 +0000 (10:17 +0000)]
[analyzer] Fix an off-by-one in evalIntegralCast()

Make sure that we do not add SymbolCast at the very boundary of
the range in which the cast would not certainly happen.

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

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

8 years ago[MS ABI] Don't crash while mangling recursive lambdas
David Majnemer [Sun, 17 Jan 2016 07:09:24 +0000 (07:09 +0000)]
[MS ABI] Don't crash while mangling recursive lambdas

We might get into bad situations where we try to embed the signature of
an inner lambda into an outer lambda which cannot work: the inner lambda
wants to embed the name of the outer lambda!

Instead, omit the return type for lambdas.

This fixes PR26105.

N.B.  While we are here, make lambdas nested within functions use an
artificial scope so that they can get demangled.

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

8 years agoclang/test/Driver/darwin-multiarch-arm.c: Appease the case that "ld.exe" exists on...
NAKAMURA Takumi [Sat, 16 Jan 2016 08:35:53 +0000 (08:35 +0000)]
clang/test/Driver/darwin-multiarch-arm.c: Appease the case that "ld.exe" exists on %PATH% on win32.

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

8 years agoFix buildbot bustage in Driver/darwin-multiarch-arm.c caused by r257983.
Justin Lebar [Sat, 16 Jan 2016 04:50:13 +0000 (04:50 +0000)]
Fix buildbot bustage in Driver/darwin-multiarch-arm.c caused by r257983.

The test was too loose; "ld" was matching directories named "build" in
the path.

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

8 years ago[Cygwin] Use -femulated-tls by default since r257718 introduced the new pass.
NAKAMURA Takumi [Sat, 16 Jan 2016 03:44:52 +0000 (03:44 +0000)]
[Cygwin] Use -femulated-tls by default since r257718 introduced the new pass.

FIXME: Add more targets to use emutls into clang/test/Driver/emulated-tls.cpp.
FIXME: Add cygwin tests into llvm/test/CodeGen/X86. Working in progress.

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

8 years agoRespect bound archs, even when they don't alter the toolchain.
Justin Lebar [Sat, 16 Jan 2016 03:30:08 +0000 (03:30 +0000)]
Respect bound archs, even when they don't alter the toolchain.

Summary:
It's possible to BindArch without changing the toolchain at all.  For
example, armv7 and armv7s have exactly the same toolchain triple.

Therefore the code in the Driver that checks that we're not creating a
job for the same Action twice needs to consider (Action, Toolchain,
BoundArch) tuples.

Reviewers: tra

Subscribers: aemerson, echristo, beanz, cfe-commits

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

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

8 years ago[libclang] Add missing CINDEX_LINKAGE from some new APIs in Index.h.
Argyrios Kyrtzidis [Sat, 16 Jan 2016 03:01:20 +0000 (03:01 +0000)]
[libclang] Add missing CINDEX_LINKAGE from some new APIs in Index.h.

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

8 years agoIntroduce -fsanitize-stats flag.
Peter Collingbourne [Sat, 16 Jan 2016 00:31:22 +0000 (00:31 +0000)]
Introduce -fsanitize-stats flag.

This is part of a new statistics gathering feature for the sanitizers.
See clang/docs/SanitizerStats.rst for further info and docs.

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

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

8 years ago[libclang] Introduce APIs for evaluating a cursor and checking if a macro is builtin...
Argyrios Kyrtzidis [Sat, 16 Jan 2016 00:20:02 +0000 (00:20 +0000)]
[libclang] Introduce APIs for evaluating a cursor and checking if a macro is builtin/function.

rdar://24091595

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

8 years agoOpaquePtr: Use nullptr construction for ParsedType OpaquePtr typedef
David Blaikie [Fri, 15 Jan 2016 23:43:34 +0000 (23:43 +0000)]
OpaquePtr: Use nullptr construction for ParsedType OpaquePtr typedef

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

8 years agoOpaquePtr: Use nullptr construction for TemplateTy OpaquePtr typedef
David Blaikie [Fri, 15 Jan 2016 23:43:28 +0000 (23:43 +0000)]
OpaquePtr: Use nullptr construction for TemplateTy OpaquePtr typedef

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

8 years agoOpaquePtr: Use nullptr construction for DeclGroupPtrTy OpaquePtr typedef
David Blaikie [Fri, 15 Jan 2016 23:43:25 +0000 (23:43 +0000)]
OpaquePtr: Use nullptr construction for DeclGroupPtrTy OpaquePtr typedef

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

8 years agoOpaquePtr: Provide conversion-from-nullptr_t to make default construction simpler...
David Blaikie [Fri, 15 Jan 2016 23:43:21 +0000 (23:43 +0000)]
OpaquePtr: Provide conversion-from-nullptr_t to make default construction simpler to read/write

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

8 years ago[CMake] Fix bots broken by including order file generation in check-all
Chris Bieneman [Fri, 15 Jan 2016 22:44:18 +0000 (22:44 +0000)]
[CMake] Fix bots broken by including order file generation in check-all

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

8 years agoAvoid self-assignment of SmallString, trigger UB behavior down the road.
Joerg Sonnenberger [Fri, 15 Jan 2016 22:29:34 +0000 (22:29 +0000)]
Avoid self-assignment of SmallString, trigger UB behavior down the road.

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

8 years agoMake -Wdelete-non-virtual-dtor warn on explicit `a->~A()` dtor calls too.
Nico Weber [Fri, 15 Jan 2016 21:45:31 +0000 (21:45 +0000)]
Make -Wdelete-non-virtual-dtor warn on explicit `a->~A()` dtor calls too.

-Wdelete-non-virtual-dtor warns if A is a type with virtual functions but
without virtual dtor has its constructor called via `delete a`. This makes the
warning also fire if the dtor is called via `a->~A()`. This would've found a
security bug in Chromium at compile time. Fixes PR26137.

To fix the warning, add a virtual destructor, make the class final, or remove
its other virtual methods.  If you want to silence the warning, there's also
a fixit that shows how:

test.cc:12:3: warning: destructor called on 'B' ... [-Wdelete-non-virtual-dtor]
  b->~B();
  ^
test.cc:12:6: note: qualify call to silence this warning
  b->~B();
     ^
     B::

http://reviews.llvm.org/D16206

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

8 years ago[analyzer] Check for return of nil in ObjC methods with nonnull return type.
Devin Coughlin [Fri, 15 Jan 2016 21:35:40 +0000 (21:35 +0000)]
[analyzer] Check for return of nil in ObjC methods with nonnull return type.

Update NullabilityChecker so that it checks return statements in ObjC methods.
Previously it was returning early because methods do not have a function type.

Also update detection of violated parameter _Nonnull preconditions to handle
ObjC methods.

rdar://problem/24200560

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

8 years ago[CMake] [Order-files] Use print_function as an attempt at being forward compatible.
Chris Bieneman [Fri, 15 Jan 2016 21:30:06 +0000 (21:30 +0000)]
[CMake] [Order-files] Use print_function as an attempt at being forward compatible.

Based on feedback from bogner.

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

8 years ago[CMake] Support generation of linker order files using dtrace
Chris Bieneman [Fri, 15 Jan 2016 21:21:12 +0000 (21:21 +0000)]
[CMake] Support generation of linker order files using dtrace

Summary:
This patch extends the lit-based perf-training tooling supplied for PGO data generation to also generate linker order files using dtrace.

This patch should work on any system that has dtrace. If CMake can find the dtrace tool it will generate a target 'generate-order-file' which will run the per-training tests wrapped by dtrace to capture function entries. There are several algorithms implemented for sorting the order files which can be experimented with for best performance. The dtrace wrapper also supports bot oneshot and pid probes.

The perf-helper.py changes to support order file construction are ported from internal changes by ddunbar; he gets all the credit for the hard work here, I just copy and pasted.

Note: I've tested these patches on FreeBSD and OS X 10.10.

Reviewers: ddunbar, bogner, silvas

Subscribers: llvm-commits, emaste

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

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

8 years agoAdd OpenMP dist_schedule clause to distribute directive and related regression tests.
Carlo Bertolli [Fri, 15 Jan 2016 18:50:31 +0000 (18:50 +0000)]
Add OpenMP dist_schedule clause to distribute directive and related regression tests.

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

8 years ago[analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion, v2.
Artem Dergachev [Fri, 15 Jan 2016 15:22:05 +0000 (15:22 +0000)]
[analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion, v2.

Provide separate visitor templates for the three hierarchies, and also
the `FullSValVisitor' class, which is a union of all three visitors.

Additionally, add a particular example visitor, `SValExplainer', in order to
test the visitor templates. This visitor is capable of explaining the SVal,
SymExpr, or MemRegion in a natural language.

Compared to the reverted r257605, this fixes the test that used to fail
on some triples, and fixes build failure under -fmodules.

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

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

8 years agoFix a -Wparentheses warning in ASTDiagnostic.cpp.
James Y Knight [Fri, 15 Jan 2016 05:57:41 +0000 (05:57 +0000)]
Fix a -Wparentheses warning in ASTDiagnostic.cpp.

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

8 years agoFixing more issues with template type diffing
Richard Trieu [Fri, 15 Jan 2016 05:48:38 +0000 (05:48 +0000)]
Fixing more issues with template type diffing

1) Print qualifiers for templates with zero arguments
2) Add a few more tests for the template type diffing refactoring.
Specifically, PR24587 has been fixed and has a test case from
http://reviews.llvm.org/D15384
3) Adds asserts to check the DiffTree is in correct state when moving nodes
4) Rename the field FromType and ToType since it is heavily used within
member functions.

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

8 years agoAdd new diff modes to template type diffing.
Richard Trieu [Fri, 15 Jan 2016 05:01:53 +0000 (05:01 +0000)]
Add new diff modes to template type diffing.

Remove an old assertion that does not hold.  It is possible for a template
argument to be a declaration in one instantiation and an integer in another.
Create two new diff kinds for these (decl vs int and int vs decl).

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

8 years agoPR26111: segmentation fault with __attribute__((mode(QI))) on function declaration...
Alexey Bataev [Fri, 15 Jan 2016 04:36:32 +0000 (04:36 +0000)]
PR26111: segmentation fault with __attribute__((mode(QI))) on function declaration, by Denis Zobnin
Allow "mode" attribute to be applied to VarDecl, not ValueDecl (which includes FunctionDecl and EnumConstantDecl), emit an error if this attribute is used with function declarations and enum constants.
Differential Revision: http://reviews.llvm.org/D16112

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

8 years ago[X86] Support 'interrupt' attribute for x86
Alexey Bataev [Fri, 15 Jan 2016 04:06:31 +0000 (04:06 +0000)]
[X86] Support 'interrupt' attribute for x86
This attribute may be attached to a function definition and instructs the backend to generate appropriate function entry/exit code so that
it can be used directly as an interrupt handler.
The IRET instruction, instead of the RET instruction, is used to return from interrupt or exception handlers. All registers, except for the EFLAGS register which is restored by the IRET instruction, are preserved by the compiler.
Any interruptible-without-stack-switch code must be compiled with -mno-red-zone since interrupt handlers can and will, because of the hardware design, touch
the red zone.

interrupt handler must be declared with a mandatory pointer argument:
struct interrupt_frame;

__attribute__ ((interrupt))
void f (struct interrupt_frame *frame) {
    ...
}
and user must properly define the structure the pointer pointing to.

exception handler:

The exception handler is very similar to the interrupt handler with a different mandatory function signature:
#ifdef __x86_64__
typedef unsigned long long int uword_t;
#else
typedef unsigned int uword_t;
#endif

struct interrupt_frame;

__attribute__ ((interrupt))
void f (struct interrupt_frame *frame, uword_t error_code) {
    ...
}
and compiler pops the error code off stack before the IRET instruction.

The exception handler should only be used for exceptions which push an error code and all other exceptions must use the interrupt handler.
The system will crash if the wrong handler is used.
Differential Revision: http://reviews.llvm.org/D15709

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

8 years ago[CodeGen] Attach attributes to thread local wrapper function.
Akira Hatanaka [Fri, 15 Jan 2016 03:34:06 +0000 (03:34 +0000)]
[CodeGen] Attach attributes to thread local wrapper function.

This commit is a follow-up to r251734, r251476, and r249735, which fixes
a bug where function attributes were not attached to thread local
wrapper functions.

rdar://problem/20828324

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

8 years agoWhen copying whitespace flags from the token naming a macro argument onto the
Richard Smith [Fri, 15 Jan 2016 03:24:18 +0000 (03:24 +0000)]
When copying whitespace flags from the token naming a macro argument onto the
first token of the expansion, don't forget to copy the "is at the start of a
line" token (which is always false, as newlines cannot appear within a macro
body); otherwise, stringizing the result can insert spurious whitespace.

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

8 years agoSave the integer type for integral template arguments.
Richard Trieu [Fri, 15 Jan 2016 02:55:17 +0000 (02:55 +0000)]
Save the integer type for integral template arguments.

Save the integer type when diffing integers in template type diffing.  When
integers are different sizes, print out the type along with the integer value.
Also with the type information, print true and false instead of 1 and 0 for
boolean values.

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