Commit Graph

62108 Commits

Author SHA1 Message Date
Xinliang David Li 5527a9dd42 [PGO] code simplification: use existing VP annotation API /NFC
llvm-svn: 259819
2016-02-04 19:54:17 +00:00
Rong Xu 9837ef56b4 [PGO] cc1 option name change for profile instrumentation
This patch changes cc1 option -fprofile-instr-generate to an enum option
-fprofile-instrument={clang|none}. It also changes cc1 options
-fprofile-instr-generate= to -fprofile-instrument-path=.
The driver level option -fprofile-instr-generate and -fprofile-instr-generate=
remain intact. This change will pave the way to integrate new PGO
instrumentation in IR level.

Review: http://reviews.llvm.org/D16730
llvm-svn: 259811
2016-02-04 18:39:09 +00:00
Andrey Bokhanko 6e34c1dcf7 [x86] Correct setting of WIntType for MCU target
Differential Revision: http://reviews.llvm.org/D16626

llvm-svn: 259780
2016-02-04 11:54:45 +00:00
Alexey Bataev 31300ed0a5 [OPENMP 4.0] Fixed support of array sections/array subscripts.
Codegen for array sections/array subscripts worked only for expressions with arrays as base. Patch fixes codegen for bases with pointer/reference types.

llvm-svn: 259776
2016-02-04 11:27:03 +00:00
Samuel Antao e57ad2aac3 Add -nocudainc option to CUDA preprocessor test.
If include files are used in the CUDA preprocessor tests it will cause a 
failure due to a missing header file in hosts that do not match the triple
in the test. E.g. powerpc64le have CUDA support but the include files
cannot be used for an x86 target.

llvm-svn: 259769
2016-02-04 08:13:16 +00:00
Saleem Abdulrasool adaaccc23b Basic: mark TLS as supported on Windows on ARM
LLVM can now lower TLS access as per the MS ABI on ARM.  This enables the
generation of TLS access for Windows on ARM.

llvm-svn: 259751
2016-02-04 05:05:23 +00:00
Alexey Bataev 703a93c4e6 PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression, by Dmitry Polukhin
Differential Revision: http://reviews.llvm.org/D16572
A    test/Parser/cxx-ambig-paren-expr-asan.cpp
M    lib/Parse/ParseExprCXX.cpp

llvm-svn: 259750
2016-02-04 04:22:09 +00:00
Ben Langmuir f5416740fc Fix predefine for __NSConstantString struct type
Per review feedback the name was wrong and it can be used outside
Objective-C.

Unfortunately, making the internal struct visible broke some ASTMatchers
tests that assumed that the first record decl would be from user code,
rather than a builtin type.  I'm worried that this will also affect
users' code.  So this patch adds a typedef to wrap the internal struct
and only makes the typedef visible to namelookup.  This is sufficient to
allow the ASTReader to merge the decls we need without making the struct
itself visible.

rdar://problem/24425801

llvm-svn: 259734
2016-02-04 00:55:24 +00:00
Manman Ren b72f766e12 Bump DiagnosticSemaKinds count; we're close to hitting it.
$ grep '= DIAG_START_SEMA' include/clang/Basic/DiagnosticIDs.h
       DIAG_START_ANALYSIS      = DIAG_START_SEMA            + 3000
 $ grep 'def ' include/clang/Basic/DiagnosticSemaKinds.td | wc -l
       2994

llvm-svn: 259728
2016-02-03 23:35:29 +00:00
Quentin Colombet 043406b87f Reapply r259624, it is likely not the commit causing the bot failures.
Original message:
Make CF constant string decl visible to name lookup to fix module errors

The return type of the __builtin___*StringMakeConstantString functions
is a pointer to a struct, so we need that struct to be visible to name
lookup so that we will correctly merge multiple declarations of that
type if they come from different modules.

Incidentally, to make this visible to name lookup we need to rename the
type to __NSConstantString, since the real NSConstantString is an
Objective-C interface type.  This shouldn't affect anyone outside the
compiler since users of the constant string builtins cast the result
immediately to CFStringRef.

Since this struct type is otherwise implicitly created by the AST
context and cannot access namelookup, we make this a predefined type
and initialize it in Sema.

Note: this issue of builtins that refer to types not visible to name
lookup technically also affects other builtins (e.g. objc_msgSendSuper),
but in all other cases the builtin is a library builtin and the issue
goes away if you include the library that defines the types it uses,
unlike for these constant string builtins.

rdar://problem/24425801

llvm-svn: 259721
2016-02-03 22:41:00 +00:00
Evgeniy Stepanov f31ea30694 [cfi] Safe handling of unaddressable vtable pointers (clang).
Avoid crashing when printing diagnostics for vtable-related CFI
errors. In diagnostic mode, the frontend does an additional check of
the vtable pointer against the set of all known vtable addresses and
lets the runtime handler know if it is safe to inspect the vtable.

http://reviews.llvm.org/D16823

llvm-svn: 259716
2016-02-03 22:18:55 +00:00
Quentin Colombet 0cdb86bd38 Revert r259624 - Make CF constant string decl visible to name lookup to fix module errors.
This breaks some internal bots in stage2: clang seg fault.
Looking with Ben to see what is going on.

llvm-svn: 259715
2016-02-03 22:14:53 +00:00
Artem Belevich 7b660e2604 [CUDA] added declarations for device-side system calls
...and std:: wrappers for free/malloc.

llvm-svn: 259690
2016-02-03 20:53:58 +00:00
Richard Smith df18ee9620 Ensure that we substitute into the declaration of a template parameter pack
(that is not a pack expansion) during template argument deduction, even if we
deduced that the pack would be empty.

llvm-svn: 259688
2016-02-03 20:40:30 +00:00
Richard Smith 37acb79084 Refactor conversion of deduced template arguments to reduce repetition.
llvm-svn: 259687
2016-02-03 20:15:01 +00:00
Douglas Gregor 0fc3a00168 [Sema debugger support] Require non-void types to be complete in unknown-anytype casts.
When performing a cast from an __unknown_anytype function call to a
non-void type, we need to make sure that type is complete. Fixes
rdar://problem/23959960.

llvm-svn: 259681
2016-02-03 19:13:08 +00:00
Anastasia Stulova 126a2b534e Added Anastasia Stulova as a code owner for OpenCL
Reviewers: Chris Lattner

Subscribers: cfe-dev
llvm-svn: 259678
2016-02-03 18:51:19 +00:00
Richard Smith 7b4df3bf5b Fix regression from r259622: the operand of an increment that is the operand of
a cast expression is not the operand of a cast expression itself, so if it's
parenthesized we need to form a ParenExpr not a ParenListExpr.

llvm-svn: 259677
2016-02-03 18:48:43 +00:00
Matt Arsenault 105e892c2c Add builtins for bitreverse intrinsic
Follow the naming convention that bswap uses since it's a
similar sort of operation.

llvm-svn: 259671
2016-02-03 17:49:38 +00:00
Daniel Jasper 45860fac37 clang-format: Fix formatting of ternary expressions with comments.
Before:
  int i = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ?
	      /*bbbbbbbbbbbbbbbbbbbb=*/bbbbbbbbbbbbbbbbbbbbbbbbb :
				       ccccccccccccccccccccccccccc;

After:
  int i = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ?
	      /*bbbbbbbbbbbbbbbbbbbb=*/bbbbbbbbbbbbbbbbbbbbbbbbb :
              ccccccccccccccccccccccccccc;

llvm-svn: 259670
2016-02-03 17:27:10 +00:00
Chris Bieneman 2e4c67299e Add back the ABITest makefiles
These files are standalone and not integrated with CMake, so we probably want them.

llvm-svn: 259667
2016-02-03 17:16:01 +00:00
Arpith Chacko Jacob 05bebb578a [OpenMP] Parsing + sema for target parallel for directive.
Summary:
This patch adds parsing + sema for the target parallel for directive along with testcases.

Reviewers: ABataev

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

llvm-svn: 259654
2016-02-03 15:46:42 +00:00
Aaron Ballman a88b93ed62 Minor cleanup to remove casts and improve some const correctness. NFC.
Patch by Alexander Riccio.

llvm-svn: 259652
2016-02-03 15:20:51 +00:00
Anastasia Stulova 735c6cdebd [OpenCL] Adding reserved operator logical xor for OpenCL
This patch adds the reserved operator ^^ when compiling for OpenCL (spec v1.1 s6.3.g),
which results in a more meaningful error message.

Patch by Neil Hickey!

Review: http://reviews.llvm.org/D13280

M    test/SemaOpenCL/unsupported.cl
M    include/clang/Basic/TokenKinds.def
M    include/clang/Basic/DiagnosticParseKinds.td
M    lib/Basic/OperatorPrecedence.cpp
M    lib/Lex/Lexer.cpp
M    lib/Parse/ParseExpr.cpp

llvm-svn: 259651
2016-02-03 15:17:14 +00:00
Daniel Jasper 739ae64346 Provide match function to look over an entire TU again.
llvm-svn: 259648
2016-02-03 14:29:55 +00:00
Yury Gribov 0826bf2211 Forgot to remove file in previous commit.
llvm-svn: 259647
2016-02-03 13:36:31 +00:00
Yury Gribov 8f7d8b6c32 [analyzer] AnalysisConsumer: print fully-qualified function name while displaying progress
-analyzer-display progress option prints only function names which may be ambiguous. This patch forces AnalysisConsumer to print fully-qualified function names.
Patch by Alex Sidorin!

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

llvm-svn: 259646
2016-02-03 13:35:33 +00:00
Marina Yatsina 41c45fa42d -inline-asm][X86] Add ability to use AVX512 in MS inline asm
Defined the new AVX512 registers in clang inline asm.
Fixed a bug in the MC subtarget info creation during the parsing of MS asm statement - now it receives the actual CPU and target features information.

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

llvm-svn: 259639
2016-02-03 11:32:08 +00:00
Axel Naumann 323862e13c Reduce initial Sema memory consumption by 400KB. By Elisavet Sakellari.
llvm-svn: 259637
2016-02-03 10:45:22 +00:00
Daniel Jasper 8737930cac clang-format: [JS/TypeScript] Support "enum" as an optional property name, too.
Before:
  enum?: string
  [];

After:
  enum?: string[];

llvm-svn: 259628
2016-02-03 05:33:44 +00:00
Ben Langmuir 6a34e10514 Make CF constant string decl visible to name lookup to fix module errors
The return type of the __builtin___*StringMakeConstantString functions
is a pointer to a struct, so we need that struct to be visible to name
lookup so that we will correctly merge multiple declarations of that
type if they come from different modules.

Incidentally, to make this visible to name lookup we need to rename the
type to __NSConstantString, since the real NSConstantString is an
Objective-C interface type.  This shouldn't affect anyone outside the
compiler since users of the constant string builtins cast the result
immediately to CFStringRef.

Since this struct type is otherwise implicitly created by the AST
context and cannot access namelookup, we make this a predefined type
and initialize it in Sema.

Note: this issue of builtins that refer to types not visible to name
lookup technically also affects other builtins (e.g. objc_msgSendSuper),
but in all other cases the builtin is a library builtin and the issue
goes away if you include the library that defines the types it uses,
unlike for these constant string builtins.

rdar://problem/24425801

llvm-svn: 259624
2016-02-03 03:26:19 +00:00
Richard Smith 4378568c8f Fix miscompile and rejects-valids when disambiguating after an ambiguous
C-style-cast to function/array type or parenthesized function-style cast/array
indexing.

llvm-svn: 259622
2016-02-03 02:58:20 +00:00
Richard Smith 8467c87aa2 Fix typo in OpenCL type mangling. This is still bogus (we should either use the
actual source name of the typedef or a vendor mangling) but at least it stands
a chance of demangling now.

We would also benefit from some test coverage of this (OpenCL +
__attribute__((overloadable)) is probably required to reach this).

llvm-svn: 259618
2016-02-03 01:43:59 +00:00
Richard Smith 4a38201176 Fix Itanium RTTI emission so that we emit fundamental type information into the
C++ ABI library for the same set of types for which we expect the C++ ABI
library to provide the RTTI.

Specifically:
 1) __int128 and unsigned __int128 are now emitted into the ABI library. We
    always expected them to be there but never actually made sure to emit them.
 2) Do not expect OpenCL builtin types to have type info in the C++ ABI library.
    Neither libc++abi nor libstdc++ puts them there when built with either GCC
    or Clang.

This matches GCC's behavior.

llvm-svn: 259616
2016-02-03 01:32:42 +00:00
Richard Smith 59b982e1be PR24989: Stop trying to use the C++11 rules for lambda return type inference in
C++14 generic lambdas. It conflicts with the C++14 return type deduction
mechanism, and results in us failing to actually deduce the lambda's return
type in some cases.

llvm-svn: 259609
2016-02-02 23:58:56 +00:00
Richard Smith 83c2ecf9fa Fix rejects-valid when forming a pointer-to-member with 'decltype(expr)::*'.
llvm-svn: 259604
2016-02-02 23:34:49 +00:00
Richard Smith ad609d56d2 Work around build failure due to GCC 4.8.1 bug. We don't completely understand
the details of the bug, but avoiding overloading llvm::cast with another
function template sidesteps it.

See gcc.gnu.org/PR58022 for details of the bug, and llvm.org/PR26362 for more
backgound on how it manifested in Clang. Patch by Igor Sugak!

llvm-svn: 259598
2016-02-02 23:11:49 +00:00
Artem Belevich 97c01c35f8 [CUDA] Do not allow dynamic initialization of global device side variables.
In general CUDA does not allow dynamic initialization of
global device-side variables. One exception is that CUDA allows
records with empty constructors as described in section E2.2.1 of
CUDA 7.5 Programming guide.

This patch applies initializer checks for all device-side variables.
Empty constructors are accepted, but no code is generated for them.

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

llvm-svn: 259592
2016-02-02 22:29:48 +00:00
Manman Ren 8abc2e51b8 ObjCXX: fix a crash during typo correction.
For ObjCXX, we can create a CastExpr with Kind being CK_UserDefinedConversion
and SubExpr being BlockExpr. Specifically one can return BlockExpr from
BuildCXXMemberCallExpr and the result can be used to build a CastExpr.

Fix the assumption in CastExpr::getSubExprAsWritten that SubExpr can only
be CXXMemberCallExpr.

rdar://problem/24364077

llvm-svn: 259591
2016-02-02 22:23:03 +00:00
Tim Northover bbac6d7c1b ARM: allow both vfma and vfms intrinsics on v7.
The main purpose here is that vfma/vfms should be symmetric, and they are
supported on most v7 cores.

The new ArchGuard is suggested by ACLE but prophylactic for us. Almost all CPUs
with NEON *will* have vfma, and the few exceptions I know of (e.g. Cortex-A8)
are incorrectly modelled by Clang so can't trigger a test.

Fortunately, they're getting rarer. But if we ever do support them properly
arm_neon.h should now do the right thing.

llvm-svn: 259537
2016-02-02 18:02:10 +00:00
Denis Zobnin 7d6b924df8 PR23057: Fix assertion `Val && "isa<> used on a null pointer"' on invalid for-range expression.
Fix the issue discovered by fuzzing (PR23057, comment 18) by handling nullptr in Sema::ActOnCXXForRangeDecl 
and correct delayed typos in for-range expression before calling Sema::ActOnCXXForRangeStmt. Also fixes PR26288.

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

llvm-svn: 259532
2016-02-02 17:33:09 +00:00
Benjamin Kramer ff2e323a32 Make CodeGen headers self-contained.
llvm-svn: 259518
2016-02-02 16:05:18 +00:00
Benjamin Kramer 8fdba91bc9 Make the remaining headers self-contained.
llvm-svn: 259507
2016-02-02 14:24:21 +00:00
Benjamin Kramer c6e234c767 [StaticAnalyzer] Pull SymExpr and SymbolData into its own header to avoid cyclic includes.
llvm-svn: 259506
2016-02-02 14:24:11 +00:00
Oliver Stannard 9181785a0c Add backend dignostic printer for unsupported features
Re-commit of r258950 after fixing layering violation.

The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.

llvm-svn: 259499
2016-02-02 13:52:52 +00:00
Denis Zobnin d9e2dcdb42 Fix for PR8901: attribute "mode" rejected for enums and dependent types.
Allow "mode" attribute for enum types, except for vector modes, for compatibility with GCC.
Support "mode" attribute with dependent types.

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

llvm-svn: 259497
2016-02-02 13:50:39 +00:00
Denis Zobnin b2dc238736 Test commit (NFC).
llvm-svn: 259492
2016-02-02 12:39:08 +00:00
Anastasia Stulova b607e0f238 [OpenCL] Eliminate warning when declaring OpenCL builtin functions.
OpenCL builtin functions are usually declared in header files.
Currently clang emits warning for OpenCL builtin functions
which have the same name as standard C library functions.

This commit eliminates such warnings by not adding the C standard
includes following the restriction from OpenCL v1.2 s6.9.f.

Patch by Liu Yaxun (Sam)!

Review: http://reviews.llvm.org/D16692
llvm-svn: 259491
2016-02-02 11:29:43 +00:00
Benjamin Kramer fa51138932 Make headers self-contained.
llvm-svn: 259490
2016-02-02 11:06:57 +00:00
Benjamin Kramer 8c30592e18 Move DebugInfoKind into its own header to cut the cyclic dependency edge from Driver to Frontend.
llvm-svn: 259489
2016-02-02 11:06:51 +00:00