]> granicus.if.org Git - clang/log
clang
5 years agoCodeGen: Preserve packed attribute in constStructWithPadding.
Peter Collingbourne [Sat, 16 Mar 2019 19:25:39 +0000 (19:25 +0000)]
CodeGen: Preserve packed attribute in constStructWithPadding.

Otherwise the object may have an incorrect size due to tail padding.

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

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

5 years ago[analyzer] ConditionBRVisitor: Unknown condition evaluation support
Csaba Dabis [Sat, 16 Mar 2019 13:47:55 +0000 (13:47 +0000)]
[analyzer] ConditionBRVisitor: Unknown condition evaluation support

Summary:
If the constraint information is not changed between two program states the
analyzer has not learnt new information and made no report. But it is
possible to happen because we have no information at all. The new approach
evaluates the condition to determine if that is the case and let the user
know we just `Assuming...` some value.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ

Subscribers: llvm-commits, xazax.hun, baloghadamsoftware, szepet, a.sidorin,
mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gsd, gerazo

Tags: #clang, #llvm

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

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

5 years ago[analyzer] ConditionBRVisitor: Remove GDM checking
Csaba Dabis [Sat, 16 Mar 2019 11:55:07 +0000 (11:55 +0000)]
[analyzer] ConditionBRVisitor: Remove GDM checking

Summary:
Removed the `GDM` checking what could prevent reports made by this visitor.
Now we rely on constraint changes instead.
(It reapplies 356318 with a feature from 356319 because build-bot failure.)

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ

Subscribers: cfe-commits, jdoerfert, gerazo, xazax.hun, baloghadamsoftware,
szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp

Tags: #clang

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

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

5 years agoRevert "[analyzer] ConditionBRVisitor: Remove GDM checking"
Csaba Dabis [Sat, 16 Mar 2019 10:44:49 +0000 (10:44 +0000)]
Revert "[analyzer] ConditionBRVisitor: Remove GDM checking"

This reverts commit f962485adad9d646511fd3240c0408d9554e6784.

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

5 years agoRevert "[analyzer] ConditionBRVisitor: Unknown condition evaluation support"
Csaba Dabis [Sat, 16 Mar 2019 10:06:06 +0000 (10:06 +0000)]
Revert "[analyzer] ConditionBRVisitor: Unknown condition evaluation support"

This reverts commit 0fe67a61cd4aec13c7969a179517f1cc06ab05cd.

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

5 years ago[analyzer] ConditionBRVisitor: Unknown condition evaluation support
Csaba Dabis [Sat, 16 Mar 2019 09:24:30 +0000 (09:24 +0000)]
[analyzer] ConditionBRVisitor: Unknown condition evaluation support

Summary: If the constraint information is not changed between two program states the analyzer has not learnt new information and made no report. But it is possible to happen because we have no information at all. The new approach evaluates the condition to determine if that is the case and let the user know we just 'Assuming...' some value.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gsd, gerazo

Tags: #clang

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

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

5 years ago[analyzer] ConditionBRVisitor: Remove GDM checking
Csaba Dabis [Sat, 16 Mar 2019 09:16:16 +0000 (09:16 +0000)]
[analyzer] ConditionBRVisitor: Remove GDM checking

Summary: Removed the `GDM` checking what could prevent reports made by this visitor. Now we rely on constraint changes instead.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ

Subscribers: jdoerfert, gerazo, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp

Tags: #clang

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

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

5 years ago[WebAssembly] Use rethrow intrinsic in the rethrow block
Heejin Ahn [Sat, 16 Mar 2019 05:39:12 +0000 (05:39 +0000)]
[WebAssembly] Use rethrow intrinsic in the rethrow block

Summary:
Because in wasm we merge all catch clauses into one big catchpad, in
case none of the types in catch handlers matches after we test against
each of them, we should unwind to the next EH enclosing scope. For this,
we should NOT use a call to `__cxa_rethrow` but rather a call to our own
rethrow intrinsic, because what we're trying to do here is just to
transfer the control flow into the next enclosing EH pad (or the
caller). Calls to `__cxa_rethrow` should only be used after a call to
`__cxa_begin_catch`.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Teach scan-build to find clang when installed in /usr/local/bin/
Devin Coughlin [Sat, 16 Mar 2019 01:01:29 +0000 (01:01 +0000)]
[analyzer] Teach scan-build to find clang when installed in /usr/local/bin/

Change scan-build to support the scenario where scan-build is installed in
$TOOLCHAIN/usr/local/bin/ but clang itself is installed in $TOOLCHAIN/usr/bin/.

This is restricted to when 'xcrun' is present; that is, on the Mac.

rdar://problem/48914634

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

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

5 years agohello, clang
Csaba Dabis [Fri, 15 Mar 2019 23:44:35 +0000 (23:44 +0000)]
hello, clang

Test commit with head and body.

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

5 years ago[coroutines][PR40978] Emit error for co_yield within catch block
Brian Gesiak [Fri, 15 Mar 2019 20:25:49 +0000 (20:25 +0000)]
[coroutines][PR40978] Emit error for co_yield within catch block

Summary:
As reported in https://bugs.llvm.org/show_bug.cgi?id=40978, it's an
error to use the `co_yield` or `co_await` keywords outside of a valid
"suspension context" as defined by [expr.await]p2 of
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4775.pdf.

Whether or not the current scope was in a function-try-block's
(https://en.cppreference.com/w/cpp/language/function-try-block) handler
could be determined using scope flag `Scope::FnTryCatchScope`. No
such flag existed for a simple C++ catch statement, so this commit adds
one.

Reviewers: GorNishanov, tks2103, rsmith

Reviewed By: GorNishanov

Subscribers: EricWF, jdoerfert, cfe-commits, lewissbaker

Tags: #clang

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

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

5 years ago[CUDA][Windows] Partial fix for bug 38811 (Step 2 of 3)
Evgeny Mankov [Fri, 15 Mar 2019 19:04:46 +0000 (19:04 +0000)]
[CUDA][Windows] Partial fix for bug 38811 (Step 2 of 3)

Partial fix for the clang Bug 38811 "Clang fails to compile with CUDA-9.x on Windows".

[Synopsis]
__sptr is a new Microsoft specific modifier (https://docs.microsoft.com/en-us/cpp/cpp/sptr-uptr?view=vs-2017).

[Solution]
Replace all `__sptr` occurrences with `__s` (and all `__cptr` with `__c` as well) to eliminate the below clang compilation error on Windows.

In file included from C:\GIT\LLVM\trunk\llvm-64-release-vs2017-15.9.5\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:162:
C:\GIT\LLVM\trunk\llvm-64-release-vs2017-15.9.5\dist\lib\clang\9.0.0\include\__clang_cuda_device_functions.h:524:33: error: expected expression
  return __nv_fast_sincosf(__a, __sptr, __cptr);
                                ^
Reviewed by: Artem Belevich

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

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

5 years ago[HIP-Clang] propagate -mllvm options to opt and llc
Aaron Enye Shi [Fri, 15 Mar 2019 17:31:51 +0000 (17:31 +0000)]
[HIP-Clang] propagate -mllvm options to opt and llc

Change the HIP Toolchain to pass the OPT_mllvm options into OPT and LLC stages. Added a lit test to verify the command args.

Reviewers: yaxunl

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

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

5 years ago[CUDA][Windows] Partial fix for bug #38811 (Step 1 of 3)
Evgeny Mankov [Fri, 15 Mar 2019 12:05:36 +0000 (12:05 +0000)]
[CUDA][Windows] Partial fix for bug #38811 (Step 1 of 3)

Partial fix for the clang Bug https://bugs.llvm.org/show_bug.cgi?id=38811 "Clang fails to compile with CUDA-9.x on Windows".

Adding defined(_WIN64) check along with existing #if defined(__LP64__) eliminates the below clang (64-bit) compilation error on Windows.

C:/GIT/LLVM/trunk/llvm-64-release-vs2017/dist/lib/clang/9.0.0\include\__clang_cuda_device_functions.h(1609,45): error GEF7559A7: no matching function for call to 'roundf'
 __DEVICE__ long lroundf(float __a) { return roundf(__a); }

Reviewed by: Artem Belevich

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

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

5 years agoMake getFullyQualifiedName qualify both the pointee and class type for member ptr...
Benjamin Kramer [Fri, 15 Mar 2019 11:09:41 +0000 (11:09 +0000)]
Make getFullyQualifiedName qualify both the pointee and class type for member ptr types

We already handle pointers and references, member ptrs are just another
special case. Fixes PR40732.

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

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

5 years agoRemove an assert in template pack deduction during nested instantiation.
Richard Trieu [Fri, 15 Mar 2019 04:26:02 +0000 (04:26 +0000)]
Remove an assert in template pack deduction during nested instantiation.

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

5 years agoAdd missing override specifier [NFC]
Aaron Puchert [Fri, 15 Mar 2019 02:30:07 +0000 (02:30 +0000)]
Add missing override specifier [NFC]

This should fix a -Winconsistent-missing-override warning that is only
visible when Z3 is enabled.

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

5 years ago[analyzer] RetainCount: A function isn't a CFRetain if it takes no arguments.
Artem Dergachev [Fri, 15 Mar 2019 00:26:17 +0000 (00:26 +0000)]
[analyzer] RetainCount: A function isn't a CFRetain if it takes no arguments.

Don't crash when a function has a name that starts with "CF" and ends with
"Retain" but takes 0 arguments. In particular, don't try to treat it as if
it returns its first argument.

These problems are inevitable because the checker is naming-convention-based,
but at least we shouldn't crash.

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

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

5 years ago[analyzer] Support C++17 aggregates with bases without constructors.
Artem Dergachev [Fri, 15 Mar 2019 00:22:59 +0000 (00:22 +0000)]
[analyzer] Support C++17 aggregates with bases without constructors.

RegionStore now knows how to bind a nonloc::CompoundVal that represents the
value of an aggregate initializer when it has its initial segment of sub-values
correspond to base classes.

Additionally, fixes the crash from pr40022.

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

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

5 years agoReland the rest of "Add AIX Target Info"
Jason Liu [Thu, 14 Mar 2019 21:54:30 +0000 (21:54 +0000)]
Reland the rest of "Add AIX Target Info"

llvm-svn 356197 relanded previously failing test case max_align.c.
This commit will reland the rest of llvm-svn 356060 commit.

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

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

5 years ago[OPENMP]Fix crash for the ordered(n) clause.
Alexey Bataev [Thu, 14 Mar 2019 20:36:00 +0000 (20:36 +0000)]
[OPENMP]Fix crash for the ordered(n) clause.

If the doacross lop construct is used and the loop counter is declare
outside of the loop, the compiler might crash trying to get the address
of the loop counter. Patch fixes this problem.

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

5 years agoReland part of "Add AIX Target Info"
Jason Liu [Thu, 14 Mar 2019 20:27:39 +0000 (20:27 +0000)]
Reland part of "Add AIX Target Info"

This patch reland the test case max_align.c which is failing at
Windows and PS4 platform in the previous commit.

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

original llvm-svn: 356060

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

5 years ago[CodeGen] Consider tied operands when adjusting inline asm operands.
Eli Friedman [Thu, 14 Mar 2019 19:46:51 +0000 (19:46 +0000)]
[CodeGen] Consider tied operands when adjusting inline asm operands.

The constraint "0" in the following asm did not consider the its
relationship with "=y" when try to replace the type of the operands.

asm ("nop" : "=y"(Mu8_1 ) : "0"(Mu8_0 ));

Patch by Xiang Zhang.

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

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

5 years ago[Sema] Fix a use-after-free of a _Nonnull ParsedAttr
Erik Pilkington [Thu, 14 Mar 2019 18:38:02 +0000 (18:38 +0000)]
[Sema] Fix a use-after-free of a _Nonnull ParsedAttr

We were allocating the implicit attribute in the declarator's attribute pool,
but putting into the declaration specifier's ParsedAttributesView. If there are
multiple declarators, then we'll use the attribute from the declaration
specifier after clearing out the declarators attribute pool. Fix this by
allocating the attribute in the declaration specifier's pool.

rdar://48529718

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

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

5 years agoAdd PragmaHandler for MSVC pragma execution_character_set
Reid Kleckner [Thu, 14 Mar 2019 18:12:17 +0000 (18:12 +0000)]
Add PragmaHandler for MSVC pragma execution_character_set

__pragma(execution_character_set(push, "UTF-8")) is used in
TraceLoggingProvider.h. This commit implements a no-op handler for
compatability, similar to how the flag -fexec_charset is handled.

Patch by Matt Gardner!

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

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

5 years ago[analyzer] Fix an assertation failure for invalid sourcelocation, add a new debug...
Kristof Umann [Thu, 14 Mar 2019 16:10:29 +0000 (16:10 +0000)]
[analyzer] Fix an assertation failure for invalid sourcelocation, add a new debug checker

For a rather short code snippet, if debug.ReportStmts (added in this patch) was
enabled, a bug reporter visitor crashed:

struct h {
  operator int();
};

int k() {
  return h();
}

Ultimately, this originated from PathDiagnosticLocation::createMemberLoc, as it
didn't handle the case where it's MemberExpr typed parameter returned and
invalid SourceLocation for MemberExpr::getMemberLoc. The solution was to find
any related valid SourceLocaion, and Stmt::getBeginLoc happens to be just that.

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

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

5 years ago[CodeGen][ObjC] Remove the leading 'l' from symbols for protocol
Akira Hatanaka [Thu, 14 Mar 2019 15:17:37 +0000 (15:17 +0000)]
[CodeGen][ObjC] Remove the leading 'l' from symbols for protocol
metadata and protocol list

The leading 'l' tells ld64 to remove the symbol name, which can make
debugging difficult.

rdar://problem/47256637

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

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

5 years agoFix test after r356148
Nico Weber [Thu, 14 Mar 2019 14:40:48 +0000 (14:40 +0000)]
Fix test after r356148

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

5 years agoRemove unused variable to silence compiler warning [NFC]
Mikael Holmen [Thu, 14 Mar 2019 14:20:50 +0000 (14:20 +0000)]
Remove unused variable to silence compiler warning [NFC]

The only use of MI was removed in r356142.

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

5 years ago[ASTImporter] Fix import of NestedNameSpecifierLoc.
Balazs Keri [Thu, 14 Mar 2019 14:20:23 +0000 (14:20 +0000)]
[ASTImporter] Fix import of NestedNameSpecifierLoc.

Summary:
Import type location in case of TypeSpec and TypeSpecWithTemplate.
Without this fix the imported NespedNameSpecifierLoc will have an
invalid begin location.

Reviewers: a.sidorin, shafik, a_sidorin, martong

Reviewed By: a_sidorin

Subscribers: rnkovacs, jdoerfert, dkrupp, martong, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

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

5 years agoObjective-C++11: Support static_assert() in @interface/@implementation ivar lists...
Nico Weber [Thu, 14 Mar 2019 14:18:56 +0000 (14:18 +0000)]
Objective-C++11: Support static_assert() in @interface/@implementation ivar lists and method declarations

This adds support for static_assert() (and _Static_assert()) in
@interface/@implementation ivar lists and in @interface method declarations.

It was already supported in @implementation blocks outside of the ivar lists.

The assert AST nodes are added at file scope, matching where other
(non-Objective-C) declarations at @interface / @implementation level go (cf
`allTUVariables`).

Also add a `__has_feature(objc_c_static_assert)` that's true in C11 (and
`__has_extension(objc_c_static_assert)` that's always true) and
`__has_feature(objc_cxx_static_assert)` that's true in C++11 modea fter this
patch, so it's possible to check if this is supported.

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

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

5 years ago[analyzer] Fix function macro crash
Kristof Umann [Thu, 14 Mar 2019 13:38:16 +0000 (13:38 +0000)]
[analyzer] Fix function macro crash

Re-commit D57893.

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

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

5 years ago[X86] Only define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 in 64-bit mode.
Craig Topper [Thu, 14 Mar 2019 05:45:42 +0000 (05:45 +0000)]
[X86] Only define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 in 64-bit mode.

Summary:
This define should correspond to CMPXCHG16B being available which requires 64-bit mode.

I checked and gcc also seems to only define this in 64-bit mode.

Reviewers: RKSimon, spatel, efriedma, jyknight, jfb

Reviewed By: jfb

Subscribers: jfb, cfe-commits, llvm-commits

Tags: #clang

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

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

5 years agoFix invocation of Gold plugin with LTO after r355331
Nemanja Ivanovic [Wed, 13 Mar 2019 23:54:52 +0000 (23:54 +0000)]
Fix invocation of Gold plugin with LTO after r355331

The above commit breaks the usage of PGO and LTO when -fprofile-use is
supplied without a path. This patch changes the usage of this argument
to be inline with its use in addPGOAndCoverageFlags().

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

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

5 years agoRevert "Add a new attribute, fortify_stdlib"
Erik Pilkington [Wed, 13 Mar 2019 21:37:01 +0000 (21:37 +0000)]
Revert "Add a new attribute, fortify_stdlib"

This reverts commit r353765. After talking with our c stdlib folks, we decided
to use the existing pass_object_size attribute to implement _FORTIFY_SOURCE
wrappers, like Bionic does (I didn't realize that pass_object_size could be used
for this purpose). Sorry for the flip/flop, and thanks to James Y. Knight for
pointing this out to me.

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

5 years ago[clang-format] Propagate inferred language to getLLVMStyle() in getPredefinedStyle()
Jordan Rupprecht [Wed, 13 Mar 2019 21:13:01 +0000 (21:13 +0000)]
[clang-format] Propagate inferred language to getLLVMStyle() in getPredefinedStyle()

rC355158 added an optional language parameter to getLLVMStyle(), but this parameter was not used in getPredefinedStyle(). Because unit tests directly specify the style, this codepath wasn't tested. Add an additional unit test for getStyle().

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

5 years ago[OPENMP]Fix PR37283: Assertion failure on openmp task with by reference
Alexey Bataev [Wed, 13 Mar 2019 20:46:28 +0000 (20:46 +0000)]
[OPENMP]Fix PR37283: Assertion failure on openmp task with by reference
array.

If the firstprivate variable is a reference, we may incorrectly classify
the kind of the private copy. Use the type of the private copy instead
of the original shared variable.

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

5 years ago[clang-format][NFC] Include TableGen in enum->string mapping used for debugging
Jordan Rupprecht [Wed, 13 Mar 2019 20:34:34 +0000 (20:34 +0000)]
[clang-format][NFC] Include TableGen in enum->string mapping used for debugging

Running `clang-format -debug` prints "Unknown" for tablegen files because of this missing mapping, even though it is recognized as a tablegen file.

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

5 years ago[LibTooling] Add retrieval of extended AST-node source to FixIt library
Yitzhak Mandelbaum [Wed, 13 Mar 2019 19:48:51 +0000 (19:48 +0000)]
[LibTooling] Add retrieval of extended AST-node source to FixIt library

Summary:
Introduces variants of `getText` and `getSourceRange` that extract the source text of an AST node potentially with a trailing token.

Some of the new functions manipulate `CharSourceRange`s, rather than `SourceRange`s, because they document and dynamically enforce their type.  So, this revision also updates the corresponding existing FixIt functions to manipulate `CharSourceRange`s.  This change is not strictly necessary, but seems like the correct choice, to keep the API self-consistent.

This revision is the first in a series intended to improve the abstractions available to users for writing source-to-source transformations.  A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling".

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: kimgr, riccibruno, JonasToth, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Disable ADL in C for user-defined reductions.
Alexey Bataev [Wed, 13 Mar 2019 19:31:34 +0000 (19:31 +0000)]
[OPENMP]Disable ADL in C for user-defined reductions.

C does not support ADL, disable it for C to prevent compiler crash.

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

5 years ago[Analyzer] Clean up test/Analysis/ptr-sort.cpp
Mandeep Singh Grang [Wed, 13 Mar 2019 19:21:11 +0000 (19:21 +0000)]
[Analyzer] Clean up test/Analysis/ptr-sort.cpp

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

5 years agoFix a failing test.
Erik Pilkington [Wed, 13 Mar 2019 19:20:45 +0000 (19:20 +0000)]
Fix a failing test.

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

5 years ago[Analyzer] Update the LLVM license in PointerSortingChecker.cpp
Mandeep Singh Grang [Wed, 13 Mar 2019 19:09:48 +0000 (19:09 +0000)]
[Analyzer] Update the LLVM license in PointerSortingChecker.cpp

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

5 years ago[Parse] Parse '#pragma clang attribute' as an external-declaration
Erik Pilkington [Wed, 13 Mar 2019 18:30:59 +0000 (18:30 +0000)]
[Parse] Parse '#pragma clang attribute' as an external-declaration

Previously, we parsed it only in the top level, which excludes namespaces and
extern "C" blocks.

rdar://problem/48818890

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

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

5 years ago[OPENMP][NVPTX]Fix PR40893: Size doesn't match for
Alexey Bataev [Wed, 13 Mar 2019 18:21:10 +0000 (18:21 +0000)]
[OPENMP][NVPTX]Fix PR40893: Size doesn't match for
'_openmp_teams_reductions_buffer_$_.

nvlink does not handle weak linkage correctly, same symbols with the
different sizes are reported as erroneous though the largest size must
be chosen instead. Patch fixes this problem by using Internal linkage
instead of the Common.

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

5 years agoRevert "Add AIX Target Info"
Jason Liu [Wed, 13 Mar 2019 17:57:23 +0000 (17:57 +0000)]
Revert "Add AIX Target Info"

This reverts commit 4e192d0e1e72ce32fabf1bccc06ac31ab5385e78.
The newly added test case max_align.c do not work on all platforms.

original llvm-svn: 356060

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

5 years ago[libclang] Expose aligned() attribute.
Emilio Cobos Alvarez [Wed, 13 Mar 2019 16:16:54 +0000 (16:16 +0000)]
[libclang] Expose aligned() attribute.

Summary:
This is useful because otherwise there's no easy way to distinguish #pragma
packed(N) from attribute(packed, aligned(N)) that isn't looking at field
offsets (since pragma packed() also creates a packed attribute).

Reviewers: Anastasia, arphaman, serge-sans-paille

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd AIX Target Info
Jason Liu [Wed, 13 Mar 2019 16:02:26 +0000 (16:02 +0000)]
Add AIX Target Info

Summary:
A first pass over platform-specific properties of the C API/ABI
on AIX for both 32-bit and 64-bit modes.
This is a continuation of D18360 by Andrew Paprocki and further work by Wu Zhao.

Patch by Andus Yu

Reviewers: apaprocki, chandlerc, hubert.reinterpretcast, jasonliu,
xingxue, sfertile

Reviewed by: hubert.reinterpretcast, apaprocki, sfertile

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

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

5 years ago[Analyzer] Skip symbolic regions based on conjured symbols in comparison of the conta...
Adam Balogh [Wed, 13 Mar 2019 13:55:11 +0000 (13:55 +0000)]
[Analyzer] Skip symbolic regions based on conjured symbols in comparison of the containers of iterators

Checking whether two regions are the same is a partially decidable problem:
either we know for sure that they are the same or we cannot decide. A typical
case for this are the symbolic regions based on conjured symbols. Two
different conjured symbols are either the same or they are different. Since
we cannot decide this and want to reduce false positives as much as possible
we exclude these regions whenever checking whether two containers are the
same at iterator mismatch check.

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

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

5 years ago[AST] Improve support of external layouts in `MicrosoftRecordLayoutBuilder`
Aleksandr Urakov [Wed, 13 Mar 2019 13:38:12 +0000 (13:38 +0000)]
[AST] Improve support of external layouts in `MicrosoftRecordLayoutBuilder`

Summary:
This patch fixes several small problems with external layouts support in
`MicrosoftRecordLayoutBuilder`:
- aligns properly the size of a struct that ends with a bit field. It was
  aligned on byte before, not on the size of the field, so the struct size was
  smaller than it should be;
- adjusts the struct size when injecting a vbptr in the case when there were no
  bases or fields allocated after the vbptr. Similarly, without the adjustment
  the struct was smaller than it should be;
- the same fix as above for the vfptr.
All these fixes affect the non-virtual size of a struct, so they are tested
through non-virtual inheritance.

Reviewers: rnk, zturner, rsmith

Reviewed By: rnk

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else...
Paul Hoad [Wed, 13 Mar 2019 08:26:39 +0000 (08:26 +0000)]
[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present

Summary:
Addressing: PR25010 - https://bugs.llvm.org/show_bug.cgi?id=25010

Code like:

```
    if(true) var++;
    else  {
        var--;
    }
```

is reformatted to be

```
  if (true)
    var++;
  else {
    var--;
  }
```

Even when `AllowShortIfStatementsOnASingleLine` is true

The following revision comes from a +1'd suggestion in the PR to support AllowShortIfElseStatementsOnASingleLine

This suppresses the clause prevents the merging of the if when there is a compound else

Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, reuk
Reviewed By: reuk
Subscribers: reuk, Higuoxing, jdoerfert, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59087

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

5 years agoRevert "[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working...
Paul Hoad [Wed, 13 Mar 2019 08:15:03 +0000 (08:15 +0000)]
Revert "[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present"

This reverts commit b358cbb9b78389e20f7be36e1a98e26515c3ecce.

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

5 years ago[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else...
Paul Hoad [Wed, 13 Mar 2019 08:07:46 +0000 (08:07 +0000)]
[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present

Summary:
Addressing: PR25010 - https://bugs.llvm.org/show_bug.cgi?id=25010

Code like:

```
    if(true) var++;
    else  {
        var--;
    }
```

is reformatted to be

```
  if (true)
    var++;
  else {
    var--;
  }
```

Even when `AllowShortIfStatementsOnASingleLine` is true

The following revision comes from a +1'd suggestion in the PR to support AllowShortIfElseStatementsOnASingleLine

This suppresses the clause prevents the merging of the if when there is a compound else

Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, reuk
Reviewed By: reuk
Subscribers: reuk, Higuoxing, jdoerfert, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59087

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

5 years ago[X86] Remove 'cx16' from 'prescott' and 'yonah' as they are 32-bit only CPUs and...
Craig Topper [Wed, 13 Mar 2019 05:14:52 +0000 (05:14 +0000)]
[X86] Remove 'cx16' from 'prescott' and 'yonah' as they are 32-bit only CPUs and cmpxchg16b requires 64-bit mode.

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

5 years ago[X86] Add 'yonah' test to predefined-arch-macros.c test.
Craig Topper [Wed, 13 Mar 2019 05:14:50 +0000 (05:14 +0000)]
[X86] Add 'yonah' test to predefined-arch-macros.c test.

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

5 years agoDelete unused declaration of DeclContextPrintAction after the removal of -print-decl...
Fangrui Song [Wed, 13 Mar 2019 03:22:33 +0000 (03:22 +0000)]
Delete unused declaration of DeclContextPrintAction after the removal of -print-decl-contexts by D52529

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

5 years agoAdd XCOFF triple object format type for AIX
Jason Liu [Tue, 12 Mar 2019 22:01:10 +0000 (22:01 +0000)]
Add XCOFF triple object format type for AIX

This patch adds an XCOFF triple object format type into LLVM.
This XCOFF triple object file type will be used later by object file and assembly generation for the AIX platform.

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

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

5 years ago[NFC][clang][PCH][ObjC] Add some missing `VisitStmt(S);`
Roman Lebedev [Tue, 12 Mar 2019 21:31:00 +0000 (21:31 +0000)]
[NFC][clang][PCH][ObjC] Add some missing `VisitStmt(S);`

Summary:
These ObjC AST classes inherit from Stmt, but don't call `VisitStmt(S);`.
Some were founded with help of existing tests (with `NumStmtFields` bumped to `1`),
but some of them don't even have PCH test coverage. :/

Reviewers: arphaman, sammccall, smeenai, aprantl, rsmith, jordan_rose

Reviewed By: jordan_rose

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoReland "[Remarks] Add -foptimization-record-passes to filter remark emission"
Francis Visoiu Mistrih [Tue, 12 Mar 2019 21:22:27 +0000 (21:22 +0000)]
Reland "[Remarks] Add -foptimization-record-passes to filter remark emission"

Currently we have -Rpass for filtering the remarks that are displayed as
diagnostics, but when using -fsave-optimization-record, there is no way
to filter the remarks while generating them.

This adds support for filtering remarks by passes using a regex.
Ex: `clang -fsave-optimization-record -foptimization-record-passes=inline`

will only emit the remarks coming from the pass `inline`.

This adds:

* `-fsave-optimization-record` to the driver
* `-opt-record-passes` to cc1
* `-lto-pass-remarks-filter` to the LTOCodeGenerator
* `--opt-remarks-passes` to lld
* `-pass-remarks-filter` to llc, opt, llvm-lto, llvm-lto2
* `-opt-remarks-passes` to gold-plugin

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

Original llvm-svn: 355964

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

5 years agoRevert "[Remarks] Add -foptimization-record-passes to filter remark emission"
Francis Visoiu Mistrih [Tue, 12 Mar 2019 20:54:18 +0000 (20:54 +0000)]
Revert "[Remarks] Add -foptimization-record-passes to filter remark emission"

This reverts commit 20fff32b7d1f1a1bd417b22aa9f26ededd97a3e5.

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

5 years ago[Remarks] Add -foptimization-record-passes to filter remark emission
Francis Visoiu Mistrih [Tue, 12 Mar 2019 20:28:50 +0000 (20:28 +0000)]
[Remarks] Add -foptimization-record-passes to filter remark emission

Currently we have -Rpass for filtering the remarks that are displayed as
diagnostics, but when using -fsave-optimization-record, there is no way
to filter the remarks while generating them.

This adds support for filtering remarks by passes using a regex.
Ex: `clang -fsave-optimization-record -foptimization-record-passes=inline`

will only emit the remarks coming from the pass `inline`.

This adds:

* `-fsave-optimization-record` to the driver
* `-opt-record-passes` to cc1
* `-lto-pass-remarks-filter` to the LTOCodeGenerator
* `--opt-remarks-passes` to lld
* `-pass-remarks-filter` to llc, opt, llvm-lto, llvm-lto2
* `-opt-remarks-passes` to gold-plugin

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

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

5 years ago[OPENMP]Allow to redefine entry for the variables definitions.
Alexey Bataev [Tue, 12 Mar 2019 20:05:17 +0000 (20:05 +0000)]
[OPENMP]Allow to redefine entry for the variables definitions.

If the variable was declared and marked as declare target, a new offload
entry with size 0 is created. But if later a definition is created and
marked as declare target, this definition is not added to the entry set
and the definition remains not mapped to the target. Patch fixes this
problem allowing to redefine the size and linkage for
previously registered declaration.

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

5 years ago[OPENMP 5.0]Initial support for 'allocator' clause.
Alexey Bataev [Tue, 12 Mar 2019 18:52:33 +0000 (18:52 +0000)]
[OPENMP 5.0]Initial support for 'allocator' clause.

Added parsing/sema analysis/serialization/deserialization for the
'allocator' clause of the 'allocate' directive.

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

5 years agoModules: Add LangOptions::CacheGeneratedPCH
Duncan P. N. Exon Smith [Tue, 12 Mar 2019 18:38:04 +0000 (18:38 +0000)]
Modules: Add LangOptions::CacheGeneratedPCH

Add an option to cache the generated PCH in the ModuleCache when
emitting it.  This protects clients that build PCHs and read them in the
same process, allowing them to avoid race conditions between parallel
jobs the same way that Clang's implicit module build system does.

rdar://problem/48740787

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

5 years agoAdd a creduce script for clang crashes
George Burgess IV [Tue, 12 Mar 2019 17:48:53 +0000 (17:48 +0000)]
Add a creduce script for clang crashes

This CL adds a script that calls C-Reduce on an input file and given the
clang crash script, which is used to generate an interestingness test
for C-Reduce.

Patch by Amy Huang!

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

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

5 years ago[CMake] Tell libc++ that we're using compiler-rt on Apple platforms
Louis Dionne [Tue, 12 Mar 2019 15:32:00 +0000 (15:32 +0000)]
[CMake] Tell libc++ that we're using compiler-rt on Apple platforms

Reviewers: beanz, arphaman, EricWF

Subscribers: dberris, mgorny, jkorous, dexonsmith, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[PR41007][OpenCL] Allow printf in C++ mode.
Anastasia Stulova [Tue, 12 Mar 2019 12:46:56 +0000 (12:46 +0000)]
[PR41007][OpenCL] Allow printf in C++ mode.

As for OpenCL C, we need to allow using printf and toolchain variadic
functions (prefixed by "__") in C++ mode.

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

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

5 years agoRevert "[analyzer] Fix function macro crash"
Kristof Umann [Tue, 12 Mar 2019 11:22:30 +0000 (11:22 +0000)]
Revert "[analyzer] Fix function macro crash"

Buildbot breaks when LLVm is compiled with memory sanitizer.

WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0xa3d16d8 in getMacroNameAndPrintExpansion(blahblah)
                             lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:903:11

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

5 years ago[analyzer] Fix function macro crash
Kristof Umann [Tue, 12 Mar 2019 10:03:32 +0000 (10:03 +0000)]
[analyzer] Fix function macro crash

When there is a functor-like macro which is passed as parameter to another
"function" macro then its parameters are not listed at the place of expansion:

#define foo(x) int bar() { return x; }
#define hello(fvar) fvar(0)
hello(foo)
int main() { 1 / bar(); }

Expansion of hello(foo) asserted Clang, because it expected an l_paren token in
the 3rd line after "foo", since it is a function-like token.

Patch by Tibor Brunner!

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

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

5 years ago[Driver] Support object files in addition to static and shared libraries in compiler-rt
Petr Hosek [Tue, 12 Mar 2019 02:12:48 +0000 (02:12 +0000)]
[Driver] Support object files in addition to static and shared libraries in compiler-rt

This change introduces support for object files in addition to static
and shared libraries which were already supported which requires
changing the type of the argument from boolean to an enum.

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

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

5 years ago[DebugInfo] Add test cases for FlagNonTrivial
Aaron Smith [Tue, 12 Mar 2019 02:00:39 +0000 (02:00 +0000)]
[DebugInfo] Add test cases for FlagNonTrivial

Summary:
This is a test case to go with D44406 which added FlagNonTrivial to mark that a C++ record is non-trivial to support CodeView debug emission.

While it looks like FlagTypePassByValue can imply triviality and FlagTypePassByReference can imply non-triviality that is not true. Some non-trivial cases use a combination of FlagNonTrivial and FlagTypePassByValue instead of FlagTypePassByReference. See the test cases and D44406 for discussion.

Reviewers: dblaikie, rnk, zturner

Reviewed By: dblaikie

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years agoRemove esan.
Nico Weber [Mon, 11 Mar 2019 20:23:40 +0000 (20:23 +0000)]
Remove esan.

It hasn't seen active development in years, and it hasn't reached a
state where it was useful.

Remove the code until someone is interested in working on it again.

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

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

5 years ago[OPENMP]Fix codegen for declare target link in target regions.
Alexey Bataev [Mon, 11 Mar 2019 19:51:42 +0000 (19:51 +0000)]
[OPENMP]Fix codegen for declare target link in target regions.

If the declare target link global is used in the target region
indirectly (used in the inner parallel, teams, etc. regions), we may
miss this variable and it leads to incorrect codegen.

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

5 years ago[clang] Add install targets for API headers
Shoaib Meenai [Mon, 11 Mar 2019 18:53:57 +0000 (18:53 +0000)]
[clang] Add install targets for API headers

Add an install target for clang's API headers, which allows them to be
included in distributions. The install rules already existed, but they
lacked a component and a target, making them only accessible via a full
install. These headers are useful for writing clang-based tooling, for
example. They're the clang equivalent to the llvm-headers target and
complement the clang-libraries target.

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

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

5 years agoclang-format: distinguish ObjC call subexpressions after r355434
Krasimir Georgiev [Mon, 11 Mar 2019 16:02:52 +0000 (16:02 +0000)]
clang-format: distinguish ObjC call subexpressions after r355434

Summary:
The revision r355434 had the unfortunate side-effect that it started to
recognize certain ObjC expressions with a call subexpression followed by a
`a->b` subexpression as C++ lambda expressions.

This patch adds a bit of logic to handle these cases and documents them in
tests.

The commented-out test cases in the new test suite are ones that were
problematic before r355434.

Reviewers: MyDeveloperDay, gribozavr

Reviewed By: MyDeveloperDay, gribozavr

Subscribers: MyDeveloperDay, cfe-commits

Tags: #clang

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

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

5 years agoRemove an unnecessary -f when cp'ing to a file that was just deleted. NFC.
Benjamin Kramer [Mon, 11 Mar 2019 10:44:10 +0000 (10:44 +0000)]
Remove an unnecessary -f when cp'ing to a file that was just deleted. NFC.

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

5 years ago[Serialization] Add missing include
Benjamin Kramer [Mon, 11 Mar 2019 10:30:51 +0000 (10:30 +0000)]
[Serialization] Add missing include

forward decl is not sufficient for destroying a unique_ptr<MemoryBuffer>.

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

5 years agoStop relying on allocator behaviour in modules unit test
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 20:15:01 +0000 (20:15 +0000)]
Stop relying on allocator behaviour in modules unit test

Another fixup for r355778 for Windows bots, this time to stop
accidentally relying on allocator behaviour for the test to pass.

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

5 years agoFix slashes in path references in -Rmodule-import test from r355778
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 19:33:32 +0000 (19:33 +0000)]
Fix slashes in path references in -Rmodule-import test from r355778

Fixup for r355778 to fix all the Windows bots.  Apparently I already
forgot the lesson from r355482 :/.

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

5 years agoModules: Invalidate out-of-date PCMs as they're discovered
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:44:01 +0000 (17:44 +0000)]
Modules: Invalidate out-of-date PCMs as they're discovered

Leverage the InMemoryModuleCache to invalidate a module the first time
it fails to import (and to lock a module as soon as it's built or
imported successfully).  For implicit module builds, this optimizes
importing deep graphs where the leaf module is out-of-date; see example
near the end of the commit message.

Previously the cache finalized ("locked in") all modules imported so far
when starting a new module build.  This was sufficient to prevent
loading two versions of the same module, but was somewhat arbitrary and
hard to reason about.

Now the cache explicitly tracks module state, where each module must be
one of:

- Unknown: module not in the cache (yet).
- Tentative: module in the cache, but not yet fully imported.
- ToBuild: module found on disk could not be imported; need to build.
- Final: module in the cache has been successfully built or imported.

Preventing repeated failed imports avoids variation in builds based on
shifting filesystem state.  Now it's guaranteed that a module is loaded
from disk exactly once.  It now seems safe to remove
FileManager::invalidateCache, but I'm leaving that for a later commit.

The new, precise logic uncovered a pre-existing problem in the cache:
the map key is the module filename, and different contexts use different
filenames for the same PCM file.  (In particular, the test
Modules/relative-import-path.c does not build without this commit.
r223577 started using a relative path to describe a module's base
directory when importing it within another module.  As a result, the
module cache sees an absolute path when (a) building the module or
importing it at the top-level, and a relative path when (b) importing
the module underneath another one.)

The "obvious" fix is to resolve paths using FileManager::getVirtualFile
and change the map key for the cache to a FileEntry, but some contexts
(particularly related to ASTUnit) have a shorter lifetime for their
FileManager than the InMemoryModuleCache.  This is worth pursuing
further in a later commit; perhaps by tying together the FileManager and
InMemoryModuleCache lifetime, or moving the in-memory PCM storage into a
VFS layer.

For now, use the PCM's base directory as-written for constructing the
filename to check the ModuleCache.

Example
=======

To understand the build optimization, first consider the build of a
module graph TU -> A -> B -> C -> D with an empty cache:

    TU builds A'
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

If we build TU again, where A, B, C, and D are in the cache and D is
out-of-date, we would previously get this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A'
       A' imports B
          imports C
          imports D (out-of-date)
          builds B'
          B' imports C
             imports D (out-of-date)
             builds C'
             C' imports D (out-of-date)
                builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
     TU imports A'
        imports B'
        imports C'
        imports D'

After this commit, we'll immediateley invalidate A, B, C, and D when we
first observe that D is out-of-date, giving this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A' // The same graph as an empty cache.
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

The new build matches what we'd naively expect, pretty closely matching
the original build with the empty cache.

rdar://problem/48545366

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

5 years agoModules: Rename MemoryBufferCache to InMemoryModuleCache
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:33:56 +0000 (17:33 +0000)]
Modules: Rename MemoryBufferCache to InMemoryModuleCache

Change MemoryBufferCache to InMemoryModuleCache, moving it from Basic to
Serialization.  Another patch will start using it to manage module build
more explicitly, but this is split out because it's mostly mechanical.

Because of the move to Serialization we can no longer abuse the
Preprocessor to forward it to the ASTReader.  Besides the rename and
file move, that means Preprocessor::Preprocessor has one fewer parameter
and ASTReader::ASTReader has one more.

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

5 years ago[CMake] Support stripping and linking output to .build-id directory
Petr Hosek [Sat, 9 Mar 2019 01:26:55 +0000 (01:26 +0000)]
[CMake] Support stripping and linking output to .build-id directory

When installing runtimes with install-runtimes-stripped, we don't want
to just strip them, we also want to preserve the debugging information
for potential debugging. To make it possible to later find the stripped
debugging information, we want to use the .build-id layout:

https://fedoraproject.org/wiki/RolandMcGrath/BuildID#Find_files_by_build_ID

That is, for libfoo.so with build ID abcdef1234, the debugging information
will be installed into lib/debug/.build-id/ab/cdef1234. llvm-objcopy
already has support for stripping files and linking the debugging
stripped output into the right location. However, CMake doesn't support
customizing strip invocation for the *-stripped targets. So instead, we
replace CMAKE_STRIP with a custom script that invokes llvm-objcopy with
the right command line flags.

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

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

5 years ago[8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments...
Eric Fiselier [Fri, 8 Mar 2019 22:06:48 +0000 (22:06 +0000)]
[8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments, enumerators, case statements, and the enable_if attribute.

Summary:
The following code is accepted by Clang 7 and prior but rejected by the upcoming 8 release and in trunk [1]

```
// error {{never produces a constant expression}}
void foo(const char* s) __attribute__((enable_if(__builtin_constant_p(*s) == false, "trap"))) {}
void test() { foo("abc"); }
```

Prior to Clang 8, the call to `__builtin_constant_p` was a constant expression returning false. Currently, it's not a valid constant expression.

The bug is caused because we failed to set `InConstantContext` when attempting to evaluate unevaluated constant expressions.

[1]  https://godbolt.org/z/ksAjmq

Reviewers: rsmith, hans, sbenza

Reviewed By: rsmith

Subscribers: kristina, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Remove debug service variable.
Alexey Bataev [Fri, 8 Mar 2019 20:48:54 +0000 (20:48 +0000)]
[OPENMP]Remove debug service variable.

Removed not required service variable for the debug info.

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

5 years ago[docs] Fix checkers.rst doc for PointerSorting checker
Mandeep Singh Grang [Fri, 8 Mar 2019 20:35:25 +0000 (20:35 +0000)]
[docs] Fix checkers.rst doc for PointerSorting checker

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

5 years agoRevert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
Matthew Voss [Fri, 8 Mar 2019 20:33:55 +0000 (20:33 +0000)]
Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"

This broke the windows bots.

This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0.

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

5 years agoRevert "Recommit "Support attribute used in member funcs of class templates""
Rafael Auler [Fri, 8 Mar 2019 20:23:57 +0000 (20:23 +0000)]
Revert "Recommit "Support attribute used in member funcs of class templates""

There is nontrivial bug caused in lld that I need to further
investigate. Meanwhile, I'll revert this.

This reverts commit 8297e93480c636dc90fd14653c5a66406193363f.

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

5 years ago[Analyzer] Checker for non-determinism caused by sorting of pointer-like elements
Mandeep Singh Grang [Fri, 8 Mar 2019 20:13:53 +0000 (20:13 +0000)]
[Analyzer] Checker for non-determinism caused by sorting of pointer-like elements

Summary:
Added a new category of checkers for non-determinism. Added a checker for non-determinism
caused due to sorting containers with pointer-like elements.

Reviewers: NoQ, george.karpenkov, whisperity, Szelethus

Reviewed By: NoQ, Szelethus

Subscribers: Charusso, baloghadamsoftware, jdoerfert, donat.nagy, dkrupp, martong, dblaikie, MTC, Szelethus, mgorny, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Fix infinite recursion in printing macros
Kristof Umann [Fri, 8 Mar 2019 16:26:29 +0000 (16:26 +0000)]
[analyzer] Fix infinite recursion in printing macros

In the commited testfile, macro expansion (the one implemented for the plist
output) runs into an infinite recursion. The issue originates from the algorithm
being faulty, as in

#define value REC_MACRO_FUNC(value)

the "value" is being (or at least attempted) expanded from the same macro.

The solved this issue by gathering already visited macros in a set, which does
resolve the crash, but will result in an incorrect macro expansion, that would
preferably be fixed down the line.

Patch by Tibor Brunner!

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

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

5 years ago[analyzer] Emit an error rather than assert on invalid checker option input
Kristof Umann [Fri, 8 Mar 2019 16:00:42 +0000 (16:00 +0000)]
[analyzer] Emit an error rather than assert on invalid checker option input

Asserting on invalid input isn't very nice, hence the patch to emit an error
instead.

This is the first of many patches to overhaul the way we handle checker options.

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

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

5 years ago[analyzer] Use the new infrastructure of expressing taint propagation, NFC
Kristof Umann [Fri, 8 Mar 2019 15:47:56 +0000 (15:47 +0000)]
[analyzer] Use the new infrastructure of expressing taint propagation, NFC

In D55734, we implemented a far more general way of describing taint propagation
rules for functions, like being able to specify an unlimited amount of
source and destination parameters. Previously, we didn't have a particularly
elegant way of expressing the propagation rules for functions that always return
(either through an out-param or return value) a tainted value. In this patch,
we model these functions similarly to other ones, by assigning them a
TaintPropagationRule that describes that they "create a tainted value out of
nothing".

The socket C function is somewhat special, because for certain parameters (for
example, if we supply localhost as parameter), none of the out-params should
be tainted. For this, we added a general solution of being able to specify
custom taint propagation rules through function pointers.

Patch by Gábor Borsik!

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

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

5 years agoUse {{.*}} in test case to match the type of wide string literals.
Akira Hatanaka [Fri, 8 Mar 2019 15:20:12 +0000 (15:20 +0000)]
Use {{.*}} in test case to match the type of wide string literals.

The type of wide string literals varies depending on the target.

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

5 years agoRe-fix _lrotl/_lrotr to always take Long, no matter the platform.
Erich Keane [Fri, 8 Mar 2019 15:10:07 +0000 (15:10 +0000)]
Re-fix _lrotl/_lrotr to always take Long, no matter the platform.

r355322 fixed this, however is being reverted due to concerns with
enabling it in other modes.

Change-Id: I6a939b7469b8fa196d5871a627eb2330dbd30f29

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

5 years agoRevert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."
Erich Keane [Fri, 8 Mar 2019 15:10:05 +0000 (15:10 +0000)]
Revert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."

This reverts commit 24400dafe16716f28cd0e7e5fa6e004c0e50686a.

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

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Fri, 8 Mar 2019 10:44:06 +0000 (10:44 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

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

5 years ago[clang][Index] Fix msan failure
Kadir Cetinkaya [Fri, 8 Mar 2019 10:18:40 +0000 (10:18 +0000)]
[clang][Index] Fix msan failure

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

5 years agoclang-cl : Parse all /d2 options
Hans Wennborg [Fri, 8 Mar 2019 10:00:42 +0000 (10:00 +0000)]
clang-cl : Parse all /d2 options

We will now warn about such options being unused,
which is better than the current
"no such file or directory: '/d2foo'" errors.

Note that we can still handle specific flags separately,
e.g. we were already ignoring /d2FastFail and /d2Zi+

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

5 years ago[clang][Tooling] Delete dots and dotdots when generating absolute paths
Kadir Cetinkaya [Fri, 8 Mar 2019 09:42:04 +0000 (09:42 +0000)]
[clang][Tooling] Delete dots and dotdots when generating absolute paths

Summary:
GetAllFiles interface returns absolute paths, but keeps dots and dot
dots. This patch makes those paths canonical by deleting them.

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd another test for r354937 that came up in PR40890
Hans Wennborg [Fri, 8 Mar 2019 09:01:10 +0000 (09:01 +0000)]
Add another test for r354937 that came up in PR40890

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

5 years ago[clang][Index] Mark references from Constructors and Destructors to class as NameRefe...
Kadir Cetinkaya [Fri, 8 Mar 2019 08:30:20 +0000 (08:30 +0000)]
[clang][Index] Mark references from Constructors and Destructors to class as NameReference

Summary:
In current indexing logic we get references to class itself when we see
a constructor/destructor which is only syntactically true. Semantically
this information is not correct. This patch marks that reference as
NameReference to let clients deal with it.

Reviewers: akyrtzi, gribozavr, nathawes, benlangmuir

Reviewed By: gribozavr, nathawes

Subscribers: nathawes, arphaman, cfe-commits

Tags: #clang

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

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