|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2 |
|
| #
786a4f42 |
| 02-Aug-2022 |
Chuanqi Xu <[email protected]> |
[C++20] [Modules] Handle initializer for Header Units
Previously when we add module initializer, we forget to handle header units. This results that we couldn't compile a Hello World Example with He
[C++20] [Modules] Handle initializer for Header Units
Previously when we add module initializer, we forget to handle header units. This results that we couldn't compile a Hello World Example with Header Units. This patch tries to fix this.
Reviewed By: iains
Differential Revision: https://reviews.llvm.org/D130871
(cherry picked from commit 6d10733d445506c02ebec9faa54658431857bb49)
show more ...
|
|
Revision tags: llvmorg-15.0.0-rc1, llvmorg-16-init |
|
| #
8dfaecc4 |
| 23-Jul-2022 |
Argyrios Kyrtzidis <[email protected]> |
[CGDebugInfo] Access the current working directory from the `VFS`
...instead of calling `llvm::sys::fs::current_path()` directly.
Differential Revision: https://reviews.llvm.org/D130443
|
| #
de1b5c91 |
| 26-Jul-2022 |
Fangrui Song <[email protected]> |
[AArch64] Simplify BTI/PAC-RET module flags
These module flags use the Min merge behavior with a default value of zero, so we don't need to emit them if zero.
Reviewed By: danielkiss
Differential
[AArch64] Simplify BTI/PAC-RET module flags
These module flags use the Min merge behavior with a default value of zero, so we don't need to emit them if zero.
Reviewed By: danielkiss
Differential Revision: https://reviews.llvm.org/D130145
show more ...
|
| #
58c94808 |
| 23-Jul-2022 |
Jun Zhang <[email protected]> |
[CodeGen] Consider MangleCtx when move lazy emission States
Also move MangleCtx when moving some lazy emission states in CodeGenModule. Without this patch clang-repl hits an invalid address access w
[CodeGen] Consider MangleCtx when move lazy emission States
Also move MangleCtx when moving some lazy emission states in CodeGenModule. Without this patch clang-repl hits an invalid address access when passing `-Xcc -O2` flag.
Signed-off-by: Jun Zhang <[email protected]>
Differential Revision: https://reviews.llvm.org/D130420
show more ...
|
| #
1a3a2eec |
| 23-Jul-2022 |
Jun Zhang <[email protected]> |
[NFC] Move function definition to cpp file
Signed-off-by: Jun Zhang <[email protected]>
|
| #
37502e04 |
| 22-Jul-2022 |
Sergei Barannikov <[email protected]> |
[clang][CodeGen] Only include ABIInfo.h where required (NFC)
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D130322
|
|
Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4 |
|
| #
afda39a5 |
| 15-May-2022 |
Iain Sandoe <[email protected]> |
re-land [C++20][Modules] Build module static initializers per P1874R1.
The re-land fixes module map module dependencies seen on Greendragon, but not in the clang test suite.
---
Currently we only
re-land [C++20][Modules] Build module static initializers per P1874R1.
The re-land fixes module map module dependencies seen on Greendragon, but not in the clang test suite.
---
Currently we only implement this for the Itanium ABI since the correct mangling for the initializers in other ABIs is not yet known.
Intended result:
For a module interface [which includes partition interface and implementation units] (instead of the generic CXX initializer) we emit a module init that:
- wraps the contained initializations in a control variable to ensure that the inits only happen once, even if a module is imported many times by imports of the main unit.
- calls module initializers for imported modules first. Note that the order of module import is not significant, and therefore neither is the order of imported module initializers.
- We then call initializers for the Global Module Fragment (if present) - We then call initializers for the current module. - We then call initializers for the Private Module Fragment (if present)
For a module implementation unit, or a non-module TU that imports at least one module we emit a regular CXX init that:
- Calls the initializers for any imported modules first. - Then proceeds as normal with remaining inits.
For all module unit kinds we include a global constructor entry, this allows for the (in most cases unusual) possibility that a module object could be included in a final binary without a specific call to its initializer.
Implementation:
- We provide the module pointer in the AST Context so that CodeGen can act on it and its sub-modules.
- We need to account for module build lines like this: ` clang -cc1 -std=c++20 Foo.pcm -emit-obj -o Foo.o` or ` clang -cc1 -std=c++20 -xc++-module Foo.cpp -emit-obj -o Foo.o`
- in order to do this, we add to ParseAST to set the module pointer in the ASTContext, once we establish that this is a module build and we know the module pointer. To be able to do this, we make the query for current module public in Sema.
- In CodeGen, we determine if the current build requires a CXX20-style module init and, if so, we defer any module initializers during the "Eagerly Emitted" phase.
- We then walk the module initializers at the end of the TU but before emitting deferred inits (which adds any hidden and static ones, fixing https://github.com/llvm/llvm-project/issues/51873 ).
- We then proceed to emit the deferred inits and continue to emit the CXX init function.
Differential Revision: https://reviews.llvm.org/D126189
show more ...
|
| #
23ba688f |
| 20-Jul-2022 |
Fangrui Song <[email protected]> |
[X86] Use Min behavior for cf-protection-{return,branch}/ibt-seal module flags
These features require that all object files are compiled with the support. When the feature is disabled for an object
[X86] Use Min behavior for cf-protection-{return,branch}/ibt-seal module flags
These features require that all object files are compiled with the support. When the feature is disabled for an object file, the merge behavior should treat the file having a value of 0 (see D129911).
Reviewed By: xiangzhangllvm
Differential Revision: https://reviews.llvm.org/D130065
show more ...
|
| #
0d5a62fa |
| 15-Jul-2022 |
Fangrui Song <[email protected]> |
[sanitizer] Add "mainfile" prefix to sanitizer special case list
When an issue exists in the main file (caller) instead of an included file (callee), using a `src` pattern applying to the included f
[sanitizer] Add "mainfile" prefix to sanitizer special case list
When an issue exists in the main file (caller) instead of an included file (callee), using a `src` pattern applying to the included file may be inappropriate if it's the caller's responsibility. Add `mainfile` prefix to check the main filename.
For the example below, the issue may reside in a.c (foo should not be called with a misaligned pointer or foo should switch to an unaligned load), but with `src` we can only apply to the innocent callee a.h. With this patch we can use the more appropriate `mainfile:a.c`. ``` //--- a.h // internal linkage static inline int load(int *x) { return *x; }
//--- a.c, -fsanitize=alignment #include "a.h" int foo(void *x) { return load(x); } ```
See the updated clang/docs/SanitizerSpecialCaseList.rst for a caveat due to C++ vague linkage functions.
Reviewed By: #sanitizers, kstoimenov, vitalybuka
Differential Revision: https://reviews.llvm.org/D129832
show more ...
|
| #
888673b6 |
| 15-Jul-2022 |
Jonas Devlieghere <[email protected]> |
Revert "[clang] Implement ElaboratedType sugaring for types written bare"
This reverts commit 7c51f02effdbd0d5e12bfd26f9c3b2ab5687c93f because it stills breaks the LLDB tests. This was re-landed wi
Revert "[clang] Implement ElaboratedType sugaring for types written bare"
This reverts commit 7c51f02effdbd0d5e12bfd26f9c3b2ab5687c93f because it stills breaks the LLDB tests. This was re-landed without addressing the issue or even agreement on how to address the issue. More details and discussion in https://reviews.llvm.org/D112374.
show more ...
|
|
Revision tags: llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1 |
|
| #
7c51f02e |
| 11-Oct-2021 |
Matheus Izvekov <[email protected]> |
[clang] Implement ElaboratedType sugaring for types written bare
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which go
[clang] Implement ElaboratedType sugaring for types written bare
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which goes against the intent that we should produce an AST which retains enough details to recover how things are written.
The lack of this sugar is incompatible with the intent of the type printer default policy, which is to print types as written, but to fall back and print them fully qualified when they are desugared.
An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still requires pointer alignment due to pre-existing bug in the TypeLoc buffer handling.
---
Troubleshooting list to deal with any breakage seen with this patch:
1) The most likely effect one would see by this patch is a change in how a type is printed. The type printer will, by design and default, print types as written. There are customization options there, but not that many, and they mainly apply to how to print a type that we somehow failed to track how it was written. This patch fixes a problem where we failed to distinguish between a type that was written without any elaborated-type qualifiers, such as a 'struct'/'class' tags and name spacifiers such as 'std::', and one that has been stripped of any 'metadata' that identifies such, the so called canonical types. Example: ``` namespace foo { struct A {}; A a; }; ``` If one were to print the type of `foo::a`, prior to this patch, this would result in `foo::A`. This is how the type printer would have, by default, printed the canonical type of A as well. As soon as you add any name qualifiers to A, the type printer would suddenly start accurately printing the type as written. This patch will make it print it accurately even when written without qualifiers, so we will just print `A` for the initial example, as the user did not really write that `foo::` namespace qualifier.
2) This patch could expose a bug in some AST matcher. Matching types is harder to get right when there is sugar involved. For example, if you want to match a type against being a pointer to some type A, then you have to account for getting a type that is sugar for a pointer to A, or being a pointer to sugar to A, or both! Usually you would get the second part wrong, and this would work for a very simple test where you don't use any name qualifiers, but you would discover is broken when you do. The usual fix is to either use the matcher which strips sugar, which is annoying to use as for example if you match an N level pointer, you have to put N+1 such matchers in there, beginning to end and between all those levels. But in a lot of cases, if the property you want to match is present in the canonical type, it's easier and faster to just match on that... This goes with what is said in 1), if you want to match against the name of a type, and you want the name string to be something stable, perhaps matching on the name of the canonical type is the better choice.
3) This patch could exposed a bug in how you get the source range of some TypeLoc. For some reason, a lot of code is using getLocalSourceRange(), which only looks at the given TypeLoc node. This patch introduces a new, and more common TypeLoc node which contains no source locations on itself. This is not an inovation here, and some other, more rare TypeLoc nodes could also have this property, but if you use getLocalSourceRange on them, it's not going to return any valid locations, because it doesn't have any. The right fix here is to always use getSourceRange() or getBeginLoc/getEndLoc which will dive into the inner TypeLoc to get the source range if it doesn't find it on the top level one. You can use getLocalSourceRange if you are really into micro-optimizations and you have some outside knowledge that the TypeLocs you are dealing with will always include some source location.
4) Exposed a bug somewhere in the use of the normal clang type class API, where you have some type, you want to see if that type is some particular kind, you try a `dyn_cast` such as `dyn_cast<TypedefType>` and that fails because now you have an ElaboratedType which has a TypeDefType inside of it, which is what you wanted to match. Again, like 2), this would usually have been tested poorly with some simple tests with no qualifications, and would have been broken had there been any other kind of type sugar, be it an ElaboratedType or a TemplateSpecializationType or a SubstTemplateParmType. The usual fix here is to use `getAs` instead of `dyn_cast`, which will look deeper into the type. Or use `getAsAdjusted` when dealing with TypeLocs. For some reason the API is inconsistent there and on TypeLocs getAs behaves like a dyn_cast.
5) It could be a bug in this patch perhaps.
Let me know if you need any help!
Signed-off-by: Matheus Izvekov <[email protected]>
Differential Revision: https://reviews.llvm.org/D112374
show more ...
|
| #
af58684f |
| 14-Jul-2022 |
Ellis Hoag <[email protected]> |
[InstrProf] Add options to profile function groups
Add two options, `-fprofile-function-groups=N` and `-fprofile-selected-function-group=i` used to partition functions into `N` groups and only instr
[InstrProf] Add options to profile function groups
Add two options, `-fprofile-function-groups=N` and `-fprofile-selected-function-group=i` used to partition functions into `N` groups and only instrument the functions in group `i`. Similar options were added to xray in https://reviews.llvm.org/D87953 and the goal is the same; to reduce instrumented size overhead by spreading the overhead across multiple builds. Raw profiles from different groups can be added like normal using the `llvm-profdata merge` command.
Reviewed By: ianlevesque
Differential Revision: https://reviews.llvm.org/D129594
show more ...
|
| #
140bfdca |
| 14-Jul-2022 |
Nick Desaulniers <[email protected]> |
[clang][CodeGen] add fn_ret_thunk_extern to synthetic fns
Follow up fix to commit 2240d72f15f3 ("[X86] initial -mfunction-return=thunk-extern support") https://reviews.llvm.org/D129572
@nathanchanc
[clang][CodeGen] add fn_ret_thunk_extern to synthetic fns
Follow up fix to commit 2240d72f15f3 ("[X86] initial -mfunction-return=thunk-extern support") https://reviews.llvm.org/D129572
@nathanchance reported that -mfunction-return=thunk-extern was failing to annotate the asan and tsan contructors. https://lore.kernel.org/llvm/Ys7pLq+tQk5xEa%[email protected]/
I then noticed the same occurring for gcov synthetic functions.
Similar to commit 2786e67 ("[IR][sanitizer] Add module flag "frame-pointer" and set it for cc1 -mframe-pointer={non-leaf,all}") define a new module level MetaData, "fn_ret_thunk_extern", then when set adds the fn_ret_thunk_extern IR Fn Attr to synthetically created Functions.
Fixes https://github.com/llvm/llvm-project/issues/56514
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D129709
show more ...
|
| #
3968936b |
| 13-Jul-2022 |
Jonas Devlieghere <[email protected]> |
Revert "[clang] Implement ElaboratedType sugaring for types written bare"
This reverts commit bdc6974f92304f4ed542241b9b89ba58ba6b20aa because it breaks all the LLDB tests that import the std module
Revert "[clang] Implement ElaboratedType sugaring for types written bare"
This reverts commit bdc6974f92304f4ed542241b9b89ba58ba6b20aa because it breaks all the LLDB tests that import the std module.
import-std-module/array.TestArrayFromStdModule.py import-std-module/deque-basic.TestDequeFromStdModule.py import-std-module/deque-dbg-info-content.TestDbgInfoContentDequeFromStdModule.py import-std-module/forward_list.TestForwardListFromStdModule.py import-std-module/forward_list-dbg-info-content.TestDbgInfoContentForwardListFromStdModule.py import-std-module/list.TestListFromStdModule.py import-std-module/list-dbg-info-content.TestDbgInfoContentListFromStdModule.py import-std-module/queue.TestQueueFromStdModule.py import-std-module/stack.TestStackFromStdModule.py import-std-module/vector.TestVectorFromStdModule.py import-std-module/vector-bool.TestVectorBoolFromStdModule.py import-std-module/vector-dbg-info-content.TestDbgInfoContentVectorFromStdModule.py import-std-module/vector-of-vectors.TestVectorOfVectorsFromStdModule.py
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/45301/
show more ...
|
| #
70455193 |
| 13-Jul-2022 |
Mitch Phillips <[email protected]> |
Add missing sanitizer metadata plumbing from CFE.
clang misses attaching sanitizer metadata for external globals.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D129492
|
| #
8082a002 |
| 13-Jul-2022 |
Jun Zhang <[email protected]> |
[CodeGen] Keep track of decls that were deferred and have been emitted.
This patch adds a new field called EmittedDeferredDecls in CodeGenModule that keeps track of decls that were deferred and have
[CodeGen] Keep track of decls that were deferred and have been emitted.
This patch adds a new field called EmittedDeferredDecls in CodeGenModule that keeps track of decls that were deferred and have been emitted.
The intention of this patch is to solve issues in the incremental c++, we'll lose info of decls that are lazily emitted when we undo their usage.
See example below:
clang-repl> inline int foo() { return 42;} clang-repl> int bar = foo(); clang-repl> %undo clang-repl> int baz = foo(); JIT session error: Symbols not found: [ _Z3foov ] error: Failed to materialize symbols: { (main, { baz, $.incr_module_2.inits.0, orc_init_func.incr_module_2 }) }
Signed-off-by: Jun Zhang <[email protected]>
Differential Revision: https://reviews.llvm.org/D128782
show more ...
|
| #
bdc6974f |
| 11-Oct-2021 |
Matheus Izvekov <[email protected]> |
[clang] Implement ElaboratedType sugaring for types written bare
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which go
[clang] Implement ElaboratedType sugaring for types written bare
Without this patch, clang will not wrap in an ElaboratedType node types written without a keyword and nested name qualifier, which goes against the intent that we should produce an AST which retains enough details to recover how things are written.
The lack of this sugar is incompatible with the intent of the type printer default policy, which is to print types as written, but to fall back and print them fully qualified when they are desugared.
An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still requires pointer alignment due to pre-existing bug in the TypeLoc buffer handling.
Signed-off-by: Matheus Izvekov <[email protected]>
Differential Revision: https://reviews.llvm.org/D112374
show more ...
|
| #
a45dd3d8 |
| 12-Jul-2022 |
Xiang1 Zhang <[email protected]> |
[X86] Support -mstack-protector-guard-symbol
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D129346
|
| #
64378621 |
| 12-Jul-2022 |
Xiang1 Zhang <[email protected]> |
Revert "[X86] Support -mstack-protector-guard-symbol"
This reverts commit efbaad1c4a526e91b034e56386e98a9268cd87b2. due to miss adding review info.
|
| #
efbaad1c |
| 08-Jul-2022 |
Xiang1 Zhang <[email protected]> |
[X86] Support -mstack-protector-guard-symbol
|
| #
b19d3ee7 |
| 11-Jul-2022 |
Iain Sandoe <[email protected]> |
Revert "[C++20][Modules] Build module static initializers per P1874R1."
This reverts commit ac507102d258b6fc0cb57eb60c9dfabd57ff562f.
reverting while we figuere out why one of the green dragon lldb
Revert "[C++20][Modules] Build module static initializers per P1874R1."
This reverts commit ac507102d258b6fc0cb57eb60c9dfabd57ff562f.
reverting while we figuere out why one of the green dragon lldb test fails.
show more ...
|
| #
ac507102 |
| 15-May-2022 |
Iain Sandoe <[email protected]> |
[C++20][Modules] Build module static initializers per P1874R1.
Currently we only implement this for the Itanium ABI since the correct mangling for the initializers in other ABIs is not yet known.
I
[C++20][Modules] Build module static initializers per P1874R1.
Currently we only implement this for the Itanium ABI since the correct mangling for the initializers in other ABIs is not yet known.
Intended result:
For a module interface [which includes partition interface and implementation units] (instead of the generic CXX initializer) we emit a module init that:
- wraps the contained initializations in a control variable to ensure that the inits only happen once, even if a module is imported many times by imports of the main unit.
- calls module initializers for imported modules first. Note that the order of module import is not significant, and therefore neither is the order of imported module initializers.
- We then call initializers for the Global Module Fragment (if present) - We then call initializers for the current module. - We then call initializers for the Private Module Fragment (if present)
For a module implementation unit, or a non-module TU that imports at least one module we emit a regular CXX init that:
- Calls the initializers for any imported modules first. - Then proceeds as normal with remaining inits.
For all module unit kinds we include a global constructor entry, this allows for the (in most cases unusual) possibility that a module object could be included in a final binary without a specific call to its initializer.
Implementation:
- We provide the module pointer in the AST Context so that CodeGen can act on it and its sub-modules.
- We need to account for module build lines like this: ` clang -cc1 -std=c++20 Foo.pcm -emit-obj -o Foo.o` or ` clang -cc1 -std=c++20 -xc++-module Foo.cpp -emit-obj -o Foo.o`
- in order to do this, we add to ParseAST to set the module pointer in the ASTContext, once we establish that this is a module build and we know the module pointer. To be able to do this, we make the query for current module public in Sema.
- In CodeGen, we determine if the current build requires a CXX20-style module init and, if so, we defer any module initializers during the "Eagerly Emitted" phase.
- We then walk the module initializers at the end of the TU but before emitting deferred inits (which adds any hidden and static ones, fixing https://github.com/llvm/llvm-project/issues/51873 ).
- We then proceed to emit the deferred inits and continue to emit the CXX init function.
Differential Revision: https://reviews.llvm.org/D126189
show more ...
|
| #
6678f8e5 |
| 27-Jun-2022 |
Yuanfang Chen <[email protected]> |
[ubsan] Using metadata instead of prologue data for function sanitizer
Information in the function `Prologue Data` is intentionally opaque. When a function with `Prologue Data` is duplicated. The se
[ubsan] Using metadata instead of prologue data for function sanitizer
Information in the function `Prologue Data` is intentionally opaque. When a function with `Prologue Data` is duplicated. The self (global value) references inside `Prologue Data` is still pointing to the original function. This may cause errors like `fatal error: error in backend: Cannot represent a difference across sections`.
This patch detaches the information from function `Prologue Data` and attaches it to a function metadata node.
This and D116130 fix https://github.com/llvm/llvm-project/issues/49689.
Reviewed By: pcc
Differential Revision: https://reviews.llvm.org/D115844
show more ...
|
| #
97afce08 |
| 26-Jun-2022 |
Kazu Hirata <[email protected]> |
[clang] Don't use Optional::hasValue (NFC)
This patch replaces Optional::hasValue with the implicit cast to bool in conditionals only.
|
| #
3b7c3a65 |
| 25-Jun-2022 |
Kazu Hirata <[email protected]> |
Revert "Don't use Optional::hasValue (NFC)"
This reverts commit aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.
|