MmsOTDeveloperadded all modifications made for msdebug
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[MSVC] work-around for compile time issue 102513 Manual cherry-pick of #110986 to the LLVM 19 release branch. | 1 年前 | |
clang:: to llvm::; NFC These interfaces are LLVM interfaces, not Clang ones; but this worked because of LLVM.h adding the interfaces to the clang namespace. | 2 年前 | |
[clang] Add method 'backupStr' to ASTContext (#99417) Method 'backupStr' extracts common code of dynamically allocating memory with ASTContext to hold a copy of a string's contents. | 1 年前 | |
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636 | 7 年前 | |
Revert "[clang] fix broken canonicalization of DeducedTemplateSpecializationType (#95202)" This reverts commit 2e1ad93961a3f444659c5d02d800e3144acccdb4. Reverting #95202 in the 19.x branch Fixes #106182 The change in #95202 causes code to crash and there is no good way to backport a fix for that as there are ABI-impacting changes at play. Instead we revert #95202 in the 19x branch, fixing the regression and preserving the 18.x behavior (which is GCC's behavior) https://github.com/llvm/llvm-project/pull/106335#discussion_r1735174841 | 1 年前 | |
[clang] add fallback to expr in the template differ when comparing ValueDecl (#93266) | 2 年前 | |
[clang][NFC] Use provided stream in APValue::dump() I assume this is a copy/paste error. | 1 年前 | |
[Clang][Sema] Make UnresolvedLookupExprs in class scope explicit specializations instantiation dependent (#100392) A class member named by an expression in a member function that may instantiate to a static _or_ non-static member is represented by a UnresolvedLookupExpr in order to defer the implicit transformation to a class member access expression until instantiation. Since ASTContext::getDecltypeType only creates a DecltypeType that has a DependentDecltypeType as its canonical type when the operand is instantiation dependent, and since we do not transform types unless they are instantiation dependent, we need to mark the UnresolvedLookupExpr as instantiation dependent in order to correctly build a DecltypeType using the expression as its operand with a DependentDecltypeType canonical type. Fixes #99873. (cherry picked from commit 55ea36002bd364518c20b3ce282640c920697bf7) | 1 年前 | |
[clang][ASTImporter] Add VaList declaration to lookup table. The declaration of __builtin_va_list seems to be handled specially by ASTContext and/or Sema. The normal AST traversal probably can not find it, therefore it is not added to ASTImporterLookupTable. If it is not added, errors can occur because a duplicated VaList declaration is created at import. To fix the problem the VaList declaration is added manually to ASTImporterLookupTable at construction. In special cases this declaration is inside a "invisible" 'std' namespace that behaves the same way. This namespace must be added to the table too. Reviewed By: vabridgers, donat.nagy Differential Revision: https://reviews.llvm.org/D144273 | 3 年前 | |
[StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr comparison (#95190) improve ASTStructuralEquivalenceTest: 1. compare the depth and index of NTTP 2. provide comparison of CXXDependentScopeMemberExpr to StmtCompare. Co-authored-by: huqizhi <836744285@qq.com> | 2 年前 | |
[AST] Add dump() method to TypeLoc (#65484) The ability to dump AST nodes is important to ad-hoc debugging, and the fact this doesn't work with TypeLoc nodes is an obvious missing feature in e.g. clang-query ( set output dump simply does nothing). Having TypeLoc::dump(), and enabling DynTypedNode::dump() for such nodes seems like a clear win. It looks like this: `` int main(int argc, char **argv); FunctionProtoTypeLoc <test.cc:3:1, col:31> 'int (int, char **)' cdecl |-ParmVarDecl 0x30071a8 <col:10, col:14> col:14 argc 'int' | -BuiltinTypeLoc <col:10> 'int' |-ParmVarDecl 0x3007250 <col:20, col:27> col:27 argv 'char **' | -PointerTypeLoc <col:20, col:26> 'char **' | -PointerTypeLoc <col:20, col:25> 'char *' | -BuiltinTypeLoc <col:20> 'char' -BuiltinTypeLoc <col:1> 'int' `` It dumps the lexically nested tree of type locs. This often looks similar to how types are dumped, but unlike types we don't look at desugaring e.g. typedefs, as their underlying types are not lexically spelled here. --- Less clear is exactly when to include these nodes in existing text AST dumps rooted at (TranslationUnit)Decls. These already omit supported nodes sometimes, e.g. NestedNameSpecifiers are often mentioned but not recursively dumped. TypeLocs are a more extreme case: they're ~always more verbose than the current AST dump. So this patch punts on that, TypeLocs are only ever printed recursively as part of a TypeLoc::dump() call. It would also be nice to be able to invoke clang to dump a typeloc somehow, like clang -cc1 -ast-dump. But I don't know exactly what the best verison of that is, so this patch doesn't do it. --- There are similar (less critical!) nodes: TemplateArgumentLoc etc, these also don't have dump() functions today and are obvious extensions. I suspect that we should add these, and Loc nodes should dump each other (e.g. the ElaboratedTypeLoc vector<int>::iterator should dump the NestedNameSpecifierLoc vector<int>::, which dumps the TemplateSpecializationTypeLoc vector<int>::` etc). Maybe this generalizes further to a "full syntactic dump" mode, where even Decls and Stmts would print the TypeLocs they lexically contain. But this may be more complex than useful. --- While here, ConceptReference JSON dumping must be implemented. It's not totally clear to me why this implementation wasn't required before but is now... | 2 年前 | |
[clang] Silence warning when building with MSVC targetting x86 This fixes: [3786/6996] Building CXX object tools\clang\lib\AST\CMakeFiles\obj.clangAST.dir\AttrDocTable.cpp.obj C:\git\llvm-project\clang\lib\AST\AttrDocTable.cpp(24): warning C4018: '<': signed/unsigned mismatch | 2 年前 | |
[OpenMP] Always apply target declarations to canonical definitions This patch changes the handling of OpenMP to add the device attributes to the canonical definitions when we encounter a non-canonical definition. Previously, the following code would not work because it would find the non-canonical definition first which would then not be used anywhere else. int x; extern int x; This patch now adds the attribute to both of them. This allows us to perform the following operation if, for example, there were an implementation of stderr on the device. #include <stdio.h> // List of libc symbols supported on the device. extern FILE *stderr; Unfortunately I cannot think of an equivalent solution to HIP / CUDA device declarations as those are done with simple attributes. Attributes themselves cannot be used to affect a definition once its canonical definition has already been seen. Some help on that front would be appreciated. Fixes https://github.com/llvm/llvm-project/issues/63355 Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D153369 | 2 年前 | |
[InstallAPI] Verify that declarations in headers map to exports found in dylib (#85348) * This completes support for verifying every declaration found in a header is discovered in the dylib. Diagnostics are reported for each class for differences that are representable in TBD files. * This patch also now captures unavailable attributes that depend on target triples. This is needed for proper tbd file generation. | 2 年前 | |
Reapply "[clang][Interp] Implement dynamic memory allocation handling (#70306)" This reverts commit 48d703e7f56282ce5d690e45a129a4a7fd040ee6. | 1 年前 | |
[clang] Remove unused forward declarations (NFC) | 4 年前 | |
Revert "[clang] Add the check of membership for the issue #58674 and improve the lookup process" The commit causes clang to crash. See https://reviews.llvm.org/D143840#4147234 This reverts commit 8498ba6c2860c838183f9951b63df26ab5f02265. | 3 年前 | |
[clang][NFC] Refactor ParamCommandComment::PassDirection This patch converts ParamCommandComment::PassDirection to a scoped enum at namespace scope, making it eligible for forward declaring. This is useful for e.g. annotating bit-fields with preferred_type. | 2 年前 | |
[AST] Remove an unnecessary continue (NFC) | 4 年前 | |
[clang] Use std::size instead of llvm::array_lengthof LLVM contains a helpful function for getting the size of a C-style array: llvm::array_lengthof. This is useful prior to C++17, but not as helpful for C++17 or later: std::size already has support for C-style arrays. Change call sites to use std::size instead. Leave the few call sites that use a locally defined array_lengthof that are meant to test previous bugs with NTTPs in clang analyzer and SemaTemplate. Differential Revision: https://reviews.llvm.org/D133520 | 3 年前 | |
[Clang][Comments] Parse <img src=""/> in doc comments correctly This is a valid HTML5 tag. Previously it triggered a Clang error (HTML start tag prematurely ended, expected attribute name or '>') since Clang was treating /> as a text token. This was happening because after lexing the closing quote (") the lexer state was reset to "Normal" while the tag was not actually closed yet: > was not yet parsed at that point. rdar://91464292 Differential Revision: https://reviews.llvm.org/D132932 | 3 年前 | |
[Clang][Comments] Support for parsing headers in Doxygen \par commands (#91100) ### Background Doxygen's \par command ([link](https://www.doxygen.nl/manual/commands.html#cmdpar)) has an optional argument, which denotes the header of the paragraph started by a given \par command. In short, the paragraph command can be used with a heading, or without one. The code block below shows both forms and how the current version of LLVM/Clang parses this code: `` $ cat test.cpp /// \par User defined paragraph: /// Contents of the paragraph. /// /// \par /// New paragraph under the same heading. /// /// \par /// A second paragraph. class A {}; $ clang++ -cc1 -ast-dump -fcolor-diagnostics -std=c++20 test.cpp -CXXRecordDecl 0x1530f3a78 <test.cpp:11:1, col:10> col:7 class A definition |-FullComment 0x1530fea38 <line:2:4, line:9:23> | |-ParagraphComment 0x1530fe7e0 <line:2:4> | | -TextComment 0x1530fe7b8 <col:4> Text=" " | |-BlockCommandComment 0x1530fe800 <col:5, line:3:30> Name="par" | | -ParagraphComment 0x1530fe878 <line:2:9, line:3:30> | | |-TextComment 0x1530fe828 <line:2:9, col:32> Text=" User defined paragraph:" | | -TextComment 0x1530fe848 <line:3:4, col:30> Text=" Contents of the paragraph." | |-ParagraphComment 0x1530fe8c0 <line:5:4> | | -TextComment 0x1530fe898 <col:4> Text=" " | |-BlockCommandComment 0x1530fe8e0 <col:5, line:6:41> Name="par" | | -ParagraphComment 0x1530fe930 <col:4, col:41> | | -TextComment 0x1530fe908 <col:4, col:41> Text=" New paragraph under the same heading." | |-ParagraphComment 0x1530fe978 <line:8:4> | | -TextComment 0x1530fe950 <col:4> Text=" " | -BlockCommandComment 0x1530fe998 <col:5, line:9:23> Name="par" | -ParagraphComment 0x1530fe9e8 <col:4, col:23> | -TextComment 0x1530fe9c0 <col:4, col:23> Text=" A second paragraph." -CXXRecordDecl 0x1530f3bb0 <line:11:1, col:7> col:7 implicit class A ` As we can see above, the optional paragraph heading ("User defined paragraph") is not an argument of the \par BlockCommandComment, but instead a child TextComment. For documentation generators like [hdoc](https://hdoc.io/), it would be ideal if we could parse Doxygen documentation comments with these semantics in mind. Currently that's not possible. ### Change This change parses \par command according to how Doxygen parses them, making an optional header available as a an argument if it is present. In addition: - AST unit tests are defined to test this functionality when an argument is present, isn't present, with additional spacing, etc. - TableGen is updated with an IsParCommand to support this functionality - lit` tests are updated where needed | 1 年前 | |
[clang][NFC] Refactor ParamCommandComment::PassDirection This patch converts ParamCommandComment::PassDirection to a scoped enum at namespace scope, making it eligible for forward declaring. This is useful for e.g. annotating bit-fields with preferred_type. | 2 年前 | |
[clang][AST][NFC] Take const CXXRecordDecl* in ComparisonCategories The class member is already const. | 2 年前 | |
| 2 年前 | ||
Avoid SourceManager.h include in RawCommentList.h, add missing incs SourceManager.h includes FileManager.h, which is expensive due to dependencies on LLVM FS headers. Remove dead BeforeThanCompare specialization. Sink ASTContext::addComment to cpp file. This reduces the time to compile a file that does nothing but include ASTContext.h from ~3.4s to ~2.8s for me. Saves these includes: 219 - ../clang/include/clang/Basic/SourceManager.h 204 - ../clang/include/clang/Basic/FileSystemOptions.h 204 - ../clang/include/clang/Basic/FileManager.h 165 - ../llvm/include/llvm/Support/VirtualFileSystem.h 164 - ../llvm/include/llvm/Support/SourceMgr.h 164 - ../llvm/include/llvm/Support/SMLoc.h 161 - ../llvm/include/llvm/Support/Path.h 141 - ../llvm/include/llvm/ADT/BitVector.h 128 - ../llvm/include/llvm/Support/MemoryBuffer.h 124 - ../llvm/include/llvm/Support/FileSystem.h 124 - ../llvm/include/llvm/Support/Chrono.h 124 - .../MSVCSTL/include/stack 122 - ../llvm/include/llvm-c/Types.h 122 - ../llvm/include/llvm/Support/NativeFormatting.h 122 - ../llvm/include/llvm/Support/FormatProviders.h 122 - ../llvm/include/llvm/Support/CBindingWrapping.h 122 - .../MSVCSTL/include/xtimec.h 122 - .../MSVCSTL/include/ratio 122 - .../MSVCSTL/include/chrono 121 - ../llvm/include/llvm/Support/FormatVariadicDetails.h 118 - ../llvm/include/llvm/Support/MD5.h 109 - .../MSVCSTL/include/deque 105 - ../llvm/include/llvm/Support/Host.h 105 - ../llvm/include/llvm/Support/Endian.h Reviewed By: aaron.ballman, hans Differential Revision: https://reviews.llvm.org/D75279 | 6 年前 | |
[clang] Fix C23 constexpr crashes (#112708) Before using a constexpr variable that is not properly initialized check that it is valid. Fixes https://github.com/llvm/llvm-project/issues/109095 Fixes https://github.com/llvm/llvm-project/issues/112516 | 1 年前 | |
[C++20] [Modules] Add Decl::isFromGlobalModule | 1 年前 | |
[Clang] Fix definition of layout-compatible to ignore empty classes (#92103) Also changes the behaviour of __builtin_is_layout_compatible None of the historic nor the current definition of layout-compatible classes mention anything about base classes (other than implicitly through being standard-layout) and are defined in terms of members, not direct members. | 1 年前 | |
[NFC] [Serialization] Avoid using DeclID directly as much as possible This patch tries to remove all the direct use of DeclID except the real low level reading and writing. All the use of DeclID is converted to the use of LocalDeclID or GlobalDeclID. This is helpful to increase the readability and type safety. | 2 年前 | |
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636 | 7 年前 | |
[NFC] [Serialization] Avoid using DeclID directly as much as possible This patch tries to remove all the direct use of DeclID except the real low level reading and writing. All the use of DeclID is converted to the use of LocalDeclID or GlobalDeclID. This is helpful to increase the readability and type safety. | 2 年前 | |
[NFC] [Serialization] Avoid using DeclID directly as much as possible This patch tries to remove all the direct use of DeclID except the real low level reading and writing. All the use of DeclID is converted to the use of LocalDeclID or GlobalDeclID. This is helpful to increase the readability and type safety. | 2 年前 | |
Revert "[clang][AST] fix ast-print of extern <lang> with >=2 declarators" This reverts commit 48f13d48a88c14acbaea7c3ee05018bb173fb360. It broke some external bots: https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/6805/console https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8743609724828014497/+/u/clang/build/stdout | 1 年前 | |
[NFC] [Serialization] Unify how LocalDeclID can be created Now we can create a LocalDeclID directly with an integer without verifying. It may be hard to refactor if we want to change the way we serialize DeclIDs (See https://github.com/llvm/llvm-project/pull/95897). Also it is hard for us to debug if someday someone construct a LocalDeclID with an incorrect value. So in this patch, I tried to unify the way we can construct a LocalDeclID in ASTReader, where we will construct the LocalDeclID from the serialized data. Also, now we can verify the constructed LocalDeclID sooner in the new interface. | 1 年前 | |
Call printName to get name of Decl Rather than sending a name directly to the stream, use printName to preserve any PrintingPolicy. This ensures that names are properly affected by path remapping. Fixes: https://github.com/llvm/llvm-project/issues/62192 Differential Revision: https://reviews.llvm.org/D149272 | 3 年前 | |
[clang] Fix underlying type of EmbedExpr (#99050) This patch makes remaining cases of #embed to emit int type since there is an agreement to do that for C. C++ is being discussed, but in general we don't want to produce different types for C and C++. | 1 年前 | |
[Clang][Sema] Make UnresolvedLookupExprs in class scope explicit specializations instantiation dependent (#100392) A class member named by an expression in a member function that may instantiate to a static _or_ non-static member is represented by a UnresolvedLookupExpr in order to defer the implicit transformation to a class member access expression until instantiation. Since ASTContext::getDecltypeType only creates a DecltypeType that has a DependentDecltypeType as its canonical type when the operand is instantiation dependent, and since we do not transform types unless they are instantiation dependent, we need to mark the UnresolvedLookupExpr as instantiation dependent in order to correctly build a DecltypeType using the expression as its operand with a DependentDecltypeType canonical type. Fixes #99873. (cherry picked from commit 55ea36002bd364518c20b3ce282640c920697bf7) | 1 年前 | |
Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (#95802) This commit implements the entirety of the now-accepted [N3017 -Preprocessor Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and its sister C++ paper [p1967](https://wg21.link/p1967). It implements everything in the specification, and includes an implementation that drastically improves the time it takes to embed data in specific scenarios (the initialization of character type arrays). The mechanisms used to do this are used under the "as-if" rule, and in general when the system cannot detect it is initializing an array object in a variable declaration, will generate EmbedExpr AST node which will be expanded by AST consumers (CodeGen or constant expression evaluators) or expand embed directive as a comma expression. This reverts commit https://github.com/llvm/llvm-project/commit/682d461d5a231cee54d65910e6341769419a67d7. --------- Co-authored-by: The Phantom Derpstorm <phdofthehouse@gmail.com> Co-authored-by: Aaron Ballman <aaron@aaronballman.com> Co-authored-by: cor3ntin <corentinjabot@gmail.com> Co-authored-by: H. Vetinari <h.vetinari@gmx.com> | 1 年前 | |
Implement mangling rules for C++20 concepts and requires-expressions. This implements proposals from: - https://github.com/itanium-cxx-abi/cxx-abi/issues/24: mangling for constraints, requires-clauses, requires-expressions. - https://github.com/itanium-cxx-abi/cxx-abi/issues/31: requires-clauses and template parameters in a lambda expression are mangled into the <lambda-sig>. - https://github.com/itanium-cxx-abi/cxx-abi/issues/47 (STEP 3): mangling for template argument is prefixed by mangling of template parameter declaration if it's not "obvious", for example because the template parameter is constrained (we already implemented STEP 1 and STEP 2). This changes the manglings for a few cases: - Functions and function templates with constraints. - Function templates with template parameters with deduced types: typename<auto N> void f(); - Function templates with template template parameters where the argument has a different template-head: template<template<typename...T>> void f(); f<std::vector>(); In each case where a mangling changed, the change fixes a mangling collision. Note that only function templates are affected, not class templates or variable templates, and only new constructs (template parameters with deduced types, constrained templates) and esoteric constructs (templates with template template parameters with non-matching template template arguments, most of which Clang still does not accept by default due to -frelaxed-template-template-args not being enabled by default), so the risk to ABI stability from this change is relatively low. Nonetheless, -fclang-abi-compat=17 can be used to restore the old manglings for cases which we could successfully but incorrectly mangle before. Fixes #48216, #49884, #61273 Reviewed By: erichkeane, #libc_abi Differential Revision: https://reviews.llvm.org/D147655 | 2 年前 | |
[clang][Interp] Implement complex division (#94892) Share the implementation with the current interpreter. | 1 年前 | |
[ExprConstant] Handle shift overflow the same way as other kinds of overflow (#99579) We have a mechanism to allow folding expressions that aren't ICEs as an extension; use it more consistently. This ends up causing bad effects on diagnostics in a few cases, but that's not specific to shifts; it's a general issue with the way those uses handle overflow diagnostics. (cherry picked from commit 20eff684203287828d6722fc860b9d3621429542) | 1 年前 | |
[clang] NFC: refactor multiple implementations of getDecltypeForParenthesizedExpr This cleanup patch refactors a bunch of functional duplicates of getDecltypeForParenthesizedExpr into a common implementation. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Reviewed By: aaronpuchert Differential Revision: https://reviews.llvm.org/D100713 | 4 年前 | |
[AST] Use DenseMapBase::lookup (NFC) | 3 年前 | |
[clang][Modules] Move ASTSourceDescriptor into its own file (#67930) | 2 年前 | |
[Sema] Implement support for -Wformat-signedness (#74440) In gcc there exist a modifier option -Wformat-signedness that turns on additional signedness warnings in the already existing -Wformat warning. This patch implements that support in clang. This is done by adding a dummy warning diag::warn_format_conversion_argument_type_mismatch_signedness that is never emitted and only used as an option to toggle the signedness warning in -Wformat. This will ensure gcc compatibility. | 2 年前 | |
Add a missing header comment, NFC llvm-svn: 368754 | 6 年前 | |
Silence static analyzer getAs<RecordType> null dereference warnings. NFCI. The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<RecordType> directly and if not assert will fire for us. llvm-svn: 373584 | 6 年前 | |
[clang] Use std::optional instead of llvm::Optional (NFC) This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to remove #include "llvm/ADT/Optional.h". This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 | 3 年前 | |
[PAC] Define __builtin_ptrauth_type_discriminator (#100204) The builtin computes the discriminator for a type, which can be used to sign/authenticate function pointers and member function pointers. If the type passed to the builtin is a C++ member function pointer type, the result is the discriminator used to signed member function pointers of that type. If the type is a function, function pointer, or function reference type, the result is the discriminator used to sign functions of that type. It is ill-formed to use this builtin with any other type. A call to this function is an integer constant expression. Co-Authored-By: John McCall rjmccall@apple.com (cherry picked from commit 666e3326fedfb6a033494c36c36aa95c4124d642) | 1 年前 | |
[Clang][AST] Move NamespaceDecl bits to DeclContext (#98567) Currently, NamespaceDecl has a member AnonOrFirstNamespaceAndFlags which stores a few pieces of data: - a bit indicating whether the namespace was declared inline, and - a bit indicating whether the namespace was declared as a _nested-namespace-definition_, and - a pointer a NamespaceDecl that either stores: - a pointer to the first declaration of that namespace if the declaration is no the first declaration, or - a pointer to the unnamed namespace that inhabits the namespace otherwise. Redeclarable already stores a pointer to the first declaration of an entity, so it's unnecessary to store this in NamespaceDecl. DeclContext has 8 bytes in which various bitfields can be stored for a declaration, so it's not necessary to store these in NamespaceDecl either. We only need to store a pointer to the unnamed namespace that inhabits the first declaration of a namespace. This patch moves the two bits currently stored in NamespaceDecl to DeclContext, and only stores a pointer to the unnamed namespace that inhabits a namespace in the first declaration of that namespace. Since getOriginalNamespace always returns the same NamespaceDecl as getFirstDecl, this function is removed to avoid confusion. | 1 年前 | |
[clang][NFC] Annotate AST/Linkage.h with preferred_type This helps debuggers to display values in bit-fields in a more helpful way. | 2 年前 | |
[clang] Implement pointer authentication for C++ virtual functions, v-tables, and VTTs (#94056) Virtual function pointer entries in v-tables are signed with address discrimination in addition to declaration-based discrimination, where an integer discriminator the string hash (see ptrauth_string_discriminator) of the mangled name of the overridden method. This notably provides diversity based on the full signature of the overridden method, including the method name and parameter types. This patch introduces ItaniumVTableContext logic to find the original declaration of the overridden method. On AArch64, these pointers are signed using the IA key (the process-independent code key.) V-table pointers can be signed with either no discrimination, or a similar scheme using address and decl-based discrimination. In this case, the integer discriminator is the string hash of the mangled v-table identifier of the class that originally introduced the vtable pointer. On AArch64, these pointers are signed using the DA key (the process-independent data key.) Not using discrimination allows attackers to simply copy valid v-table pointers from one object to another. However, using a uniform discriminator of 0 does have positive performance and code-size implications on AArch64, and diversity for the most important v-table access pattern (virtual dispatch) is already better assured by the signing schemas used on the virtual functions. It is also known that some code in practice copies objects containing v-tables with memcpy, and while this is not permitted formally, it is something that may be invasive to eliminate. This is controlled by: -fptrauth-vtable-pointer-type-discrimination -fptrauth-vtable-pointer-address-discrimination In addition, this provides fine-grained controls in the ptrauth_vtable_pointer attribute, which allows overriding the default ptrauth schema for vtable pointers on a given class hierarchy, e.g.: [[clang::ptrauth_vtable_pointer(no_authentication, no_address_discrimination, no_extra_discrimination)]] [[clang::ptrauth_vtable_pointer(default_key, default_address_discrimination, custom_discrimination, 0xf00d)]] The override is then mangled as a parametrized vendor extension: "__vtptrauth" I <key> <addressDiscriminated> <extraDiscriminator> E To support this attribute, this patch adds a small extension to the attribute-emitter tablegen backend. Note that there are known areas where signing is either missing altogether or can be strengthened. Some will be addressed in later changes (e.g., member function pointers, some RTTI). dynamic_cast in particular is handled by emitting an artificial v-table pointer load (in a way that always authenticates it) before the runtime call itself, as the runtime doesn't have enough information today to properly authenticate it. Instead, the runtime is currently expected to strip the v-table pointer. --------- Co-authored-by: John McCall <rjmccall@apple.com> Co-authored-by: Ahmed Bougacha <ahmed@bougacha.org> | 1 年前 | |
[AST] Modernize MicrosoftNumberingContext (NFC) | 2 年前 | |
[APFloat] Add support for f8E4M3 IEEE 754 type (#97179) This PR adds f8E4M3 type to APFloat. f8E4M3 type follows IEEE 754 convention c f8E4M3 (IEEE 754) - Exponent bias: 7 - Maximum stored exponent value: 14 (binary 1110) - Maximum unbiased exponent value: 14 - 7 = 7 - Minimum stored exponent value: 1 (binary 0001) - Minimum unbiased exponent value: 1 − 7 = −6 - Precision specifies the total number of bits used for the significand (mantisa), including implicit leading integer bit = 3 + 1 = 4 - Follows IEEE 754 conventions for representation of special values - Has Positive and Negative zero - Has Positive and Negative infinity - Has NaNs Additional details: - Max exp (unbiased): 7 - Min exp (unbiased): -6 - Infinities (+/-): S.1111.000 - Zeros (+/-): S.0000.000 - NaNs: S.1111.{001, 010, 011, 100, 101, 110, 111} - Max normal number: S.1110.111 = +/-2^(7) x (1 + 0.875) = +/-240 - Min normal number: S.0001.000 = +/-2^(-6) - Max subnormal number: S.0000.111 = +/-2^(-6) x 0.875 = +/-2^(-9) x 7 - Min subnormal number: S.0000.001 = +/-2^(-6) x 0.125 = +/-2^(-9) Related PRs: - [PR-97118](https://github.com/llvm/llvm-project/pull/97118) Add f8E4M3 IEEE 754 type to mlir | 1 年前 | |
[Clang][AMDGPU] Add a new builtin type for buffer rsrc (#94830) This patch adds a new builtin type for AMDGPU's buffer rsrc data type, which is effectively an AS 8 pointer. This is needed because we'd like to expose certain intrinsics to users via builtins which take buffer rsrc as argument. | 1 年前 | |
[NFC][Clang] Improve const correctness for IdentifierInfo (#79365) The IdentifierInfo isn't typically modified. Use 'const' wherever possible. | 2 年前 | |
[clang] NFCI: use TemplateArgumentLoc for NTTP DefaultArgument (#92852) This is an enabler for https://github.com/llvm/llvm-project/pull/92855 This allows an NTTP default argument to be set as an arbitrary TemplateArgument, not just an expression. This allows template parameter packs to have default arguments in the AST, even though the language proper doesn't support the syntax for it. This allows NTTP default arguments to be other kinds of arguments, like packs, integral constants, and such. | 2 年前 | |
[Serialization] Use stable hash functions clangSerialization currently uses hash_combine/hash_value from Hashing.h, which are not guaranteed to be deterministic. Replace these uses with xxh3_64bits. Pull Request: https://github.com/llvm/llvm-project/pull/96136 | 1 年前 | |
[AST] Use std::optional in OSLog.cpp (NFC) This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 | 3 年前 | |
[OpenACC][NFC] Refactor SemaOpenACC to use a visitor This code was getting unwieldy, so a quick patch to refactor it a bit. | 2 年前 | |
[OpenMP] atomic compare weak : Parser & AST support (#79475) This is a support for " #pragma omp atomic compare weak". It has Parser & AST support for now. --------- Authored-by: Sunil Kuravinakop <kuravina@pe28vega.us.cray.com> | 2 年前 | |
[clang] Replace X && isa<Y>(X) with isa_and_nonnull<Y>(X). NFC (#94987) This addresses a clang-tidy suggestion. | 2 年前 | |
| 2 年前 | ||
[Clang][AMDGPU] Add a new builtin type for buffer rsrc (#94830) This patch adds a new builtin type for AMDGPU's buffer rsrc data type, which is effectively an AS 8 pointer. This is needed because we'd like to expose certain intrinsics to users via builtins which take buffer rsrc as argument. | 1 年前 | |
[clang][AST] createNestedNameSpecifierForScopeOf - don't use dyn_cast_or_null on never null DC argument Fixes static analysis warning about later dereferencing the DC variable which might have been null (assumed due to dyn_cast_or_null) - getRedeclContext shouldn't ever return a null value so safe to use dyn_cast instead. | 1 年前 | |
[randstruct] Randomize all elements of a record A record may have more than just FieldDecls in it. If so, then we're likely to drop them if we only randomize the FieldDecls. We need to be careful about anonymous structs/unions. Their fields are made available in the RecordDecl as IndirectFieldDecls, which are listed after the anonymous struct/union. The ordering doesn't appear to be super important, however we place them unrandomized at the end of the RecordDecl just in case. There's also the possiblity of StaticAssertDecls. We also want those at the end. All other non-FieldDecls we place at the top, just in case we get something like: struct foo { enum e { BORK }; enum e a; }; Link: https://github.com/KSPP/linux/issues/185 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123958 | 4 年前 | |
[clang] Use StringRef::{starts,ends}_with (NFC) (#75149) This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. I'm planning to deprecate and eventually remove StringRef::{starts,ends}with. | 2 年前 | |
[AIX] Implement AIX special alignment rule about double/long double Implement AIX default power alignment rule by adding PreferredAlignment and PreferredNVAlignment in ASTRecordLayout class. The patchh aims at returning correct value for __alignof(x) and alignof(x) under power alignment rules. Differential Revision: https://reviews.llvm.org/D79719 | 5 年前 | |
[CUDA][HIP] Fix record layout on Windows (#87651) On windows, record layout should be consistent with host side, otherwise host code is not able to access fields of the record correctly. Fixes: https://github.com/llvm/llvm-project/issues/51031 Fixes: SWDEV-446010 | 2 年前 | |
[NFC] Refactor ConstantArrayType size storage (#85716) In PR #79382, I need to add a new type that derives from ConstantArrayType. This means that ConstantArrayType can no longer use llvm::TrailingObjects to store the trailing optional Expr*. This change refactors ConstantArrayType to store a 60-bit integer and 4-bits for the integer size in bytes. This replaces the APInt field previously in the type but preserves enough information to recreate it where needed. To reduce the number of places where the APInt is re-constructed I've also added some helper methods to the ConstantArrayType to allow some common use cases that operate on either the stored small integer or the APInt as appropriate. Resolves #85124. | 2 年前 | |
[NFC][Clang] Improve const correctness for IdentifierInfo (#79365) The IdentifierInfo isn't typically modified. Use 'const' wherever possible. | 2 年前 | |
[OpenACC] Implement AST for OpenACC Compute Constructs (#81188) 'serial', 'parallel', and 'kernel' constructs are all considered 'Compute' constructs. This patch creates the AST type, plus the required infrastructure for such a type, plus some base types that will be useful in the future for breaking this up. The only difference between the three is the 'kind'( plus some minor clause legalization rules, but those can be differentiated easily enough), so rather than representing them as separate AST nodes, it seems to make sense to make them the same. Additionally, no clause AST functionality is being implemented yet, as that fits better in a separate patch, and this is enough to get the 'naked' constructs implemented. This is otherwise an 'NFC' patch, as it doesn't alter execution at all, so there aren't any tests. I did this to break up the review workload and to get feedback on the layout. | 2 年前 | |
Fix codegen for coroutine with function-try-block This fixes an assertion error when writing a coroutine with a function-try-block. In this case the function body is not a CompoundStmt so the code constructing an artificial CXXTryStmt must also construct a CompoundStmt for it. While on it adjust the CXXStmt::Create function to only accept CompoundStmt*. Differential Revision: https://reviews.llvm.org/D146758 | 3 年前 | |
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636 | 7 年前 | |
[clang] Convert ObjCAtTryStmt to llvm::TrailingObjects And make it final while here. No behavior change. Differential Revision: https://reviews.llvm.org/D112542 | 4 年前 | |
[OpenACC] Loop construct basic Sema and AST work (#93742) This patch implements the 'loop' construct AST, as well as the basic appertainment rule. Additionally, it sets up the 'parent' compute construct, which is necessary for codegen/other diagnostics. A 'loop' can apply to a for or range-for loop, otherwise it has no other restrictions (though some of its clauses do). | 2 年前 | |
[Clang][OpenMP] Add interchange directive (#93022) Add the interchange directive which will be introduced in the upcoming OpenMP 6.0 specification. A preview has been published in [Technical Report 12](https://www.openmp.org/wp-content/uploads/openmp-TR12.pdf). | 1 年前 | |
[Clang][OpenMP] Add interchange directive (#93022) Add the interchange directive which will be introduced in the upcoming OpenMP 6.0 specification. A preview has been published in [Technical Report 12](https://www.openmp.org/wp-content/uploads/openmp-TR12.pdf). | 1 年前 | |
[Clang][OpenMP] Add interchange directive (#93022) Add the interchange directive which will be introduced in the upcoming OpenMP 6.0 specification. A preview has been published in [Technical Report 12](https://www.openmp.org/wp-content/uploads/openmp-TR12.pdf). | 1 年前 | |
Update the file headers across all of the LLVM projects in the monorepo to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636 | 7 年前 | |
[clang] NFCI: improve TemplateArgument and TemplateName dump methods (#94905) These will work as AST Text node dumpers, as usual, instead of AST printers. Note that for now, the TemplateName dumper is using the TemplateArgument dumper through an implicit conversion. This can be fixed in a later pass. | 2 年前 | |
Revert "[clang] fix broken canonicalization of DeducedTemplateSpecializationType (#95202)" This reverts commit 2e1ad93961a3f444659c5d02d800e3144acccdb4. Reverting #95202 in the 19.x branch Fixes #106182 The change in #95202 causes code to crash and there is no good way to backport a fix for that as there are ABI-impacting changes at play. Instead we revert #95202 in the 19x branch, fixing the regression and preserving the 18.x behavior (which is GCC's behavior) https://github.com/llvm/llvm-project/pull/106335#discussion_r1735174841 | 1 年前 | |
[Clang][AST] Move NamespaceDecl bits to DeclContext (#98567) Currently, NamespaceDecl has a member AnonOrFirstNamespaceAndFlags which stores a few pieces of data: - a bit indicating whether the namespace was declared inline, and - a bit indicating whether the namespace was declared as a _nested-namespace-definition_, and - a pointer a NamespaceDecl that either stores: - a pointer to the first declaration of that namespace if the declaration is no the first declaration, or - a pointer to the unnamed namespace that inhabits the namespace otherwise. Redeclarable already stores a pointer to the first declaration of an entity, so it's unnecessary to store this in NamespaceDecl. DeclContext has 8 bytes in which various bitfields can be stored for a declaration, so it's not necessary to store these in NamespaceDecl either. We only need to store a pointer to the unnamed namespace that inhabits the first declaration of a namespace. This patch moves the two bits currently stored in NamespaceDecl to DeclContext, and only stores a pointer to the unnamed namespace that inhabits a namespace in the first declaration of that namespace. Since getOriginalNamespace always returns the same NamespaceDecl as getFirstDecl, this function is removed to avoid confusion. | 1 年前 | |
Performance optimizations for function effects (nonblocking attribute etc.) (#96844) - Put new FunctionProtoType trailing objects last. - Inline FunctionEffectsRef::get() - Manually inline FunctionEffectsRef::Profile(). --------- Co-authored-by: Doug Wyatt <dwyatt@apple.com> | 1 年前 | |
[Clang][AMDGPU] Add a new builtin type for buffer rsrc (#94830) This patch adds a new builtin type for AMDGPU's buffer rsrc data type, which is effectively an AS 8 pointer. This is needed because we'd like to expose certain intrinsics to users via builtins which take buffer rsrc as argument. | 1 年前 | |
added all modifications made for msdebug | 6 个月前 | |
Fix typo "indicies" (#92232) | 2 年前 | |
[clang] Implement pointer authentication for C++ virtual functions, v-tables, and VTTs (#94056) Virtual function pointer entries in v-tables are signed with address discrimination in addition to declaration-based discrimination, where an integer discriminator the string hash (see ptrauth_string_discriminator) of the mangled name of the overridden method. This notably provides diversity based on the full signature of the overridden method, including the method name and parameter types. This patch introduces ItaniumVTableContext logic to find the original declaration of the overridden method. On AArch64, these pointers are signed using the IA key (the process-independent code key.) V-table pointers can be signed with either no discrimination, or a similar scheme using address and decl-based discrimination. In this case, the integer discriminator is the string hash of the mangled v-table identifier of the class that originally introduced the vtable pointer. On AArch64, these pointers are signed using the DA key (the process-independent data key.) Not using discrimination allows attackers to simply copy valid v-table pointers from one object to another. However, using a uniform discriminator of 0 does have positive performance and code-size implications on AArch64, and diversity for the most important v-table access pattern (virtual dispatch) is already better assured by the signing schemas used on the virtual functions. It is also known that some code in practice copies objects containing v-tables with memcpy, and while this is not permitted formally, it is something that may be invasive to eliminate. This is controlled by: -fptrauth-vtable-pointer-type-discrimination -fptrauth-vtable-pointer-address-discrimination In addition, this provides fine-grained controls in the ptrauth_vtable_pointer attribute, which allows overriding the default ptrauth schema for vtable pointers on a given class hierarchy, e.g.: [[clang::ptrauth_vtable_pointer(no_authentication, no_address_discrimination, no_extra_discrimination)]] [[clang::ptrauth_vtable_pointer(default_key, default_address_discrimination, custom_discrimination, 0xf00d)]] The override is then mangled as a parametrized vendor extension: "__vtptrauth" I <key> <addressDiscriminated> <extraDiscriminator> E To support this attribute, this patch adds a small extension to the attribute-emitter tablegen backend. Note that there are known areas where signing is either missing altogether or can be strengthened. Some will be addressed in later changes (e.g., member function pointers, some RTTI). dynamic_cast in particular is handled by emitting an artificial v-table pointer load (in a way that always authenticates it) before the runtime call itself, as the runtime doesn't have enough information today to properly authenticate it. Instead, the runtime is currently expected to strip the v-table pointer. --------- Co-authored-by: John McCall <rjmccall@apple.com> Co-authored-by: Ahmed Bougacha <ahmed@bougacha.org> | 1 年前 |