Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link failures on arm32 all{yes,mod}config after e7a96b0b7d1669e95aa77c007e71e3c88c531cc4 #631

Closed
nathanchance opened this issue Aug 6, 2019 · 8 comments
Assignees
Labels
[ARCH] arm32 This bug impacts ARCH=arm [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 9 This bug was fixed in LLVM 9.0 [FIXED][LLVM] 10 This bug was fixed in LLVM 10.0

Comments

@nathanchance
Copy link
Member

So this is an interesting one...

After commit e7a96b0b7d16 ("pinctrl: aspeed: Add multiple pin group support for functions") in -next, arm all{yes,mod}config builds started failing at link time with a lot of errors like so:

arm-linux-gnueabi-ld: drivers/pinctrl/aspeed/pinctrl-aspeed-g6.o:(.data+0x1088): multiple definition of `sig_exprs_205_GPIOZ5'; drivers/pinctrl/aspeed/pinctrl-aspeed-g4.o:(.data+0x11d4): first defined here
arm-linux-gnueabi-ld: drivers/pinctrl/aspeed/pinctrl-aspeed-g6.o:(.data+0x10a0): multiple definition of `sig_exprs_206_GPIOZ6'; drivers/pinctrl/aspeed/pinctrl-aspeed-g4.o:(.data+0x11f8): first defined here
arm-linux-gnueabi-ld: drivers/pinctrl/aspeed/pinctrl-aspeed-g6.o:(.data+0x10b8): multiple definition of `sig_exprs_207_GPIOZ7'; drivers/pinctrl/aspeed/pinctrl-aspeed-g4.o:(.data+0x121c): first defined here 

This can be easily reproduced on next-20190806 and this patch (the KCFLAGS= is needed for an unrelated issue that I will try to deal with shortly):

$ make -s -j$(nproc) ARCH=arm CC=clang CROSS_COMPILE=arm-linux-gnueabi- KCFLAGS="-Wno-error=incompatible-pointer-types" O=out distclean allmodconfig vmlinux

This issue is not present with GCC. Dumping the symbol tables shows that GCC keeps the symbols local whereas Clang makes them global.

$ rg sig_exprs_20 ${TMP}
/tmp/tmp.39vwqYENfC/gcc-pinctrl-aspeed-g6.syms
2362:00001354 d sig_exprs_200_GPIOZ0
2363:0000135c d sig_exprs_200_SPI1CS1
2364:00001334 d sig_exprs_201_GPIOZ1
2365:0000133c d sig_exprs_201_SPI1ABR
2366:00001314 d sig_exprs_202_GPIOZ2
2367:0000131c d sig_exprs_202_SPI1WP
2368:000012f4 d sig_exprs_203_GPIOZ3
2369:000012fc d sig_exprs_203_SPI1CK
2370:000012d8 d sig_exprs_204_GPIOZ4
2371:000012e0 d sig_exprs_204_SPI1MOSI
2372:000012bc d sig_exprs_205_GPIOZ5
2373:000012c4 d sig_exprs_205_SPI1MISO
2374:00001298 d sig_exprs_206_GPIOZ6
2375:000012a8 d sig_exprs_206_SPI1DQ2
2376:000012a0 d sig_exprs_206_TXD13
2377:00001270 d sig_exprs_207_GPIOZ7
2378:00001278 d sig_exprs_207_RXD13
2379:00001280 d sig_exprs_207_SPI1DQ3
2380:00001238 d sig_exprs_208_GPIO18A0
2381:00001248 d sig_exprs_208_RGMII1TXCK
2382:00001240 d sig_exprs_208_RMII1RCLKO
2383:00001210 d sig_exprs_209_GPIO18A1
2384:00001220 d sig_exprs_209_RGMII1TXCTL
2385:00001218 d sig_exprs_209_RMII1TXEN
2386:00002e90 d sig_exprs_20_GPIOC4
2387:00002e98 d sig_exprs_20_RGMII3TXD2

/tmp/tmp.39vwqYENfC/clang-pinctrl-aspeed-g6.syms
2362:00001038 D sig_exprs_200_GPIOZ0
2363:00001030 D sig_exprs_200_SPI1CS1
2364:00001048 D sig_exprs_201_GPIOZ1
2365:00001040 D sig_exprs_201_SPI1ABR
2366:00001058 D sig_exprs_202_GPIOZ2
2367:00001050 D sig_exprs_202_SPI1WP
2368:00001068 D sig_exprs_203_GPIOZ3
2369:00001060 D sig_exprs_203_SPI1CK
2370:00001078 D sig_exprs_204_GPIOZ4
2371:00001070 D sig_exprs_204_SPI1MOSI
2372:00001088 D sig_exprs_205_GPIOZ5
2373:00001080 D sig_exprs_205_SPI1MISO
2374:000010a0 D sig_exprs_206_GPIOZ6
2375:00001090 D sig_exprs_206_SPI1DQ2
2376:00001098 D sig_exprs_206_TXD13
2377:000010b8 D sig_exprs_207_GPIOZ7
2378:000010b0 D sig_exprs_207_RXD13
2379:000010a8 D sig_exprs_207_SPI1DQ3
2380:000010d0 D sig_exprs_208_GPIO18A0
2381:000010c0 D sig_exprs_208_RGMII1TXCK
2382:000010c8 D sig_exprs_208_RMII1RCLKO
2383:000010e8 D sig_exprs_209_GPIO18A1
2384:000010d8 D sig_exprs_209_RGMII1TXCTL
2385:000010e0 D sig_exprs_209_RMII1TXEN
2386:000001e8 D sig_exprs_20_GPIOC4
2387:000001e0 D sig_exprs_20_RGMII3TXD2

That commit is a handful to take in but it looks like this is the problematic section according to creduce:

/**
 * Create an expression symbol alias from (signal, group) to (pin, signal).
 *
 * @pin: The pin number
 * @sig: The signal name
 * @group: The name of the group of which the pin is a member that is
 *         associated with the function's signal
 *
 * Using an alias in this way enables detection of copy/paste errors (defining
 * the signal for a group multiple times) whilst enabling multiple pin groups
 * to exist for a signal without intrusive side-effects on defining the list of
 * signals available on a pin.
 */
#define SIG_EXPR_LIST_ALIAS(pin, sig, group) \
	static const struct aspeed_sig_expr *\
		SIG_EXPR_LIST_SYM(pin, sig)[ARRAY_SIZE(SIG_EXPR_LIST_SYM(sig, group))] \
		__attribute__((alias(istringify(SIG_EXPR_LIST_SYM(sig, group)))))

which spits out:

$ cat test.i
a, b = &a;
static c[0] __attribute__((alias("b")));
d = c;

$ arm-linux-gnueabi-gcc -O2 -c -o test.o test.i
...

$ arm-linux-gnueabi-nm test.o
00000004 C a
00000004 D b
00000004 d c
00000000 D d

$ clang -O2 -no-integrated-as --target=arm-linux-gnueabi --prefix=/home/nathan/cbl/usr/bin/ --gcc-toolchain=/home/nathan/cbl/usr -c -o test.o test.i
...

$ arm-linux-gnueabi-nm test.o
00000004 C a
00000000 D b
00000000 D c
00000004 D d

Interestingness test and full files available here.

@nathanchance nathanchance added [BUG] Untriaged Something isn't working [ARCH] arm32 This bug impacts ARCH=arm labels Aug 6, 2019
@nickdesaulniers
Copy link
Member

So it looks like static and __attribute__((alias("")) is busted in Clang; I swear I've heard this issue before.

@nathanchance
Copy link
Member Author

nathanchance commented Aug 7, 2019

https://llvm.org/pr42377

@nickdesaulniers nickdesaulniers added [BUG] llvm A bug that should be fixed in upstream LLVM and removed [BUG] Untriaged Something isn't working labels Aug 7, 2019
@ihalip
Copy link

ihalip commented Aug 14, 2019

I think this happens because in clang all aliases are created with ExternalLinkage. Changing this line to use InternalLinkage instead, I can see that the output symbol is local, as expected.

It's obvious to me some checks need to be added to select the right linkage type.

@nickdesaulniers nickdesaulniers self-assigned this Aug 20, 2019
@nickdesaulniers
Copy link
Member

@nickdesaulniers nickdesaulniers added the [PATCH] Submitted A patch has been submitted for review label Aug 20, 2019
@nathanchance
Copy link
Member Author

That patch fixes this issue and (tentatively, haven't done a full run) doesn't introduce any immediately apparent regressions, thanks!

llvm-git-migration pushed a commit to llvm/llvm-project that referenced this issue Aug 22, 2019
Summary:
It seems that CodeGen was always using ExternalLinkage when emitting a
GlobalDecl with __attribute__((alias)). This leads to symbol
redefinitions (ODR) that cause failures at link time for static aliases.
This is readily attempting to link an ARM (32b) allyesconfig Linux
kernel built with Clang.

Reported-by: nathanchance
Suggested-by: ihalip
Link: https://bugs.llvm.org/show_bug.cgi?id=42377
Link: ClangBuiltLinux/linux#631

Reviewers: rsmith, aaron.ballman, erichkeane

Reviewed By: aaron.ballman

Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance

Tags: #clang

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

llvm-svn: 369705
@nickdesaulniers
Copy link
Member

@nickdesaulniers nickdesaulniers added [FIXED][LLVM] 10 This bug was fixed in LLVM 10.0 and removed [PATCH] Submitted A patch has been submitted for review labels Aug 22, 2019
spurious pushed a commit to spurious/clang-mirror that referenced this issue Aug 22, 2019
Summary:
It seems that CodeGen was always using ExternalLinkage when emitting a
GlobalDecl with __attribute__((alias)). This leads to symbol
redefinitions (ODR) that cause failures at link time for static aliases.
This is readily attempting to link an ARM (32b) allyesconfig Linux
kernel built with Clang.

Reported-by: nathanchance
Suggested-by: ihalip
Link: https://bugs.llvm.org/show_bug.cgi?id=42377
Link: ClangBuiltLinux/linux#631

Reviewers: rsmith, aaron.ballman, erichkeane

Reviewed By: aaron.ballman

Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance

Tags: #clang

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

git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@369705 91177308-0d34-0410-b5e6-96231b3b80d8
chisuhua added a commit to chisuhua/clang that referenced this issue Sep 1, 2019
* Test commit #2.

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

* Fix the test, NFC.

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

* Allow standards-based attributes to have leading and trailing underscores.

This gives library implementers a way to use standards-based attributes that do not conflict with user-defined macros of the same name. Attributes in C2x require this behavior normatively (C2x 6.7.11p4), but there's no reason to not have the same behavior in C++, especially given that such attributes may be used by a C library consumed by a C++ compilation.

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

* Rename this file from cx2.c to c2x.c; NFC.

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

* [WebAssembly] Correctly handle va_arg of zero-sized structures

Summary:
D66168 passes size 0 structs indirectly, while the wasm backend expects it to
be passed directly. This causes subsequent variadic arguments to be read
incorrectly.

This diff changes it so that size 0 structs are passed directly.

Reviewers: dschuff, tlively, sbc100

Reviewed By: dschuff

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

Tags: #clang

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

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

* [Sema] Implement DR2386 for C++17 structured binding

Allow implementations to provide complete definitions of
std::tuple_size<T>, but to omit the 'value' member to signal that T is
not tuple-like. The Microsoft standard library implements
std::tuple_size<const T> this way.

If the value member exists, clang still validates that it is an ICE, but
if it does not, then the type is considered to not be tuple-like.

Fixes PR33236

Reviewers: rsmith

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

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

* Mark the test as unsupported on darwin, NFC.

The bundler may fail on darwin, mark the test as not compatible.

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

* [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug

I'd like to add these comments to warn others of problems I
encountered when trying to use `RemoveLineIfEmpty`.  I originally
tried to fix the problem, but I realized I could implement the
functionality more easily and efficiently in my calling code where I
can make the simplifying assumption that there are no prior edits to
the line from which text is being removed.  While I've lost the
motivation to write a fix, which doesn't look easy, I figure a warning
to others is better than silence.

I've added a unit test to demonstrate the problem.  I don't know how
to mark it as an expected failure, so I just marked it disabled.

Reviewed By: jkorous

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

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

* [analyzer] Analysis: Silence checkers

Summary:
This patch introduces a new `analyzer-config` configuration:
`-analyzer-config silence-checkers`
which could be used to silence the given checkers.

It accepts a semicolon separated list, packed into quotation marks, e.g:
`-analyzer-config silence-checkers="core.DivideZero;core.NullDereference"`

It could be used to "disable" core checkers, so they model the analysis as
before, just if some of them are too noisy it prevents to emit reports.

This patch also adds support for that new option to the scan-build.
Passing the option `-disable-checker core.DivideZero` to the scan-build
will be transferred to `-analyzer-config silence-checkers=core.DivideZero`.

Reviewed By: NoQ, Szelethus

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

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

* [RISCV] Add inline asm constraint A for RISC-V

This allows the constraint A to be used in inline asm for RISC-V, which
allows an address held in a register to be used.

This patch adds the minimal amount of code required to get operands with
the right constraints to compile.

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



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

* [ASTImporter] Import ctor initializers after setting flags.

Summary:
Code to import "ctor initializers" at import of functions
is moved to be after the flags in the newly created function
are imported. This fixes an error when the already created but
incomplete (flags are not set) function declaration is accessed.

Reviewers: martong, shafik, a_sidorin, a.sidorin

Reviewed By: shafik

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

Tags: #clang

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

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

* Fix typos in LibASTImporter.rst

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

* Stop abusing SuppressAllDiagnostics when speculatively determining
whether an expression would be valid during error recovery.

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

* [OPENMP5.0]Diagnose global variables in lambda not marked as declare
target.

According to OpenMP 5.0, if a lambda declaration and definition appears between a declare target directive and the matching end declare target directive, all variables that are captured by the lambda expression must also appear in a to clause.

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

* [ARM] push LR before __gnu_mcount_nc

Push LR register before calling __gnu_mcount_nc as it expects the value of LR register to be the top value of
the stack on ARM32.

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

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

* [Test Commit] Fix typo in diagtool.rst

Test commit after obtaining commit access.

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

* Revert "[ARM] push LR before __gnu_mcount_nc"

This reverts commit f4cf3b959333f62b7a7b2d7771f7010c9d8da388.

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

* [X86] Support -mlong-double-80

Add an option group for all of the -mlong-double-* options and make
-mlong-double-80 restore the default long double behavior for X86.  The
motivations are that GNU accepts the -mlong-double-80 option and that complex
Makefiles often need a way of undoing earlier options. Prior to this commit, if
one chooses 64-bit or 128-bit long double for X86, there is no way to undo that
choice and restore the 80-bit behavior.

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

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

* [clang-format] Fix the bug that joins template closer and > or >>

Also fixes a buggy test case.

See PR42404

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

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

* [doc] Fix some minor formatting issues.

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

* Revert "[X86] Support -mlong-double-80"

This reverts commit 250aafa2c4a1bc2395edfe8d4365545bbe56fffe.
Caused buildbot failures -- still investigating.

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

* Reland "[ARM] push LR before __gnu_mcount_nc"

This relands r369147 with fixes to unit tests.

https://reviews.llvm.org/D65019

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

* [X86] Support -mlong-double-80

Add an option group for all of the -mlong-double-* options and make
-mlong-double-80 restore the default long double behavior for X86.  The
motivations are that GNU accepts the -mlong-double-80 option and that complex
Makefiles often need a way of undoing earlier options. Prior to this commit, if
one chooses 64-bit or 128-bit long double for X86, there is no way to undo that
choice and restore the 80-bit behavior.

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

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

* [analyzer] Turn an assert into an if condition

Shocker, turns out that terminator conditions that are binary operators
aren't always logical operators.

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

* [SemaDeclCXX] Allow inheriting constructor declaration to specify a cv-qualified type

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

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

* [Diagnostics] Improve -Wsizeof-pointer-div

Emit diag note with a location of pointer declaration.
Revisited/added tests.



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

* [clang-format] Fix a bug that joins template closer and =

Also fixes the documentation for SpaceBeforeAssignmentOperators.

See discussions at https://reviews.llvm.org/D66332

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

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

* [Diagnostics] Diagnose misused xor as pow

Summary:
Motivation:
https://twitter.com/jfbastien/status/1139298419988549632
https://twitter.com/mikemx7f/status/1139335901790625793
https://codesearch.isocpp.org/cgi-bin/cgi_ppsearch?q=10+%5E&search=Search

Reviewers: jfb, rsmith, regehr, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: lebedev.ri, Quuxplusone, erik.pilkington, riccibruno, dexonsmith, cfe-commits

Tags: #clang

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

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

* [OpenCL] Fix addr space deduction for pointers/references to arrays.

Rewrite the logic for detecting if we are deducing addr space of
a pointee type to take into account special logic for arrays. For
pointers/references to arrays we can have any number of parentheses
expressions as well as nested pointers.

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



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

* [OpenCL] Add generic type handling for builtin functions

Generic types are an abstraction of type sets.  It mimics the way
functions are defined in the OpenCL specification.  For example,
floatN can abstract all the vector sizes of the float type.

This allows to
 * stick more closely to the specification, which uses generic types;
 * factorize definitions of functions with numerous prototypes in the
   tablegen file; and
 * reduce the memory impact of functions with many overloads.

Patch by Pierre Gondois and Sven van Haastregt.

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

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

* Don't keep stale pointers to LoopInfos.

CGLoopInfo was keeping pointers to parent loop LoopInfos, but when the loop info vector grew, it reallocated the storage and invalidated all of the parent pointers, causing use-after-free. Manage the lifetimes of the LoopInfos separately so that the pointers aren't stale.

Patch by Bevin Hansson.

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

* Implement P1668R1

Allow inline assembly statements in unexecuted branches of constexpr
functions.

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

* Update cxx_status.html with P1668 status.

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

* Fix test where diagnostics changed in P1668 implementation

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

* Fix poorly formatted HTML in the cxx_status.html file caused by adding
1668.

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

* [Support][Time profiler] Make FE codegen blocks to be inside frontend blocks

Summary:
Add `Frontend` time trace entry to `HandleTranslationUnit()` function.
Add test to check all codegen blocks are inside frontend blocks.
Also, change `--time-trace-granularity` option a bit to make sure very small
time blocks are outputed to json-file when using `--time-trace-granularity=0`.

This fixes http://llvm.org/pr41969

Reviewers: russell.gallop, lebedev.ri, thakis

Reviewed By: russell.gallop

Subscribers: vsapsai, aras-p, lebedev.ri, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

* [analyzer] NFC: Drop support for extra text attached to bug reports.

It was introduced in 2011 but never used since then.

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

* [analyzer] NFC: Rename GRBugReporter to PathSensitiveBugReporter.

The GR prefix is super ancient.

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

* [CallGraph] Take into accound calls that aren't within any function bodies.

This patch improves Clang call graph analysis by adding in expressions
that are not found in regular function bodies, such as default arguments
or member initializers.

Patch by Joshua Cranmer!

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

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

* Rudimentary support for Doxygen \retval command

...so that at least a preceding \param etc. that lacks a description gets a
-Wdocumentation warning (instead of erroneously treating the \retval ... text as
its paragraph).

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

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

* [OpenCL] Add const, volatile and pointer builtin handling

Const, volatile, and pointer types were previously available, but not
working.  This patch adds handling for OpenCL builtin functions.

Add TableGen definitions for some atomic and asynchronous builtins to
make use of the new functionality.

Patch by Pierre Gondois and Sven van Haastregt.

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

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

* Removed the 'id' AST matcher, which is superseded by '.bind()'

Summary:
The 'id' matcher is not even included in the AST Matchers Reference
document, so I don't expect there to be a significant number of users.

There's no reason to provide two ways to do the exact same thing that
only have a minor syntactic difference.

Subscribers: cfe-commits

Tags: #clang

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

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

* [Syntax] Added function to get macro expansion tokens to TokenBuffer.

Summary:
Returns the first token in every mapping where the token is an identifier.
This API is required to be able to highlight macro expansions in clangd.

Reviewers: hokein, ilya-biryukov

Subscribers: kadircet, cfe-commits

Tags: #clang

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

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

* [clang] Use the new Regex::isValid() with no parameter

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


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

* win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update 3 or newer

MSVC 2017 update 3 (_MSC_VER 1911) enables /Zc:twoPhase by default, and
so should clang-cl:
https://docs.microsoft.com/en-us/cpp/build/reference/zc-twophase

clang-cl takes the MSVC version it emulates from the -fmsc-version flag,
or if that's not passed it tries to check what the installed version of
MSVC is and uses that, and failing that it uses a default version that's
currently 1911. So this changes the default if no -fmsc-version flag is
passed and no installed MSVC is detected. (It also changes the default
if -fmsc-version is passed or MSVC is detected, and either indicates
_MSC_VER >= 1911.)

As mentioned in the MSDN article, the Windows SDK header files in
version 10.0.15063.0 (Creators Update or Redstone 2) and earlier
versions do not work correctly with /Zc:twoPhase. If you need to use
these old SDKs with a new clang-cl, explicitly pass /Zc:twoPhase- to get
the old behavior.

Fixes PR43032.

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

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

* [LifetimeAnalysis] Add support for free functions

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

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

* [Attr] Support _attribute__ ((fallthrough))

Summary: Fixed extraneous matches of non-NullStmt

Reviewers: aaron.ballman, rsmith, efriedma, xbolva00

Reviewed By: aaron.ballman, rsmith, xbolva00

Subscribers: riccibruno, arphaman, ziangwan, ojeda, xbolva00, nickdesaulniers, cfe-commits

Tags: #clang

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

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

* Fix name of the error message, NFC.

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

* [Sema][Typo] Fix assertion failure for expressions with multiple typos

Summary:
As Typo Resolution can create new TypoExprs while resolving typos,
it is necessary to recurse through the expression to search for more
typos.

This should fix the assertion failure in `clang::Sema::~Sema()`:
  `DelayedTypos.empty() && "Uncorrected typos!"`

Notes:
- In case some TypoExprs are created but thrown away, Sema
  now has a Vector that is used to keep track of newly created
  typos.
- For expressions with multiple typos, we only give suggestions
  if we are able to resolve all typos in the expression
- This patch is similar to D37521 except that it does not eagerly
  commit to a correction for the first typo in the expression.
  Instead, it will search for corrections which fix all of the
  typos in the expression.

Subscribers: cfe-commits

Tags: #clang

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

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

* [OPENMP]Fix delayed diagnostics for standalone declare target directive.

If the function is marked as declare target in a standalone directive,
the delayed diagnostics is not emitted. Patch fixes this problem.

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

* [NewPM] Run ubsan-coroutines test under the legacy pass manager only

The passes that lower the llvm.coro.* instrinsics have not yet been ported,
so only run under the legacy PM for now.

See https://bugs.llvm.org/show_bug.cgi?id=42867

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

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

* [analyzer] Improve VirtualCallChecker and enable parts of it by default.

Calling a pure virtual method during construction or destruction
is undefined behavior. It's worth it to warn about it by default.
That part is now known as the cplusplus.PureVirtualCall checker.

Calling a normal virtual method during construction or destruction
may be fine, but does behave unexpectedly, as it skips virtual dispatch.
Do not warn about this by default, but let projects opt in into it
by enabling the optin.cplusplus.VirtualCall checker manually.

Give the two parts differentiated warning text:

  Before:

    Call to virtual function during construction or destruction:
    Call to pure virtual function during construction

    Call to virtual function during construction or destruction:
    Call to virtual function during destruction

  After:

    Pure virtual method call:
    Call to pure virtual method 'X::foo' during construction
        has undefined behavior

    Unexpected loss of virtual dispatch:
    Call to virtual method 'Y::bar' during construction
        bypasses virtual dispatch

Also fix checker names in consumers that support them (eg., clang-tidy)
because we now have different checker names for pure virtual calls and
regular virtual calls.

Also fix capitalization in the bug category.

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

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

* [analyzer] Fix a crash when destroying a non-region.

Add defensive check that prevents a crash when we try to evaluate a destructor
whose this-value is a concrete integer that isn't a null.

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

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

* [analyzer] NFC: Remove the BugTypes set from BugReporter.

Its only purpose was to avoid a bug that's caused by
making a virtual call in BugReporter's destructor.

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

* [DebugInfo] Add debug location to dynamic atexit destructor

Fixes PR43012

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

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

* Add triple to new test to try to pacify bots

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

* [PPC Docs] Remove duplicate info about __builtin_setrnd()

This looks like a combination of a copy-and-paste (and paste and paste)
error and a commit without reviewing the diff first error.

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

* Removed some dead code in BugReporter and related files

Subscribers: cfe-commits

Tags: #clang

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

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

* clang: Fix typo in comment

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

* clang: Fix typo in comment

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

* clang: Fix typo in comment

(Sorry for all these commits; trying to sort out why svn doesn't want to store
my password.)

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

* clang: Fix typo in comment

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

* [LTO] Always mark regular LTO units with EnableSplitLTOUnit=1 under the new pass manager

Match the behavior of D65009 under the new pass manager. This addresses
the test clang/test/CodeGen/split-lto-unit.c when running under the new
PM.

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

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

* [analyzer] Mention whether an event is about a condition in a bug report part 1

Can't add much more to the title! This is part 1, the case where the collapse
point isn't in the condition point is the responsibility of ConditionBRVisitor,
which I'm addressing in part 2.

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

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

* Use C++14 heteregenous lookup for a couple of std::map<std::string, ...>

These call find with a StringRef, heterogenous lookup saves a temporary
std::string there.

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

* [analyzer][NFC] Add different interestingness kinds

We defined (on the mailing list and here on phabricator) 2 different cases where
retrieving information about a control dependency condition is very important:

* When the condition's last write happened in a different stack frame
* When the collapse point of the condition (when we can constrain it to be
true/false) didn't happen in the actual condition.

It seems like we solved this problem with the help of expression value tracking,
and have started working on better diagnostics notes about this process.

Expression value tracking is nothing more than registering a variety of visitors
to construct reports about it. Each of the registered visitors (ReturnVisitor,
FindLastStoreVisitor, NoStoreFuncVisitor, etc) have something to go by: a
MemRegion, an SVal, an ExplodedNode, etc. For this reason, better explaining a
last write is super simple, we can always just pass on some more information to
the visitor in question (as seen in D65575).

ConditionBRVisitor is a different beast, as it was built for a different
purpose. It is responsible for constructing events at, well, conditions, and is
registered only once, and isn't a part of the "expression value tracking
family". Unfortunately, it is also the visitor to tinker with for constructing
better diagnostics about the collapse point problem.

This creates a need for alternative way to communicate with ConditionBRVisitor
that a specific condition is being tracked for for the reason of being a control
dependency. Since at almost all PathDiagnosticEventPiece construction the
visitor checks interestingness, it makes sense to pair interestingness with a
reason as to why we marked an entity as such.

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

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

* NFCI: Simplify SourceManager::translateFile by removing code path that should never be taken

I noticed that SourceManager::translateFile has code that doesn't really make sense.
In particular, if it fails to find a FileID by comparing FileEntry * values, it tries to
look through files that have the same filename, to see if they have a matching inode to try to
find the right FileID. However, the inode comparison seem redundant, as Clang's FileManager
already deduplicates FileEntry * values by inode.
Thus the comparisons between inodes should never actually succeed, and the comparison between FileEntry * values should be sufficient here.

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

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

* [analyzer] Don't make ConditionBRVisitor events prunable when the condition is an interesting field

Exactly what it says on the tin! Note that we're talking about interestingness
in general, hence this isn't a control-dependency-tracking specific patch.

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

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

* [LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)

Summary:
This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator
on the template is a DependentNameType - we can only put the gsl::Pointer attribute
on the underlaying record after instantiation)

inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared,
we added the gsl::Pointer on the canonical decl (the forward decl), and later when the
template was instantiated, there was no attribute on the definition so it was not instantiated).

and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to
a incomplete instantiation, and then another was copied from the template definition
when the instantiation was completed).

We now add the attributes to all redeclarations to fix thos issues and make their usage easier.

Reviewers: gribozavr

Subscribers: Szelethus, xazax.hun, cfe-commits

Tags: #clang

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

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

* [analyzer] Mention whether an event is about a condition in a bug report part 2

In D65724, I do a pretty thorough explanation about how I'm solving this
problem, I think that summary nails whats happening here ;)

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

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

* [analyzer] TrackConstraintBRVisitor: Do not track unknown values

Summary: -

Reviewers: NoQ, Szelethus

Reviewed By: NoQ, Szelethus

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

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

* [analyzer] CastValueChecker: Store the dynamic types and casts

Summary:
This patch introduces `DynamicCastInfo` similar to `DynamicTypeInfo` which
is stored in `CastSets` which are storing the dynamic cast informations of
objects based on memory regions. It could be used to store and check the
casts and prevent infeasible paths.

Reviewed By: NoQ

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

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

* [analyzer] CastValueChecker: Rewrite dead header hotfix

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

* [analyzer] CastValueChecker: Try to fix the buildbots

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

* [analyzer] Don't track the condition of foreach loops

As discussed on the mailing list, notes originating from the tracking of foreach
loop conditions are always meaningless.

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

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

* [analyzer] CastValueChecker: Model isa(), isa_and_nonnull()

Summary: -

Reviewed By: NoQ

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

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

* [analyzer] Enable control dependency condition tracking by default

This patch concludes my GSoC'19 project by enabling track-conditions by default.

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

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

* [OpenMP] Permit map with DSA on combined directive

For `map`, the following restriction changed in OpenMP 5.0:

* OpenMP 4.5 [2.15.5.1, Restrictions]: "A list item cannot appear in
  both a map clause and a data-sharing attribute clause on the same
  construct.

* OpenMP 5.0 [2.19.7.1, Restrictions]: "A list item cannot appear in
  both a map clause and a data-sharing attribute clause on the same
  construct unless the construct is a combined construct."

This patch removes this restriction in the case of combined constructs
and OpenMP 5.0, and it updates Sema not to capture a scalar by copy in
the target region when `firstprivate` and `map` appear for that scalar
on a combined target construct.

This patch also adds a fixme to a test that now reveals that a
diagnostic about loop iteration variables is dropped in the case of
OpenMP 5.0.  That bug exists regardless of this patch's changes.

Reviewed By: ABataev, jdoerfert, hfinkel, kkwli0

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

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

* Remove an unused function, suppress -Wunused-function warning.

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

* Revert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"

It causes the build to fail with

"inlinable function call in a function with debug info must have a !dbg location"

in Chromium. See llvm-commits thread for more info.

(This also reverts the follow-up in r369474.)

> Fixes PR43012
>
> Differential Revision: https://reviews.llvm.org/D66328

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

* [OpenCL] Fix declaration of enqueue_marker

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


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

* Revert r369402 "win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update 3 or newer"

This broke compiling some ASan tests with never versions of MSVC/the Win
SDK, see https://crbug.com/996675

> MSVC 2017 update 3 (_MSC_VER 1911) enables /Zc:twoPhase by default, and
> so should clang-cl:
> https://docs.microsoft.com/en-us/cpp/build/reference/zc-twophase
>
> clang-cl takes the MSVC version it emulates from the -fmsc-version flag,
> or if that's not passed it tries to check what the installed version of
> MSVC is and uses that, and failing that it uses a default version that's
> currently 1911. So this changes the default if no -fmsc-version flag is
> passed and no installed MSVC is detected. (It also changes the default
> if -fmsc-version is passed or MSVC is detected, and either indicates
> _MSC_VER >= 1911.)
>
> As mentioned in the MSDN article, the Windows SDK header files in
> version 10.0.15063.0 (Creators Update or Redstone 2) and earlier
> versions do not work correctly with /Zc:twoPhase. If you need to use
> these old SDKs with a new clang-cl, explicitly pass /Zc:twoPhase- to get
> the old behavior.
>
> Fixes PR43032.
>
> Differential Revision: https://reviews.llvm.org/D66394

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

* [OPENMP]Generalization of handling of declare target attribute.

Used OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration instead of
direct checking of the OMPDeclareTargetDeclAttr attribute.

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

* Retire llvm::less_ptr. llvm::deref is much more flexible.

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

* Revert "[LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)"

This reverts commit r369591, because it causes the formerly-reliable
-Wreturn-stack-address warning to start issuing false positives.
Testcase provided on the commit thread.

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

* Introduce FileEntryRef and use it when handling includes to report correct dependencies
when the FileManager is reused across invocations

This commit introduces a parallel API to FileManager's getFile: getFileEntryRef, which returns
a reference to the FileEntry, and the name that was used to access the file. In the case of
a VFS with 'use-external-names', the FileEntyRef contains the external name of the file,
not the filename that was used to access it.

The new API is adopted only in the HeaderSearch and Preprocessor for include file lookup, so that the
accessed path can be propagated to SourceManager's FileInfo. SourceManager's FileInfo now can report this accessed path, using
the new getName method. This API is then adopted in the dependency collector, which now correctly reports dependencies when a file
is included both using a symlink and a real path in the case when the FileManager is reused across multiple Preprocessor invocations.

Note that this patch does not fix all dependency collector issues, as the same problem is still present in other cases when dependencies
are obtained using FileSkipped, InclusionDirective, and HasInclude. This will be fixed in follow-up commits.

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

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

* Implement nullPointerConstant() using a better API.

Instead of manually attempting to identify whether something is a null pointer constant, use Expr::isNullPointerConstant().

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

* Fix the nullPointerConstant() test to get bots back to green.

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

* Improve the documentation for OpenCL vector types.

This fixes some minor grammatical issues I noticed when reading the docs, and changes the recommended feature testing approach to use __has_attribute instead of __has_extension.

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

* Disable the ScanDepsReuseFilemanager test on Windows

Right now it fails.
I'm going to investigate it and fix it in follow-up commits.

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

* IR. Change strip* family of functions to not look through aliases.

I noticed another instance of the issue where references to aliases were
being replaced with aliasees, this time in InstCombine. In the instance that
I saw it turned out to be only a QoI issue (a symbol ended up being missing
from the symbol table due to the last reference to the alias being removed,
preventing HWASAN from symbolizing a global reference), but it could easily
have manifested as incorrect behaviour.

Since this is the third such issue encountered (previously: D65118, D65314)
it seems to be time to address this common error/QoI issue once and for all
and make the strip* family of functions not look through aliases.

Includes a test for the specific issue that I saw, but no doubt there are
other similar bugs fixed here.

As with D65118 this has been tested to make sure that the optimization isn't
load bearing. I built Clang, Chromium for Linux, Android and Windows as well
as the test-suite and there were no size regressions.

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

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

* [Clang][CodeGen] set alias linkage on QualType

Summary:
It seems that CodeGen was always using ExternalLinkage when emitting a
GlobalDecl with __attribute__((alias)). This leads to symbol
redefinitions (ODR) that cause failures at link time for static aliases.
This is readily attempting to link an ARM (32b) allyesconfig Linux
kernel built with Clang.

Reported-by: nathanchance
Suggested-by: ihalip
Link: https://bugs.llvm.org/show_bug.cgi?id=42377
Link: https://github.com/ClangBuiltLinux/linux/issues/631

Reviewers: rsmith, aaron.ballman, erichkeane

Reviewed By: aaron.ballman

Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance

Tags: #clang

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

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

* [Bugfix] fix r369705 unit test

Summary:
Aliases aren't supported on OSX.  Add a GNU target triple.

Reported-by: leonardchan
Reported-by: erik.pilkington

Reviewers: leonardchan, erik.pilkington

Reviewed By: leonardchan, erik.pilkington

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

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

* [libclang][NFC] Remove debug comment

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

* [clang][ifs] New interface stubs format (llvm triple based).

After posting llvm-ifs on phabricator, I made some progress in hardening up how
I think the format for Interface Stubs should look. There are a number of
things I think the TBE format was missing (no endianness, no info about the
Object Format because it assumes ELF), so I have added those and broken off
from being as similar to the TBE schema. In a subsequent commit I can drop the
other formats.

An example of how The format will look is as follows:

--- !experimental-ifs-v1
IfsVersion: 1.0
Triple: x86_64-unknown-linux-gnu
ObjectFileFormat: ELF
Symbols:
  _Z9nothiddenv: { Type: Func }
  _Z10cmdVisiblev: { Type: Func }
...

The format is still marked experimental.

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


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

* [clang][ifs] Dropping older experimental interface stub formats.

I've been working on a new tool, llvm-ifs, for merging interface stub files
generated by clang and I've iterated on my derivative format of TBE to a newer
format. llvm-ifs will only support the new format, so I am going to drop the
older experimental interface stubs formats in this commit to make things
simpler.

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


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

* PR42587: diagnose unexpanded uses of a pack parameter of a generic
lambda from within the lambda-declarator.

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

* Revert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" due to buildbot breakage.

This reverts commit r369722.

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

* [analyzer] DynamicTypeInfo: Avoid putting null regions into dynamic typemap.

Fixes a crash.

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

* [analyzer] CastValueChecker: Avoid modeling casts between objects.

Our method only works correctly when casting a pointer to a pointer
or a reference to a reference.

Fixes a crash.

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

* [analyzer] CastValueChecker: Provide DynamicTypeMap with pointer types only.

The idea to drop this requirement is good, but for now every other user
of DynamicTypeInfo expects pointer types.

Fixes a crash.

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

* [analyzer] CastValueChecker: Correctly model results of based-to-derived casts.

Our SVal hierarchy doesn't allow modeling pointer casts as no-op. The
pointer type is instead encoded into the pointer object. Defer to our
usual pointer casting facility, SValBuilder::evalBinOp().

Fixes a crash.

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

* [clang-format] Recognize ECMAScript module .mjs as JavaScript

PR43085.

Recognize .mjs files as JavaScript. .mjs is the extension for ECMAScript modules.
A specific extension (and associated content type javascript/esm) is
introduced to differentiate it from CommonJS modules and solve some
interoperability problems.

Differential Revision: https://reviews.llvm.org/D66584
Patch by Fergal Daly

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

* [Docs][OpenCL] Several corrections to C++ for OpenCL

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



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

* clang-format: Disable across-block include reordering.

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

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

* [analyzer] Avoid unnecessary enum range check on LValueToRValue casts

Summary: EnumCastOutOfRangeChecker should not perform enum range checks on LValueToRValue casts, since this type of cast does not actually change the underlying type.   Performing the unnecessary check actually triggered an assertion failure deeper in EnumCastOutOfRange for certain input (which is captured in the accompanying test code).

Reviewers: #clang, Szelethus, gamesh411, NoQ

Reviewed By: Szelethus, gamesh411, NoQ

Subscribers: NoQ, gamesh411, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, Charusso, bjope, cfe-commits

Tags: #clang

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

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

* [NFC] Move some variable declarations into their 'if' conditions.

A couple of variables are being declared outside of the 'if' condition
that is their only actual use.  Additionally, switch a few 'const TYPE
*' to 'const auto *' for consistency.

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

* [OPENMP5.0]Add support for device_type clause in declare target
construct.

OpenMP 5.0 introduced new clause for declare target directive, device_type clause, which may accept values host, nohost, and any. Host means
that the function must be emitted only for the host, nohost - only for
the device, and any - for both, device and the host.

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

* Fixed a typo.

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

* [OpenCL] Renamed value of std flag in C++ mode.
 
Clang should accept -std=clc++ (not -std=c++!) for OpenCL.

This was forgotten in r367008.



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

* [Sema] Don't warn on printf('%hd', [char]) (PR41467)

Summary: Link: https://bugs.llvm.org/show_bug.cgi?id=41467

Reviewers: rsmith, nickdesaulniers, aaron.ballman, lebedev.ri

Reviewed By: nickdesaulniers, aaron.ballman, lebedev.ri

Subscribers: lebedev.ri, nickdesaulniers, cfe-commits

Tags: #clang

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

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

* [OPENMP5]Use nonmonotonic modifier by default for non-static and
non-ordered loops.

According to OpenMP 5.0, 2.9.2 Worksharing-Loop Construct, Desription, If the static schedule kind is specified or if the ordered clause is specified, and if the nonmonotonic modifier is not specified, the effect is as if the monotonic modifier is specified. Otherwise, unless the monotonic modifier is specified, the effect is as if the nonmonotonic modifier is specified.
The first part of this requirement is implemented in runtime. Patch adds
support for the second, nonmonotonic, part of this requirement.

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

* Do a sweep of symbol internalization. NFC.

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

* [LifetimeAnalysis] Make it possible to disable the new warnings

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

* Fix a test to test what the name suggest.

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

* [libclang][index][NFC] Fix test for skipping already parsed function bodies

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

* PR40674: fix assertion failure if a structured binding declaration has a
tuple-like decomposition that produces value-dependent reference
bindings.

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

* NFC: Rename some sanitizer related lifetime checks

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

* Re-enable DependencyScannerTest on windows with the right fixes

It should now pass.

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

* PR42513: Enter the proper DeclContext before substituting into an
default template argument expression.

We already did this for type template parameters and template template
parameters, but apparently forgot to do so for non-type template
parameters. This causes the substituted default argument expression to
be substituted in the proper context, and in particular to properly mark
its subexpressions as odr-used.

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

* [Testing] Unbreak r369830

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

* [analyzer] Analysis: Fix checker silencing

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

* [OpenCL] Microoptimize OCL2Qual a bit

Still not optimal, but makes clang 25k smaller.

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

* FileManager: Factor duplicated code in getBufferForFile, NFC

Incidentally, this also unifies the two versions (removing an
unnecessary call to `SmallString::c_str`).

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

* [Wdocumentation] improve wording of a warning message

Based on @davezarzycki remarks in D64696 improved the wording of the warning
message.

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

Patch by Mark de Wever.

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

* clang-format: [JS] handle `as const`.

Summary:
TypeScript 3.4 supports casting into a const type using `as const`:

    const x = {x: 1} as const;

Previously, clang-format would insert a space after the `const`. With
this patch, no space is inserted after the sequence `as const`.

Reviewers: krasimir

Subscribers: cfe-commits

Tags: #clang

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

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

* Fix -dA flag, it is not a preprocessor flag.

-dA was in the d_group, which is a preprocessor state dumping group.
However -dA is a debug flag to cause a verbose asm.  It was already
implemented to do the same thing as -fverbose-asm, so make it just be an
alias.

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

* [NFC] Add comments to some bool arguments for better readability

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

* [libclang][index][NFCi] Refactor machinery for skipping function bodies

Refactor machinery for skipping inline function bodies that have already
been parsed in other frontend actions.

Preparations for moving this code to libIndex.

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

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

* Fix use of invalidated iterator introduced by r369680.

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

* [driver] add a new option `-gen-cdb-fragment-path` to emit
a fragment of a compilation database for each compilation

This patch adds a new option called -gen-cdb-fragment-path to the driver,
which can be used to specify a directory path to which clang can emit a fragment
of a CDB for each compilation it needs to invoke.

This option emits the same CDB contents as -MJ, and will be ignored if -MJ is specified.

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

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

* Improve behavior in the case of stack exhaustion.

Summary:
Clang performs various recursive operations (such as template instantiation),
and may use non-trivial amounts of stack space in each recursive step (for
instance, due to recursive AST walks). While we try to keep the stack space
used by such steps to a minimum and we have explicit limits on the number of
such steps we perform, it's impractical to guarantee that we won't blow out the
stack on deeply recursive template instantiations on complex ASTs, even with
only a moderately high instantiation depth limit.

The user experience in these cases is generally terrible: we crash with
no hint of what went wrong. Under this patch, we attempt to do better:

 * Detect when the stack is nearly exhausted, and produce a warning with a
   nice template instantiation backtrace, telling the user that we might
   run slowly or crash.

 * For cases where we're forced to trigger recursive template
   instantiation in arbitrarily-deeply-nested contexts, check whether
   we're nearly out of stack space and allocate a new stack (by spawning
   a new thread) after producing the warning.

Reviewers: rnk, aaron.ballman

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

* Fix file header.

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

* FileManager: Use llvm::Expected in new getFileRef API

`FileManager::getFileRef` is a modern API which we expect to convert to
over time.  We should modernize the error handling as well, using
`llvm::Expected` instead of `llvm::ErrorOr`, to help clients that care
about errors to ensure nothing is missed.

However, not all clients care.  I've also added another path for those
that don't:

- `FileEntryRef` is now copy- and move-assignable (using a pointer
  instead of a reference).
- `FileManager::getOptionalFileRef` returns an `llvm::Optional` instead
  of `llvm::Expected`.
- Added an `llvm::expectedToOptional` utility in case this is useful
  elsewhere.

https://reviews.llvm.org/D66705

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

* [msvc] Add necessary #include to make compiler intrinsics available.

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

* [OPENMP][NVPTX]Fix critical region codegen.

Summary:
Previously critical regions were emitted with the barrier making it a
worksharing construct though it is not. Also, it leads to incorrect
behavior in Cuda9+. Patch fixes this problem.

Reviewers: ABataev, jdoerfert

Subscribers: jholewinski, guansong, cfe-commits, grokos

Tags: #clang

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

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

* Diagnose use of _Thread_local as an extension when not in C11 mode.

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

* [Clang][Bundler] Use llvm-objcopy for creating fat object files

clang-offload-bundler currently uses partial linking for creating fat object files, but such technique cannot be used on Windows due to the absence of partial linking support in the linker. This patch changes implementation to use llvm-objcopy for merging device and host objects instead of doing partial linking. This is one step forward towards enabling OpenMP offload on Windows.

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

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

* Fix gen-cdb-fragment test for Windows

Windows bots didn't seem to like the empty argument, so I rewrote the test.

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

* Reword the C11 extension diagnostic.

This makes it more consistent with other language extension diagnostics.

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

* ContentCache: Drop getBuffer's dependency on SourceManager

Refactor ContentCache::IsSystemFile to IsFileVolatile, checking
SourceManager::userFilesAreVolatile at construction time.  This is a
step toward lowering ContentCache down from SourceManager to
FileManager.

No functionality change intended.

https://reviews.llvm.org/D66713

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

* Fixing a weird copy-pasta to get bots back to green.

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

* [DebugInfo] Add debug-entry-values test coverage, NFC

Check that call site descriptions are emitted in dwarf4 + lldb +
debug-entry-values mode.

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

* Remove unused variables.

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

* Updating a test case that was missed in r369957.

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

* Revert r369843 "[Testing] Unbreak r369830"

That was not the fix.

This reverts commit 8bcf690ae03db85608b2ea22eac7a91c84df4dc.

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

* msan, codegen, instcombine: Keep more lifetime markers used for msan

Reviewers: eugenis

Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

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

* hwasan, codegen: Keep more lifetime markers used for hwasan

Reviewers: eugenis

Subscribers: cfe-commits

Tags: #clang

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

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

* PR42587: diagnose unexpanded uses of a pack parameter of a generic
lambda from within the lambda-declarator.

Instead of trying to reconstruct whether a parameter pack was declared
inside a lambda (which we can't do correctly in general because we might
not have attached parameters to their declaration contexts yet), track
the set of parameter packs introduced in each live lambda scope, and
require only those parameters to be immediately expanded when they
appear inside that lambda.

In passing, fix incorrect disambiguation of a lambda-expression starting
with an init-capture pack in a braced-init-list. We previously
incorrectly parsed that as a designated initializer.

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

* [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF line endings

Previously, an #error directive with quoted, multi-line content, along with CR+LF line endings wasn't handled correctly.

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

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

* [clang-scan-deps] Minimizer: Correctly skip over double slashes in angle bracket #include

Previously, double slashes (//) occurring in angle brackets #include were incorrectly interpreted as comments. eg. #include <dir//file.h>

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

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

* NFC: Make test work with or without assertions

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

* [clang-scan-deps] Skip UTF-8 BOM in source minimizer

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


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

* Use FileEntryRef for PPCallbacks::FileSkipped

This fixes the issue where a filename dependendency was missing if the file that
was skipped was included through a symlink in an earlier run, if the file
manager was reused between runs.

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

* Don't lose the FoundDecl and template arguments for a DeclRefExpr in
TreeTransform.

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

* Revert "[clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF line endings"

This reverts commit r369986.

This change added a dependency on the 'dos2unix' tool, which is not one
of our accepted test dependencies and may not exist on all machines that
build Clang.

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

* [Driver] Add an option for createInvocationFromCommandLine to recover on errors

Summary:
Previously, it would always return nullptr on any error.
This change adds a parameter, controlling whether the function should
attempt to return a non-null result even if unknown arguments (or other
errors were encountered).

The new behavior is only used in clangd.

Considered an alternative of changing the return value instead of adding
a new parameter, but that would require updating all callsites. Settled
with the parameter to minimize the code changes.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: nridge, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

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

* [ReleaseNotes] MemorySanitizer support of ASLR on FreeBSD

Reviewers: sylvestre.ledru, kcc

Reviewed By: sylvestre.ledru

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

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

* [clang] Ensure that comment classes are trivially destructible

As in D66646, these classes are also allocated with a BumpPtrAllocator,
and therefore should be trivially destructible.

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

Reviewed By: Mordante, gribozavr

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

* [clang] Ensure that statements, expressions and types are trivially destructible

Since statements, expressions and types are allocated with the BumpPtrAllocator
from ASTContext their destructor is not executed. Two classes are currently
exempted from the check : InitListExpr due to its ASTVector and
ConstantArrayType due to its APInt.

No functional changes.

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

Reviewed By: lebedev.ri, gribozavr

git-svn-id: https:/…
@nickdesaulniers
Copy link
Member

nickdesaulniers commented Sep 6, 2019

@arndb is asking about this in clang-9 in https://llvm.org/pr43243
cc @zmodem

llvm-git-migration pushed a commit to llvm/llvm-project that referenced this issue Sep 9, 2019
------------------------------------------------------------------------
r369705 | nickdesaulniers | 2019-08-22 22:47:12 +0200 (Thu, 22 Aug 2019) | 23 lines

[Clang][CodeGen] set alias linkage on QualType

Summary:
It seems that CodeGen was always using ExternalLinkage when emitting a
GlobalDecl with __attribute__((alias)). This leads to symbol
redefinitions (ODR) that cause failures at link time for static aliases.
This is readily attempting to link an ARM (32b) allyesconfig Linux
kernel built with Clang.

Reported-by: nathanchance
Suggested-by: ihalip
Link: https://bugs.llvm.org/show_bug.cgi?id=42377
Link: ClangBuiltLinux/linux#631

Reviewers: rsmith, aaron.ballman, erichkeane

Reviewed By: aaron.ballman

Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66492
------------------------------------------------------------------------

------------------------------------------------------------------------
r369713 | nickdesaulniers | 2019-08-23 01:18:46 +0200 (Fri, 23 Aug 2019) | 17 lines

[Bugfix] fix r369705 unit test

Summary:
Aliases aren't supported on OSX.  Add a GNU target triple.

Reported-by: leonardchan
Reported-by: erik.pilkington

Reviewers: leonardchan, erik.pilkington

Reviewed By: leonardchan, erik.pilkington

Subscribers: dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66622
------------------------------------------------------------------------

llvm-svn: 371372
@zmodem
Copy link

zmodem commented Sep 9, 2019

I've merged the fix to release_90 and replied on the bug. Thanks!

dtzWill pushed a commit to llvm-mirror/clang that referenced this issue Sep 9, 2019
------------------------------------------------------------------------
r369705 | nickdesaulniers | 2019-08-22 22:47:12 +0200 (Thu, 22 Aug 2019) | 23 lines

[Clang][CodeGen] set alias linkage on QualType

Summary:
It seems that CodeGen was always using ExternalLinkage when emitting a
GlobalDecl with __attribute__((alias)). This leads to symbol
redefinitions (ODR) that cause failures at link time for static aliases.
This is readily attempting to link an ARM (32b) allyesconfig Linux
kernel built with Clang.

Reported-by: nathanchance
Suggested-by: ihalip
Link: https://bugs.llvm.org/show_bug.cgi?id=42377
Link: ClangBuiltLinux/linux#631

Reviewers: rsmith, aaron.ballman, erichkeane

Reviewed By: aaron.ballman

Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66492
------------------------------------------------------------------------

------------------------------------------------------------------------
r369713 | nickdesaulniers | 2019-08-23 01:18:46 +0200 (Fri, 23 Aug 2019) | 17 lines

[Bugfix] fix r369705 unit test

Summary:
Aliases aren't supported on OSX.  Add a GNU target triple.

Reported-by: leonardchan
Reported-by: erik.pilkington

Reviewers: leonardchan, erik.pilkington

Reviewed By: leonardchan, erik.pilkington

Subscribers: dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66622
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_90@371372 91177308-0d34-0410-b5e6-96231b3b80d8
@nickdesaulniers nickdesaulniers added the [FIXED][LLVM] 9 This bug was fixed in LLVM 9.0 label Sep 9, 2019
ajohnson-uoregon pushed a commit to ajohnson-uoregon/clang-rewrite-only that referenced this issue Jul 17, 2022
------------------------------------------------------------------------
r369705 | nickdesaulniers | 2019-08-22 22:47:12 +0200 (Thu, 22 Aug 2019) | 23 lines

[Clang][CodeGen] set alias linkage on QualType

Summary:
It seems that CodeGen was always using ExternalLinkage when emitting a
GlobalDecl with __attribute__((alias)). This leads to symbol
redefinitions (ODR) that cause failures at link time for static aliases.
This is readily attempting to link an ARM (32b) allyesconfig Linux
kernel built with Clang.

Reported-by: nathanchance
Suggested-by: ihalip
Link: https://bugs.llvm.org/show_bug.cgi?id=42377
Link: ClangBuiltLinux/linux#631

Reviewers: rsmith, aaron.ballman, erichkeane

Reviewed By: aaron.ballman

Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66492
------------------------------------------------------------------------

------------------------------------------------------------------------
r369713 | nickdesaulniers | 2019-08-23 01:18:46 +0200 (Fri, 23 Aug 2019) | 17 lines

[Bugfix] fix r369705 unit test

Summary:
Aliases aren't supported on OSX.  Add a GNU target triple.

Reported-by: leonardchan
Reported-by: erik.pilkington

Reviewers: leonardchan, erik.pilkington

Reviewed By: leonardchan, erik.pilkington

Subscribers: dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66622
------------------------------------------------------------------------

llvm-svn: 371372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] arm32 This bug impacts ARCH=arm [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 9 This bug was fixed in LLVM 9.0 [FIXED][LLVM] 10 This bug was fixed in LLVM 10.0
Projects
None yet
Development

No branches or pull requests

4 participants