r298695 - Revert r298491 and r298494 which changed Clang's handling of 'nonnull'
Author: chandlerc Date: Fri Mar 24 04:11:57 2017 New Revision: 298695 URL: http://llvm.org/viewvc/llvm-project?rev=298695&view=rev Log: Revert r298491 and r298494 which changed Clang's handling of 'nonnull' attributes. These patches don't work because we can't currently access the parameter information in a reliable way when building attributes. I thought this would be relatively straightforward to fix, but it seems not to be the case. Fixing this will requrie a substantial re-plumbing of machinery to allow attributes to be handled in this location, and several other fixes to the attribute machinery should probably be made at the same time. All of this will make the patch substantially more complicated. Reverting for now as there are active miscompiles caused by the current version. Modified: cfe/trunk/include/clang/AST/ASTContext.h cfe/trunk/include/clang/Basic/Builtins.def cfe/trunk/lib/AST/ASTContext.cpp cfe/trunk/lib/CodeGen/CGCall.cpp cfe/trunk/test/CodeGen/function-attributes.c cfe/trunk/test/CodeGen/nonnull.c Modified: cfe/trunk/include/clang/AST/ASTContext.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=298695&r1=298694&r2=298695&view=diff == --- cfe/trunk/include/clang/AST/ASTContext.h (original) +++ cfe/trunk/include/clang/AST/ASTContext.h Fri Mar 24 04:11:57 2017 @@ -1864,9 +1864,7 @@ public: /// arguments to the builtin that are required to be integer constant /// expressions. QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, - unsigned *IntegerConstantArgs = nullptr, - bool *OverrideNonnullReturn = nullptr, - unsigned *OverrideNonnullArgs = nullptr) const; + unsigned *IntegerConstantArgs = nullptr) const; private: CanQualType getFromTargetType(unsigned Type) const; Modified: cfe/trunk/include/clang/Basic/Builtins.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=298695&r1=298694&r2=298695&view=diff == --- cfe/trunk/include/clang/Basic/Builtins.def (original) +++ cfe/trunk/include/clang/Basic/Builtins.def Fri Mar 24 04:11:57 2017 @@ -55,12 +55,6 @@ // S -> signed // U -> unsigned // I -> Required to constant fold to an integer constant expression. -// N -> Do not assume non-null for optimizations even if attributed nonnull. -// This can be used when a relevant standard requires arguments or -// returns to be non-null and they are attributed accordingly but in -// practice are not used in this way. This typically used when a size -// parameter is also provided and when zero it would be reasonable to -// give an invalid pointer. // // Types may be postfixed with the following modifiers: // * -> pointer (optionally followed by an address space number, if no address @@ -792,27 +786,27 @@ LIBBUILTIN(_Exit, "vi", "fr", LIBBUILTIN(malloc, "v*z", "f", "stdlib.h", ALL_LANGUAGES) LIBBUILTIN(realloc, "v*v*z", "f", "stdlib.h", ALL_LANGUAGES) // C99 string.h -LIBBUILTIN(memcpy, "Nv*Nv*NvC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(memcmp, "iNvC*NvC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(memmove, "Nv*Nv*NvC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strcpy, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strncpy, "Nc*Nc*NcC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strcmp, "icC*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strncmp, "iNcC*NcC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strcat, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strncat, "c*c*NcC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strxfrm, "zc*cC*z", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(memchr, "Nv*NvC*iz","f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strcspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strpbrk, "c*cC*cC*","f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strrchr, "c*cC*i", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strspn, "zcC*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strstr, "c*cC*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strtok, "c*c*cC*", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(memset, "Nv*Nv*iz", "f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strerror, "c*i","f", "string.h", ALL_LANGUAGES) -LIBBUILTIN(strlen, "zcC*", "f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(memcpy, "v*v*vC*z","f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(memcmp, "ivC*vC*z","f", "string.h", ALL_LANGUAGES) +LIBBUILTIN(memmove, "v*v*vC*z", "f",
[clang-tools-extra] r298696 - [clangd] Add support for vscode extension configuration
Author: krasimir Date: Fri Mar 24 04:29:00 2017 New Revision: 298696 URL: http://llvm.org/viewvc/llvm-project?rev=298696&view=rev Log: [clangd] Add support for vscode extension configuration Summary: Adds vscode workspace level configuration options for path to clangd binary and its arguments. Contributed by stanionascu! Reviewers: cfe-commits, bkramer, krasimir Reviewed By: krasimir Differential Revision: https://reviews.llvm.org/D31121 Modified: clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts Modified: clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json?rev=298696&r1=298695&r2=298696&view=diff == --- clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json (original) +++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json Fri Mar 24 04:29:00 2017 @@ -33,5 +33,26 @@ "mocha": "^2.3.3", "@types/node": "^6.0.40", "@types/mocha": "^2.2.32" +}, +"contributes": { +"configuration": { +"type": "object", +"title": "clangd configuration", +"properties": { +"clangd.path": { +"type": "string", +"default": "clangd", +"description": "The path to clangd executable, e.g.: /usr/bin/clangd" +}, +"clangd.arguments": { +"type": "array", +"default": [], +"items": { +"type": "string" +}, +"description": "Arguments for clangd server" +} +} +} } -} \ No newline at end of file +} Modified: clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts?rev=298696&r1=298695&r2=298696&view=diff == --- clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts (original) +++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts Fri Mar 24 04:29:00 2017 @@ -2,14 +2,24 @@ import * as vscode from 'vscode'; import * as vscodelc from 'vscode-languageclient'; /** + * Method to get workspace configuration option + * @param option name of the option (e.g. for clangd.path should be path) + * @param defaultValue default value to return if option is not set + */ +function getConfig(option: string, defaultValue?: any) : T { +const config = vscode.workspace.getConfiguration('clangd'); +return config.get(option, defaultValue); +} + +/** * this method is called when your extension is activate * your extension is activated the very first time the command is executed */ export function activate(context: vscode.ExtensionContext) { -// TODO: make this configurable -const clangdPath = '/usr/bin/clangd'; +const clangdPath = getConfig('path'); +const clangdArgs = getConfig('arguments'); -const serverOptions: vscodelc.ServerOptions = { command: clangdPath }; +const serverOptions: vscodelc.ServerOptions = { command: clangdPath, args: clangdArgs }; const clientOptions: vscodelc.LanguageClientOptions = { // Register the server for C/C++ files @@ -39,4 +49,4 @@ export function activate(context: vscode const disposable = clangdClient.start(); context.subscriptions.push(disposable, vscode.commands.registerCommand('clangd.applyFix', applyTextEdits)); -} \ No newline at end of file +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31121: [clangd] Add support for vscode extension configuration
This revision was automatically updated to reflect the committed changes. Closed by commit rL298696: [clangd] Add support for vscode extension configuration (authored by krasimir). Changed prior to commit: https://reviews.llvm.org/D31121?vs=92367&id=92907#toc Repository: rL LLVM https://reviews.llvm.org/D31121 Files: clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts Index: clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts === --- clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts +++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts @@ -2,14 +2,24 @@ import * as vscodelc from 'vscode-languageclient'; /** + * Method to get workspace configuration option + * @param option name of the option (e.g. for clangd.path should be path) + * @param defaultValue default value to return if option is not set + */ +function getConfig(option: string, defaultValue?: any) : T { +const config = vscode.workspace.getConfiguration('clangd'); +return config.get(option, defaultValue); +} + +/** * this method is called when your extension is activate * your extension is activated the very first time the command is executed */ export function activate(context: vscode.ExtensionContext) { -// TODO: make this configurable -const clangdPath = '/usr/bin/clangd'; +const clangdPath = getConfig('path'); +const clangdArgs = getConfig('arguments'); -const serverOptions: vscodelc.ServerOptions = { command: clangdPath }; +const serverOptions: vscodelc.ServerOptions = { command: clangdPath, args: clangdArgs }; const clientOptions: vscodelc.LanguageClientOptions = { // Register the server for C/C++ files @@ -39,4 +49,4 @@ const disposable = clangdClient.start(); context.subscriptions.push(disposable, vscode.commands.registerCommand('clangd.applyFix', applyTextEdits)); -} \ No newline at end of file +} Index: clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json === --- clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json +++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json @@ -33,5 +33,26 @@ "mocha": "^2.3.3", "@types/node": "^6.0.40", "@types/mocha": "^2.2.32" +}, +"contributes": { +"configuration": { +"type": "object", +"title": "clangd configuration", +"properties": { +"clangd.path": { +"type": "string", +"default": "clangd", +"description": "The path to clangd executable, e.g.: /usr/bin/clangd" +}, +"clangd.arguments": { +"type": "array", +"default": [], +"items": { +"type": "string" +}, +"description": "Arguments for clangd server" +} +} +} } -} \ No newline at end of file +} Index: clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts === --- clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts +++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/src/extension.ts @@ -2,14 +2,24 @@ import * as vscodelc from 'vscode-languageclient'; /** + * Method to get workspace configuration option + * @param option name of the option (e.g. for clangd.path should be path) + * @param defaultValue default value to return if option is not set + */ +function getConfig(option: string, defaultValue?: any) : T { +const config = vscode.workspace.getConfiguration('clangd'); +return config.get(option, defaultValue); +} + +/** * this method is called when your extension is activate * your extension is activated the very first time the command is executed */ export function activate(context: vscode.ExtensionContext) { -// TODO: make this configurable -const clangdPath = '/usr/bin/clangd'; +const clangdPath = getConfig('path'); +const clangdArgs = getConfig('arguments'); -const serverOptions: vscodelc.ServerOptions = { command: clangdPath }; +const serverOptions: vscodelc.ServerOptions = { command: clangdPath, args: clangdArgs }; const clientOptions: vscodelc.LanguageClientOptions = { // Register the server for C/C++ files @@ -39,4 +49,4 @@ const disposable = clangdClient.start(); context.subscriptions.push(disposable, vscode.commands.registerCommand('clangd.applyFix', applyTextEdits)); -} \ No newline at end of file +} Index: clang-tools-extra/trunk/clangd/clients/clangd-vscode/package.json ==
r298697 - [libclang] Bury dead TemporaryFiles
Author: krasimir Date: Fri Mar 24 04:49:54 2017 New Revision: 298697 URL: http://llvm.org/viewvc/llvm-project?rev=298697&view=rev Log: [libclang] Bury dead TemporaryFiles Summary: AllocatedCXCodeCompleteResults::TemporaryFiles have turned into zombies. Seven years ago they used to do their job during [[ https://github.com/llvm-mirror/clang/commit/313e26c4e81f0e467490a530548450f4c824a6c4/tools/CIndex/CIndexCodeCompletion.cpp#diff-02d3e692ad507b10af9458b775c5750bL261 | file remapping]], but now they are created just to be torn down in the destructor. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31288 Modified: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Modified: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=298697&r1=298696&r2=298697&view=diff == --- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp (original) +++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Fri Mar 24 04:49:54 2017 @@ -270,10 +270,6 @@ struct AllocatedCXCodeCompleteResults : /// \brief Source manager, used for diagnostics. IntrusiveRefCntPtr SourceMgr; - /// \brief Temporary files that should be removed once we have finished - /// with the code-completion results. - std::vector TemporaryFiles; - /// \brief Temporary buffers that will be deleted once we have finished with /// the code-completion results. SmallVector TemporaryBuffers; @@ -335,8 +331,6 @@ AllocatedCXCodeCompleteResults::~Allocat llvm::DeleteContainerPointers(DiagnosticsWrappers); delete [] Results; - for (unsigned I = 0, N = TemporaryFiles.size(); I != N; ++I) -llvm::sys::fs::remove(TemporaryFiles[I]); for (unsigned I = 0, N = TemporaryBuffers.size(); I != N; ++I) delete TemporaryBuffers[I]; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31288: [libclang] Bury dead TemporaryFiles
This revision was automatically updated to reflect the committed changes. Closed by commit rL298697: [libclang] Bury dead TemporaryFiles (authored by krasimir). Changed prior to commit: https://reviews.llvm.org/D31288?vs=92804&id=92908#toc Repository: rL LLVM https://reviews.llvm.org/D31288 Files: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Index: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp === --- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp +++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp @@ -270,10 +270,6 @@ /// \brief Source manager, used for diagnostics. IntrusiveRefCntPtr SourceMgr; - /// \brief Temporary files that should be removed once we have finished - /// with the code-completion results. - std::vector TemporaryFiles; - /// \brief Temporary buffers that will be deleted once we have finished with /// the code-completion results. SmallVector TemporaryBuffers; @@ -335,8 +331,6 @@ llvm::DeleteContainerPointers(DiagnosticsWrappers); delete [] Results; - for (unsigned I = 0, N = TemporaryFiles.size(); I != N; ++I) -llvm::sys::fs::remove(TemporaryFiles[I]); for (unsigned I = 0, N = TemporaryBuffers.size(); I != N; ++I) delete TemporaryBuffers[I]; Index: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp === --- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp +++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp @@ -270,10 +270,6 @@ /// \brief Source manager, used for diagnostics. IntrusiveRefCntPtr SourceMgr; - /// \brief Temporary files that should be removed once we have finished - /// with the code-completion results. - std::vector TemporaryFiles; - /// \brief Temporary buffers that will be deleted once we have finished with /// the code-completion results. SmallVector TemporaryBuffers; @@ -335,8 +331,6 @@ llvm::DeleteContainerPointers(DiagnosticsWrappers); delete [] Results; - for (unsigned I = 0, N = TemporaryFiles.size(); I != N; ++I) -llvm::sys::fs::remove(TemporaryFiles[I]); for (unsigned I = 0, N = TemporaryBuffers.size(); I != N; ++I) delete TemporaryBuffers[I]; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31321: [OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args
echuraev created this revision. Herald added a subscriber: yaxunl. "kernel_arg_type_qual" metadata should contain const/volatile/restrict tags only for pointer types to match the corresponding requirement of the OpenCL specification. OpenCL 2.0 spec 5.9.3 Kernel Object Queries: CL_KERNEL_ARG_TYPE_VOLATILE is returned if the argument is a pointer and the referenced type is declared with the volatile qualifier. [...] Similarly, CL_KERNEL_ARG_TYPE_CONST is returned if the argument is a pointer and the referenced type is declared with the restrict or const qualifier. [...] CL_KERNEL_ARG_TYPE_RESTRICT will be returned if the pointer type is marked restrict. https://reviews.llvm.org/D31321 Files: lib/CodeGen/CodeGenFunction.cpp test/CodeGenOpenCL/kernel-arg-info.cl Index: test/CodeGenOpenCL/kernel-arg-info.cl === --- test/CodeGenOpenCL/kernel-arg-info.cl +++ test/CodeGenOpenCL/kernel-arg-info.cl @@ -63,7 +63,7 @@ // CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2} // CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none"} // CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*"} -// CHECK: ![[MD14]] = !{!"restrict", !"const", !"volatile", !"restrict const"} +// CHECK: ![[MD14]] = !{!"restrict", !"", !"", !"restrict const"} // ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z"} // CHECK: ![[MD21]] = !{i32 1, i32 1, i32 1, i32 1} // CHECK: ![[MD22]] = !{!"read_only", !"read_only", !"write_only", !"read_write"} Index: lib/CodeGen/CodeGenFunction.cpp === --- lib/CodeGen/CodeGenFunction.cpp +++ lib/CodeGen/CodeGenFunction.cpp @@ -610,11 +610,6 @@ argBaseTypeNames.push_back(llvm::MDString::get(Context, baseTypeName)); - // Get argument type qualifiers: - if (ty.isConstQualified()) -typeQuals = "const"; - if (ty.isVolatileQualified()) -typeQuals += typeQuals.empty() ? "volatile" : " volatile"; if (isPipe) typeQuals = "pipe"; } Index: test/CodeGenOpenCL/kernel-arg-info.cl === --- test/CodeGenOpenCL/kernel-arg-info.cl +++ test/CodeGenOpenCL/kernel-arg-info.cl @@ -63,7 +63,7 @@ // CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2} // CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none"} // CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*"} -// CHECK: ![[MD14]] = !{!"restrict", !"const", !"volatile", !"restrict const"} +// CHECK: ![[MD14]] = !{!"restrict", !"", !"", !"restrict const"} // ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z"} // CHECK: ![[MD21]] = !{i32 1, i32 1, i32 1, i32 1} // CHECK: ![[MD22]] = !{!"read_only", !"read_only", !"write_only", !"read_write"} Index: lib/CodeGen/CodeGenFunction.cpp === --- lib/CodeGen/CodeGenFunction.cpp +++ lib/CodeGen/CodeGenFunction.cpp @@ -610,11 +610,6 @@ argBaseTypeNames.push_back(llvm::MDString::get(Context, baseTypeName)); - // Get argument type qualifiers: - if (ty.isConstQualified()) -typeQuals = "const"; - if (ty.isVolatileQualified()) -typeQuals += typeQuals.empty() ? "volatile" : " volatile"; if (isPipe) typeQuals = "pipe"; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298698 - [analyzer] Add MisusedMovedObjectChecker for detecting use-after-move errors.
Author: dergachev Date: Fri Mar 24 04:52:30 2017 New Revision: 298698 URL: http://llvm.org/viewvc/llvm-project?rev=298698&view=rev Log: [analyzer] Add MisusedMovedObjectChecker for detecting use-after-move errors. The checker currently warns on copying, moving, or calling methods on an object that was recently std::move'd from. It understands a set of "state reset" methods that bring a moved-from object back to a well-specified state. Patch by Peter Szecsi! Differential Revision: https://reviews.llvm.org/D24246 Added: cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp cfe/trunk/test/Analysis/MisusedMovedObject.cpp Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td?rev=298698&r1=298697&r2=298698&view=diff == --- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td Fri Mar 24 04:52:30 2017 @@ -279,6 +279,11 @@ def VirtualCallChecker : Checker<"Virtua let ParentPackage = CplusplusAlpha in { +def MisusedMovedObjectChecker: Checker<"MisusedMovedObject">, + HelpText<"Method calls on a moved-from object and copying a moved-from " + "object will be reported">, + DescFile<"MisusedMovedObjectChecker.cpp">; + def IteratorPastEndChecker : Checker<"IteratorPastEnd">, HelpText<"Check iterators used past end">, DescFile<"IteratorPastEndChecker.cpp">; Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=298698&r1=298697&r2=298698&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Fri Mar 24 04:52:30 2017 @@ -48,6 +48,7 @@ add_clang_library(clangStaticAnalyzerChe MallocChecker.cpp MallocOverflowSecurityChecker.cpp MallocSizeofChecker.cpp + MisusedMovedObjectChecker.cpp MPI-Checker/MPIBugReporter.cpp MPI-Checker/MPIChecker.cpp MPI-Checker/MPIFunctionClassifier.cpp Added: cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp?rev=298698&view=auto == --- cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp (added) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp Fri Mar 24 04:52:30 2017 @@ -0,0 +1,488 @@ +// MisusedMovedObjectChecker.cpp - Check use of moved-from objects. - C++ -===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// +// +// This defines checker which checks for potential misuses of a moved-from +// object. That means method calls on the object or copying it in moved-from +// state. +// +//===--===// + +#include "ClangSACheckers.h" +#include "clang/AST/ExprCXX.h" +#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" +#include "clang/StaticAnalyzer/Core/Checker.h" +#include "clang/StaticAnalyzer/Core/CheckerManager.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" + +using namespace clang; +using namespace ento; + +namespace { + +struct RegionState { +private: + enum Kind { Moved, Reported } K; + RegionState(Kind InK) : K(InK) {} + +public: + bool isReported() const { return K == Reported; } + bool isMoved() const { return K == Moved; } + + static RegionState getReported() { return RegionState(Reported); } + static RegionState getMoved() { return RegionState(Moved); } + + bool operator==(const RegionState &X) const { return K == X.K; } + void Profile(llvm::FoldingSetNodeID &ID) const { ID.AddInteger(K); } +}; + +class MisusedMovedObjectChecker +: public Checker { +public: + void checkEndFunction(CheckerContext &C) const; + void checkPreCall(const CallEvent &MC, CheckerContext &C) const; + void checkPostCall(const CallEvent &MC, CheckerContext &C) const; + void checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const; + bool wantsRegionChangeUpdate(ProgramStateRef State) const; + ProgramStateRef + checkRegionChanges(ProgramStateRef State, + const InvalidatedSymbols *Invalidated, + ArrayRef Ex
r298699 - [analyzer] MisusedMovedObject: Remove deprecated callback. NFC
Author: dergachev Date: Fri Mar 24 05:16:08 2017 New Revision: 298699 URL: http://llvm.org/viewvc/llvm-project?rev=298699&view=rev Log: [analyzer] MisusedMovedObject: Remove deprecated callback. NFC wantsRegionChangeUpdate() checker callback is no longer used since recently. Fixes a buildbot warning. Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp?rev=298699&r1=298698&r2=298699&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp Fri Mar 24 05:16:08 2017 @@ -50,7 +50,6 @@ public: void checkPreCall(const CallEvent &MC, CheckerContext &C) const; void checkPostCall(const CallEvent &MC, CheckerContext &C) const; void checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const; - bool wantsRegionChangeUpdate(ProgramStateRef State) const; ProgramStateRef checkRegionChanges(ProgramStateRef State, const InvalidatedSymbols *Invalidated, @@ -453,12 +452,6 @@ void MisusedMovedObjectChecker::checkDea C.addTransition(State); } -bool MisusedMovedObjectChecker::wantsRegionChangeUpdate( -ProgramStateRef State) const { - TrackedRegionMapTy Regions = State->get(); - return !Regions.isEmpty(); -} - ProgramStateRef MisusedMovedObjectChecker::checkRegionChanges( ProgramStateRef State, const InvalidatedSymbols *Invalidated, ArrayRef ExplicitRegions, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31324: [OpenCL] Extended mapping of parcing CodeGen arguments
echuraev created this revision. Herald added a subscriber: yaxunl. Enable cl_mad_enamle and cl_no_signed_zeros options when user turns on cl_unsafe_math_optimizations or cl_fast_relaxed_math options. https://reviews.llvm.org/D31324 Files: lib/Frontend/CompilerInvocation.cpp test/CodeGenOpenCL/relaxed-fpmath.cl Index: test/CodeGenOpenCL/relaxed-fpmath.cl === --- test/CodeGenOpenCL/relaxed-fpmath.cl +++ test/CodeGenOpenCL/relaxed-fpmath.cl @@ -2,33 +2,54 @@ // RUN: %clang_cc1 %s -emit-llvm -cl-fast-relaxed-math -o - | FileCheck %s -check-prefix=FAST // RUN: %clang_cc1 %s -emit-llvm -cl-finite-math-only -o - | FileCheck %s -check-prefix=FINITE // RUN: %clang_cc1 %s -emit-llvm -cl-unsafe-math-optimizations -o - | FileCheck %s -check-prefix=UNSAFE - -typedef __attribute__(( ext_vector_type(4) )) float float4; +// RUN: %clang_cc1 %s -emit-llvm -cl-mad-enable -o - | FileCheck %s -check-prefix=MAD +// RUN: %clang_cc1 %s -emit-llvm -cl-no-signed-zeros -o - | FileCheck %s -check-prefix=NOSIGNED float spscalardiv(float a, float b) { // CHECK: @spscalardiv( - // NORMAL: fdiv float + // NORMAL: fdiv float // FAST: fdiv fast float // FINITE: fdiv nnan ninf float - // UNSAFE: fdiv nnan float + // UNSAFE: fdiv nnan nsz float + // MAD: fdiv float + // NOSIGNED: fdiv nsz float return a / b; } // CHECK: attributes +// NORMAL: "less-precise-fpmad"="false" // NORMAL: "no-infs-fp-math"="false" // NORMAL: "no-nans-fp-math"="false" +// NORMAL: "no-signed-zeros-fp-math"="false" // NORMAL: "unsafe-fp-math"="false" +// FAST: "less-precise-fpmad"="true" // FAST: "no-infs-fp-math"="true" // FAST: "no-nans-fp-math"="true" +// FAST: "no-signed-zeros-fp-math"="true" // FAST: "unsafe-fp-math"="true" +// FINITE: "less-precise-fpmad"="false" // FINITE: "no-infs-fp-math"="true" // FINITE: "no-nans-fp-math"="true" +// FINITE: "no-signed-zeros-fp-math"="false" // FINITE: "unsafe-fp-math"="false" +// UNSAFE: "less-precise-fpmad"="true" // UNSAFE: "no-infs-fp-math"="false" // UNSAFE: "no-nans-fp-math"="true" +// UNSAFE: "no-signed-zeros-fp-math"="true" // UNSAFE: "unsafe-fp-math"="true" +// MAD: "less-precise-fpmad"="true" +// MAD: "no-infs-fp-math"="false" +// MAD: "no-nans-fp-math"="false" +// MAD: "no-signed-zeros-fp-math"="false" +// MAD: "unsafe-fp-math"="false" + +// NOSIGNED: "less-precise-fpmad"="false" +// NOSIGNED: "no-infs-fp-math"="false" +// NOSIGNED: "no-nans-fp-math"="false" +// NOSIGNED: "no-signed-zeros-fp-math"="true" +// NOSIGNED: "unsafe-fp-math"="false" Index: lib/Frontend/CompilerInvocation.cpp === --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -573,7 +573,9 @@ Opts.DiscardValueNames = Args.hasArg(OPT_discard_value_names); Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls); Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi); - Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable); + Opts.LessPreciseFPMAD = Args.hasArg(OPT_cl_mad_enable) || + Args.hasArg(OPT_cl_unsafe_math_optimizations) || + Args.hasArg(OPT_cl_fast_relaxed_math); Opts.LimitFloatPrecision = Args.getLastArgValue(OPT_mlimit_float_precision); Opts.NoInfsFPMath = (Args.hasArg(OPT_menable_no_infinities) || Args.hasArg(OPT_cl_finite_math_only) || @@ -583,7 +585,9 @@ Args.hasArg(OPT_cl_finite_math_only) || Args.hasArg(OPT_cl_fast_relaxed_math)); Opts.NoSignedZeros = (Args.hasArg(OPT_fno_signed_zeros) || -Args.hasArg(OPT_cl_no_signed_zeros)); +Args.hasArg(OPT_cl_no_signed_zeros) || +Args.hasArg(OPT_cl_unsafe_math_optimizations) || +Args.hasArg(OPT_cl_fast_relaxed_math)); Opts.FlushDenorm = Args.hasArg(OPT_cl_denorms_are_zero); Opts.CorrectlyRoundedDivSqrt = Args.hasArg(OPT_cl_fp32_correctly_rounded_divide_sqrt); Index: test/CodeGenOpenCL/relaxed-fpmath.cl === --- test/CodeGenOpenCL/relaxed-fpmath.cl +++ test/CodeGenOpenCL/relaxed-fpmath.cl @@ -2,33 +2,54 @@ // RUN: %clang_cc1 %s -emit-llvm -cl-fast-relaxed-math -o - | FileCheck %s -check-prefix=FAST // RUN: %clang_cc1 %s -emit-llvm -cl-finite-math-only -o - | FileCheck %s -check-prefix=FINITE // RUN: %clang_cc1 %s -emit-llvm -cl-unsafe-math-optimizations -o - | FileCheck %s -check-prefix=UNSAFE - -typedef __attribute__(( ext_vector_type(4) )) float float4; +// RUN: %clang_cc1 %s -emit-llvm -cl-mad-enable -o - | FileCheck %s -check-prefix=MAD +// RUN: %clang_cc1 %s -emit-llvm -cl-no-signed-zeros -o - | FileCheck %s -check-prefix=NOSIGNED float spscalardiv(float a, float b) { // CHECK: @spscalardiv( - // NORMAL: fdiv float + // NORMAL: fdiv float
[PATCH] D22476: [AST] Make MemberExpr non-dependent according to core issue 224
mgehre added a comment. Friendly ping https://reviews.llvm.org/D22476 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29262: Fixes to modernize-use-using
alexfh added a comment. In https://reviews.llvm.org/D29262#709351, @krystyna wrote: > I have plan to finish this patch next week, when I finish academic year at my > school. If I will have any issues with submitting, Prazek offered to help me. Sure, no stress. Good luck with your studies! https://reviews.llvm.org/D29262 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31308: [clang-tidy] new check readability-no-alternative-tokens
mgehre added a comment. Thanks for your feedback, Eugene! I'm not sure if it would be helpful to have this check in both ways. I did a code search for "not_eq", "bitand" and "and_eq" on github, and their usage seems to be a clear minority. So I would propose to keep the features as-is for now, change the name to readability-operators-representation, and then later (someone else?) might also add an option for making this work the other way around. Would that be ok for you? Were you refering to https://reviews.llvm.org/D25195 ("[lit] Fix FormatError on individual test timeout")? Repository: rL LLVM https://reviews.llvm.org/D31308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31308: [clang-tidy] new check readability-no-alternative-tokens
alexfh added a comment. In https://reviews.llvm.org/D31308#709709, @mgehre wrote: > Thanks for your feedback, Eugene! > > I'm not sure if it would be helpful to have this check in both ways. I did a > code search for "not_eq", "bitand" and "and_eq" > on github, and their usage seems to be a clear minority. > > So I would propose to keep the features as-is for now, > change the name to readability-operators-representation, and then later > (someone else?) might also add an option > for making this work the other way around. Would that be ok for you? > > Were you refering to https://reviews.llvm.org/D25195 ("[lit] Fix FormatError > on individual test timeout")? Nope, "PR" notation is used to reference bugs ("Problem Reports", PRobably): http://llvm.org/PR25195 Repository: rL LLVM https://reviews.llvm.org/D31308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31308: [clang-tidy] new check readability-no-alternative-tokens
alexfh added a comment. > So I would propose to keep the features as-is for now, > change the name to readability-operators-representation, and then later > (someone else?) might also add an option > for making this work the other way around. Would that be ok for you? Fine by me. Repository: rL LLVM https://reviews.llvm.org/D31308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31308: [clang-tidy] new check readability-no-alternative-tokens
alexfh added a comment. FWIW, I'm pretty sure this can and should be done on the lexer level - it will be faster and more universal. Repository: rL LLVM https://reviews.llvm.org/D31308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24886: Add [[clang::suppress(rule, ...)]] attribute
mgehre updated this revision to Diff 92923. mgehre added a comment. Thank you for the comments; all of them have been addressed. https://reviews.llvm.org/D24886 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td lib/Sema/SemaDeclAttr.cpp lib/Sema/SemaStmtAttr.cpp test/SemaCXX/suppress.cpp Index: test/SemaCXX/suppress.cpp === --- /dev/null +++ test/SemaCXX/suppress.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify + +[[clang::suppress("globally")]]; + +namespace N { + [[clang::suppress("in-a-namespace")]]; +} + +[[clang::suppress("readability-identifier-naming")]] +void f_() { + int *aVar_Name; + [[gsl::suppress("type", "bounds")]] { +aVar_Name = reinterpret_cast(7); + } + + [[clang::suppress]] int x; // expected-error {{'suppress' attribute takes at least 1 argument}} + [[clang::suppress()]] int y; // expected-error {{'suppress' attribute takes at least 1 argument}} + int [[clang::suppress("r")]] z; // expected-error {{'suppress' attribute cannot be applied to types}} + [[clang::suppress(f_)]] float f; // expected-error {{'suppress' attribute requires a string}} +} + +union [[gsl::suppress("type.1")]] U { + int i; + float f; +}; Index: lib/Sema/SemaStmtAttr.cpp === --- lib/Sema/SemaStmtAttr.cpp +++ lib/Sema/SemaStmtAttr.cpp @@ -53,6 +53,31 @@ return ::new (S.Context) auto(Attr); } +static Attr *handleSuppressAttr(Sema &S, Stmt *St, const AttributeList &A, +SourceRange Range) { + if (A.getNumArgs() < 1) { +S.Diag(A.getLoc(), diag::err_attribute_too_few_arguments) +<< A.getName() << 1; +return nullptr; + } + + std::vector DiagnosticIdentifiers; + for (unsigned I = 0, E = A.getNumArgs(); I != E; ++I) { +StringRef RuleName; + +if (!S.checkStringLiteralArgumentAttr(A, I, RuleName, nullptr)) + return nullptr; + +// FIXME: Warn if the rule name is unknown. This is tricky because only +// clang-tidy knows about available rules. +DiagnosticIdentifiers.push_back(RuleName); + } + + return ::new (S.Context) SuppressAttr( + A.getRange(), S.Context, DiagnosticIdentifiers.data(), + DiagnosticIdentifiers.size(), A.getAttributeSpellingListIndex()); +} + static Attr *handleLoopHintAttr(Sema &S, Stmt *St, const AttributeList &A, SourceRange) { IdentifierLoc *PragmaNameLoc = A.getArgAsIdent(0); @@ -279,6 +304,8 @@ return handleLoopHintAttr(S, St, A, Range); case AttributeList::AT_OpenCLUnrollHint: return handleOpenCLUnrollHint(S, St, A, Range); + case AttributeList::AT_Suppress: +return handleSuppressAttr(S, St, A, Range); default: // if we're here, then we parsed a known attribute, but didn't recognize // it as a statement attribute => it is declaration attribute Index: lib/Sema/SemaDeclAttr.cpp === --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -4075,6 +4075,26 @@ } } +static void handleSuppressAttr(Sema &S, Decl *D, const AttributeList &Attr) { + if (!checkAttributeAtLeastNumArgs(S, Attr, 1)) +return; + + std::vector DiagnosticIdentifiers; + for (unsigned I = 0, E = Attr.getNumArgs(); I != E; ++I) { +StringRef RuleName; + +if (!S.checkStringLiteralArgumentAttr(Attr, I, RuleName, nullptr)) + return; + +// FIXME: Warn if the rule name is unknown. This is tricky because only +// clang-tidy knows about available rules. +DiagnosticIdentifiers.push_back(RuleName); + } + D->addAttr(::new (S.Context) SuppressAttr( + Attr.getRange(), S.Context, DiagnosticIdentifiers.data(), + DiagnosticIdentifiers.size(), Attr.getAttributeSpellingListIndex())); +} + bool Sema::CheckCallingConvAttr(const AttributeList &attr, CallingConv &CC, const FunctionDecl *FD) { if (attr.isInvalid()) @@ -6118,6 +6138,9 @@ case AttributeList::AT_PreserveAll: handleCallConvAttr(S, D, Attr); break; + case AttributeList::AT_Suppress: +handleSuppressAttr(S, D, Attr); +break; case AttributeList::AT_OpenCLKernel: handleSimpleAttribute(S, D, Attr); break; Index: include/clang/Basic/AttrDocs.td === --- include/clang/Basic/AttrDocs.td +++ include/clang/Basic/AttrDocs.td @@ -2723,6 +2723,32 @@ }]; } +def SuppressDocs : Documentation { + let Category = DocCatStmt; + let Content = [{ +The ``[[gsl::suppress]]`` attribute suppresses specific +clang-tidy diagnostics for rules of the `C++ Core Guidelines`_ in a portable +way. The attribute can be attached to declarations, statements, and at +namespace scope. + +.. code-block:: c++ + + [[gsl::suppress("Rh-public")]] + void f_() { +int *aVar_Name; +[[gsl::suppress("type")]] { + aVar_Name =
[PATCH] D31328: [clangd] Add code completion support
krasimir created this revision. Adds code completion support to clangd. https://reviews.llvm.org/D31328 Files: clangd/ASTManager.cpp clangd/ASTManager.h clangd/ClangDMain.cpp clangd/Protocol.cpp clangd/Protocol.h clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h test/clangd/completion.test test/clangd/formatting.test Index: test/clangd/formatting.test === --- test/clangd/formatting.test +++ test/clangd/formatting.test @@ -4,13 +4,14 @@ Content-Length: 125 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} -# CHECK: Content-Length: 332 +# CHECK: Content-Length: 392 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{ # CHECK: "textDocumentSync": 1, # CHECK: "documentFormattingProvider": true, # CHECK: "documentRangeFormattingProvider": true, # CHECK: "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, -# CHECK: "codeActionProvider": true +# CHECK: "codeActionProvider": true, +# CHECK: "completionProvider": {"resolveProvider": false} # CHECK: }}} # Content-Length: 193 Index: test/clangd/completion.test === --- /dev/null +++ test/clangd/completion.test @@ -0,0 +1,69 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 208 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#include \nint main() {\n std::vector v;\n v.\n}\n"}}} + +Content-Length: 148 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":3,"character":4}}} +# The order of results returned by ASTUnit CodeComplete seems to be +# nondeterministic, so we check regardless of order. +# +# CHECK: {"jsonrpc":"2.0","id":1,"result":[ +# CHECK-DAG: {"label":"_M_allocate"} +# CHECK-DAG: {"label":"_M_allocate_and_copy"} +# CHECK-DAG: {"label":"_M_assign_aux"} +# CHECK-DAG: {"label":"_M_assign_dispatch"} +# CHECK-DAG: {"label":"_M_check_len"} +# CHECK-DAG: {"label":"_M_create_storage" +# CHECK-DAG: {"label":"_M_deallocate"} +# CHECK-DAG: {"label":"_M_erase_at_end"} +# CHECK-DAG: {"label":"_M_fill_assign"} +# CHECK-DAG: {"label":"_M_fill_initialize"} +# CHECK-DAG: {"label":"_M_fill_insert"} +# CHECK-DAG: {"label":"_M_get_Tp_allocator"} +# CHECK-DAG: {"label":"_M_impl"} +# CHECK-DAG: {"label":"_M_initialize_dispatch"} +# CHECK-DAG: {"label":"_M_insert_aux"} +# CHECK-DAG: {"label":"_M_insert_dispatch"} +# CHECK-DAG: {"label":"_M_range_check"} +# CHECK-DAG: {"label":"_M_range_initialize"} +# CHECK-DAG: {"label":"_M_range_insert"} +# CHECK-DAG: {"label":"_Vector_base"} +# CHECK-DAG: {"label":"assign"} +# CHECK-DAG: {"label":"at"} +# CHECK-DAG: {"label":"back"} +# CHECK-DAG: {"label":"begin"} +# CHECK-DAG: {"label":"capacity"} +# CHECK-DAG: {"label":"clear"} +# CHECK-DAG: {"label":"data"} +# CHECK-DAG: {"label":"empty"} +# CHECK-DAG: {"label":"end"} +# CHECK-DAG: {"label":"erase"} +# CHECK-DAG: {"label":"front"} +# CHECK-DAG: {"label":"get_allocator"} +# CHECK-DAG: {"label":"insert"} +# CHECK-DAG: {"label":"max_size"} +# CHECK-DAG: {"label":"operator="} +# CHECK-DAG: {"label":"operator[]"} +# CHECK-DAG: {"label":"pop_back"} +# CHECK-DAG: {"label":"push_back"} +# CHECK-DAG: {"label":"rbegin"} +# CHECK-DAG: {"label":"rend"} +# CHECK-DAG: {"label":"reserve"} +# CHECK-DAG: {"label":"resize"} +# CHECK-DAG: {"label":"size"} +# CHECK-DAG: {"label":"swap"} +# CHECK-DAG: {"label":"vector"} +# CHECK-DAG: {"label":"~_Vector_base"} +# CHECK-DAG: {"label":"~vector"} +# CHECK: ]} +Content-Length: 44 + +{"jsonrpc":"2.0","id":3,"method":"shutdown"} Index: clangd/ProtocolHandlers.h === --- clangd/ProtocolHandlers.h +++ clangd/ProtocolHandlers.h @@ -36,7 +36,8 @@ "documentFormattingProvider": true, "documentRangeFormattingProvider": true, "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, - "codeActionProvider": true + "codeActionProvider": true, + "completionProvider": {"resolveProvider": false} }}})"); } }; @@ -114,6 +115,16 @@ ASTManager &AST; }; +struct CompletionHandler : Handler { + CompletionHandler(JSONOutput &Output, ASTManager &AST) + : Handler(Output), AST(AST) {} + + void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override; + + private: + ASTManager &AST; +}; + } // namespace clangd } // namespace clang Index: clangd/ProtocolHandlers.cpp =
[PATCH] D31328: [clangd] Add code completion support
krasimir updated this revision to Diff 92931. krasimir added a comment. - Clean-up leftovers https://reviews.llvm.org/D31328 Files: clangd/ASTManager.cpp clangd/ASTManager.h clangd/ClangDMain.cpp clangd/Protocol.cpp clangd/Protocol.h clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h test/clangd/completion.test test/clangd/formatting.test Index: test/clangd/formatting.test === --- test/clangd/formatting.test +++ test/clangd/formatting.test @@ -4,13 +4,14 @@ Content-Length: 125 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} -# CHECK: Content-Length: 332 +# CHECK: Content-Length: 392 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{ # CHECK: "textDocumentSync": 1, # CHECK: "documentFormattingProvider": true, # CHECK: "documentRangeFormattingProvider": true, # CHECK: "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, -# CHECK: "codeActionProvider": true +# CHECK: "codeActionProvider": true, +# CHECK: "completionProvider": {"resolveProvider": false} # CHECK: }}} # Content-Length: 193 Index: test/clangd/completion.test === --- /dev/null +++ test/clangd/completion.test @@ -0,0 +1,69 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 208 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#include \nint main() {\n std::vector v;\n v.\n}\n"}}} + +Content-Length: 148 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":3,"character":4}}} +# The order of results returned by ASTUnit CodeComplete seems to be +# nondeterministic, so we check regardless of order. +# +# CHECK: {"jsonrpc":"2.0","id":1,"result":[ +# CHECK-DAG: {"label":"_M_allocate"} +# CHECK-DAG: {"label":"_M_allocate_and_copy"} +# CHECK-DAG: {"label":"_M_assign_aux"} +# CHECK-DAG: {"label":"_M_assign_dispatch"} +# CHECK-DAG: {"label":"_M_check_len"} +# CHECK-DAG: {"label":"_M_create_storage" +# CHECK-DAG: {"label":"_M_deallocate"} +# CHECK-DAG: {"label":"_M_erase_at_end"} +# CHECK-DAG: {"label":"_M_fill_assign"} +# CHECK-DAG: {"label":"_M_fill_initialize"} +# CHECK-DAG: {"label":"_M_fill_insert"} +# CHECK-DAG: {"label":"_M_get_Tp_allocator"} +# CHECK-DAG: {"label":"_M_impl"} +# CHECK-DAG: {"label":"_M_initialize_dispatch"} +# CHECK-DAG: {"label":"_M_insert_aux"} +# CHECK-DAG: {"label":"_M_insert_dispatch"} +# CHECK-DAG: {"label":"_M_range_check"} +# CHECK-DAG: {"label":"_M_range_initialize"} +# CHECK-DAG: {"label":"_M_range_insert"} +# CHECK-DAG: {"label":"_Vector_base"} +# CHECK-DAG: {"label":"assign"} +# CHECK-DAG: {"label":"at"} +# CHECK-DAG: {"label":"back"} +# CHECK-DAG: {"label":"begin"} +# CHECK-DAG: {"label":"capacity"} +# CHECK-DAG: {"label":"clear"} +# CHECK-DAG: {"label":"data"} +# CHECK-DAG: {"label":"empty"} +# CHECK-DAG: {"label":"end"} +# CHECK-DAG: {"label":"erase"} +# CHECK-DAG: {"label":"front"} +# CHECK-DAG: {"label":"get_allocator"} +# CHECK-DAG: {"label":"insert"} +# CHECK-DAG: {"label":"max_size"} +# CHECK-DAG: {"label":"operator="} +# CHECK-DAG: {"label":"operator[]"} +# CHECK-DAG: {"label":"pop_back"} +# CHECK-DAG: {"label":"push_back"} +# CHECK-DAG: {"label":"rbegin"} +# CHECK-DAG: {"label":"rend"} +# CHECK-DAG: {"label":"reserve"} +# CHECK-DAG: {"label":"resize"} +# CHECK-DAG: {"label":"size"} +# CHECK-DAG: {"label":"swap"} +# CHECK-DAG: {"label":"vector"} +# CHECK-DAG: {"label":"~_Vector_base"} +# CHECK-DAG: {"label":"~vector"} +# CHECK: ]} +Content-Length: 44 + +{"jsonrpc":"2.0","id":3,"method":"shutdown"} Index: clangd/ProtocolHandlers.h === --- clangd/ProtocolHandlers.h +++ clangd/ProtocolHandlers.h @@ -36,7 +36,8 @@ "documentFormattingProvider": true, "documentRangeFormattingProvider": true, "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, - "codeActionProvider": true + "codeActionProvider": true, + "completionProvider": {"resolveProvider": false} }}})"); } }; @@ -114,6 +115,16 @@ ASTManager &AST; }; +struct CompletionHandler : Handler { + CompletionHandler(JSONOutput &Output, ASTManager &AST) + : Handler(Output), AST(AST) {} + + void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override; + + private: + ASTManager &AST; +}; + } // namespace clangd } // namespace clang Index: clangd/ProtocolHandlers.cpp
[PATCH] D31328: [clangd] Add code completion support
bkramer added inline comments. Comment at: clangd/ASTManager.cpp:264 +assert(CCS->getTypedText()); +Item.label = llvm::yaml::escape(CCS->getTypedText()); +if (CCS->getBriefComment()) CompletionItem::unparse should do the escaping. It's weird to have YAML stuff here. Comment at: clangd/ASTManager.cpp:267 + Item.documentation = llvm::yaml::escape(CCS->getBriefComment()); +Items.push_back(Item); + } std::move Comment at: clangd/ASTManager.cpp:276 + + std::vector getItems() const { return Items; } +}; I think returning by reference and moving out of CodeCompletionInfo in codeComplete() is safe. Comment at: clangd/ASTManager.h:78 llvm::StringMap> ASTs; + std::mutex ASTLock; + Some documentation on the lock would be useful. I'm a bit worried about the priorities here, code completion should always have priority over parsing for diagnostics. But we can address that later. Comment at: clangd/Protocol.cpp:635 +// flush the stream to the string. +Os.str(); +// The list additionalTextEdits is guaranteed nonempty at this point. Os.flush(); Comment at: clangd/Protocol.cpp:640 + } + Os.str(); + // Label is required, so Result is guaranteed to have a trailing comma. Os.flush(); Comment at: clangd/Protocol.h:289 +struct CompletionItem { + CompletionItem() + : kind(CompletionItemKind::Missing), Just use C++11 inline initialization, no need to spell out the constructor. https://reviews.llvm.org/D31328 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31328: [clangd] Add code completion support
krasimir updated this revision to Diff 92939. krasimir added a comment. - Add '.' and '>' as completion trigger characters https://reviews.llvm.org/D31328 Files: clangd/ASTManager.cpp clangd/ASTManager.h clangd/ClangDMain.cpp clangd/Protocol.cpp clangd/Protocol.h clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h test/clangd/completion.test test/clangd/formatting.test Index: test/clangd/formatting.test === --- test/clangd/formatting.test +++ test/clangd/formatting.test @@ -4,13 +4,14 @@ Content-Length: 125 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} -# CHECK: Content-Length: 332 +# CHECK: Content-Length: 424 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{ # CHECK: "textDocumentSync": 1, # CHECK: "documentFormattingProvider": true, # CHECK: "documentRangeFormattingProvider": true, # CHECK: "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, -# CHECK: "codeActionProvider": true +# CHECK: "codeActionProvider": true, +# CHECK: "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">"]} # CHECK: }}} # Content-Length: 193 Index: test/clangd/completion.test === --- /dev/null +++ test/clangd/completion.test @@ -0,0 +1,69 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 208 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#include \nint main() {\n std::vector v;\n v.\n}\n"}}} + +Content-Length: 148 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":3,"character":4}}} +# The order of results returned by ASTUnit CodeComplete seems to be +# nondeterministic, so we check regardless of order. +# +# CHECK: {"jsonrpc":"2.0","id":1,"result":[ +# CHECK-DAG: {"label":"_M_allocate"} +# CHECK-DAG: {"label":"_M_allocate_and_copy"} +# CHECK-DAG: {"label":"_M_assign_aux"} +# CHECK-DAG: {"label":"_M_assign_dispatch"} +# CHECK-DAG: {"label":"_M_check_len"} +# CHECK-DAG: {"label":"_M_create_storage" +# CHECK-DAG: {"label":"_M_deallocate"} +# CHECK-DAG: {"label":"_M_erase_at_end"} +# CHECK-DAG: {"label":"_M_fill_assign"} +# CHECK-DAG: {"label":"_M_fill_initialize"} +# CHECK-DAG: {"label":"_M_fill_insert"} +# CHECK-DAG: {"label":"_M_get_Tp_allocator"} +# CHECK-DAG: {"label":"_M_impl"} +# CHECK-DAG: {"label":"_M_initialize_dispatch"} +# CHECK-DAG: {"label":"_M_insert_aux"} +# CHECK-DAG: {"label":"_M_insert_dispatch"} +# CHECK-DAG: {"label":"_M_range_check"} +# CHECK-DAG: {"label":"_M_range_initialize"} +# CHECK-DAG: {"label":"_M_range_insert"} +# CHECK-DAG: {"label":"_Vector_base"} +# CHECK-DAG: {"label":"assign"} +# CHECK-DAG: {"label":"at"} +# CHECK-DAG: {"label":"back"} +# CHECK-DAG: {"label":"begin"} +# CHECK-DAG: {"label":"capacity"} +# CHECK-DAG: {"label":"clear"} +# CHECK-DAG: {"label":"data"} +# CHECK-DAG: {"label":"empty"} +# CHECK-DAG: {"label":"end"} +# CHECK-DAG: {"label":"erase"} +# CHECK-DAG: {"label":"front"} +# CHECK-DAG: {"label":"get_allocator"} +# CHECK-DAG: {"label":"insert"} +# CHECK-DAG: {"label":"max_size"} +# CHECK-DAG: {"label":"operator="} +# CHECK-DAG: {"label":"operator[]"} +# CHECK-DAG: {"label":"pop_back"} +# CHECK-DAG: {"label":"push_back"} +# CHECK-DAG: {"label":"rbegin"} +# CHECK-DAG: {"label":"rend"} +# CHECK-DAG: {"label":"reserve"} +# CHECK-DAG: {"label":"resize"} +# CHECK-DAG: {"label":"size"} +# CHECK-DAG: {"label":"swap"} +# CHECK-DAG: {"label":"vector"} +# CHECK-DAG: {"label":"~_Vector_base"} +# CHECK-DAG: {"label":"~vector"} +# CHECK: ]} +Content-Length: 44 + +{"jsonrpc":"2.0","id":3,"method":"shutdown"} Index: clangd/ProtocolHandlers.h === --- clangd/ProtocolHandlers.h +++ clangd/ProtocolHandlers.h @@ -36,7 +36,8 @@ "documentFormattingProvider": true, "documentRangeFormattingProvider": true, "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, - "codeActionProvider": true + "codeActionProvider": true, + "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">"]} }}})"); } }; @@ -114,6 +115,16 @@ ASTManager &AST; }; +struct CompletionHandler : Handler { + CompletionHandler(JSONOutput &Output, ASTManager &AST) + : Handler(Output), AST(AST) {} + + void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override; + + private: + ASTManager
[PATCH] D30909: [Analyzer] Finish taint propagation to derived symbols of tainted regions
NoQ added a comment. Thanks again for the awesome stuff! It took years for me to even come up with the idea. Comment at: lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp:494 + SymbolManager &SM = C.getSymbolManager(); + return SM.getDerivedSymbol(Sym, LCV.getRegion()); } I'd think about this a bit more and come back. I need to understand how come that constructing a symbol manually is the right thing to do; that doesn't happen very often, but it seems correct here. Comment at: lib/StaticAnalyzer/Core/ProgramState.cpp:678 +if (contains(SD->getParentSymbol())) + SymRegions = *get(SD->getParentSymbol()); + Just see if this pointer is null instead of a separate `contains<>` check? Comment at: lib/StaticAnalyzer/Core/ProgramState.cpp:746 +const TypedValueRegion *R = SD->getRegion(); +const TaintedSymRegionsRef *SymRegions = +get(SD->getParentSymbol()); Just see if this pointer is null instead of a separate `contains<>` check? Comment at: lib/StaticAnalyzer/Core/ProgramState.cpp:751 + I != E; ++I) { + if (R == *I || R->isSubRegionOf(*I)) +return true; This could be made even stronger when there are multiple ways of constructing the same sub-region. For instance, ``` union { int x; char y[4]; } u; u.x = taint(); u.y[0]; // is tainted? ``` To handle such cases, we could try to see if byte offsets are nested, instead of checking `isSubRegionOf()`. I suggest adding a TODO (and maybe a FIXME-test), because it gets more and more complicated. Especially with symbolic offsets. Comment at: test/Analysis/taint-generic.c:210 + read(sock, &tainted.st, sizeof(tainted.st)); + __builtin_memcpy(buffer, tainted.buf, tainted.st[0].length); // expected-warning {{Untrusted data is used to specify the buffer size}} } Are we already supporting the case when we're tainting some elements of an array but not all of them, and this works as expected? Could we add such tests (regardless of whether we already handle them)? https://reviews.llvm.org/D30909 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31328: [clangd] Add code completion support
krasimir updated this revision to Diff 92940. krasimir marked 7 inline comments as done. krasimir added a comment. - Address review comments https://reviews.llvm.org/D31328 Files: clangd/ASTManager.cpp clangd/ASTManager.h clangd/ClangDMain.cpp clangd/Protocol.cpp clangd/Protocol.h clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h test/clangd/completion.test test/clangd/formatting.test Index: test/clangd/formatting.test === --- test/clangd/formatting.test +++ test/clangd/formatting.test @@ -4,13 +4,14 @@ Content-Length: 125 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} -# CHECK: Content-Length: 332 +# CHECK: Content-Length: 424 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{ # CHECK: "textDocumentSync": 1, # CHECK: "documentFormattingProvider": true, # CHECK: "documentRangeFormattingProvider": true, # CHECK: "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, -# CHECK: "codeActionProvider": true +# CHECK: "codeActionProvider": true, +# CHECK: "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">"]} # CHECK: }}} # Content-Length: 193 Index: test/clangd/completion.test === --- /dev/null +++ test/clangd/completion.test @@ -0,0 +1,69 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 208 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#include \nint main() {\n std::vector v;\n v.\n}\n"}}} + +Content-Length: 148 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":3,"character":4}}} +# The order of results returned by ASTUnit CodeComplete seems to be +# nondeterministic, so we check regardless of order. +# +# CHECK: {"jsonrpc":"2.0","id":1,"result":[ +# CHECK-DAG: {"label":"_M_allocate"} +# CHECK-DAG: {"label":"_M_allocate_and_copy"} +# CHECK-DAG: {"label":"_M_assign_aux"} +# CHECK-DAG: {"label":"_M_assign_dispatch"} +# CHECK-DAG: {"label":"_M_check_len"} +# CHECK-DAG: {"label":"_M_create_storage" +# CHECK-DAG: {"label":"_M_deallocate"} +# CHECK-DAG: {"label":"_M_erase_at_end"} +# CHECK-DAG: {"label":"_M_fill_assign"} +# CHECK-DAG: {"label":"_M_fill_initialize"} +# CHECK-DAG: {"label":"_M_fill_insert"} +# CHECK-DAG: {"label":"_M_get_Tp_allocator"} +# CHECK-DAG: {"label":"_M_impl"} +# CHECK-DAG: {"label":"_M_initialize_dispatch"} +# CHECK-DAG: {"label":"_M_insert_aux"} +# CHECK-DAG: {"label":"_M_insert_dispatch"} +# CHECK-DAG: {"label":"_M_range_check"} +# CHECK-DAG: {"label":"_M_range_initialize"} +# CHECK-DAG: {"label":"_M_range_insert"} +# CHECK-DAG: {"label":"_Vector_base"} +# CHECK-DAG: {"label":"assign"} +# CHECK-DAG: {"label":"at"} +# CHECK-DAG: {"label":"back"} +# CHECK-DAG: {"label":"begin"} +# CHECK-DAG: {"label":"capacity"} +# CHECK-DAG: {"label":"clear"} +# CHECK-DAG: {"label":"data"} +# CHECK-DAG: {"label":"empty"} +# CHECK-DAG: {"label":"end"} +# CHECK-DAG: {"label":"erase"} +# CHECK-DAG: {"label":"front"} +# CHECK-DAG: {"label":"get_allocator"} +# CHECK-DAG: {"label":"insert"} +# CHECK-DAG: {"label":"max_size"} +# CHECK-DAG: {"label":"operator="} +# CHECK-DAG: {"label":"operator[]"} +# CHECK-DAG: {"label":"pop_back"} +# CHECK-DAG: {"label":"push_back"} +# CHECK-DAG: {"label":"rbegin"} +# CHECK-DAG: {"label":"rend"} +# CHECK-DAG: {"label":"reserve"} +# CHECK-DAG: {"label":"resize"} +# CHECK-DAG: {"label":"size"} +# CHECK-DAG: {"label":"swap"} +# CHECK-DAG: {"label":"vector"} +# CHECK-DAG: {"label":"~_Vector_base"} +# CHECK-DAG: {"label":"~vector"} +# CHECK: ]} +Content-Length: 44 + +{"jsonrpc":"2.0","id":3,"method":"shutdown"} Index: clangd/ProtocolHandlers.h === --- clangd/ProtocolHandlers.h +++ clangd/ProtocolHandlers.h @@ -36,7 +36,8 @@ "documentFormattingProvider": true, "documentRangeFormattingProvider": true, "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, - "codeActionProvider": true + "codeActionProvider": true, + "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">"]} }}})"); } }; @@ -114,6 +115,16 @@ ASTManager &AST; }; +struct CompletionHandler : Handler { + CompletionHandler(JSONOutput &Output, ASTManager &AST) + : Handler(Output), AST(AST) {} + + void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override; + + priva
[PATCH] D31328: [clangd] Add code completion support
malaperle-ericsson added a comment. Urg, I was working on this too :) I'll compare implementations and provide comments if I find anything good to suggest. https://reviews.llvm.org/D31328 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31328: [clangd] Add code completion support
krasimir updated this revision to Diff 92948. krasimir added a comment. - Make Items ownership more explicit https://reviews.llvm.org/D31328 Files: clangd/ASTManager.cpp clangd/ASTManager.h clangd/ClangDMain.cpp clangd/Protocol.cpp clangd/Protocol.h clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h test/clangd/completion.test test/clangd/formatting.test Index: test/clangd/formatting.test === --- test/clangd/formatting.test +++ test/clangd/formatting.test @@ -4,13 +4,14 @@ Content-Length: 125 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} -# CHECK: Content-Length: 332 +# CHECK: Content-Length: 424 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{ # CHECK: "textDocumentSync": 1, # CHECK: "documentFormattingProvider": true, # CHECK: "documentRangeFormattingProvider": true, # CHECK: "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, -# CHECK: "codeActionProvider": true +# CHECK: "codeActionProvider": true, +# CHECK: "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">"]} # CHECK: }}} # Content-Length: 193 Index: test/clangd/completion.test === --- /dev/null +++ test/clangd/completion.test @@ -0,0 +1,69 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. +# +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +Content-Length: 208 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#include \nint main() {\n std::vector v;\n v.\n}\n"}}} + +Content-Length: 148 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":3,"character":4}}} +# The order of results returned by ASTUnit CodeComplete seems to be +# nondeterministic, so we check regardless of order. +# +# CHECK: {"jsonrpc":"2.0","id":1,"result":[ +# CHECK-DAG: {"label":"_M_allocate"} +# CHECK-DAG: {"label":"_M_allocate_and_copy"} +# CHECK-DAG: {"label":"_M_assign_aux"} +# CHECK-DAG: {"label":"_M_assign_dispatch"} +# CHECK-DAG: {"label":"_M_check_len"} +# CHECK-DAG: {"label":"_M_create_storage" +# CHECK-DAG: {"label":"_M_deallocate"} +# CHECK-DAG: {"label":"_M_erase_at_end"} +# CHECK-DAG: {"label":"_M_fill_assign"} +# CHECK-DAG: {"label":"_M_fill_initialize"} +# CHECK-DAG: {"label":"_M_fill_insert"} +# CHECK-DAG: {"label":"_M_get_Tp_allocator"} +# CHECK-DAG: {"label":"_M_impl"} +# CHECK-DAG: {"label":"_M_initialize_dispatch"} +# CHECK-DAG: {"label":"_M_insert_aux"} +# CHECK-DAG: {"label":"_M_insert_dispatch"} +# CHECK-DAG: {"label":"_M_range_check"} +# CHECK-DAG: {"label":"_M_range_initialize"} +# CHECK-DAG: {"label":"_M_range_insert"} +# CHECK-DAG: {"label":"_Vector_base"} +# CHECK-DAG: {"label":"assign"} +# CHECK-DAG: {"label":"at"} +# CHECK-DAG: {"label":"back"} +# CHECK-DAG: {"label":"begin"} +# CHECK-DAG: {"label":"capacity"} +# CHECK-DAG: {"label":"clear"} +# CHECK-DAG: {"label":"data"} +# CHECK-DAG: {"label":"empty"} +# CHECK-DAG: {"label":"end"} +# CHECK-DAG: {"label":"erase"} +# CHECK-DAG: {"label":"front"} +# CHECK-DAG: {"label":"get_allocator"} +# CHECK-DAG: {"label":"insert"} +# CHECK-DAG: {"label":"max_size"} +# CHECK-DAG: {"label":"operator="} +# CHECK-DAG: {"label":"operator[]"} +# CHECK-DAG: {"label":"pop_back"} +# CHECK-DAG: {"label":"push_back"} +# CHECK-DAG: {"label":"rbegin"} +# CHECK-DAG: {"label":"rend"} +# CHECK-DAG: {"label":"reserve"} +# CHECK-DAG: {"label":"resize"} +# CHECK-DAG: {"label":"size"} +# CHECK-DAG: {"label":"swap"} +# CHECK-DAG: {"label":"vector"} +# CHECK-DAG: {"label":"~_Vector_base"} +# CHECK-DAG: {"label":"~vector"} +# CHECK: ]} +Content-Length: 44 + +{"jsonrpc":"2.0","id":3,"method":"shutdown"} Index: clangd/ProtocolHandlers.h === --- clangd/ProtocolHandlers.h +++ clangd/ProtocolHandlers.h @@ -36,7 +36,8 @@ "documentFormattingProvider": true, "documentRangeFormattingProvider": true, "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, - "codeActionProvider": true + "codeActionProvider": true, + "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">"]} }}})"); } }; @@ -114,6 +115,16 @@ ASTManager &AST; }; +struct CompletionHandler : Handler { + CompletionHandler(JSONOutput &Output, ASTManager &AST) + : Handler(Output), AST(AST) {} + + void handleMethod(llvm::yaml::MappingNode *Params, StringRef ID) override; + + private: + ASTManager &AST; +}; + }
[PATCH] D31004: [Objective-C] Fix __weak type traits with -fobjc-weak
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. Looks great, thanks! https://reviews.llvm.org/D31004 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31176: [clang-rename] Support renaming qualified symbol
hokein updated this revision to Diff 92954. hokein marked 3 inline comments as done. hokein added a comment. Add comments and polish tests. https://reviews.llvm.org/D31176 Files: clang-rename/RenamingAction.cpp clang-rename/RenamingAction.h clang-rename/USRFinder.cpp clang-rename/USRFindingAction.cpp clang-rename/USRLocFinder.cpp clang-rename/USRLocFinder.h unittests/clang-rename/CMakeLists.txt unittests/clang-rename/ClangRenameTest.h unittests/clang-rename/ClangRenameTests.cpp unittests/clang-rename/RenameClassTest.cpp Index: unittests/clang-rename/RenameClassTest.cpp === --- /dev/null +++ unittests/clang-rename/RenameClassTest.cpp @@ -0,0 +1,668 @@ +//===-- RenameClassTest.cpp - unit tests for renaming classes -===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "ClangRenameTest.h" + +namespace clang { +namespace clang_rename { +namespace test { +namespace { + +class RenameClassTest : public ClangRenameTest { +public: + RenameClassTest() { +AppendToHeader(R"( + namespace a { +class Foo { + public: +struct Nested { + enum NestedEnum {E1, E2}; +}; +void func() {} + static int Constant; +}; +class Goo { + public: +struct Nested { + enum NestedEnum {E1, E2}; +}; +}; +int Foo::Constant = 1; + } // namespace a + namespace b { + class Foo {}; + } // namespace b + + #define MACRO(x) x + + template class ptr {}; +)"); + } +}; + +INSTANTIATE_TEST_CASE_P( +RenameClassTests, RenameClassTest, +testing::ValuesIn(std::vector({ +// basic classes +{"a::Foo f;", "b::Bar f;"}, +{"void f(a::Foo f) {}", "void f(b::Bar f) {}"}, +{"void f(a::Foo *f) {}", "void f(b::Bar *f) {}"}, +{"a::Foo f() { return a::Foo(); }", "b::Bar f() { return b::Bar(); }"}, +{"namespace a {a::Foo f() { return Foo(); }}", + "namespace a {b::Bar f() { return b::Bar(); }}"}, +{"void f(const a::Foo& a1) {}", "void f(const b::Bar& a1) {}"}, +{"void f(const a::Foo* a1) {}", "void f(const b::Bar* a1) {}"}, +{"namespace a { void f(Foo a1) {} }", + "namespace a { void f(b::Bar a1) {} }"}, +{"void f(MACRO(a::Foo) a1) {}", "void f(MACRO(b::Bar) a1) {}"}, +{"void f(MACRO(a::Foo a1)) {}", "void f(MACRO(b::Bar a1)) {}"}, +{"a::Foo::Nested ns;", "b::Bar::Nested ns;"}, +{"auto t = a::Foo::Constant;", "auto t = b::Bar::Constant;"}, +{"a::Foo::Nested ns;", "a::Foo::Nested2 ns;", "a::Foo::Nested", + "a::Foo::Nested2"}, + +// use namespace and typedefs +{"using a::Foo; Foo gA;", "using b::Bar; b::Bar gA;"}, +{"using a::Foo; void f(Foo gA) {}", "using b::Bar; void f(Bar gA) {}"}, +{"using a::Foo; namespace x { Foo gA; }", + "using b::Bar; namespace x { Bar gA; }"}, +{"struct S { using T = a::Foo; T a_; };", + "struct S { using T = b::Bar; T a_; };"}, +{"using T = a::Foo; T gA;", "using T = b::Bar; T gA;"}, +{"typedef a::Foo T; T gA;", "typedef b::Bar T; T gA;"}, +{"typedef MACRO(a::Foo) T; T gA;", "typedef MACRO(b::Bar) T; T gA;"}, + +// struct members and other oddities +{"struct S : public a::Foo {};", "struct S : public b::Bar {};"}, +{"struct F { void f(a::Foo a1) {} };", + "struct F { void f(b::Bar a1) {} };"}, +{"struct F { a::Foo a_; };", "struct F { b::Bar a_; };"}, +{"struct F { ptr a_; };", "struct F { ptr a_; };"}, + +{"void f() { a::Foo::Nested ne; }", "void f() { b::Bar::Nested ne; }"}, +{"void f() { a::Goo::Nested ne; }", "void f() { a::Goo::Nested ne; }"}, +{"void f() { a::Foo::Nested::NestedEnum e; }", + "void f() { b::Bar::Nested::NestedEnum e; }"}, +{"void f() { auto e = a::Foo::Nested::NestedEnum::E1; }", + "void f() { auto e = b::Bar::Nested::NestedEnum::E1; }"}, +{"void f() { auto e = a::Foo::Nested::E1; }", + "void f() { auto e = b::Bar::Nested::E1; }"}, + +// templates +{"template struct Foo { T t; };\n" + "void f() { Foo foo; }", + "template struct Foo { T t; };\n" + "void f() { Foo foo; }"}, +{"template struct Foo { a::Foo a; };", + "template struct Foo { b::Bar a; };"}, +{"template void f(T t) {}\n" + "void g() { f(a::Foo()); }", + "template void f(T t) {}\n" + "void g() { f(b::Bar()); }"}, +{"template int f() { return 1; }\n" + "template <> int f() { return 2; }\n" + "int g()
[PATCH] D31176: [clang-rename] Support renaming qualified symbol
hokein added inline comments. Comment at: clang-rename/USRLocFinder.cpp:195 +// Find all locations identified by the given USRs. Traverse the AST and find +// every AST node whose USR is in the given USRs' set. +class RenameLocFinder ioeric wrote: > I think this also does some renaming? No, this class is only responsible for finding rename locations and other information which are used for renaming. The renaming stuff is done by `USRSymbolRenamer`. Comment at: clang-rename/USRLocFinder.cpp:217 + + // FIXME: For renaming declarations/definitions, prefix qualifiers should be + // filtered out. ioeric wrote: > Could you be more specific in this FIXME? I don't quite get it. Maybe an > example? You can also see the `FIXME` in the test. Comment at: clang-rename/USRLocFinder.cpp:359 + + // Returns a list of using declarations which are needed to update. + const std::vector &getUsingDecls() const { ioeric wrote: > I think these are using shadows only? These are interested `UsingDecl`s which contain `UsingShadowDecl` of the symbol declarations being renamed. Comment at: clang-rename/USRLocFinder.h:36 +/// \return Replacement for renaming. +std::vector +createRenameReplacement(llvm::ArrayRef USRs, ioeric wrote: > Why use `std::vector` instead of `tooling::Replacements`? Seems that we don't get many benefits from using `tooling::Replacements` here. This function could be called multiple times (for renaming multiple symbols), we need to merge/add all replacements in caller side. if using `tooling::Replacements`, we will merge twice (one is in the API implementation). https://reviews.llvm.org/D31176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31176: [clang-rename] Support renaming qualified symbol
ioeric added inline comments. Comment at: clang-rename/USRLocFinder.cpp:195 +// Find all locations identified by the given USRs. Traverse the AST and find +// every AST node whose USR is in the given USRs' set. +class RenameLocFinder hokein wrote: > ioeric wrote: > > I think this also does some renaming? > No, this class is only responsible for finding rename locations and other > information which are used for renaming. The renaming stuff is done by > `USRSymbolRenamer`. Sure. I meant you should also document it. Comment at: clang-rename/USRLocFinder.cpp:359 + + // Returns a list of using declarations which are needed to update. + const std::vector &getUsingDecls() const { hokein wrote: > ioeric wrote: > > I think these are using shadows only? > These are interested `UsingDecl`s which contain `UsingShadowDecl` of the > symbol declarations being renamed. Sure. But maybe also document it? Comment at: clang-rename/USRLocFinder.h:36 +/// \return Replacement for renaming. +std::vector +createRenameReplacement(llvm::ArrayRef USRs, hokein wrote: > ioeric wrote: > > Why use `std::vector` instead of `tooling::Replacements`? > Seems that we don't get many benefits from using `tooling::Replacements` > here. This function could be called multiple times (for renaming multiple > symbols), we need to merge/add all replacements in caller side. if using > `tooling::Replacements`, we will merge twice (one is in the API > implementation). I think what we really want is `AtomicChange`. We shouldn't be using `std::vector` or `std::set` replacements anymore. https://reviews.llvm.org/D31176 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31007: [Objective-C] Miscellaneous -fobjc-weak Fixes
rjmccall added inline comments. Comment at: lib/Sema/SemaInit.cpp:6681 // full-expression's cleanups. - if ((S.getLangOpts().ObjCAutoRefCount && - MTE->getType()->isObjCLifetimeType()) || + if (MTE->getType()->isNonTrivialObjCLifetimeType() || (MTE->getStorageDuration() == SD_Automatic && Oh, I see what's happening here. The special case for ARC is actually wholly unnecessary. The code's been written as if MTE->getType() for an ARC temporary will just have type "id". In fact, it'll have a lifetime-qualified type, dependent on the type of the reference which has been bound to it. So we need to mark that there's a temporary cleanup if the type has non-trivial lifetime, i.e. if MTE->getType().hasNonTrivialObjCLifetime(); but this is already considered as part of MTE->getType().isDestructedType(), and the storage-duration condition there is correct as well. So really we should just delete this entire clause. That should eliminate the need for Type::isNonTrivialObjCLifetimeType(). In general, we don't want methods like that to ever exist: lifetime is determined by qualifiers, and querying a Type instead of a QualType has the potential to implicitly remove qualifiers. https://reviews.llvm.org/D31007 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D29599: Clang Changes for alloc_align
erichkeane added a comment. FWIW, the LLVM changes for this have been committed. https://reviews.llvm.org/D29599 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30760: Record command lines in objects built by clang, Clang part
aprantl added inline comments. Comment at: test/CodeGen/debug-info-grecord-gcc-switches.c:1 +// RUN: %clang -g -grecord-gcc-switches -S -emit-llvm -o - %s | FileCheck %s +int main (void) { Shouldn't this test be in the Driver/ directory? There is already a big file that exercises all -g options, I would just append it there. https://reviews.llvm.org/D30760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r298706 - XFAIL the std::byte tests on a bunch of old clang versions, because they don't like 'std::byte b1{1}'
Author: marshall Date: Fri Mar 24 11:17:20 2017 New Revision: 298706 URL: http://llvm.org/viewvc/llvm-project?rev=298706&view=rev Log: XFAIL the std::byte tests on a bunch of old clang versions, because they don't like 'std::byte b1{1}' Modified: libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/lshift.fail.cpp libcxx/trunk/test/std/language.support/support.types/byteops/lshift.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/not.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/or.assign.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/or.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp libcxx/trunk/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/rshift.fail.cpp libcxx/trunk/test/std/language.support/support.types/byteops/rshift.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/to_integer.fail.cpp libcxx/trunk/test/std/language.support/support.types/byteops/to_integer.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/xor.assign.pass.cpp libcxx/trunk/test/std/language.support/support.types/byteops/xor.pass.cpp Modified: libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp?rev=298706&r1=298705&r2=298706&view=diff == --- libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp (original) +++ libcxx/trunk/test/std/language.support/support.types/byteops/and.assign.pass.cpp Fri Mar 24 11:17:20 2017 @@ -11,6 +11,9 @@ #include // UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't like "std::byte b1{1}" +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 // constexpr byte& operator &=(byte l, byte r) noexcept; Modified: libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp?rev=298706&r1=298705&r2=298706&view=diff == --- libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp (original) +++ libcxx/trunk/test/std/language.support/support.types/byteops/and.pass.cpp Fri Mar 24 11:17:20 2017 @@ -11,6 +11,9 @@ #include // UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't like "std::byte b1{1}" +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 // constexpr byte operator&(byte l, byte r) noexcept; Modified: libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp?rev=298706&r1=298705&r2=298706&view=diff == --- libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp (original) +++ libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp Fri Mar 24 11:17:20 2017 @@ -11,6 +11,9 @@ #include // UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't like "std::byte b1{1}" +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 // template // constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept; Modified: libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp?rev=298706&r1=298705&r2=298706&view=diff == --- libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp (original) +++ libcxx/trunk/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp Fri Mar 24 11:17:20 2017 @@ -11,6 +11,9 @@ #include // UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't like "std::byte b1{1}" +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, a
[PATCH] D31007: [Objective-C] Miscellaneous -fobjc-weak Fixes
bkelley updated this revision to Diff 92966. bkelley marked an inline comment as done. bkelley added a comment. Updated with latest feedback from @rjmccall https://reviews.llvm.org/D31007 Files: lib/Sema/SemaCast.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaInit.cpp test/SemaObjCXX/objc-weak.mm Index: test/SemaObjCXX/objc-weak.mm === --- /dev/null +++ test/SemaObjCXX/objc-weak.mm @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-weak -fblocks -Wno-objc-root-class -std=c++98 -Wno-c++0x-extensions -verify %s + +@interface AnObject +@property(weak) id value; +@end + +__attribute__((objc_arc_weak_reference_unavailable)) +@interface NOWEAK : AnObject // expected-note 2 {{class is declared here}} +@end + +struct S { + __weak id a; // expected-note {{because type 'S' has a member with __weak ownership}} +}; + +union U { + __weak id a; // expected-error {{ARC forbids Objective-C objects in union}} + S b; // expected-error {{union member 'b' has a non-trivial copy constructor}} +}; + +void testCast(AnObject *o) { + __weak id a = reinterpret_cast<__weak NOWEAK *>(o); // expected-error {{class is incompatible with __weak references}} \ + // expected-error {{explicit ownership qualifier on cast result has no effect}} \ + // expected-error {{assignment of a weak-unavailable object to a __weak object}} + + __weak id b = static_cast<__weak NOWEAK *>(o); // expected-error {{class is incompatible with __weak references}} \ + // expected-error {{explicit ownership qualifier on cast result has no effect}} \ + // expected-error {{assignment of a weak-unavailable object to a __weak object}} +} Index: lib/Sema/SemaInit.cpp === --- lib/Sema/SemaInit.cpp +++ lib/Sema/SemaInit.cpp @@ -6674,14 +6674,10 @@ /*IsInitializerList=*/false, ExtendingEntity->getDecl()); - // If we're binding to an Objective-C object that has lifetime, we - // need cleanups. Likewise if we're extending this temporary to automatic - // storage duration -- we need to register its cleanup during the - // full-expression's cleanups. - if ((S.getLangOpts().ObjCAutoRefCount && - MTE->getType()->isObjCLifetimeType()) || - (MTE->getStorageDuration() == SD_Automatic && - MTE->getType().isDestructedType())) + // If we're extending this temporary to automatic storage duration -- we + // need to register its cleanup during the full-expression's cleanups. + if (MTE->getStorageDuration() == SD_Automatic && + MTE->getType().isDestructedType()) S.Cleanup.setExprNeedsCleanups(true); CurInit = MTE; Index: lib/Sema/SemaDeclCXX.cpp === --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -7145,8 +7145,7 @@ // [...] nontrivally ownership-qualified types are [...] not trivially // default constructible, copy constructible, move constructible, copy // assignable, move assignable, or destructible [...] -if (S.getLangOpts().ObjCAutoRefCount && -FieldType.hasNonTrivialObjCLifetime()) { +if (FieldType.hasNonTrivialObjCLifetime()) { if (Diagnose) S.Diag(FI->getLocation(), diag::note_nontrivial_objc_ownership) << RD << FieldType.getObjCLifetime(); Index: lib/Sema/SemaDecl.cpp === --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -14492,7 +14492,7 @@ // Verify that all the fields are okay. SmallVector RecFields; - bool ARCErrReported = false; + bool ObjCFieldLifetimeErrReported = false; for (ArrayRef::iterator i = Fields.begin(), end = Fields.end(); i != end; ++i) { FieldDecl *FD = cast(*i); @@ -14627,16 +14627,16 @@ << FixItHint::CreateInsertion(FD->getLocation(), "*"); QualType T = Context.getObjCObjectPointerType(FD->getType()); FD->setType(T); -} else if (getLangOpts().ObjCAutoRefCount && Record && !ARCErrReported && +} else if (getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() && + Record && !ObjCFieldLifetimeErrReported && (!getLangOpts().CPlusPlus || Record->isUnion())) { - // It's an error in ARC if a field has lifetime. + // It's an error in ARC or Weak if a field has lifetime. // We don't want to report this in a system header, though, // so we just make the field unavailable. // FIXME: that's really not sufficient; we need to make the type // itself invalid to, say, initialize or c
[PATCH] D31007: [Objective-C] Miscellaneous -fobjc-weak Fixes
bkelley added inline comments. Comment at: lib/Sema/SemaInit.cpp:6681 // full-expression's cleanups. - if ((S.getLangOpts().ObjCAutoRefCount && - MTE->getType()->isObjCLifetimeType()) || + if (MTE->getType()->isNonTrivialObjCLifetimeType() || (MTE->getStorageDuration() == SD_Automatic && rjmccall wrote: > Oh, I see what's happening here. The special case for ARC is actually wholly > unnecessary. The code's been written as if MTE->getType() for an ARC > temporary will just have type "id". In fact, it'll have a lifetime-qualified > type, dependent on the type of the reference which has been bound to it. So > we need to mark that there's a temporary cleanup if the type has non-trivial > lifetime, i.e. if MTE->getType().hasNonTrivialObjCLifetime(); but this is > already considered as part of MTE->getType().isDestructedType(), and the > storage-duration condition there is correct as well. So really we should > just delete this entire clause. > > That should eliminate the need for Type::isNonTrivialObjCLifetimeType(). In > general, we don't want methods like that to ever exist: lifetime is > determined by qualifiers, and querying a Type instead of a QualType has the > potential to implicitly remove qualifiers. Thanks for looking in to this and for the explanation. I've removed the check and the changes to Type. https://reviews.llvm.org/D31007 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298709 - [OpenCL][Bug 10573] Don't set CXXOperatorNames flag
Author: stulova Date: Fri Mar 24 11:43:51 2017 New Revision: 298709 URL: http://llvm.org/viewvc/llvm-project?rev=298709&view=rev Log: [OpenCL][Bug 10573] Don't set CXXOperatorNames flag The flag CXXOperatorNames was overwritten unconditionally after being set for OpenCL. There seems to be no necessity to set it, so removing the line. Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=298709&r1=298708&r2=298709&view=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Mar 24 11:43:51 2017 @@ -1642,7 +1642,6 @@ void CompilerInvocation::setLangDefaults if (Opts.OpenCL) { Opts.AltiVec = 0; Opts.ZVector = 0; -Opts.CXXOperatorNames = 1; Opts.LaxVectorConversions = 0; Opts.DefaultFPContract = 1; Opts.NativeHalfType = 1; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298712 - Fix MSVC 'not all control paths return a value' warning.
Author: rksimon Date: Fri Mar 24 11:59:14 2017 New Revision: 298712 URL: http://llvm.org/viewvc/llvm-project?rev=298712&view=rev Log: Fix MSVC 'not all control paths return a value' warning. Modified: cfe/trunk/lib/Index/IndexingContext.cpp Modified: cfe/trunk/lib/Index/IndexingContext.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexingContext.cpp?rev=298712&r1=298711&r2=298712&view=diff == --- cfe/trunk/lib/Index/IndexingContext.cpp (original) +++ cfe/trunk/lib/Index/IndexingContext.cpp Fri Mar 24 11:59:14 2017 @@ -235,6 +235,7 @@ static bool shouldReportOccurrenceForSys case SymbolRole::RelationContainedBy: return true; } + llvm_unreachable("Unsupported SymbolRole value!"); }); return accept; }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30810: Preserve vec3 type.
jaykang10 added a comment. > I believe the argument lacks numbers (or at least you have them but didn't > mention). I didn't hear about performance results, or validation that this > was actually tested for correctness. Small test cases prove a point, but > can't be considered general. > > OTOH, it seems like this is exactly why you want the flag, to hide any > potential issues and play with it. I'm not opposed to adding the flag if > there's a commitment to actually get the result and change the default to > whatever seems to be better, does that seems reasonable? To be honest, I did not start this discussion to get better performance for GPU. But the goal has moved while we discussing it. I think I have showed you the gain from AMD GPU target on previous comments. On current version of clang/llvm, it generates one less load/store to preserve vec3 type instead of vec4 type on GPU target. But it could cause more load/store on another targets which have vector register because they usually expect aligned vector load/store. It means that if we want to change default to vec3 on clang, we need to change llvm's codegen's default legalization or backend targets need to be modified in order to get aligned vector load/store with vec3 type. I think It is too big change at this moment. In the future, we could move this discussion to llvm-dev. Up to that time, as you mentioned, I would like to hide the potential issues with vec3 type and play with it. https://reviews.llvm.org/D30810 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31210: [AMDGPU] Add new address space mapping
yaxunl updated this revision to Diff 92977. yaxunl added a comment. Revised by Tony's suggestions. https://reviews.llvm.org/D31210 Files: lib/Basic/Targets.cpp test/CodeGenOpenCL/amdgpu-env-amdgiz.cl Index: test/CodeGenOpenCL/amdgpu-env-amdgiz.cl === --- /dev/null +++ test/CodeGenOpenCL/amdgpu-env-amdgiz.cl @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -O0 -triple amdgcn -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple amdgcn---opencl -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple amdgcn---amdgiz -emit-llvm -o - | FileCheck -check-prefix=NEW %s +// RUN: %clang_cc1 %s -O0 -triple amdgcn---amdgizcl -emit-llvm -o - | FileCheck -check-prefix=NEW %s + +// CHECK: target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" +// NEW: target datalayout = "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" +void foo(void) {} + Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -2002,14 +2002,23 @@ return llvm::makeArrayRef(GCCRegNames); } -static const unsigned AMDGPUAddrSpaceMap[] = { - 1,// opencl_global - 3,// opencl_local - 2,// opencl_constant - 4,// opencl_generic - 1,// cuda_device - 2,// cuda_constant - 3 // cuda_shared +static LangAS::Map AMDGPUPrivateIsZeroMap = { +1, // opencl_global +3, // opencl_local +2, // opencl_constant +4, // opencl_generic +1, // cuda_device +2, // cuda_constant +3 // cuda_shared +}; +static LangAS::Map AMDGPUGenericIsZeroMap = { +1, // opencl_global +3, // opencl_local +4, // opencl_constant +0, // opencl_generic +1, // cuda_device +4, // cuda_constant +3 // cuda_shared }; // If you edit the description strings, make sure you update @@ -2019,15 +2028,39 @@ "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; -static const char *const DataLayoutStringSI = +static const char *const DataLayoutStringSIPrivateIsZero = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; +static const char *const DataLayoutStringSIGenericIsZero = + "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" + "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" + "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; + class AMDGPUTargetInfo final : public TargetInfo { static const Builtin::Info BuiltinInfo[]; static const char * const GCCRegNames[]; + struct AddrSpace { +unsigned Generic, Global, Local, Constant, Private; +AddrSpace(bool IsGenericZero_ = false){ + if (IsGenericZero_) { +Generic = 0; +Global= 1; +Local = 3; +Constant = 4; +Private = 5; + } else { +Generic = 4; +Global= 1; +Local = 3; +Constant = 2; +Private = 0; + } +} + }; + /// \brief The GPU profiles supported by the AMDGPU target. enum GPUKind { GK_NONE, @@ -2054,39 +2087,43 @@ return TT.getArch() == llvm::Triple::amdgcn; } + static bool isGenericZero(const llvm::Triple &TT) { +return TT.getEnvironment() == llvm::Triple::AMDGIZ || +TT.getEnvironment() == llvm::Triple::AMDGIZCL; + } public: AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : TargetInfo(Triple) , GPU(isAMDGCN(Triple) ? GK_GFX6 : GK_R600), hasFP64(false), hasFMAF(false), hasLDEXPF(false), - hasFullSpeedFP32Denorms(false){ + hasFullSpeedFP32Denorms(false), + AS(isGenericZero(Triple)){ if (getTriple().getArch() == llvm::Triple::amdgcn) { hasFP64 = true; hasFMAF = true; hasLDEXPF = true; } - +auto IsGenericZero = isGenericZero(Triple); resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn ? -DataLayoutStringSI : DataLayoutStringR600); +(IsGenericZero ? DataLayoutStringSIGenericIsZero : +DataLayoutStringSIPrivateIsZero) +: DataLayoutStringR600); -AddrSpaceMap = &AMDGPUAddrSpaceMap; +AddrSpaceMap = IsGenericZero ? &AMDGPUGenericIsZeroMap : +&AMDGPUPrivateIsZeroMap; UseAddrSpaceMapMangling = true; } uint64_t getPointerWidthV(unsigned AddrSpace) const override { if (GPU <= GK_CAYMAN) return 32; -switch(AddrSpace) { - default: -return 64; - case 0: - case 3: - case 5: -return 32; +if (AddrSpace ==
[PATCH] D31210: [AMDGPU] Add new address space mapping
t-tye requested changes to this revision. t-tye added a comment. This revision now requires changes to proceed. Also please upload as full diff. Comment at: lib/Basic/Targets.cpp:2026-2069 + struct AddrSpace { +unsigned Generic, Global, Local, Constant, Private; +bool IsGenericZero; +AddrSpace(bool IsGenericZero_ = false){ + reset(IsGenericZero_); +} +void reset(bool IsGenericZero_) { Now that the target triple is being used to control the address space mapping, the mapping is only being set once. So suggest simplifying this and simply have two static arrays for the address spaces (like is done for the data layout), and then set AddrSpaceMap to the address of the appropriate array. Comment at: lib/Basic/Targets.cpp:2119 -AddrSpaceMap = &AMDGPUAddrSpaceMap; +AddrSpaceMap = AS.getMap(); UseAddrSpaceMapMangling = true; See comment above. https://reviews.llvm.org/D31210 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31043: Update for lifetime intrinsic signature change
arsenm updated this revision to Diff 92981. arsenm added a comment. Use existing type member variable https://reviews.llvm.org/D31043 Files: lib/CodeGen/CGDecl.cpp test/CodeGen/cleanup-destslot-simple.c test/CodeGen/lifetime-asan.c test/CodeGen/lifetime2.c test/CodeGen/temporary-lifetime-exceptions.cpp test/CodeGen/temporary-lifetime.cpp test/CodeGenCXX/destructors.cpp test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp test/CodeGenCXX/nrvo.cpp test/CodeGenObjC/arc-blocks.m test/CodeGenObjC/arc-precise-lifetime.m test/CodeGenObjC/arc-ternary-op.m test/CodeGenObjC/arc.m test/CodeGenObjC/exceptions.m test/CodeGenObjCXX/arc-move.mm test/CodeGenObjCXX/arc-references.mm test/CodeGenObjCXX/arc.mm test/CodeGenObjCXX/literals.mm Index: test/CodeGenObjCXX/literals.mm === --- test/CodeGenObjCXX/literals.mm +++ test/CodeGenObjCXX/literals.mm @@ -21,7 +21,7 @@ // Initializing first element // CHECK: [[PTR1:%.*]] = bitcast i8** [[ARR]] to i8* - // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PTR1]]) + // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTR1]]) // CHECK: [[ELEMENT0:%[a-zA-Z0-9.]+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[OBJECTS]], i64 0, i64 0 // CHECK-NEXT: call void @_ZN1XC1Ev // CHECK-NEXT: [[OBJECT0:%[a-zA-Z0-9.]+]] = invoke i8* @_ZNK1XcvP11objc_objectEv @@ -51,7 +51,7 @@ // CHECK-NOT: ret void // CHECK: call void @objc_release // CHECK-NEXT: [[PTR2:%.*]] = bitcast i8** [[ARR]] to i8* - // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR2]]) + // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR2]]) // CHECK-NEXT: ret void // Check cleanups @@ -73,7 +73,7 @@ // Initializing first element // CHECK: [[PTR1:%.*]] = bitcast i8** [[ARR]] to i8* - // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PTR1]]) + // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTR1]]) // CHECK: [[ELEMENT0:%[a-zA-Z0-9.]+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[OBJECTS]], i64 0, i64 0 // CHECK-NEXT: call void @_ZN1XC1Ev // CHECK-NEXT: [[OBJECT0:%[a-zA-Z0-9.]+]] = invoke i8* @_ZNK1XcvP11objc_objectEv @@ -103,7 +103,7 @@ // CHECK-NOT: ret void // CHECK: call void @objc_release // CHECK-NEXT: [[PTR2]] = bitcast i8** [[ARR]] to i8* - // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR2]]) + // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR2]]) // CHECK-NEXT: ret void // Check cleanups Index: test/CodeGenObjCXX/arc.mm === --- test/CodeGenObjCXX/arc.mm +++ test/CodeGenObjCXX/arc.mm @@ -65,10 +65,10 @@ // CHECK-NEXT: [[CONDCLEANUP:%.*]] = alloca i1 // CHECK-NEXT: store i32 // CHECK-NEXT: [[STRONGP:%.*]] = bitcast i8** [[STRONG]] to i8* - // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[STRONGP]]) + // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[STRONGP]]) // CHECK-NEXT: store i8* null, i8** [[STRONG]] // CHECK-NEXT: [[WEAKP:%.*]] = bitcast i8** [[WEAK]] to i8* - // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[WEAKP]]) + // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[WEAKP]]) // CHECK-NEXT: call i8* @objc_initWeak(i8** [[WEAK]], i8* null) // CHECK-NEXT: [[T0:%.*]] = load i32, i32* [[COND]] @@ -316,7 +316,7 @@ // CHECK: [[X:%.*]] = alloca i8* // CHECK-NEXT: [[TEMP:%.*]] = alloca i8* // CHECK-NEXT: [[XP:%.*]] = bitcast i8** [[X]] to i8* -// CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XP]]) +// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XP]]) // CHECK-NEXT: store i8* null, i8** [[X]] // CHECK: [[T0:%.*]] = load i8*, i8** [[X]] // CHECK-NEXT: store i8* [[T0]], i8** [[TEMP]] Index: test/CodeGenObjCXX/arc-references.mm === --- test/CodeGenObjCXX/arc-references.mm +++ test/CodeGenObjCXX/arc-references.mm @@ -45,7 +45,7 @@ // CHECK-NEXT: call void @_Z6calleev() callee(); // CHECK-NEXT: [[PTR:%.*]] = bitcast i8*** [[REF]] to i8* - // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR]]) + // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR]]) // CHECK-NEXT: call void @objc_destroyWeak // CHECK-NEXT: ret void } @@ -75,11 +75,11 @@ // CHECK-NEXT: [[OBJ_ID:%[a-zA-Z0-9]+]] = bitcast [[A]]* [[OBJ_A]] to i8* // CHECK-NEXT: call void @objc_release // CHECK-NEXT: [[IPTR1:%.*]] = bitcast i32* [[I]] to i8* - // CHECK-NEXT: call void @llvm.lifetime.start(i64 4, i8* [[IPTR1]]) + // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[IPTR1]]) // CHECK-NEXT: store i32 17, i32 int i = 17; // CHECK-NEXT: [[IPTR2:%.*]] = bitcast i32* [[I]] to i8* - // CHECK-NEXT: call void @llvm.lifetime.end(i64 4, i8* [[IPTR2]]) + // CHECK-NEXT: call void @llvm.lifetime
[PATCH] D31326: Add option to export fixes to run-clang-tidy.py
mfherbst updated this revision to Diff 92986. mfherbst added a comment. Fixed typos (MainFile => MainSourceFile) https://reviews.llvm.org/D31326 Files: run-clang-tidy.py Index: run-clang-tidy.py === --- run-clang-tidy.py +++ run-clang-tidy.py @@ -45,6 +45,8 @@ import sys import tempfile import threading +import yaml +import glob def find_compilation_database(path): @@ -87,14 +89,37 @@ return start +def merge_replacement_files(tmpdir, fixfile): + """Merge all replacement files in a directory into a single fixfile""" + merged={ 'MainSourceFile': None, 'Replacements': [] } + + for replacefile in glob.iglob(tmpdir + '/*.yaml'): +with open(replacefile, 'r') as f: + content = yaml.safe_load(f) + if not content: continue # Skip empty files + +try: + if not merged['MainSourceFile']: +merged['MainSourceFile'] = content['MainSourceFile'] + elif merged['MainSourceFile'] != content['MainSourceFile']: +# The values given for MainSourceFile are inconsistent. +# Just empty MainSourceFile blank: +merged['MainSourceFile']='' + merged['Replacements'].extend(content['Replacements']) +except KeyError: + pass # Ignore files with missing keys + + if merged['Replacements']: +with open(fixfile,'w') as out: + yaml.safe_dump(merged, out) + def apply_fixes(args, tmpdir): - """Calls clang-apply-fixes on a given directory. Deletes the dir when done.""" + """Calls clang-apply-fixes on a given directory.""" invocation = [args.clang_apply_replacements_binary] if args.format: invocation.append('-format') invocation.append(tmpdir) subprocess.call(invocation) - shutil.rmtree(tmpdir) def run_tidy(args, tmpdir, build_path, queue): @@ -129,6 +154,9 @@ 'headers to output diagnostics from. Diagnostics from ' 'the main file of each translation unit are always ' 'displayed.') + parser.add_argument('-export-fixes', metavar='filename', dest='export_fixes', + help='Create a yaml file to store suggested fixes in, ' + 'which can be applied with clang-apply-replacements') parser.add_argument('-j', type=int, default=0, help='number of tidy instances to be run in parallel.') parser.add_argument('files', nargs='*', default=['.*'], @@ -178,7 +206,7 @@ max_task = multiprocessing.cpu_count() tmpdir = None - if args.fix: + if args.fix or args.export_fixes: tmpdir = tempfile.mkdtemp() # Build up a big regexy filter from all command line arguments. @@ -205,13 +233,20 @@ # This is a sad hack. Unfortunately subprocess goes # bonkers with ctrl-c and we start forking merrily. print '\nCtrl-C detected, goodbye.' -if args.fix: +if tmpdir: shutil.rmtree(tmpdir) os.kill(0, 9) + if args.export_fixes: +print 'Writing fixes to ' + args.export_fixes +merge_replacement_files(tmpdir,args.export_fixes) + if args.fix: print 'Applying fixes ...' apply_fixes(args, tmpdir) + if tmpdir: +shutil.rmtree(tmpdir) + if __name__ == '__main__': main() Index: run-clang-tidy.py === --- run-clang-tidy.py +++ run-clang-tidy.py @@ -45,6 +45,8 @@ import sys import tempfile import threading +import yaml +import glob def find_compilation_database(path): @@ -87,14 +89,37 @@ return start +def merge_replacement_files(tmpdir, fixfile): + """Merge all replacement files in a directory into a single fixfile""" + merged={ 'MainSourceFile': None, 'Replacements': [] } + + for replacefile in glob.iglob(tmpdir + '/*.yaml'): +with open(replacefile, 'r') as f: + content = yaml.safe_load(f) + if not content: continue # Skip empty files + +try: + if not merged['MainSourceFile']: +merged['MainSourceFile'] = content['MainSourceFile'] + elif merged['MainSourceFile'] != content['MainSourceFile']: +# The values given for MainSourceFile are inconsistent. +# Just empty MainSourceFile blank: +merged['MainSourceFile']='' + merged['Replacements'].extend(content['Replacements']) +except KeyError: + pass # Ignore files with missing keys + + if merged['Replacements']: +with open(fixfile,'w') as out: + yaml.safe_dump(merged, out) + def apply_fixes(args, tmpdir): - """Calls clang-apply-fixes on a given directory. Deletes the dir when done.""" + """Calls clang-apply-fixes on a given directory.""" invocation = [args.clang_apply_replacements_binary] if args.format: invocation.append('-format') invocation.append(tmpdir) subprocess.call(invocation) - shutil.rmtree(tmpdir) def run_tidy(args, tmpdir, build_path, queue): @@ -129,6 +154,9 @@ 'headers to output diagnostics from. Diagnostics from '
[PATCH] D31114: Refactor `initTargetOptions` out of `EmitAssemblyHelper::CreateTargetMachine` and use it to initialize TargetOptions for ThinLTO Backends
tejohnson added a comment. Ping - I think this just needs a test in addition to undoing the AsmHelper definition move. I have some follow on changes I want to send that set up the rest of the lto::Config fields (e.g. the RelocModel etc). https://reviews.llvm.org/D31114 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31210: [AMDGPU] Add new address space mapping
yaxunl added a comment. Hi Tony, I have already updated with a full diff. Please take a look. Thanks. https://reviews.llvm.org/D31210 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31308: [clang-tidy] new check readability-no-alternative-tokens
gnzlbg added a comment. Thanks for working on this! > I'm not sure if it would be helpful to have this check in both ways. I did a > code search for "not_eq", "bitand" and "and_eq" on github, and their usage > seems to be a clear minority. I actually was requesting the opposite version of this (but suggesting to implement both), because for me "if (!something)" is much harder to read than "if (not something)" (I am a bit blind). > So I would propose to keep the features as-is for now, change the name to > readability-operators-representation, and then later (someone else?) might > also add an option for making this work the other way around. Would that be > ok for you? Sounds good to me. This solves half of the problem, and I agree with you that more people will benefit from this check than from the opposite check. Thanks again for working on this! Repository: rL LLVM https://reviews.llvm.org/D31308 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31007: [Objective-C] Miscellaneous -fobjc-weak Fixes
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. LGTM, thanks! https://reviews.llvm.org/D31007 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31324: [OpenCL] Extended mapping of parcing CodeGen arguments
Anastasia accepted this revision. Anastasia added a comment. This revision is now accepted and ready to land. LGTM! Thanks! https://reviews.llvm.org/D31324 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31183: [OpenCL] Added parsing for OpenCL vector types.
Anastasia added a comment. In https://reviews.llvm.org/D31183#709566, @echuraev wrote: > In https://reviews.llvm.org/D31183#708833, @yaxunl wrote: > > > I think this is a good feature for the convenience of user. I've seen usage > > like this. > > > I agree. I don't see any reasons why this case doesn't have the right to > exist. I don't think that using extra parenthesis is a good solution for > solving this problem. I am just saying that I don't see a big use case for this. I am guessing it can largely come from the macro expansions, but those are generally good style to parenthesize. https://reviews.llvm.org/D31183 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin
hfinkel added a comment. In https://reviews.llvm.org/D30920#703305, @mehdi_amini wrote: > The fundamental difference, is that Os/Oz especially are treated as > `optimizations directive` that are independent of the pass pipeline: > instructing that "loop unroll should not increase size" is independent of > *where* is loop unroll inserted in the pipeline. > The issue with https://reviews.llvm.org/owners/package/1/ vs > https://reviews.llvm.org/owners/package/2/ is that the *ordering* of the > passes changes, not only the threshold to apply. Maybe we should stop here and ask: Is this really a *fundamental* difference? Or is this just a difference in how to handle Os/Oz today? Is there a fundamental reason why we might not want a different order for Oz vs. https://reviews.llvm.org/owners/package/2/ if we want one for 02 vs 03? My view is that, no, there is no fundamental difference. Why? Because each optimization level has a meaning, and that meaning can almost always be applied per function. - `Oz` - Make the binary as small as possible - `Os` - Make the binary small while making only minor performance tradeoffs - `O0` - Be fast, and maybe, maximize the ability to debug - `O1` - Make the code fast while making only minor debugability tradeoffs - `O2` - Make the code fast - perform only transformations that will speed up the code with near certainty - `O3` - Make the code fast - perform transformations that will speed up the code with high probability Believing that we can implement this model primarily through pass scheduling has proved false in the past (except for -O0 without LTO) and won't be any more true in the future. We essentially have one optimization pipeline, and I see no reason to assume this will change. It seems significantly more effective to have the passes become optimization-level aware than to implement optimization though changes in the pipeline structure itself. Especially in the context of the new pass manager, where the cost of scheduling a pass that will exit early should be small, I see no reason to alter the pipeline at all. For one thing, many optimizations are capable of performing several (or many) different transformations, and these often don't all fall into the same categories. In that sense, CGSCC- and function-scope passes are not really different than function/loop-scope passes. As such, I think that we should tag functions/modules with optimization levels so that users can control the optimization level effectively even in the case of LTO. We could even add pragmas allowing users to control this at finer granularity, and that would be a positive thing (I dislike that we currently force users to put functions in different files to get different optimization levels - my users find this annoying too). We need to give users a simple model to follow: optimization is associated with compiling (even if we do, in fact, delay it until link time). > Also this wouldn't work with an SCC pass, as different functions in the SCC > can have different level, it gets quite tricky. It also becomes problematic > for any module level pass: `Dead Global Elimination` would need to leave out > global variable that comes from a module compiled with > https://reviews.llvm.org/owners/package/1/, same with `Merge Duplicate Global > Constants` (I think the issue with `GlobalVariable` affects also Os/Oz by the > way). Yes, we should do this. I don't understand why this is tricky. Actually, I think having these kinds of decisions explicit in the code of the transformations would be a positive development. https://reviews.llvm.org/D30920 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298728 - Fix a test so that it actually checks the output.
Author: pcc Date: Fri Mar 24 14:32:20 2017 New Revision: 298728 URL: http://llvm.org/viewvc/llvm-project?rev=298728&view=rev Log: Fix a test so that it actually checks the output. Modified: cfe/trunk/test/Modules/module-impl-with-link.c Modified: cfe/trunk/test/Modules/module-impl-with-link.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module-impl-with-link.c?rev=298728&r1=298727&r2=298728&view=diff == --- cfe/trunk/test/Modules/module-impl-with-link.c (original) +++ cfe/trunk/test/Modules/module-impl-with-link.c Fri Mar 24 14:32:20 2017 @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -fmodule-name=Clib %s -I %S/Inputs/module-impl-with-link -emit-llvm -o - +// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -fmodule-name=Clib %s -I %S/Inputs/module-impl-with-link -emit-llvm -o - | FileCheck %s #include "foo.h" // CHECK: !{{[0-9]+}} = !{i32 6, !"Linker Options", ![[LINK_OPTIONS:[0-9]+]]} // Make sure we don't generate linker option for module Clib since this TU is ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D7375: [clang-tidy] Assert related checkers
lebedev.ri added inline comments. Comment at: test/clang-tidy/misc-assert-side-effect.cpp:67 + + assert(freeFunction()); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() with side effect Is it intentional that the check also warns on free functions even if they are marked as const, .e.g: cat >test.cpp < // only works for positive values and zero template inline constexpr bool __attribute__((const)) isPowerOfTwo(T val) { return (val & (~val+1)) == val; } int main() { assert(isPowerOfTwo(2 << 2)); } ``` EOL Run: ``` $ clang-tidy -checks misc-assert-side-effect -config="{Checks: 'misc-assert-side-effect', CheckOptions: [{key: 'misc-assert-side-effect.CheckFunctionCalls', value: 1}]}" test.cpp -- -std=c++11 /tmp/test.cpp:14:3: warning: found assert() with side effect [misc-assert-side-effect] assert(isPowerOfTwo(2 << 2)); ^ /usr/include/assert.h:89:4: note: expanded from macro 'assert' ((expr) \ ^ ``` Am i missing something obvious? https://reviews.llvm.org/D7375 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31005: [Objective-C] Fix "repeated use of weak" warning with -fobjc-weak
bkelley added a comment. Thanks again for the feedback. Is there anything further I should update in this diff or is it looking good? Thanks! Brian https://reviews.llvm.org/D31005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31210: [AMDGPU] Switch address space mapping by triple environment
yaxunl updated this revision to Diff 92997. yaxunl retitled this revision from "[AMDGPU] Add new address space mapping" to "[AMDGPU] Switch address space mapping by triple environment". yaxunl added a comment. Use triple environment name. https://reviews.llvm.org/D31210 Files: lib/Basic/Targets.cpp test/CodeGenOpenCL/amdgpu-env-amdgiz.cl Index: test/CodeGenOpenCL/amdgpu-env-amdgiz.cl === --- /dev/null +++ test/CodeGenOpenCL/amdgpu-env-amdgiz.cl @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 %s -O0 -triple amdgcn -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple amdgcn---opencl -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple amdgcn---amdgiz -emit-llvm -o - | FileCheck -check-prefix=NEW %s +// RUN: %clang_cc1 %s -O0 -triple amdgcn---amdgizcl -emit-llvm -o - | FileCheck -check-prefix=NEW %s + +// CHECK: target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" +// NEW: target datalayout = "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64" +void foo(void) {} + Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -2012,14 +2012,23 @@ return llvm::makeArrayRef(GCCRegNames); } -static const unsigned AMDGPUAddrSpaceMap[] = { - 1,// opencl_global - 3,// opencl_local - 2,// opencl_constant - 4,// opencl_generic - 1,// cuda_device - 2,// cuda_constant - 3 // cuda_shared +static LangAS::Map AMDGPUPrivateIsZeroMap = { +1, // opencl_global +3, // opencl_local +2, // opencl_constant +4, // opencl_generic +1, // cuda_device +2, // cuda_constant +3 // cuda_shared +}; +static LangAS::Map AMDGPUGenericIsZeroMap = { +1, // opencl_global +3, // opencl_local +4, // opencl_constant +0, // opencl_generic +1, // cuda_device +4, // cuda_constant +3 // cuda_shared }; // If you edit the description strings, make sure you update @@ -2029,15 +2038,39 @@ "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; -static const char *const DataLayoutStringSI = +static const char *const DataLayoutStringSIPrivateIsZero = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; +static const char *const DataLayoutStringSIGenericIsZero = + "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" + "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" + "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; + class AMDGPUTargetInfo final : public TargetInfo { static const Builtin::Info BuiltinInfo[]; static const char * const GCCRegNames[]; + struct AddrSpace { +unsigned Generic, Global, Local, Constant, Private; +AddrSpace(bool IsGenericZero_ = false){ + if (IsGenericZero_) { +Generic = 0; +Global= 1; +Local = 3; +Constant = 4; +Private = 5; + } else { +Generic = 4; +Global= 1; +Local = 3; +Constant = 2; +Private = 0; + } +} + }; + /// \brief The GPU profiles supported by the AMDGPU target. enum GPUKind { GK_NONE, @@ -2064,39 +2097,43 @@ return TT.getArch() == llvm::Triple::amdgcn; } + static bool isGenericZero(const llvm::Triple &TT) { +return TT.getEnvironmentName() == "amdgiz" || +TT.getEnvironmentName() == "amdgizcl"; + } public: AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : TargetInfo(Triple) , GPU(isAMDGCN(Triple) ? GK_GFX6 : GK_R600), hasFP64(false), hasFMAF(false), hasLDEXPF(false), - hasFullSpeedFP32Denorms(false){ + hasFullSpeedFP32Denorms(false), + AS(isGenericZero(Triple)){ if (getTriple().getArch() == llvm::Triple::amdgcn) { hasFP64 = true; hasFMAF = true; hasLDEXPF = true; } - +auto IsGenericZero = isGenericZero(Triple); resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn ? -DataLayoutStringSI : DataLayoutStringR600); +(IsGenericZero ? DataLayoutStringSIGenericIsZero : +DataLayoutStringSIPrivateIsZero) +: DataLayoutStringR600); -AddrSpaceMap = &AMDGPUAddrSpaceMap; +AddrSpaceMap = IsGenericZero ? &AMDGPUGenericIsZeroMap : +&AMDGPUPrivateIsZeroMap; UseAddrSpaceMapMangling = true; } uint64_t getPointerWidthV(unsigned AddrSpace) const override { if (GPU <= GK_CAYMAN) return 32; -switch(AddrSpace)
[PATCH] D30760: Record command lines in objects built by clang, Clang part
zhizhouy updated this revision to Diff 93003. zhizhouy marked 3 inline comments as done. zhizhouy added a comment. Checked both grecord-gcc-swtiches and gno-record-gcc-switches. Modified testcases for it. https://reviews.llvm.org/D30760 Files: lib/Driver/ToolChains/Clang.cpp test/Driver/grecord-gcc-switches.c Index: test/Driver/grecord-gcc-switches.c === --- /dev/null +++ test/Driver/grecord-gcc-switches.c @@ -0,0 +1,13 @@ +// RUN: %clang -### -g -c -grecord-gcc-switches %s 2>&1 | FileCheck -check-prefix=REC %s +// RUN: %clang -### -g -c -gno-record-gcc-switches %s 2>&1 | FileCheck -check-prefix=NO_REC %s +// RUN: %clang -### -g -c %s 2>&1 | FileCheck %s +int main (void) { + return 0; +} + +// REC: "-dwarf-debug-flags" +// REC: -### -g -c -grecord-gcc-switches +// NO_REC-NOT: "-dwarf-debug-flags" +// NO_REC-NOT: -### -g -c -gno-record-gcc-switches +// CHECK-NOT: "-dwarf-debug-flags" +// CHECK-NOT: -### -g -c Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -2728,7 +2728,8 @@ DwarfVersion = getToolChain().GetDefaultDwarfVersion(); } - // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now. + // We ignore flag -gstrict-dwarf for now. + // And we handle flag -grecord-gcc-switches later with DwarfDebugFlags. Args.ClaimAllArgs(options::OPT_g_flags_Group); // Column info is included by default for everything except PS4 and CodeView. @@ -4321,7 +4322,12 @@ // Optionally embed the -cc1 level arguments into the debug info, for build // analysis. - if (getToolChain().UseDwarfDebugFlags()) { + // Also record command line arguments into the debug info if + // -grecord-gcc-switches options is set on. + // By default, -gno-record-gcc-switches is set on and no recording. + if (getToolChain().UseDwarfDebugFlags() || + Args.hasFlag(options::OPT_grecord_gcc_switches, + options::OPT_gno_record_gcc_switches, false)) { ArgStringList OriginalArgs; for (const auto &Arg : Args) Arg->render(Args, OriginalArgs); Index: test/Driver/grecord-gcc-switches.c === --- /dev/null +++ test/Driver/grecord-gcc-switches.c @@ -0,0 +1,13 @@ +// RUN: %clang -### -g -c -grecord-gcc-switches %s 2>&1 | FileCheck -check-prefix=REC %s +// RUN: %clang -### -g -c -gno-record-gcc-switches %s 2>&1 | FileCheck -check-prefix=NO_REC %s +// RUN: %clang -### -g -c %s 2>&1 | FileCheck %s +int main (void) { + return 0; +} + +// REC: "-dwarf-debug-flags" +// REC: -### -g -c -grecord-gcc-switches +// NO_REC-NOT: "-dwarf-debug-flags" +// NO_REC-NOT: -### -g -c -gno-record-gcc-switches +// CHECK-NOT: "-dwarf-debug-flags" +// CHECK-NOT: -### -g -c Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -2728,7 +2728,8 @@ DwarfVersion = getToolChain().GetDefaultDwarfVersion(); } - // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now. + // We ignore flag -gstrict-dwarf for now. + // And we handle flag -grecord-gcc-switches later with DwarfDebugFlags. Args.ClaimAllArgs(options::OPT_g_flags_Group); // Column info is included by default for everything except PS4 and CodeView. @@ -4321,7 +4322,12 @@ // Optionally embed the -cc1 level arguments into the debug info, for build // analysis. - if (getToolChain().UseDwarfDebugFlags()) { + // Also record command line arguments into the debug info if + // -grecord-gcc-switches options is set on. + // By default, -gno-record-gcc-switches is set on and no recording. + if (getToolChain().UseDwarfDebugFlags() || + Args.hasFlag(options::OPT_grecord_gcc_switches, + options::OPT_gno_record_gcc_switches, false)) { ArgStringList OriginalArgs; for (const auto &Arg : Args) Arg->render(Args, OriginalArgs); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D30760: Record command lines in objects built by clang, Clang part
As Adrian mentioned, this can probably be covered/added to an existing test case in clang/test/Driver On Fri, Mar 24, 2017 at 1:57 PM Zhizhou Yang via Phabricator < revi...@reviews.llvm.org> wrote: > zhizhouy updated this revision to Diff 93003. > zhizhouy marked 3 inline comments as done. > zhizhouy added a comment. > > Checked both grecord-gcc-swtiches and gno-record-gcc-switches. > > Modified testcases for it. > > > https://reviews.llvm.org/D30760 > > Files: > lib/Driver/ToolChains/Clang.cpp > test/Driver/grecord-gcc-switches.c > > > Index: test/Driver/grecord-gcc-switches.c > === > --- /dev/null > +++ test/Driver/grecord-gcc-switches.c > @@ -0,0 +1,13 @@ > +// RUN: %clang -### -g -c -grecord-gcc-switches %s 2>&1 | FileCheck > -check-prefix=REC %s > +// RUN: %clang -### -g -c -gno-record-gcc-switches %s 2>&1 | FileCheck > -check-prefix=NO_REC %s > +// RUN: %clang -### -g -c %s 2>&1 | FileCheck %s > +int main (void) { > + return 0; > +} > + > +// REC: "-dwarf-debug-flags" > +// REC: -### -g -c -grecord-gcc-switches > +// NO_REC-NOT: "-dwarf-debug-flags" > +// NO_REC-NOT: -### -g -c -gno-record-gcc-switches > +// CHECK-NOT: "-dwarf-debug-flags" > +// CHECK-NOT: -### -g -c > Index: lib/Driver/ToolChains/Clang.cpp > === > --- lib/Driver/ToolChains/Clang.cpp > +++ lib/Driver/ToolChains/Clang.cpp > @@ -2728,7 +2728,8 @@ > DwarfVersion = getToolChain().GetDefaultDwarfVersion(); >} > > - // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now. > + // We ignore flag -gstrict-dwarf for now. > + // And we handle flag -grecord-gcc-switches later with DwarfDebugFlags. >Args.ClaimAllArgs(options::OPT_g_flags_Group); > >// Column info is included by default for everything except PS4 and > CodeView. > @@ -4321,7 +4322,12 @@ > >// Optionally embed the -cc1 level arguments into the debug info, for > build >// analysis. > - if (getToolChain().UseDwarfDebugFlags()) { > + // Also record command line arguments into the debug info if > + // -grecord-gcc-switches options is set on. > + // By default, -gno-record-gcc-switches is set on and no recording. > + if (getToolChain().UseDwarfDebugFlags() || > + Args.hasFlag(options::OPT_grecord_gcc_switches, > + options::OPT_gno_record_gcc_switches, false)) { > ArgStringList OriginalArgs; > for (const auto &Arg : Args) >Arg->render(Args, OriginalArgs); > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin
mehdi_amini added a subscriber: joerg. mehdi_amini added a comment. In https://reviews.llvm.org/D30920#710209, @hfinkel wrote: > Yes, we should do this. I don't understand why this is tricky. Actually, I > think having these kinds of decisions explicit in the code of the > transformations would be a positive development. I think a high reason why I consider this tricky, it the part where I mentioned that a single pass can have different behavior/level depending on where it is in the pipeline. But recently @joerg split SimplifyCFG into two wrapper passes, which may be a good way of achieving what you're describing. https://reviews.llvm.org/D30920 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30760: Record command lines in objects built by clang, Clang part
zhizhouy updated this revision to Diff 93011. zhizhouy added a comment. Added tests into test/Driver/debug-options.c. Thanks. https://reviews.llvm.org/D30760 Files: lib/Driver/ToolChains/Clang.cpp test/Driver/debug-options.c Index: test/Driver/debug-options.c === --- test/Driver/debug-options.c +++ test/Driver/debug-options.c @@ -117,8 +117,12 @@ // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \ // RUN: | FileCheck -check-prefix=GLTO_NO %s // -// RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \ -// RUN:-gstrict-dwarf -gno-strict-dwarf %s 2>&1 \ +// RUN: %clang -### -c -grecord-gcc-switches %s 2>&1 \ +// | FileCheck -check-prefix=GRECORD %s +// RUN: %clang -### -c -gno-record-gcc-switches %s 2>&1 \ +// | FileCheck -check-prefix=GNO_RECORD %s +// +// RUN: %clang -### -c -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \ // RUN:| FileCheck -check-prefix=GIGNORE %s // // RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s @@ -194,6 +198,11 @@ // GLTO_NO: "-cc1" // GLTO_NO-NOT: -debug-info-kind= // +// GRECORD: "-dwarf-debug-flags" +// GRECORD: -### -c -grecord-gcc-switches +// +// GNO_RECORD-NOT: "-dwarf-debug-flags" +// // GIGNORE-NOT: "argument unused during compilation" // // GOPT: -generate-gnu-dwarf-pub-sections Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -2728,7 +2728,8 @@ DwarfVersion = getToolChain().GetDefaultDwarfVersion(); } - // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now. + // We ignore flag -gstrict-dwarf for now. + // And we handle flag -grecord-gcc-switches later with DwarfDebugFlags. Args.ClaimAllArgs(options::OPT_g_flags_Group); // Column info is included by default for everything except PS4 and CodeView. @@ -4321,7 +4322,12 @@ // Optionally embed the -cc1 level arguments into the debug info, for build // analysis. - if (getToolChain().UseDwarfDebugFlags()) { + // Also record command line arguments into the debug info if + // -grecord-gcc-switches options is set on. + // By default, -gno-record-gcc-switches is set on and no recording. + if (getToolChain().UseDwarfDebugFlags() || + Args.hasFlag(options::OPT_grecord_gcc_switches, + options::OPT_gno_record_gcc_switches, false)) { ArgStringList OriginalArgs; for (const auto &Arg : Args) Arg->render(Args, OriginalArgs); Index: test/Driver/debug-options.c === --- test/Driver/debug-options.c +++ test/Driver/debug-options.c @@ -117,8 +117,12 @@ // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \ // RUN: | FileCheck -check-prefix=GLTO_NO %s // -// RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \ -// RUN:-gstrict-dwarf -gno-strict-dwarf %s 2>&1 \ +// RUN: %clang -### -c -grecord-gcc-switches %s 2>&1 \ +// | FileCheck -check-prefix=GRECORD %s +// RUN: %clang -### -c -gno-record-gcc-switches %s 2>&1 \ +// | FileCheck -check-prefix=GNO_RECORD %s +// +// RUN: %clang -### -c -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \ // RUN:| FileCheck -check-prefix=GIGNORE %s // // RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GOPT %s @@ -194,6 +198,11 @@ // GLTO_NO: "-cc1" // GLTO_NO-NOT: -debug-info-kind= // +// GRECORD: "-dwarf-debug-flags" +// GRECORD: -### -c -grecord-gcc-switches +// +// GNO_RECORD-NOT: "-dwarf-debug-flags" +// // GIGNORE-NOT: "argument unused during compilation" // // GOPT: -generate-gnu-dwarf-pub-sections Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -2728,7 +2728,8 @@ DwarfVersion = getToolChain().GetDefaultDwarfVersion(); } - // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now. + // We ignore flag -gstrict-dwarf for now. + // And we handle flag -grecord-gcc-switches later with DwarfDebugFlags. Args.ClaimAllArgs(options::OPT_g_flags_Group); // Column info is included by default for everything except PS4 and CodeView. @@ -4321,7 +4322,12 @@ // Optionally embed the -cc1 level arguments into the debug info, for build // analysis. - if (getToolChain().UseDwarfDebugFlags()) { + // Also record command line arguments into the debug info if + // -grecord-gcc-switches options is set on. + // By default, -gno-record-gcc-switches is set on and no recording. + if (getToolChain().UseDwarfDebugFlags() || + Args.hasFlag(options::OPT_grecord_gcc_switches, + options::OPT_gno_record_gcc_switches, false)) { ArgStringList OriginalArgs; for (const auto &Arg : Args) A
r298742 - [ODRHash] Add error messages for mismatched parameters in methods.
Author: rtrieu Date: Fri Mar 24 16:17:48 2017 New Revision: 298742 URL: http://llvm.org/viewvc/llvm-project?rev=298742&view=rev Log: [ODRHash] Add error messages for mismatched parameters in methods. Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td cfe/trunk/lib/AST/ODRHash.cpp cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/test/Modules/odr_hash.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=298742&r1=298741&r2=298742&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Fri Mar 24 16:17:48 2017 @@ -146,7 +146,12 @@ def err_module_odr_violation_mismatch_de "method %4 is %select{not static|static}5|" "method %4 is %select{not volatile|volatile}5|" "method %4 is %select{not const|const}5|" - "method %4 is %select{not inline|inline}5}3">; + "method %4 is %select{not inline|inline}5|" + "method %4 that has %5 parameter%s5|" + "method %4 with %ordinal5 parameter of type %6|" + "method %4 with %ordinal5 parameter named %6|" + "method %4 with %ordinal5 parameter with %select{no |}6default argument|" + "method %4 with %ordinal5 parameter with default argument}3">; def note_module_odr_violation_mismatch_decl_diff : Note<"but in '%0' found " "%select{" @@ -166,7 +171,12 @@ def note_module_odr_violation_mismatch_d "method %2 is %select{not static|static}3|" "method %2 is %select{not volatile|volatile}3|" "method %2 is %select{not const|const}3|" - "method %2 is %select{not inline|inline}3}1">; + "method %2 is %select{not inline|inline}3|" + "method %2 that has %3 parameter%s3|" + "method %2 with %ordinal3 parameter of type %4|" + "method %2 with %ordinal3 parameter named %4|" + "method %2 with %ordinal3 parameter with %select{no |}4default argument|" + "method %2 with %ordinal3 parameter with different default argument}1">; def warn_module_uses_date_time : Warning< "%select{precompiled header|module}0 uses __DATE__ or __TIME__">, Modified: cfe/trunk/lib/AST/ODRHash.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=298742&r1=298741&r2=298742&view=diff == --- cfe/trunk/lib/AST/ODRHash.cpp (original) +++ cfe/trunk/lib/AST/ODRHash.cpp Fri Mar 24 16:17:48 2017 @@ -169,6 +169,11 @@ public: Inherited::VisitValueDecl(D); } + void VisitParmVarDecl(const ParmVarDecl *D) { +AddStmt(D->getDefaultArg()); +Inherited::VisitParmVarDecl(D); + } + void VisitAccessSpecDecl(const AccessSpecDecl *D) { ID.AddInteger(D->getAccess()); Inherited::VisitAccessSpecDecl(D); @@ -202,6 +207,12 @@ public: Hash.AddBoolean(D->isPure()); Hash.AddBoolean(D->isDeletedAsWritten()); +ID.AddInteger(D->param_size()); + +for (auto *Param : D->parameters()) { + Hash.AddSubDecl(Param); +} + Inherited::VisitFunctionDecl(D); } @@ -315,6 +326,10 @@ public: } } + void AddQualType(QualType T) { +Hash.AddQualType(T); + } + void Visit(const Type *T) { ID.AddInteger(T->getTypeClass()); Inherited::Visit(T); @@ -327,6 +342,50 @@ public: VisitType(T); } + void VisitFunctionType(const FunctionType *T) { +AddQualType(T->getReturnType()); +T->getExtInfo().Profile(ID); +Hash.AddBoolean(T->isConst()); +Hash.AddBoolean(T->isVolatile()); +Hash.AddBoolean(T->isRestrict()); +VisitType(T); + } + + void VisitFunctionNoProtoType(const FunctionNoProtoType *T) { +VisitFunctionType(T); + } + + void VisitFunctionProtoType(const FunctionProtoType *T) { +ID.AddInteger(T->getNumParams()); +for (auto ParamType : T->getParamTypes()) + AddQualType(ParamType); + +const auto &epi = T->getExtProtoInfo(); +ID.AddInteger(epi.Variadic); +ID.AddInteger(epi.TypeQuals); +ID.AddInteger(epi.RefQualifier); +ID.AddInteger(epi.ExceptionSpec.Type); + +if (epi.ExceptionSpec.Type == EST_Dynamic) { + for (QualType Ex : epi.ExceptionSpec.Exceptions) +AddQualType(Ex); +} else if (epi.ExceptionSpec.Type == EST_ComputedNoexcept && + epi.ExceptionSpec.NoexceptExpr) { + AddStmt(epi.ExceptionSpec.NoexceptExpr); +} else if (epi.ExceptionSpec.Type == EST_Uninstantiated || + epi.ExceptionSpec.Type == EST_Unevaluated) { + AddDecl(epi.ExceptionSpec.SourceDecl->getCanonicalDecl()); +} +if (epi.ExtParameterInfos) { + for (unsigned i = 0; i != T->getNumParams(); ++i) +ID.AddInteger(epi.ExtParameterInfos[i].getOpaqueValue()); +} +epi.ExtInfo.Profile(ID); +Hash.AddBoolean(epi.HasTrailingReturn); + +VisitFunctionType(T); + } + void VisitTypedefType
[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin
hfinkel added a comment. In https://reviews.llvm.org/D30920#710329, @mehdi_amini wrote: > In https://reviews.llvm.org/D30920#710209, @hfinkel wrote: > > > Yes, we should do this. I don't understand why this is tricky. Actually, I > > think having these kinds of decisions explicit in the code of the > > transformations would be a positive development. > > > I think a high reason why I consider this tricky, it the part where I > mentioned that a single pass can have different behavior/level depending on > where it is in the pipeline. > But recently @joerg split SimplifyCFG into two wrapper passes, which may be > a good way of achieving what you're describing. I agree. https://reviews.llvm.org/D30920 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30760: Record command lines in objects built by clang, Clang part
echristo added inline comments. Comment at: test/Driver/debug-options.c:201-202 // +// GRECORD: "-dwarf-debug-flags" +// GRECORD: -### -c -grecord-gcc-switches +// This seems a little light on the testing, would you mind adding some more interesting lines here? (Also, -grecord-gcc-switches seems like an option we might want to ignore for this?) https://reviews.llvm.org/D30760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D30760: Record command lines in objects built by clang, Clang part
george.burgess.iv added inline comments. Comment at: test/Driver/debug-options.c:201 // +// GRECORD: "-dwarf-debug-flags" +// GRECORD: -### -c -grecord-gcc-switches echristo wrote: > This seems a little light on the testing, would you mind adding some more > interesting lines here? (Also, -grecord-gcc-switches seems like an option we > might want to ignore for this?) re-pasting my comment, since it looks like it got dropped when we updated diffs: nit: since `RenderAsInput` args (`-Xlinker`, `-o`, ...) have cases where they're printed without their arg, can we check that at least `-o -` is printed sanely, as well? https://reviews.llvm.org/D30760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31005: [Objective-C] Fix "repeated use of weak" warning with -fobjc-weak
rjmccall added a comment. Just a couple of minor requests. Comment at: lib/Sema/SemaExpr.cpp:708 + if (getLangOpts().ObjCWeak && E->getType().getObjCLifetime() == Qualifiers::OCL_Weak) Cleanup.setExprNeedsCleanups(true); Much like the other patches, it's probably more efficient to just check the qualifier here instead of testing the language option first. Comment at: lib/Sema/SemaExpr.cpp:2513 + if (getLangOpts().ObjCWeak) { if (IV->getType().getObjCLifetime() == Qualifiers::OCL_Weak) { if (!Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, Loc)) Same thing. Comment at: lib/Sema/SemaExprMember.cpp:1506 +if (S.getLangOpts().ObjCWeak) { if (IV->getType().getObjCLifetime() == Qualifiers::OCL_Weak) { if (!S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, MemberLoc)) Same. Comment at: lib/Sema/SemaPseudoObject.cpp:846 Qualifiers::ObjCLifetime LT = propType.getObjCLifetime(); if (LT == Qualifiers::OCL_Weak) if (!S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, RefExpr->getLocation())) Same. https://reviews.llvm.org/D31005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D30760: Record command lines in objects built by clang, Clang part
Sure I can add some more tests here. For -grecord-gcc-switches itself, I think maybe we could keep it in recording, since it is also one of the options from command line? On Fri, Mar 24, 2017 at 2:54 PM, Eric Christopher via Phabricator < revi...@reviews.llvm.org> wrote: > echristo added inline comments. > > > > Comment at: test/Driver/debug-options.c:201-202 > // > +// GRECORD: "-dwarf-debug-flags" > +// GRECORD: -### -c -grecord-gcc-switches > +// > > This seems a little light on the testing, would you mind adding some more > interesting lines here? (Also, -grecord-gcc-switches seems like an option > we might want to ignore for this?) > > > https://reviews.llvm.org/D30760 > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31210: [AMDGPU] Switch address space mapping by triple environment
t-tye accepted this revision. t-tye added a comment. This revision is now accepted and ready to land. Just a couple of suggestions, otherwise: LGTM Comment at: lib/Basic/Targets.cpp:2015 -static const unsigned AMDGPUAddrSpaceMap[] = { - 1,// opencl_global - 3,// opencl_local - 2,// opencl_constant - 4,// opencl_generic - 1,// cuda_device - 2,// cuda_constant - 3 // cuda_shared +static LangAS::Map AMDGPUPrivateIsZeroMap = { +1, // opencl_global Is there a reason this is no longer const? Comment at: lib/Basic/Targets.cpp:2024 +}; +static LangAS::Map AMDGPUGenericIsZeroMap = { +1, // opencl_global Same as above. Comment at: lib/Basic/Targets.cpp:2357 + + AddrSpace AS; }; Could this be const since it is not changed after construction? https://reviews.llvm.org/D31210 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31005: [Objective-C] Fix "repeated use of weak" warning with -fobjc-weak
bkelley updated this revision to Diff 93023. bkelley marked 4 inline comments as done. bkelley added a comment. Updated with feedback from @rjmccall https://reviews.llvm.org/D31005 Files: include/clang/AST/Type.h lib/AST/Type.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaExprMember.cpp lib/Sema/SemaExprObjC.cpp lib/Sema/SemaPseudoObject.cpp test/SemaObjC/arc-repeated-weak.mm Index: test/SemaObjC/arc-repeated-weak.mm === --- test/SemaObjC/arc-repeated-weak.mm +++ test/SemaObjC/arc-repeated-weak.mm @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -fblocks -Wno-objc-root-class -std=c++11 -Warc-repeated-use-of-weak -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-weak -fblocks -Wno-objc-root-class -std=c++11 -Warc-repeated-use-of-weak -verify %s @interface Test { @public @@ -445,8 +446,8 @@ @class NSString; @interface NSBundle +(NSBundle *)foo; -@property (class) NSBundle *foo2; -@property NSString *prop; +@property (class, strong) NSBundle *foo2; +@property (strong) NSString *prop; @property(weak) NSString *weakProp; @end @@ -473,5 +474,8 @@ }; void foo1() { - INTFPtrTy tmp = (INTFPtrTy)e1; // expected-error{{cast of 'E' to 'INTFPtrTy' (aka 'INTF *') is disallowed with ARC}} + INTFPtrTy tmp = (INTFPtrTy)e1; +#if __has_feature(objc_arc) +// expected-error@-2{{cast of 'E' to 'INTFPtrTy' (aka 'INTF *') is disallowed with ARC}} +#endif } Index: lib/Sema/SemaPseudoObject.cpp === --- lib/Sema/SemaPseudoObject.cpp +++ lib/Sema/SemaPseudoObject.cpp @@ -841,12 +841,10 @@ result = S.ImpCastExprToType(result.get(), propType, CK_BitCast); } } -if (S.getLangOpts().ObjCAutoRefCount) { - Qualifiers::ObjCLifetime LT = propType.getObjCLifetime(); - if (LT == Qualifiers::OCL_Weak) -if (!S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, RefExpr->getLocation())) - S.getCurFunction()->markSafeWeakUse(RefExpr); -} +if (propType.getObjCLifetime() == Qualifiers::OCL_Weak && +!S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, + RefExpr->getLocation())) + S.getCurFunction()->markSafeWeakUse(RefExpr); } return result; @@ -962,11 +960,11 @@ } ExprResult ObjCPropertyOpBuilder::complete(Expr *SyntacticForm) { - if (S.getLangOpts().ObjCAutoRefCount && isWeakProperty() && + if (isWeakProperty() && !S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, SyntacticForm->getLocStart())) - S.recordUseOfEvaluatedWeak(SyntacticRefExpr, - SyntacticRefExpr->isMessagingGetter()); +S.recordUseOfEvaluatedWeak(SyntacticRefExpr, + SyntacticRefExpr->isMessagingGetter()); return PseudoOpBuilder::complete(SyntacticForm); } Index: lib/Sema/SemaExprObjC.cpp === --- lib/Sema/SemaExprObjC.cpp +++ lib/Sema/SemaExprObjC.cpp @@ -3100,7 +3100,9 @@ // In ARC, check for message sends which are likely to introduce // retain cycles. checkRetainCycles(Result); + } + if (getLangOpts().ObjCWeak) { if (!isImplicit && Method) { if (const ObjCPropertyDecl *Prop = Method->findPropertyDecl()) { bool IsWeak = Index: lib/Sema/SemaExprMember.cpp === --- lib/Sema/SemaExprMember.cpp +++ lib/Sema/SemaExprMember.cpp @@ -1475,7 +1475,7 @@ } } bool warn = true; -if (S.getLangOpts().ObjCAutoRefCount) { +if (S.getLangOpts().ObjCWeak) { Expr *BaseExp = BaseExpr.get()->IgnoreParenImpCasts(); if (UnaryOperator *UO = dyn_cast(BaseExp)) if (UO->getOpcode() == UO_Deref) @@ -1502,11 +1502,9 @@ IV, IV->getUsageType(BaseType), MemberLoc, OpLoc, BaseExpr.get(), IsArrow); -if (S.getLangOpts().ObjCAutoRefCount) { - if (IV->getType().getObjCLifetime() == Qualifiers::OCL_Weak) { -if (!S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, MemberLoc)) - S.recordUseOfEvaluatedWeak(Result); - } +if (IV->getType().getObjCLifetime() == Qualifiers::OCL_Weak) { + if (!S.Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, MemberLoc)) +S.recordUseOfEvaluatedWeak(Result); } return Result; Index: lib/Sema/SemaExpr.cpp === --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -704,8 +704,7 @@ // Loading a __weak object implicitly retains the value, so we need a cleanup to // balance that. - if (getLangOpts().ObjCAutoRefCount && - E->getType().getObjCLifetime() == Qualifiers::OCL_Weak) + if (E->getType().getObjCLifetime() == Qualifiers::OCL_Weak) Cleanup.setExpr
[PATCH] D31005: [Objective-C] Fix "repeated use of weak" warning with -fobjc-weak
bkelley added a comment. Sorry for missing the unnecessary LangOpts checks here. Thanks again for the feedback! https://reviews.llvm.org/D31005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D30760: Record command lines in objects built by clang, Clang part
Not sure, that's why I asked. Is it useful? Is it one of those things we want to remove since it'll be common among all of the TUs that want the text? On Fri, Mar 24, 2017 at 3:43 PM Zhizhou Yang via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Sure I can add some more tests here. > > For -grecord-gcc-switches itself, I think maybe we could keep it in > recording, since it is also one of the options from command line? > > On Fri, Mar 24, 2017 at 2:54 PM, Eric Christopher via Phabricator < > revi...@reviews.llvm.org> wrote: > > echristo added inline comments. > > > > Comment at: test/Driver/debug-options.c:201-202 > // > +// GRECORD: "-dwarf-debug-flags" > +// GRECORD: -### -c -grecord-gcc-switches > +// > > This seems a little light on the testing, would you mind adding some more > interesting lines here? (Also, -grecord-gcc-switches seems like an option > we might want to ignore for this?) > > > https://reviews.llvm.org/D30760 > > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298754 - [ODRHash] Add support for array and decayed types.
Author: rtrieu Date: Fri Mar 24 19:48:52 2017 New Revision: 298754 URL: http://llvm.org/viewvc/llvm-project?rev=298754&view=rev Log: [ODRHash] Add support for array and decayed types. Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td cfe/trunk/lib/AST/ODRHash.cpp cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/test/Modules/odr_hash.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=298754&r1=298753&r2=298754&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Fri Mar 24 19:48:52 2017 @@ -148,7 +148,7 @@ def err_module_odr_violation_mismatch_de "method %4 is %select{not const|const}5|" "method %4 is %select{not inline|inline}5|" "method %4 that has %5 parameter%s5|" - "method %4 with %ordinal5 parameter of type %6|" + "method %4 with %ordinal5 parameter of type %6%select{| decayed from %8}7|" "method %4 with %ordinal5 parameter named %6|" "method %4 with %ordinal5 parameter with %select{no |}6default argument|" "method %4 with %ordinal5 parameter with default argument}3">; @@ -173,7 +173,7 @@ def note_module_odr_violation_mismatch_d "method %2 is %select{not const|const}3|" "method %2 is %select{not inline|inline}3|" "method %2 that has %3 parameter%s3|" - "method %2 with %ordinal3 parameter of type %4|" + "method %2 with %ordinal3 parameter of type %4%select{| decayed from %6}5|" "method %2 with %ordinal3 parameter named %4|" "method %2 with %ordinal3 parameter with %select{no |}4default argument|" "method %2 with %ordinal3 parameter with different default argument}1">; Modified: cfe/trunk/lib/AST/ODRHash.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=298754&r1=298753&r2=298754&view=diff == --- cfe/trunk/lib/AST/ODRHash.cpp (original) +++ cfe/trunk/lib/AST/ODRHash.cpp Fri Mar 24 19:48:52 2017 @@ -330,6 +330,10 @@ public: Hash.AddQualType(T); } + void VisitQualifiers(Qualifiers Quals) { +ID.AddInteger(Quals.getAsOpaqueValue()); + } + void Visit(const Type *T) { ID.AddInteger(T->getTypeClass()); Inherited::Visit(T); @@ -337,6 +341,43 @@ public: void VisitType(const Type *T) {} + void VisitAdjustedType(const AdjustedType *T) { +AddQualType(T->getOriginalType()); +AddQualType(T->getAdjustedType()); +VisitType(T); + } + + void VisitDecayedType(const DecayedType *T) { +AddQualType(T->getDecayedType()); +AddQualType(T->getPointeeType()); +VisitAdjustedType(T); + } + + void VisitArrayType(const ArrayType *T) { +AddQualType(T->getElementType()); +ID.AddInteger(T->getSizeModifier()); +VisitQualifiers(T->getIndexTypeQualifiers()); +VisitType(T); + } + void VisitConstantArrayType(const ConstantArrayType *T) { +T->getSize().Profile(ID); +VisitArrayType(T); + } + + void VisitDependentSizedArrayType(const DependentSizedArrayType *T) { +AddStmt(T->getSizeExpr()); +VisitArrayType(T); + } + + void VisitIncompleteArrayType(const IncompleteArrayType *T) { +VisitArrayType(T); + } + + void VisitVariableArrayType(const VariableArrayType *T) { +AddStmt(T->getSizeExpr()); +VisitArrayType(T); + } + void VisitBuiltinType(const BuiltinType *T) { ID.AddInteger(T->getKind()); VisitType(T); Modified: cfe/trunk/lib/Serialization/ASTReader.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=298754&r1=298753&r2=298754&view=diff == --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Mar 24 19:48:52 2017 @@ -9586,13 +9586,33 @@ void ASTReader::diagnoseOdrViolations() for (unsigned I = 0; I < FirstNumParameters; ++I) { const ParmVarDecl *FirstParam = FirstMethod->getParamDecl(I); const ParmVarDecl *SecondParam = SecondMethod->getParamDecl(I); - if (FirstParam->getType() != SecondParam->getType()) { -ODRDiagError(FirstMethod->getLocation(), - FirstMethod->getSourceRange(), MethodParameterType) -<< FirstName << (I + 1) << FirstParam->getType(); -ODRDiagNote(SecondMethod->getLocation(), -SecondMethod->getSourceRange(), MethodParameterType) -<< SecondName << (I + 1) << SecondParam->getType(); + + QualType FirstParamType = FirstParam->getType(); + QualType SecondParamType = SecondParam->getType(); + if (FirstParamType != SecondParamType) { +if (const DecayedType *ParamDec
[PATCH] D31210: [AMDGPU] Switch address space mapping by triple environment
yaxunl added inline comments. Comment at: lib/Basic/Targets.cpp:2015 -static const unsigned AMDGPUAddrSpaceMap[] = { - 1,// opencl_global - 3,// opencl_local - 2,// opencl_constant - 4,// opencl_generic - 1,// cuda_device - 2,// cuda_constant - 3 // cuda_shared +static LangAS::Map AMDGPUPrivateIsZeroMap = { +1, // opencl_global t-tye wrote: > Is there a reason this is no longer const? sorry, my omission. Will fix it when commit. Comment at: lib/Basic/Targets.cpp:2357 + + AddrSpace AS; }; t-tye wrote: > Could this be const since it is not changed after construction? Yes. will do. https://reviews.llvm.org/D31210 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31363: [libc++] Remove cmake glob for source files
smeenai created this revision. Herald added a subscriber: mgorny. Globbing for source files is problematic because if a source file is added or removed, the configuration won't be run again, and so the build won't pick up on the added or removed file until the next configuration. cmake's help explicitly recommends against the use of `file(GLOB)` to collect a list of source files for the same reason. Switch to an explicit list of files. The glob for headers is left intact, partly because there are a ton of them (courtesy of using `GLOB_RECURSE`), and partly because it shouldn't affect building, since the header dependency tracking is handled separately by cmake. https://reviews.llvm.org/D31363 Files: benchmarks/CMakeLists.txt lib/CMakeLists.txt Index: lib/CMakeLists.txt === --- lib/CMakeLists.txt +++ lib/CMakeLists.txt @@ -2,12 +2,43 @@ # Get sources file(GLOB LIBCXX_SOURCES ../src/*.cpp) +set(LIBCXX_SOURCES + ../src/algorithm.cpp + ../src/any.cpp + ../src/bind.cpp + ../src/chrono.cpp + ../src/condition_variable.cpp + ../src/debug.cpp + ../src/exception.cpp + ../src/future.cpp + ../src/hash.cpp + ../src/ios.cpp + ../src/iostream.cpp + ../src/locale.cpp + ../src/memory.cpp + ../src/mutex.cpp + ../src/new.cpp + ../src/optional.cpp + ../src/random.cpp + ../src/regex.cpp + ../src/shared_mutex.cpp + ../src/stdexcept.cpp + ../src/string.cpp + ../src/strstream.cpp + ../src/system_error.cpp + ../src/thread.cpp + ../src/typeinfo.cpp + ../src/utility.cpp + ../src/valarray.cpp + ../src/variant.cpp) if(WIN32) - file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp) - list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES}) + list(APPEND LIBCXX_SOURCES + ../src/support/win32/locale_win32.cpp + ../src/support/win32/support.cpp) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.cpp) - list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES}) + list(APPEND LIBCXX_SOURCES + ../src/support/solaris/xlocale.cpp) endif() # Add all the headers to the project for IDEs. Index: benchmarks/CMakeLists.txt === --- benchmarks/CMakeLists.txt +++ benchmarks/CMakeLists.txt @@ -141,7 +141,13 @@ #== # Register Benchmark tests #== -file(GLOB BENCHMARK_TESTS "*.bench.cpp") +set(BENCHMARK_TESTS + algorithms.bench.cpp + filesystem.bench.cpp + string.bench.cpp + unordered_set_operations.bench.cpp + util_smartptr.bench.cpp + vector_operations.bench.cpp) foreach(test_path ${BENCHMARK_TESTS}) get_filename_component(test_file "${test_path}" NAME) string(REPLACE ".bench.cpp" "" test_name "${test_file}") Index: lib/CMakeLists.txt === --- lib/CMakeLists.txt +++ lib/CMakeLists.txt @@ -2,12 +2,43 @@ # Get sources file(GLOB LIBCXX_SOURCES ../src/*.cpp) +set(LIBCXX_SOURCES + ../src/algorithm.cpp + ../src/any.cpp + ../src/bind.cpp + ../src/chrono.cpp + ../src/condition_variable.cpp + ../src/debug.cpp + ../src/exception.cpp + ../src/future.cpp + ../src/hash.cpp + ../src/ios.cpp + ../src/iostream.cpp + ../src/locale.cpp + ../src/memory.cpp + ../src/mutex.cpp + ../src/new.cpp + ../src/optional.cpp + ../src/random.cpp + ../src/regex.cpp + ../src/shared_mutex.cpp + ../src/stdexcept.cpp + ../src/string.cpp + ../src/strstream.cpp + ../src/system_error.cpp + ../src/thread.cpp + ../src/typeinfo.cpp + ../src/utility.cpp + ../src/valarray.cpp + ../src/variant.cpp) if(WIN32) - file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp) - list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES}) + list(APPEND LIBCXX_SOURCES + ../src/support/win32/locale_win32.cpp + ../src/support/win32/support.cpp) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.cpp) - list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES}) + list(APPEND LIBCXX_SOURCES + ../src/support/solaris/xlocale.cpp) endif() # Add all the headers to the project for IDEs. Index: benchmarks/CMakeLists.txt === --- benchmarks/CMakeLists.txt +++ benchmarks/CMakeLists.txt @@ -141,7 +141,13 @@ #== # Register Benchmark tests #== -file(GLOB BENCHMARK_TESTS "*.benc
r298759 - Add preprocessor defines for a bare powerpc64le triple/cpu.
Author: echristo Date: Fri Mar 24 21:29:18 2017 New Revision: 298759 URL: http://llvm.org/viewvc/llvm-project?rev=298759&view=rev Log: Add preprocessor defines for a bare powerpc64le triple/cpu. The le triple didn't exist until power8, so use that as a default (this also matches what gcc does). Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/Preprocessor/init.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298759&r1=298758&r2=298759&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar 24 21:29:18 2017 @@ -1250,68 +1250,78 @@ void PPCTargetInfo::getTargetDefines(con Builder.defineMacro("__STRUCT_PARM_ALIGN__", "16"); // CPU identification. - ArchDefineTypes defs = (ArchDefineTypes)llvm::StringSwitch(CPU) -.Case("440", ArchDefineName) -.Case("450", ArchDefineName | ArchDefine440) -.Case("601", ArchDefineName) -.Case("602", ArchDefineName | ArchDefinePpcgr) -.Case("603", ArchDefineName | ArchDefinePpcgr) -.Case("603e", ArchDefineName | ArchDefine603 | ArchDefinePpcgr) -.Case("603ev", ArchDefineName | ArchDefine603 | ArchDefinePpcgr) -.Case("604", ArchDefineName | ArchDefinePpcgr) -.Case("604e", ArchDefineName | ArchDefine604 | ArchDefinePpcgr) -.Case("620", ArchDefineName | ArchDefinePpcgr) -.Case("630", ArchDefineName | ArchDefinePpcgr) -.Case("7400", ArchDefineName | ArchDefinePpcgr) -.Case("7450", ArchDefineName | ArchDefinePpcgr) -.Case("750", ArchDefineName | ArchDefinePpcgr) -.Case("970", ArchDefineName | ArchDefinePwr4 | ArchDefinePpcgr - | ArchDefinePpcsq) -.Case("a2",ArchDefineA2) -.Case("a2q", ArchDefineName | ArchDefineA2 | ArchDefineA2q) -.Case("pwr3", ArchDefinePpcgr) -.Case("pwr4", ArchDefineName | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("pwr5", ArchDefineName | ArchDefinePwr4 | ArchDefinePpcgr - | ArchDefinePpcsq) -.Case("pwr5x", ArchDefineName | ArchDefinePwr5 | ArchDefinePwr4 - | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("pwr6", ArchDefineName | ArchDefinePwr5x | ArchDefinePwr5 - | ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("pwr6x", ArchDefineName | ArchDefinePwr6 | ArchDefinePwr5x - | ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr - | ArchDefinePpcsq) -.Case("pwr7", ArchDefineName | ArchDefinePwr6x | ArchDefinePwr6 - | ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 - | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("pwr8", ArchDefineName | ArchDefinePwr7 | ArchDefinePwr6x - | ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 - | ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("pwr9", ArchDefineName | ArchDefinePwr8 | ArchDefinePwr7 - | ArchDefinePwr6x | ArchDefinePwr6 | ArchDefinePwr5x - | ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr - | ArchDefinePpcsq) -.Case("power3", ArchDefinePpcgr) -.Case("power4", ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("power5", ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr - | ArchDefinePpcsq) -.Case("power5x", ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 - | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("power6", ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 - | ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("power6x", ArchDefinePwr6x | ArchDefinePwr6 | ArchDefinePwr5x - | ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr - | ArchDefinePpcsq) -.Case("power7", ArchDefinePwr7 | ArchDefinePwr6x | ArchDefinePwr6 - | ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 - | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("power8", ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6x - | ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 - | ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq) -.Case("power9", ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 - | ArchDefinePwr6x | ArchDefinePwr6 | ArchDefinePwr5x - | ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr - | ArchDefinePpcsq) -.Default(ArchDefineNone); + ArchDefineTypes defs = + (ArchDefineTypes)llvm::StringSwitch(CPU) + .Case("440", ArchDefineName) + .Case("450", ArchDefineName | ArchDefine440) + .Case("601", ArchDefineName) + .Case("602", ArchDefineName | ArchDefinePpcgr) +
r298761 - __BIGGEST_ALIGNMENT__ has always been 16 on all power platforms rather
Author: echristo Date: Fri Mar 24 21:55:21 2017 New Revision: 298761 URL: http://llvm.org/viewvc/llvm-project?rev=298761&view=rev Log: __BIGGEST_ALIGNMENT__ has always been 16 on all power platforms rather than the default of 8 in clang, fix and update tests accordingly. Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/Preprocessor/init.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298761&r1=298760&r2=298761&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar 24 21:55:21 2017 @@ -907,6 +907,7 @@ public: : TargetInfo(Triple), HasAltivec(false), HasVSX(false), HasP8Vector(false), HasP8Crypto(false), HasDirectMove(false), HasQPX(false), HasHTM(false), HasBPERMD(false), HasExtDiv(false), HasP9Vector(false) { +SuitableAlign = 128; SimdDefaultAlign = 128; LongDoubleWidth = LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble(); @@ -1750,7 +1751,6 @@ public: BoolWidth = BoolAlign = 32; //XXX support -mone-byte-bool? PtrDiffType = SignedInt; // for http://llvm.org/bugs/show_bug.cgi?id=15726 LongLongAlign = 32; -SuitableAlign = 128; resetDataLayout("E-m:o-p:32:32-f64:32:64-n32"); } BuiltinVaListKind getBuiltinVaListKind() const override { @@ -1763,7 +1763,6 @@ public: DarwinPPC64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : DarwinTargetInfo(Triple, Opts) { HasAlignMac68kSupport = true; -SuitableAlign = 128; resetDataLayout("E-m:o-i64:64-n32:64"); } }; Modified: cfe/trunk/test/Preprocessor/init.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=298761&r1=298760&r2=298761&view=diff == --- cfe/trunk/test/Preprocessor/init.c (original) +++ cfe/trunk/test/Preprocessor/init.c Fri Mar 24 21:55:21 2017 @@ -5324,7 +5324,7 @@ // PPC603E:#define _ARCH_PPCGR 1 // PPC603E:#define _BIG_ENDIAN 1 // PPC603E-NOT:#define _LP64 -// PPC603E:#define __BIGGEST_ALIGNMENT__ 8 +// PPC603E:#define __BIGGEST_ALIGNMENT__ 16 // PPC603E:#define __BIG_ENDIAN__ 1 // PPC603E:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ // PPC603E:#define __CHAR16_TYPE__ unsigned short @@ -5524,7 +5524,7 @@ // PPC64:#define _ARCH_PWR7 1 // PPC64:#define _BIG_ENDIAN 1 // PPC64:#define _LP64 1 -// PPC64:#define __BIGGEST_ALIGNMENT__ 8 +// PPC64:#define __BIGGEST_ALIGNMENT__ 16 // PPC64:#define __BIG_ENDIAN__ 1 // PPC64:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ // PPC64:#define __CHAR16_TYPE__ unsigned short @@ -5728,7 +5728,7 @@ // PPC64LE:#define _CALL_ELF 2 // PPC64LE:#define _LITTLE_ENDIAN 1 // PPC64LE:#define _LP64 1 -// PPC64LE:#define __BIGGEST_ALIGNMENT__ 8 +// PPC64LE:#define __BIGGEST_ALIGNMENT__ 16 // PPC64LE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ // PPC64LE:#define __CHAR16_TYPE__ unsigned short // PPC64LE:#define __CHAR32_TYPE__ unsigned int @@ -6145,7 +6145,7 @@ // PPC64-LINUX:#define _ARCH_PPC64 1 // PPC64-LINUX:#define _BIG_ENDIAN 1 // PPC64-LINUX:#define _LP64 1 -// PPC64-LINUX:#define __BIGGEST_ALIGNMENT__ 8 +// PPC64-LINUX:#define __BIGGEST_ALIGNMENT__ 16 // PPC64-LINUX:#define __BIG_ENDIAN__ 1 // PPC64-LINUX:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ // PPC64-LINUX:#define __CHAR16_TYPE__ unsigned short @@ -6351,7 +6351,7 @@ // PPC:#define _ARCH_PPC 1 // PPC:#define _BIG_ENDIAN 1 // PPC-NOT:#define _LP64 -// PPC:#define __BIGGEST_ALIGNMENT__ 8 +// PPC:#define __BIGGEST_ALIGNMENT__ 16 // PPC:#define __BIG_ENDIAN__ 1 // PPC:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ // PPC:#define __CHAR16_TYPE__ unsigned short @@ -6542,7 +6542,7 @@ // PPC-LINUX:#define _ARCH_PPC 1 // PPC-LINUX:#define _BIG_ENDIAN 1 // PPC-LINUX-NOT:#define _LP64 -// PPC-LINUX:#define __BIGGEST_ALIGNMENT__ 8 +// PPC-LINUX:#define __BIGGEST_ALIGNMENT__ 16 // PPC-LINUX:#define __BIG_ENDIAN__ 1 // PPC-LINUX:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ // PPC-LINUX:#define __CHAR16_TYPE__ unsigned short ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r298762 - [libc++] Update package version
Author: smeenai Date: Fri Mar 24 22:12:37 2017 New Revision: 298762 URL: http://llvm.org/viewvc/llvm-project?rev=298762&view=rev Log: [libc++] Update package version Make it consistent with the rest of LLVM. Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=298762&r1=298761&r2=298762&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Fri Mar 24 22:12:37 2017 @@ -23,7 +23,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR project(libcxx CXX C) set(PACKAGE_NAME libcxx) - set(PACKAGE_VERSION 4.0.0svn) + set(PACKAGE_VERSION 5.0.0svn) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r298763 - [libc++] Fix capitalization in comment
Author: smeenai Date: Fri Mar 24 22:22:35 2017 New Revision: 298763 URL: http://llvm.org/viewvc/llvm-project?rev=298763&view=rev Log: [libc++] Fix capitalization in comment Fix a stray capital letter in the middle of a sentence. No functional change. Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=298763&r1=298762&r2=298763&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Fri Mar 24 22:22:35 2017 @@ -142,7 +142,7 @@ option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY # Generate and install a linker script inplace of libc++.so. The linker script # will link libc++ to the correct ABI library. This option is on by default -# On UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' +# on UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' # is on. This option is also disabled when the ABI library is not specified # or is specified to be "none". set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r298764 - [libc++] Fix word transposition in comment
Author: smeenai Date: Fri Mar 24 22:29:51 2017 New Revision: 298764 URL: http://llvm.org/viewvc/llvm-project?rev=298764&view=rev Log: [libc++] Fix word transposition in comment "to due" -> "due to". No functional change. Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=298764&r1=298763&r2=298764&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Fri Mar 24 22:29:51 2017 @@ -161,7 +161,7 @@ option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT set(ENABLE_NEW_DELETE_DEFAULT ON) if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS) # FIXME: This option should default to off. Unfortunatly GCC 4.9 fails to link -# programs to due undefined references to new/delete in libc++abi so to work +# programs due to undefined references to new/delete in libc++abi so to work # around this libc++abi currently defaults LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS # to ON. Once the GCC bug has been worked around this option should be changed # back to OFF. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298765 - Add the _CALL_LINUX preprocessor define for ppc linux platforms.
Author: echristo Date: Fri Mar 24 22:33:59 2017 New Revision: 298765 URL: http://llvm.org/viewvc/llvm-project?rev=298765&view=rev Log: Add the _CALL_LINUX preprocessor define for ppc linux platforms. This typically is only for a new enough linker (bfd >= 2.16.2 or gold), but our ppc suppport post-dates this and it should work on all linux platforms. It is guaranteed to work on all elfv2 platforms. Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/Preprocessor/init.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298765&r1=298764&r2=298765&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar 24 22:33:59 2017 @@ -1237,6 +1237,12 @@ void PPCTargetInfo::getTargetDefines(con if (ABI == "elfv2") Builder.defineMacro("_CALL_ELF", "2"); + // This typically is only for a new enough linker (bfd >= 2.16.2 or gold), but + // our suppport post-dates this and it should work on all linux platforms. It + // is guaranteed to work on all elfv2 platforms. + if (getTriple().getOS() == llvm::Triple::Linux) +Builder.defineMacro("_CALL_LINUX", "1"); + // Subtarget options. Builder.defineMacro("__NATURAL_ALIGNMENT__"); Builder.defineMacro("__REGISTER_PREFIX__", ""); Modified: cfe/trunk/test/Preprocessor/init.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=298765&r1=298764&r2=298765&view=diff == --- cfe/trunk/test/Preprocessor/init.c (original) +++ cfe/trunk/test/Preprocessor/init.c Fri Mar 24 22:33:59 2017 @@ -6144,6 +6144,7 @@ // PPC64-LINUX:#define _ARCH_PPC 1 // PPC64-LINUX:#define _ARCH_PPC64 1 // PPC64-LINUX:#define _BIG_ENDIAN 1 +// PPC64-LINUX:#define _CALL_LINUX 1 // PPC64-LINUX:#define _LP64 1 // PPC64-LINUX:#define __BIGGEST_ALIGNMENT__ 16 // PPC64-LINUX:#define __BIG_ENDIAN__ 1 @@ -6346,6 +6347,11 @@ // PPC64-ELFv1:#define _CALL_ELF 1 // PPC64-ELFv2:#define _CALL_ELF 2 // +// Most of this is encompassed in other places. +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64le-unknown-linux-gnu -target-abi elfv2 < /dev/null | FileCheck -match-full-lines -check-prefix PPC64LE-LINUX %s +// +// PPC64LE-LINUX:#define _CALL_LINUX 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-none-none -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC %s // // PPC:#define _ARCH_PPC 1 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r298766 - [libc++] Fix some comment typos
Author: smeenai Date: Fri Mar 24 22:42:20 2017 New Revision: 298766 URL: http://llvm.org/viewvc/llvm-project?rev=298766&view=rev Log: [libc++] Fix some comment typos Remove a stray letter, add a missing letter. No functional change. Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=298766&r1=298765&r2=298766&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Fri Mar 24 22:42:20 2017 @@ -414,9 +414,9 @@ remove_flags(-stdlib=libc++ -stdlib=libs # non-debug DLLs remove_flags("/D_DEBUG" "/MTd" "/MDd" "/MT" "/Md") -# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEqDANTIC. +# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC. # Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors -# so they don't get transformed into -Wno and -errors respectivly. +# so they don't get transformed into -Wno and -errors respectively. remove_flags(-Wno-pedantic -pedantic-errors -pedantic) # Required flags == ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298767 - [AMDGPU] Switch address space mapping by triple environment amdgiz
Author: yaxunl Date: Fri Mar 24 22:46:25 2017 New Revision: 298767 URL: http://llvm.org/viewvc/llvm-project?rev=298767&view=rev Log: [AMDGPU] Switch address space mapping by triple environment amdgiz For target environment amdgiz and amdgizcl (giz means Generic Is Zero), AMDGPU will use new address space mapping where generic address space is 0 and private address space is 5. The data layout is also changed correspondingly. Differential Revision: https://reviews.llvm.org/D31210 Added: cfe/trunk/test/CodeGenOpenCL/amdgpu-env-amdgiz.cl Modified: cfe/trunk/lib/Basic/Targets.cpp Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298767&r1=298766&r2=298767&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar 24 22:46:25 2017 @@ -2027,14 +2027,23 @@ ArrayRef NVPTXTargetInfo:: return llvm::makeArrayRef(GCCRegNames); } -static const unsigned AMDGPUAddrSpaceMap[] = { - 1,// opencl_global - 3,// opencl_local - 2,// opencl_constant - 4,// opencl_generic - 1,// cuda_device - 2,// cuda_constant - 3 // cuda_shared +static const LangAS::Map AMDGPUPrivateIsZeroMap = { +1, // opencl_global +3, // opencl_local +2, // opencl_constant +4, // opencl_generic +1, // cuda_device +2, // cuda_constant +3 // cuda_shared +}; +static const LangAS::Map AMDGPUGenericIsZeroMap = { +1, // opencl_global +3, // opencl_local +4, // opencl_constant +0, // opencl_generic +1, // cuda_device +4, // cuda_constant +3 // cuda_shared }; // If you edit the description strings, make sure you update @@ -2044,15 +2053,39 @@ static const char *const DataLayoutStrin "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; -static const char *const DataLayoutStringSI = +static const char *const DataLayoutStringSIPrivateIsZero = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; +static const char *const DataLayoutStringSIGenericIsZero = + "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" + "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" + "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; + class AMDGPUTargetInfo final : public TargetInfo { static const Builtin::Info BuiltinInfo[]; static const char * const GCCRegNames[]; + struct AddrSpace { +unsigned Generic, Global, Local, Constant, Private; +AddrSpace(bool IsGenericZero_ = false){ + if (IsGenericZero_) { +Generic = 0; +Global= 1; +Local = 3; +Constant = 4; +Private = 5; + } else { +Generic = 4; +Global= 1; +Local = 3; +Constant = 2; +Private = 0; + } +} + }; + /// \brief The GPU profiles supported by the AMDGPU target. enum GPUKind { GK_NONE, @@ -2079,6 +2112,10 @@ class AMDGPUTargetInfo final : public Ta return TT.getArch() == llvm::Triple::amdgcn; } + static bool isGenericZero(const llvm::Triple &TT) { +return TT.getEnvironmentName() == "amdgiz" || +TT.getEnvironmentName() == "amdgizcl"; + } public: AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : TargetInfo(Triple) , @@ -2086,17 +2123,21 @@ public: hasFP64(false), hasFMAF(false), hasLDEXPF(false), - hasFullSpeedFP32Denorms(false){ + hasFullSpeedFP32Denorms(false), + AS(isGenericZero(Triple)){ if (getTriple().getArch() == llvm::Triple::amdgcn) { hasFP64 = true; hasFMAF = true; hasLDEXPF = true; } - +auto IsGenericZero = isGenericZero(Triple); resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn ? -DataLayoutStringSI : DataLayoutStringR600); +(IsGenericZero ? DataLayoutStringSIGenericIsZero : +DataLayoutStringSIPrivateIsZero) +: DataLayoutStringR600); -AddrSpaceMap = &AMDGPUAddrSpaceMap; +AddrSpaceMap = IsGenericZero ? &AMDGPUGenericIsZeroMap : +&AMDGPUPrivateIsZeroMap; UseAddrSpaceMapMangling = true; } @@ -2104,14 +2145,10 @@ public: if (GPU <= GK_CAYMAN) return 32; -switch(AddrSpace) { - default: -return 64; - case 0: - case 3: - case 5: -return 32; +if (AddrSpace == AS.Private || AddrSpace == AS.Local) { + return 32; } +return 64; } uint64_t getMaxPointerWidth() const override { @@ -2304,12 +2341,13 @@ public: /// DWARF. Optional getDWARFAddressSpace( unsigned AddressSpace) const override { -switch (AddressSpace) { -case 0:
[PATCH] D31210: [AMDGPU] Switch address space mapping by triple environment
This revision was automatically updated to reflect the committed changes. Closed by commit rL298767: [AMDGPU] Switch address space mapping by triple environment amdgiz (authored by yaxunl). Changed prior to commit: https://reviews.llvm.org/D31210?vs=92997&id=93031#toc Repository: rL LLVM https://reviews.llvm.org/D31210 Files: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/CodeGenOpenCL/amdgpu-env-amdgiz.cl Index: cfe/trunk/lib/Basic/Targets.cpp === --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -2027,14 +2027,23 @@ return llvm::makeArrayRef(GCCRegNames); } -static const unsigned AMDGPUAddrSpaceMap[] = { - 1,// opencl_global - 3,// opencl_local - 2,// opencl_constant - 4,// opencl_generic - 1,// cuda_device - 2,// cuda_constant - 3 // cuda_shared +static const LangAS::Map AMDGPUPrivateIsZeroMap = { +1, // opencl_global +3, // opencl_local +2, // opencl_constant +4, // opencl_generic +1, // cuda_device +2, // cuda_constant +3 // cuda_shared +}; +static const LangAS::Map AMDGPUGenericIsZeroMap = { +1, // opencl_global +3, // opencl_local +4, // opencl_constant +0, // opencl_generic +1, // cuda_device +4, // cuda_constant +3 // cuda_shared }; // If you edit the description strings, make sure you update @@ -2044,15 +2053,39 @@ "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; -static const char *const DataLayoutStringSI = +static const char *const DataLayoutStringSIPrivateIsZero = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; +static const char *const DataLayoutStringSIGenericIsZero = + "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" + "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" + "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; + class AMDGPUTargetInfo final : public TargetInfo { static const Builtin::Info BuiltinInfo[]; static const char * const GCCRegNames[]; + struct AddrSpace { +unsigned Generic, Global, Local, Constant, Private; +AddrSpace(bool IsGenericZero_ = false){ + if (IsGenericZero_) { +Generic = 0; +Global= 1; +Local = 3; +Constant = 4; +Private = 5; + } else { +Generic = 4; +Global= 1; +Local = 3; +Constant = 2; +Private = 0; + } +} + }; + /// \brief The GPU profiles supported by the AMDGPU target. enum GPUKind { GK_NONE, @@ -2079,39 +2112,43 @@ return TT.getArch() == llvm::Triple::amdgcn; } + static bool isGenericZero(const llvm::Triple &TT) { +return TT.getEnvironmentName() == "amdgiz" || +TT.getEnvironmentName() == "amdgizcl"; + } public: AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : TargetInfo(Triple) , GPU(isAMDGCN(Triple) ? GK_GFX6 : GK_R600), hasFP64(false), hasFMAF(false), hasLDEXPF(false), - hasFullSpeedFP32Denorms(false){ + hasFullSpeedFP32Denorms(false), + AS(isGenericZero(Triple)){ if (getTriple().getArch() == llvm::Triple::amdgcn) { hasFP64 = true; hasFMAF = true; hasLDEXPF = true; } - +auto IsGenericZero = isGenericZero(Triple); resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn ? -DataLayoutStringSI : DataLayoutStringR600); +(IsGenericZero ? DataLayoutStringSIGenericIsZero : +DataLayoutStringSIPrivateIsZero) +: DataLayoutStringR600); -AddrSpaceMap = &AMDGPUAddrSpaceMap; +AddrSpaceMap = IsGenericZero ? &AMDGPUGenericIsZeroMap : +&AMDGPUPrivateIsZeroMap; UseAddrSpaceMapMangling = true; } uint64_t getPointerWidthV(unsigned AddrSpace) const override { if (GPU <= GK_CAYMAN) return 32; -switch(AddrSpace) { - default: -return 64; - case 0: - case 3: - case 5: -return 32; +if (AddrSpace == AS.Private || AddrSpace == AS.Local) { + return 32; } +return 64; } uint64_t getMaxPointerWidth() const override { @@ -2304,12 +2341,13 @@ /// DWARF. Optional getDWARFAddressSpace( unsigned AddressSpace) const override { -switch (AddressSpace) { -case 0: // LLVM Private. - return 1; // DWARF Private. -case 3: // LLVM Local. - return 2; // DWARF Local. -default: +const unsigned DWARF_Private = 1; +const unsigned DWARF_Local = 2; +if (AddressSpace == AS.Private) { + return DWARF_Private; +} else if (AddressSpace == AS.Local) { + return DWARF_Local; +} else { return None; } } @@ -2330,6
r298769 - Define __HAVE_BSWAP__ on ppc to match gcc since we support both builtins as well.
Author: echristo Date: Sat Mar 25 00:40:13 2017 New Revision: 298769 URL: http://llvm.org/viewvc/llvm-project?rev=298769&view=rev Log: Define __HAVE_BSWAP__ on ppc to match gcc since we support both builtins as well. Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/Preprocessor/init.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298769&r1=298768&r2=298769&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Sat Mar 25 00:40:13 2017 @@ -1395,6 +1395,9 @@ void PPCTargetInfo::getTargetDefines(con if (PointerWidth == 64) Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8"); + // We have support for the bswap intrinsics so we can define this. + Builder.defineMacro("__HAVE_BSWAP__", "1"); + // FIXME: The following are not yet generated here by Clang, but are //generated by GCC: // @@ -1407,7 +1410,6 @@ void PPCTargetInfo::getTargetDefines(con // __RSQRTEF__ // _SOFT_DOUBLE_ // __NO_LWSYNC__ - // __HAVE_BSWAP__ // __LONGDOUBLE128 // __CMODEL_MEDIUM__ // __CMODEL_LARGE__ Modified: cfe/trunk/test/Preprocessor/init.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=298769&r1=298768&r2=298769&view=diff == --- cfe/trunk/test/Preprocessor/init.c (original) +++ cfe/trunk/test/Preprocessor/init.c Sat Mar 25 00:40:13 2017 @@ -5560,6 +5560,7 @@ // PPC64:#define __FLT_MIN_EXP__ (-125) // PPC64:#define __FLT_MIN__ 1.17549435e-38F // PPC64:#define __FLT_RADIX__ 2 +// PPC64:#define __HAVE_BSWAP__ 1 // PPC64:#define __INT16_C_SUFFIX__ // PPC64:#define __INT16_FMTd__ "hd" // PPC64:#define __INT16_FMTi__ "hi" @@ -5763,6 +5764,7 @@ // PPC64LE:#define __FLT_MIN_EXP__ (-125) // PPC64LE:#define __FLT_MIN__ 1.17549435e-38F // PPC64LE:#define __FLT_RADIX__ 2 +// PPC64LE:#define __HAVE_BSWAP__ 1 // PPC64LE:#define __INT16_C_SUFFIX__ // PPC64LE:#define __INT16_FMTd__ "hd" // PPC64LE:#define __INT16_FMTi__ "hi" @@ -6182,6 +6184,7 @@ // PPC64-LINUX:#define __FLT_MIN_EXP__ (-125) // PPC64-LINUX:#define __FLT_MIN__ 1.17549435e-38F // PPC64-LINUX:#define __FLT_RADIX__ 2 +// PPC64-LINUX:#define __HAVE_BSWAP__ 1 // PPC64-LINUX:#define __INT16_C_SUFFIX__ // PPC64-LINUX:#define __INT16_FMTd__ "hd" // PPC64-LINUX:#define __INT16_FMTi__ "hi" @@ -6393,6 +6396,7 @@ // PPC:#define __FLT_MIN_EXP__ (-125) // PPC:#define __FLT_MIN__ 1.17549435e-38F // PPC:#define __FLT_RADIX__ 2 +// PPC:#define __HAVE_BSWAP__ 1 // PPC:#define __INT16_C_SUFFIX__ // PPC:#define __INT16_FMTd__ "hd" // PPC:#define __INT16_FMTi__ "hi" @@ -6584,6 +6588,7 @@ // PPC-LINUX:#define __FLT_MIN_EXP__ (-125) // PPC-LINUX:#define __FLT_MIN__ 1.17549435e-38F // PPC-LINUX:#define __FLT_RADIX__ 2 +// PPC-LINUX:#define __HAVE_BSWAP__ 1 // PPC-LINUX:#define __INT16_C_SUFFIX__ // PPC-LINUX:#define __INT16_FMTd__ "hd" // PPC-LINUX:#define __INT16_FMTi__ "hi" @@ -6775,6 +6780,7 @@ // PPC-DARWIN:#define __FLT_MIN_EXP__ (-125) // PPC-DARWIN:#define __FLT_MIN__ 1.17549435e-38F // PPC-DARWIN:#define __FLT_RADIX__ 2 +// PPC-DARWIN:#define __HAVE_BSWAP__ 1 // PPC-DARWIN:#define __INT16_C_SUFFIX__ // PPC-DARWIN:#define __INT16_FMTd__ "hd" // PPC-DARWIN:#define __INT16_FMTi__ "hi" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r298767 - [AMDGPU] Switch address space mapping by triple environment amdgiz
On Fri, Mar 24, 2017 at 8:58 PM Yaxun Liu via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: yaxunl > Date: Fri Mar 24 22:46:25 2017 > New Revision: 298767 > > URL: http://llvm.org/viewvc/llvm-project?rev=298767&view=rev > Log: > [AMDGPU] Switch address space mapping by triple environment amdgiz > > For target environment amdgiz and amdgizcl (giz means Generic Is Zero), > AMDGPU will use new address space mapping where generic address space is 0 > and private address space is 5. The data layout is also changed > correspondingly. > > Differential Revision: https://reviews.llvm.org/D31210 > > Added: > cfe/trunk/test/CodeGenOpenCL/amdgpu-env-amdgiz.cl > Modified: > cfe/trunk/lib/Basic/Targets.cpp > > Modified: cfe/trunk/lib/Basic/Targets.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298767&r1=298766&r2=298767&view=diff > > == > --- cfe/trunk/lib/Basic/Targets.cpp (original) > +++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar 24 22:46:25 2017 > @@ -2027,14 +2027,23 @@ ArrayRef NVPTXTargetInfo:: >return llvm::makeArrayRef(GCCRegNames); > } > > -static const unsigned AMDGPUAddrSpaceMap[] = { > - 1,// opencl_global > - 3,// opencl_local > - 2,// opencl_constant > - 4,// opencl_generic > - 1,// cuda_device > - 2,// cuda_constant > - 3 // cuda_shared > +static const LangAS::Map AMDGPUPrivateIsZeroMap = { > +1, // opencl_global > +3, // opencl_local > +2, // opencl_constant > +4, // opencl_generic > +1, // cuda_device > +2, // cuda_constant > +3 // cuda_shared > +}; > +static const LangAS::Map AMDGPUGenericIsZeroMap = { > +1, // opencl_global > +3, // opencl_local > +4, // opencl_constant > +0, // opencl_generic > +1, // cuda_device > +4, // cuda_constant > +3 // cuda_shared > }; > > // If you edit the description strings, make sure you update > @@ -2044,15 +2053,39 @@ static const char *const DataLayoutStrin >"e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" >"-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; > > -static const char *const DataLayoutStringSI = > +static const char *const DataLayoutStringSIPrivateIsZero = >"e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" >"-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" >"-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; > > +static const char *const DataLayoutStringSIGenericIsZero = > + "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32" > + "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" > + "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; > + > class AMDGPUTargetInfo final : public TargetInfo { >static const Builtin::Info BuiltinInfo[]; >static const char * const GCCRegNames[]; > > + struct AddrSpace { > +unsigned Generic, Global, Local, Constant, Private; > +AddrSpace(bool IsGenericZero_ = false){ > + if (IsGenericZero_) { > +Generic = 0; > +Global= 1; > +Local = 3; > +Constant = 4; > +Private = 5; > + } else { > +Generic = 4; > +Global= 1; > +Local = 3; > +Constant = 2; > +Private = 0; > + } > +} > + }; > + >/// \brief The GPU profiles supported by the AMDGPU target. >enum GPUKind { > GK_NONE, > @@ -2079,6 +2112,10 @@ class AMDGPUTargetInfo final : public Ta > return TT.getArch() == llvm::Triple::amdgcn; >} > > + static bool isGenericZero(const llvm::Triple &TT) { > +return TT.getEnvironmentName() == "amdgiz" || > +TT.getEnvironmentName() == "amdgizcl"; > + } > public: >AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) > : TargetInfo(Triple) , > @@ -2086,17 +2123,21 @@ public: >hasFP64(false), >hasFMAF(false), >hasLDEXPF(false), > - hasFullSpeedFP32Denorms(false){ > + hasFullSpeedFP32Denorms(false), > + AS(isGenericZero(Triple)){ > if (getTriple().getArch() == llvm::Triple::amdgcn) { >hasFP64 = true; >hasFMAF = true; >hasLDEXPF = true; > } > - > +auto IsGenericZero = isGenericZero(Triple); > resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn ? > -DataLayoutStringSI : DataLayoutStringR600); > +(IsGenericZero ? DataLayoutStringSIGenericIsZero : > +DataLayoutStringSIPrivateIsZero) > +: DataLayoutStringR600); > > -AddrSpaceMap = &AMDGPUAddrSpaceMap; > +AddrSpaceMap = IsGenericZero ? &AMDGPUGenericIsZeroMap : > +&AMDGPUPrivateIsZeroMap; > UseAddrSpaceMapMangling = true; >} > > @@ -2104,14 +2145,10 @@ public: > if (GPU <= GK_CAYMAN) >return 32; > > -switch(AddrSpace) { > - default: > -return 64; > - case 0: > - case 3:
r298770 - Add the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles.
Author: echristo Date: Sat Mar 25 01:37:23 2017 New Revision: 298770 URL: http://llvm.org/viewvc/llvm-project?rev=298770&view=rev Log: Add the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles. Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/Preprocessor/init.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298770&r1=298769&r2=298770&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Sat Mar 25 01:37:23 2017 @@ -1248,8 +1248,10 @@ void PPCTargetInfo::getTargetDefines(con Builder.defineMacro("__REGISTER_PREFIX__", ""); // FIXME: Should be controlled by command line option. - if (LongDoubleWidth == 128) + if (LongDoubleWidth == 128) { Builder.defineMacro("__LONG_DOUBLE_128__"); +Builder.defineMacro("__LONGDOUBLE128"); + } // Define this for elfv2 (64-bit only) or 64-bit darwin. if (ABI == "elfv2" || Modified: cfe/trunk/test/Preprocessor/init.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=298770&r1=298769&r2=298770&view=diff == --- cfe/trunk/test/Preprocessor/init.c (original) +++ cfe/trunk/test/Preprocessor/init.c Sat Mar 25 01:37:23 2017 @@ -5436,6 +5436,7 @@ // PPC603E:#define __LDBL_MIN_10_EXP__ (-291) // PPC603E:#define __LDBL_MIN_EXP__ (-968) // PPC603E:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC603E:#define __LONGDOUBLE128 1 // PPC603E:#define __LONG_DOUBLE_128__ 1 // PPC603E:#define __LONG_LONG_MAX__ 9223372036854775807LL // PPC603E:#define __LONG_MAX__ 2147483647L @@ -5638,6 +5639,7 @@ // PPC64:#define __LDBL_MIN_10_EXP__ (-291) // PPC64:#define __LDBL_MIN_EXP__ (-968) // PPC64:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC64:#define __LONGDOUBLE128 1 // PPC64:#define __LONG_DOUBLE_128__ 1 // PPC64:#define __LONG_LONG_MAX__ 9223372036854775807LL // PPC64:#define __LONG_MAX__ 9223372036854775807L @@ -5843,6 +5845,7 @@ // PPC64LE:#define __LDBL_MIN_EXP__ (-968) // PPC64LE:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L // PPC64LE:#define __LITTLE_ENDIAN__ 1 +// PPC64LE:#define __LONGDOUBLE128 1 // PPC64LE:#define __LONG_DOUBLE_128__ 1 // PPC64LE:#define __LONG_LONG_MAX__ 9223372036854775807LL // PPC64LE:#define __LONG_MAX__ 9223372036854775807L @@ -6262,6 +6265,7 @@ // PPC64-LINUX:#define __LDBL_MIN_10_EXP__ (-291) // PPC64-LINUX:#define __LDBL_MIN_EXP__ (-968) // PPC64-LINUX:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC64-LINUX:#define __LONGDOUBLE128 1 // PPC64-LINUX:#define __LONG_DOUBLE_128__ 1 // PPC64-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL // PPC64-LINUX:#define __LONG_MAX__ 9223372036854775807L @@ -6474,6 +6478,7 @@ // PPC:#define __LDBL_MIN_10_EXP__ (-291) // PPC:#define __LDBL_MIN_EXP__ (-968) // PPC:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC:#define __LONGDOUBLE128 1 // PPC:#define __LONG_DOUBLE_128__ 1 // PPC:#define __LONG_LONG_MAX__ 9223372036854775807LL // PPC:#define __LONG_MAX__ 2147483647L @@ -,6 +6671,7 @@ // PPC-LINUX:#define __LDBL_MIN_10_EXP__ (-291) // PPC-LINUX:#define __LDBL_MIN_EXP__ (-968) // PPC-LINUX:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC-LINUX:#define __LONGDOUBLE128 1 // PPC-LINUX:#define __LONG_DOUBLE_128__ 1 // PPC-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL // PPC-LINUX:#define __LONG_MAX__ 2147483647L @@ -6858,6 +6864,7 @@ // PPC-DARWIN:#define __LDBL_MIN_10_EXP__ (-291) // PPC-DARWIN:#define __LDBL_MIN_EXP__ (-968) // PPC-DARWIN:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC-DARWIN:#define __LONGDOUBLE128 1 // PPC-DARWIN:#define __LONG_DOUBLE_128__ 1 // PPC-DARWIN:#define __LONG_LONG_MAX__ 9223372036854775807LL // PPC-DARWIN:#define __LONG_MAX__ 2147483647L ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r298771 - Update the comment on not yet generated preprocessor defines to remove __LONGDOUBLE128.
Author: echristo Date: Sat Mar 25 01:38:57 2017 New Revision: 298771 URL: http://llvm.org/viewvc/llvm-project?rev=298771&view=rev Log: Update the comment on not yet generated preprocessor defines to remove __LONGDOUBLE128. Modified: cfe/trunk/lib/Basic/Targets.cpp Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298771&r1=298770&r2=298771&view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Sat Mar 25 01:38:57 2017 @@ -1412,7 +1412,6 @@ void PPCTargetInfo::getTargetDefines(con // __RSQRTEF__ // _SOFT_DOUBLE_ // __NO_LWSYNC__ - // __LONGDOUBLE128 // __CMODEL_MEDIUM__ // __CMODEL_LARGE__ // _CALL_SYSV ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits