r366645 - [Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer'

2019-07-20 Thread Yuanfang Chen via cfe-commits
Author: yuanfang
Date: Sat Jul 20 15:50:50 2019
New Revision: 366645

URL: http://llvm.org/viewvc/llvm-project?rev=366645=rev
Log:
[Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer'
with '-mframe-pointer'

After D56351 and D64294, frame pointer handling is migrated to tri-state
(all, non-leaf, none) in clang driver and on the function attribute.
This patch makes the frame pointer handling cc1 option tri-state.

Reviewers: chandlerc, rnk, t.p.northover, MaskRay

Reviewed By: MaskRay

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

Modified:
cfe/trunk/include/clang/Basic/CodeGenOptions.def
cfe/trunk/include/clang/Basic/CodeGenOptions.h
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/msp430-fp-elim.c
cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
cfe/trunk/test/CodeGen/xcore-abi.c
cfe/trunk/test/CodeGen/xcore-abi.cpp
cfe/trunk/test/CodeGenCXX/global-init.cpp
cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm
cfe/trunk/test/Driver/cl-options.c
cfe/trunk/test/Driver/clang-translation.c
cfe/trunk/test/Driver/frame-pointer-elim.c
cfe/trunk/test/Driver/frame-pointer.c
cfe/trunk/test/Driver/woa-fp.c
cfe/trunk/test/Driver/xcore-opts.c

Modified: cfe/trunk/include/clang/Basic/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CodeGenOptions.def?rev=366645=366644=366645=diff
==
--- cfe/trunk/include/clang/Basic/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Basic/CodeGenOptions.def Sat Jul 20 15:50:50 2019
@@ -47,7 +47,8 @@ CODEGENOPT(CXXCtorDtorAliases, 1, 0) ///
  ///< aliases to base ctors when possible.
 CODEGENOPT(DataSections  , 1, 0) ///< Set when -fdata-sections is enabled.
 CODEGENOPT(UniqueSectionNames, 1, 1) ///< Set for -funique-section-names.
-CODEGENOPT(DisableFPElim , 1, 0) ///< Set when -fomit-frame-pointer is 
enabled.
+ENUM_CODEGENOPT(FramePointer, FramePointerKind, 2, FramePointerKind::None) /// 
frame-pointer: all,non-leaf,none
+
 CODEGENOPT(DisableFree   , 1, 0) ///< Don't free memory.
 CODEGENOPT(DiscardValueNames , 1, 0) ///< Discard Value Names from the IR 
(LLVMContext flag)
 CODEGENOPT(DisableGCov   , 1, 0) ///< Don't run the GCov pass, for testing.
@@ -155,8 +156,6 @@ CODEGENOPT(NoZeroInitializedInBSS , 1, 0
 ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy)
 /// Replace certain message sends with calls to ObjC runtime entrypoints
 CODEGENOPT(ObjCConvertMessagesToRuntimeCalls , 1, 1)
-CODEGENOPT(OmitLeafFramePointer , 1, 0) ///< Set when 
-momit-leaf-frame-pointer is
-///< enabled.
 
 VALUE_CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option specified.
 VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is 
specified.

Modified: cfe/trunk/include/clang/Basic/CodeGenOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CodeGenOptions.h?rev=366645=366644=366645=diff
==
--- cfe/trunk/include/clang/Basic/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/Basic/CodeGenOptions.h Sat Jul 20 15:50:50 2019
@@ -117,6 +117,12 @@ public:
 
   enum SignReturnAddressKeyValue { AKey, BKey };
 
+  enum class FramePointerKind {
+None,// Omit all frame pointers.
+NonLeaf, // Keep non-leaf frame pointers.
+All, // Keep all frame pointers.
+  };
+
   /// The code model to use (-mcmodel).
   std::string CodeModel;
 

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=366645=366644=366645=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Sat Jul 20 15:50:50 2019
@@ -285,8 +285,8 @@ def mcode_model : Separate<["-"], "mcode
   HelpText<"The code model to use">, Values<"tiny,small,kernel,medium,large">;
 def mdebug_pass : Separate<["-"], "mdebug-pass">,
   HelpText<"Enable additional debug output">;
-def mdisable_fp_elim : Flag<["-"], "mdisable-fp-elim">,
-  HelpText<"Disable frame pointer elimination optimization">;
+def mframe_pointer_EQ : Joined<["-"], "mframe-pointer=">,
+  HelpText<"Specify which frame pointers to retain (all, non-leaf, none).">, 
Values<"all,non-leaf,none">;
 def mdisable_tail_calls : Flag<["-"], "mdisable-tail-calls">,
   HelpText<"Disable tail call optimization, keeping the call stack accurate">;
 def menable_no_infinities : Flag<["-"], "menable-no-infs">,

Modified: 

[PATCH] D65029: [Driver] Support for disabling sanitizer runtime linking

2019-07-20 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In D65029#1594437 , @pcc wrote:

> It's also worth asking whether `-nodefaultlibs` would work for this use case 
> as @filcab suggested on D64547 .


It wouldn't, `-nodefaultlibs` (same as `-nostdlib`) disables linking of runtime 
dependencies, but not the runtime itself, e.g. `-fsanitize=address 
-nodefaultlibs` disables linking of `-lpthread -lrt -lm -ldl` which are all 
dependencies of ASan, but doesn't disable linking of `libclang_rt.asan.a` which 
is what we care about.

In D65029#1594409 , @MaskRay wrote:

> There is an existing option `-fsanitize-minimal-runtime`, will 
> `-fsanitize-no-runtime` be a name providing more consistency?


That's fine with me, I used `-f[no-]sanitize-link-deps` for consistency with 
XRay, but `-fsanitize-no-runtime` would work as well.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65029/new/

https://reviews.llvm.org/D65029



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65044: [Format] Add option to enable coroutines keywords

2019-07-20 Thread Brian Gesiak via Phabricator via cfe-commits
modocache created this revision.
modocache added reviewers: rsmith, sammccall, Typz, klimek.
Herald added a subscriber: EricWF.
Herald added a project: clang.

In a previous change, https://reviews.llvm.org/D65043, I allowed users to
explicitly opt-in to formatting according to the C++20 standard. Should
a user choose to do so, the formatter would treat coroutine keywords
such as `co_yield` as keywords, whereas under the C++11 standard they
would be treated as identifiers.

However, this excludes a use case in which, for example, a user's codebase
is written using the C++17 standard, but with an explicit opt-in to
`-fcoroutines-ts`. This commit adds an option to clang-format to allow
formatting under an arbitrary standard, but with `co_yield` and friends
treated as keywords.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65044

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -13810,13 +13810,17 @@
 TEST_F(FormatTest, Coroutines) {
   FormatStyle Cpp20 = getLLVMStyle();
   Cpp20.Standard = FormatStyle::LS_Cpp20;
+  FormatStyle Coro = getLLVMStyle();
+  Coro.CoroutinesTS = true;
 
   verifyFormat("co_yield++ i;");
   verifyFormat("co_yield ++i;", Cpp20);
+  verifyFormat("co_yield ++i;", Coro);
 
   verifyFormat("co_await[]() { co_return; }\n"
"();");
   verifyFormat("co_await []() { co_return; }();", Cpp20);
+  verifyFormat("co_await []() { co_return; }();", Coro);
 }
 
 } // end namespace
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -434,6 +434,7 @@
 IO.mapOptional("ConstructorInitializerIndentWidth",
Style.ConstructorInitializerIndentWidth);
 IO.mapOptional("ContinuationIndentWidth", Style.ContinuationIndentWidth);
+IO.mapOptional("CoroutinesTS", Style.CoroutinesTS);
 IO.mapOptional("Cpp11BracedListStyle", Style.Cpp11BracedListStyle);
 IO.mapOptional("DerivePointerAlignment", Style.DerivePointerAlignment);
 IO.mapOptional("DisableFormat", Style.DisableFormat);
@@ -701,6 +702,7 @@
   LLVMStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = false;
   LLVMStyle.ConstructorInitializerIndentWidth = 4;
   LLVMStyle.ContinuationIndentWidth = 4;
+  LLVMStyle.CoroutinesTS = false;
   LLVMStyle.Cpp11BracedListStyle = true;
   LLVMStyle.DerivePointerAlignment = false;
   LLVMStyle.ExperimentalAutoDetectBinPacking = false;
@@ -2378,6 +2380,8 @@
   LangOpts.ObjC = 1;
   LangOpts.MicrosoftExt = 1;// To get kw___try, kw___finally.
   LangOpts.DeclSpecKeyword = 1; // To get __declspec.
+  if (!LangOpts.CPlusPlus2a)
+LangOpts.Coroutines = Style.CoroutinesTS;
   return LangOpts;
 }
 
Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -,6 +,21 @@
   /// \endcode
   unsigned ContinuationIndentWidth;
 
+  /// If ``true``, C++ Coroutines TS keywords will be treated as keywords, not
+  /// identifiers, regardless of the language standard specified for formatting.
+  /// If ``false``, their formatting depends on the standard selected.
+  /// \code
+  ///true, C++11:
+  ///co_yield ++i;
+  ///
+  ///false, C++11:
+  ///co_yield++ i;
+  ///
+  ///both true and false, C++20:
+  ///co_yield ++i;
+  /// \endcode
+  bool CoroutinesTS;
+
   /// If ``true``, format braced lists as best suited for C++11 braced
   /// lists.
   ///
@@ -1949,6 +1964,7 @@
ConstructorInitializerIndentWidth ==
R.ConstructorInitializerIndentWidth &&
ContinuationIndentWidth == R.ContinuationIndentWidth &&
+   CoroutinesTS == R.CoroutinesTS &&
Cpp11BracedListStyle == R.Cpp11BracedListStyle &&
DerivePointerAlignment == R.DerivePointerAlignment &&
DisableFormat == R.DisableFormat &&
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -1315,6 +1315,22 @@
longFunction( // Again a long comment
  arg);
 
+**CoroutinesTS** (``bool``)
+  If ``true``, C++ Coroutines TS keywords will be treated as keywords, not
+  identifiers, regardless of the language standard specified for formatting.
+  If ``false``, their formatting depends on the standard selected.
+
+  .. code-block:: c++
+
+ true, C++11:
+ co_yield ++i;
+
+ false, C++11:
+ co_yield++ i;
+
+ both true and false, C++20:
+ co_yield ++i;
+
 

[PATCH] D65043: [Format] Add C++20 standard to style options

2019-07-20 Thread Brian Gesiak via Phabricator via cfe-commits
modocache created this revision.
modocache added reviewers: rsmith, sammccall, Typz, klimek.
Herald added a project: clang.

When C++ coroutines were adopted as part of the C++20 standard, a change
was committed in https://github.com/llvm/llvm-project/commit/10ab78e854f:
coroutine keywords such as `co_yield` went from being gated on the
presence of the `-fcoroutines-ts` flag, to instead being gated on
`-std=c++2a`. This resulted, perhaps unexpectedly to some users, in a
change in how coroutine keywords were formatted. Because libclangFormat
has only 3 options for formatting according to a language standard --
C++03, C++11, or "auto" -- and because it enabled C++20 keywords for all
settings aside from C++03, users who specified a standard of C++11 in
their style options would have their C++ formatted as if `co_yield` were
a keyword:

- Before, C++03: `co_yield ++i` would be formatted as `co_yield++ i`
- Before, C++11: `co_yield ++i` would be formatted as `co_yield++ i`
- After, C++03: `co_yield ++i` would be formatted as `co_yield++ i`
- After, C++11: `co_yield ++i` would be formatted as `co_yield ++i`

Although the "after" examples above appear like correct formatting
choices to those who are used to seeing coroutine keywords, I would
argue that they aren't technically correct, because a user may define a
variable in C++11 named `co_yield`, and they could increment that
variable by typing `co_yield++`. In this case, clang-format would change
the formatting, despite the user never opting-in to treating `co_yield`
as a keyword.

(There are other examples of clang-format suddenly formatting C++11 code
according to C++20 standards differently as a result of changes like
https://github.com/llvm/llvm-project/commit/10ab78e854f, and I've included
them as tests in this commit, but I won't go into detail explaining them
here.)

To give users the option of formatting according to the C++11 standard,
without the use of coroutines, I've added a style option for the C++20
standard (and, similarly to how the C++11 standard enables C++14, 17,
and 1z, I've written the documentation to indicate using the C++20
option enables any future C++2a standards).

In a future commit, I add a boolean style option to enable coroutines,
so that users may specify they wish to format according to the C++11
standard, but with coroutine keywords enabled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65043

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -3713,10 +3713,20 @@
   "if (aa.aa(\n"
   "aa) == 5) {\n"
   "}");
+
+  // Only in C++20 and above is <=> treated as as operator.
   verifyFormat(
   "if (a(\n"
-  "aa) <=> 5) {\n"
+  "aa) <= >\n"
+  "5) {\n"
   "}");
+  FormatStyle Cpp20 = getLLVMStyle();
+  Cpp20.Standard = FormatStyle::LS_Cpp20;
+  verifyFormat(
+  "if (a(\n"
+  "aa) <=> 5) {\n"
+  "}", Cpp20);
+
   // Even explicit parentheses stress the precedence enough to make the
   // additional break unnecessary.
   verifyFormat("if ((a +\n"
@@ -3736,10 +3746,15 @@
"aa ==\n"
"5) {\n"
"}");
+  // Only in C++20 and above is <=> treated as as operator.
+  verifyFormat("if (a +\n"
+   "aa <=\n"
+   "> 5) {\n"
+   "}");
   verifyFormat("if (a +\n"
"aa <=>\n"
"5) {\n"
-   "}");
+   "}", Cpp20);
 
   FormatStyle OnePerLine = getLLVMStyle();
   OnePerLine.BinPackParameters = false;
@@ -13792,6 +13807,18 @@
   verifyFormat("STACK_OF(int*)* a;", Macros);
 }
 
+TEST_F(FormatTest, Coroutines) {
+  FormatStyle Cpp20 = getLLVMStyle();
+  Cpp20.Standard = FormatStyle::LS_Cpp20;
+
+  verifyFormat("co_yield++ i;");
+  verifyFormat("co_yield ++i;", Cpp20);
+
+  verifyFormat("co_await[]() { co_return; }\n"
+   "();");
+  verifyFormat("co_await []() { co_return; }();", Cpp20);
+}
+
 } // end namespace
 } // end namespace format
 } // end 

[PATCH] D56353: Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer' with '-mframe-pointer'

2019-07-20 Thread Phabricator via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366645: [Clang] Replace cc1 options 
-mdisable-fp-elim and -momit-leaf-frame-pointer 
(authored by yuanfang, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56353?vs=210014=210975#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56353/new/

https://reviews.llvm.org/D56353

Files:
  cfe/trunk/include/clang/Basic/CodeGenOptions.def
  cfe/trunk/include/clang/Basic/CodeGenOptions.h
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/CodeGen/CGCall.cpp
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/msp430-fp-elim.c
  cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
  cfe/trunk/test/CodeGen/xcore-abi.c
  cfe/trunk/test/CodeGen/xcore-abi.cpp
  cfe/trunk/test/CodeGenCXX/global-init.cpp
  cfe/trunk/test/CodeGenObjCXX/msabi-stret.mm
  cfe/trunk/test/Driver/cl-options.c
  cfe/trunk/test/Driver/clang-translation.c
  cfe/trunk/test/Driver/frame-pointer-elim.c
  cfe/trunk/test/Driver/frame-pointer.c
  cfe/trunk/test/Driver/woa-fp.c
  cfe/trunk/test/Driver/xcore-opts.c

Index: cfe/trunk/lib/CodeGen/CGCall.cpp
===
--- cfe/trunk/lib/CodeGen/CGCall.cpp
+++ cfe/trunk/lib/CodeGen/CGCall.cpp
@@ -1713,16 +1713,19 @@
 if (!CodeGenOpts.TrapFuncName.empty())
   FuncAttrs.addAttribute("trap-func-name", CodeGenOpts.TrapFuncName);
   } else {
-// Attributes that should go on the function, but not the call site.
-if (!CodeGenOpts.DisableFPElim) {
-  FuncAttrs.addAttribute("no-frame-pointer-elim", "false");
-} else if (CodeGenOpts.OmitLeafFramePointer) {
-  FuncAttrs.addAttribute("no-frame-pointer-elim", "false");
-  FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf");
-} else {
-  FuncAttrs.addAttribute("no-frame-pointer-elim", "true");
-  FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf");
+StringRef FpKind;
+switch (CodeGenOpts.getFramePointer()) {
+case CodeGenOptions::FramePointerKind::None:
+  FpKind = "none";
+  break;
+case CodeGenOptions::FramePointerKind::NonLeaf:
+  FpKind = "non-leaf";
+  break;
+case CodeGenOptions::FramePointerKind::All:
+  FpKind = "all";
+  break;
 }
+FuncAttrs.addAttribute("frame-pointer", FpKind);
 
 FuncAttrs.addAttribute("less-precise-fpmad",
llvm::toStringRef(CodeGenOpts.LessPreciseFPMAD));
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -22,6 +22,7 @@
 #include "InputInfo.h"
 #include "PS4CPU.h"
 #include "clang/Basic/CharInfo.h"
+#include "clang/Basic/CodeGenOptions.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/Version.h"
@@ -501,8 +502,6 @@
   return codegenoptions::LimitedDebugInfo;
 }
 
-enum class FramePointerKind { None, NonLeaf, All };
-
 static bool mustUseNonLeafFramePointerForTarget(const llvm::Triple ) {
   switch (Triple.getArch()){
   default:
@@ -579,8 +578,8 @@
   return true;
 }
 
-static FramePointerKind getFramePointerKind(const ArgList ,
-const llvm::Triple ) {
+static CodeGenOptions::FramePointerKind
+getFramePointerKind(const ArgList , const llvm::Triple ) {
   Arg *A = Args.getLastArg(options::OPT_fomit_frame_pointer,
options::OPT_fno_omit_frame_pointer);
   bool OmitFP = A && A->getOption().matches(options::OPT_fomit_frame_pointer);
@@ -591,10 +590,10 @@
 if (Args.hasFlag(options::OPT_momit_leaf_frame_pointer,
  options::OPT_mno_omit_leaf_frame_pointer,
  Triple.isPS4CPU()))
-  return FramePointerKind::NonLeaf;
-return FramePointerKind::All;
+  return CodeGenOptions::FramePointerKind::NonLeaf;
+return CodeGenOptions::FramePointerKind::All;
   }
-  return FramePointerKind::None;
+  return CodeGenOptions::FramePointerKind::None;
 }
 
 /// Add a CC1 option to specify the debug compilation directory.
@@ -3946,12 +3945,23 @@
   if (Args.hasFlag(options::OPT_mrtd, options::OPT_mno_rtd, false))
 CmdArgs.push_back("-fdefault-calling-conv=stdcall");
 
-  FramePointerKind FPKeepKind = getFramePointerKind(Args, RawTriple);
-  if (FPKeepKind != FramePointerKind::None) {
-CmdArgs.push_back("-mdisable-fp-elim");
-if (FPKeepKind == FramePointerKind::NonLeaf)
-  CmdArgs.push_back("-momit-leaf-frame-pointer");
+  CodeGenOptions::FramePointerKind FPKeepKind =
+  getFramePointerKind(Args, 

[PATCH] D64374: [analyzer] CastValueChecker: Model casts

2019-07-20 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

I guess `getAs` and `castAs` methods could join the party too. I'm evaluating 
plenty of results on LLVM, and those seem to be in the same problem category.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64374/new/

https://reviews.llvm.org/D64374



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63082: [Diagnostics] Added support for -Wint-in-bool-context

2019-07-20 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

Ping @rsmith


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63082/new/

https://reviews.llvm.org/D63082



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63139: [Diagnostics] Implement -Wswitch-unreachable

2019-07-20 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

Ping @rsmith


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63139/new/

https://reviews.llvm.org/D63139



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D64232: [analyzer] Prune calls to functions with linear CFGs that return a non-zero constrained value

2019-07-20 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

LLVM+Clang (A total of 207 reports changed)

| with "track-conditions" set to true (bug length)  







  | with 
"track-conditions" set to true and this patch applied (bug length)  







   |
| InstrTypes.cpp 

 (9)
 | InstrTypes.cpp 

 (5)
 |
| APInt.h 

 (17)   
| 
APInt.h 

 (13)   
|
| ASTDiagnostic.cpp 

 (19)   
  | 
ASTDiagnostic.cpp 

 (15)   
   

[PATCH] D64883: Add new warning -Walloca for use of builtin alloca function

2019-07-20 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:2776
+def warn_alloca : Warning<
+  "use of builtin function %0">,
+  InGroup>, DefaultIgnore;

george.burgess.iv wrote:
> nit: I'd just say "use of function '%0'" here; "builtin" doesn't really add 
> much.
> 
> I also wonder if we should be saying anything more than "we found a use of 
> this function." Looks like GCC doesn't (https://godbolt.org/z/sYs_8G), but 
> since this warning is sort of opinionated in itself, might it be better to 
> expand this to "use of '%0' is discouraged"?
> 
> WDYT, Aaron?
What is the purpose to this diagnostic, aside from GCC compatibility? What does 
it protect against?

If there's a reason users should not use alloc(), it would be better for the 
diagnostic to spell it out.

Btw, I'm okay with this being default-off because the GCC warning is as well. 
I'm mostly hoping we can do better with our diagnostic wording.



Comment at: clang/lib/Sema/SemaChecking.cpp:1172
   return ExprError();
+LLVM_FALLTHROUGH;
+  case Builtin::BI__builtin_alloca:

Do we want to warn on all uses of alloca(), or just the ones that get past the 
call to `SemaBuiltinAllocaWithAlign()`?



Comment at: clang/test/Sema/warn-alloca.c:1
+// RUN: %clang_cc1 -fsyntax-only -verify -Walloca %s
+

I'd appreciate a test demonstrating no warnings if `-Wall` is passed without an 
explicit `-Walloca`.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64883/new/

https://reviews.llvm.org/D64883



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r366635 - Fix cppcheck reduce scope variable warnings. NFCI

2019-07-20 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Sat Jul 20 06:01:16 2019
New Revision: 366635

URL: http://llvm.org/viewvc/llvm-project?rev=366635=rev
Log:
Fix cppcheck reduce scope variable warnings. NFCI

Move a couple of variables inside the block where they are actually needed.

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=366635=366634=366635=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Jul 20 06:01:16 2019
@@ -4090,11 +4090,11 @@ void Sema::notePreviousDefinition(const
 
   // Is it the same file and same offset? Provide more information on why
   // this leads to a redefinition error.
-  bool EmittedDiag = false;
   if (FNew == FOld && FNewDecLoc.second == FOldDecLoc.second) {
 SourceLocation OldIncLoc = SrcMgr.getIncludeLoc(FOldDecLoc.first);
 SourceLocation NewIncLoc = SrcMgr.getIncludeLoc(FNewDecLoc.first);
-EmittedDiag = noteFromModuleOrInclude(Old->getOwningModule(), OldIncLoc);
+bool EmittedDiag =
+noteFromModuleOrInclude(Old->getOwningModule(), OldIncLoc);
 EmittedDiag |= noteFromModuleOrInclude(getCurrentModule(), NewIncLoc);
 
 // If the header has no guards, emit a note suggesting one.
@@ -4686,12 +4686,12 @@ Decl *Sema::BuildAnonymousStructOrUnion(
   bool Invalid = false;
   if (getLangOpts().CPlusPlus) {
 const char *PrevSpec = nullptr;
-unsigned DiagID;
 if (Record->isUnion()) {
   // C++ [class.union]p6:
   // C++17 [class.union.anon]p2:
   //   Anonymous unions declared in a named namespace or in the
   //   global namespace shall be declared static.
+  unsigned DiagID;
   DeclContext *OwnerScope = Owner->getRedeclContext();
   if (DS.getStorageClassSpec() != DeclSpec::SCS_static &&
   (OwnerScope->isTranslationUnit() ||


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63960: [C++20] Add consteval-specifique semantic

2019-07-20 Thread Tyker via Phabricator via cfe-commits
Tyker added a comment.

@rsmith ping


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63960/new/

https://reviews.llvm.org/D63960



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r366630 - [c++20] P1161R3: a[b,c] is deprecated.

2019-07-20 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sat Jul 20 02:32:27 2019
New Revision: 366630

URL: http://llvm.org/viewvc/llvm-project?rev=366630=rev
Log:
[c++20] P1161R3: a[b,c] is deprecated.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/deprecated.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=366630=366629=366630=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Sat Jul 20 02:32:27 2019
@@ -118,6 +118,7 @@ def CXX11CompatDeprecatedWritableStr :
   DiagGroup<"c++11-compat-deprecated-writable-strings">;
 
 def DeprecatedAttributes : DiagGroup<"deprecated-attributes">;
+def DeprecatedCommaSubscript : DiagGroup<"deprecated-comma-subscript">;
 def DeprecatedDeclarations : DiagGroup<"deprecated-declarations">;
 def UnavailableDeclarations : DiagGroup<"unavailable-declarations">;
 def UnguardedAvailabilityNew : DiagGroup<"unguarded-availability-new">;
@@ -135,6 +136,7 @@ def DeprecatedWritableStr : DiagGroup<"d
   [CXX11CompatDeprecatedWritableStr]>;
 // FIXME: Why is DeprecatedImplementations not in this group?
 def Deprecated : DiagGroup<"deprecated", [DeprecatedAttributes,
+  DeprecatedCommaSubscript,
   DeprecatedDeclarations,
   DeprecatedDynamicExceptionSpec,
   DeprecatedIncrementBool,

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=366630=366629=366630=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sat Jul 20 02:32:27 
2019
@@ -5719,6 +5719,9 @@ def err_arithmetic_nonfragile_interface
   "arithmetic on pointer to interface %0, which is not a constant size for "
   "this architecture and platform">;
 
+def warn_deprecated_comma_subscript : Warning<
+  "top-level comma expression in array subscript is deprecated">,
+  InGroup;
 
 def ext_subscript_non_lvalue : Extension<
   "ISO C90 does not allow subscripting non-lvalue array">;

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=366630=366629=366630=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Jul 20 02:32:27 2019
@@ -4317,6 +4317,15 @@ Sema::ActOnArraySubscriptExpr(Scope *S,
 base = result.get();
   }
 
+  // A comma-expression as the index is deprecated in C++2a onwards.
+  if (getLangOpts().CPlusPlus2a &&
+  ((isa(idx) && cast(idx)->isCommaOp()) ||
+   (isa(idx) &&
+cast(idx)->getOperator() == OO_Comma))) {
+Diag(idx->getExprLoc(), diag::warn_deprecated_comma_subscript)
+  << SourceRange(base->getBeginLoc(), rbLoc);
+  }
+
   // Handle any non-overload placeholder types in the base and index
   // expressions.  We can't handle overloads here because the other
   // operand might be an overloadable type, in which case the overload

Modified: cfe/trunk/test/SemaCXX/deprecated.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/deprecated.cpp?rev=366630=366629=366630=diff
==
--- cfe/trunk/test/SemaCXX/deprecated.cpp (original)
+++ cfe/trunk/test/SemaCXX/deprecated.cpp Sat Jul 20 02:32:27 2019
@@ -2,6 +2,7 @@
 // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify -triple x86_64-linux-gnu
 // RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu
 // RUN: %clang_cc1 -std=c++17 %s -Wdeprecated -verify -triple x86_64-linux-gnu
+// RUN: %clang_cc1 -std=c++2a %s -Wdeprecated -verify -triple x86_64-linux-gnu
 
 // RUN: %clang_cc1 -std=c++14 %s -Wdeprecated -verify -triple x86_64-linux-gnu 
-Wno-deprecated-register -DNO_DEPRECATED_FLAGS
 
@@ -99,5 +100,30 @@ namespace DeprecatedCopy {
 }
 #endif
 
+struct X {
+  friend int operator,(X, X);
+  void operator[](int);
+};
+void array_index_comma() {
+  int arr[123];
+  (void)arr[(void)1, 2];
+  (void)arr[X(), X()];
+  X()[(void)1, 2];
+  X()[X(), X()];
+#if __cplusplus > 201703L
+  // expected-warning@-5 {{deprecated}}
+  // expected-warning@-5 {{deprecated}}
+  // expected-warning@-5 {{deprecated}}
+  // expected-warning@-5 {{deprecated}}
+#endif
+
+  (void)arr[((void)1, 2)];
+  (void)arr[(X(), X())];
+  

Re: r366628 - We support P1301R4 in C++2a as of r366626.

2019-07-20 Thread Richard Smith via cfe-commits
On Sat, 20 Jul 2019 at 10:56, Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Sat, Jul 20, 2019 at 4:54 AM Richard Smith 
> wrote:
> >
> > On Sat, 20 Jul 2019 at 10:24, Aaron Ballman via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >>
> >> Author: aaronballman
> >> Date: Sat Jul 20 01:24:56 2019
> >> New Revision: 366628
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=366628=rev
> >> Log:
> >> We support P1301R4 in C++2a as of r366626.
> >>
> >> Modified:
> >> cfe/trunk/www/cxx_status.html
> >>
> >> Modified: cfe/trunk/www/cxx_status.html
> >> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=366628=366627=366628=diff
> >>
> ==
> >> --- cfe/trunk/www/cxx_status.html (original)
> >> +++ cfe/trunk/www/cxx_status.html Sat Jul 20 01:24:56 2019
> >> @@ -1108,7 +1108,7 @@ as the draft C++2a standard evolves.
> >>  
> >>[[nodiscard("with reason")]]
> >>http://wg21.link/p1301r4;>P1301R4
> >> -  No
> >> +  Yes
> >
> >
> > Please mark this as SVN (class="svn"), not as Yes, because we have not
> always done this.
>
> Oops, my mistake! I've corrected in r366629.
>

Perfect, thanks :)


> ~Aaron
>
> >
> >>
> >>  
> >>  
> >>using enum
> >>
> >>
> >> ___
> >> cfe-commits mailing list
> >> cfe-commits@lists.llvm.org
> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r366628 - We support P1301R4 in C++2a as of r366626.

2019-07-20 Thread Aaron Ballman via cfe-commits
On Sat, Jul 20, 2019 at 4:54 AM Richard Smith  wrote:
>
> On Sat, 20 Jul 2019 at 10:24, Aaron Ballman via cfe-commits 
>  wrote:
>>
>> Author: aaronballman
>> Date: Sat Jul 20 01:24:56 2019
>> New Revision: 366628
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=366628=rev
>> Log:
>> We support P1301R4 in C++2a as of r366626.
>>
>> Modified:
>> cfe/trunk/www/cxx_status.html
>>
>> Modified: cfe/trunk/www/cxx_status.html
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=366628=366627=366628=diff
>> ==
>> --- cfe/trunk/www/cxx_status.html (original)
>> +++ cfe/trunk/www/cxx_status.html Sat Jul 20 01:24:56 2019
>> @@ -1108,7 +1108,7 @@ as the draft C++2a standard evolves.
>>  
>>[[nodiscard("with reason")]]
>>http://wg21.link/p1301r4;>P1301R4
>> -  No
>> +  Yes
>
>
> Please mark this as SVN (class="svn"), not as Yes, because we have not always 
> done this.

Oops, my mistake! I've corrected in r366629.

~Aaron

>
>>
>>  
>>  
>>using enum
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r366629 - Mark P1301R4 in C++2a as being SVN instead.

2019-07-20 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Sat Jul 20 01:57:08 2019
New Revision: 366629

URL: http://llvm.org/viewvc/llvm-project?rev=366629=rev
Log:
Mark P1301R4 in C++2a as being SVN instead.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=366629=366628=366629=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Sat Jul 20 01:57:08 2019
@@ -1108,7 +1108,7 @@ as the draft C++2a standard evolves.
 
   [[nodiscard("with reason")]]
   http://wg21.link/p1301r4;>P1301R4
-  Yes
+  SVN
 
 
   using enum


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r366628 - We support P1301R4 in C++2a as of r366626.

2019-07-20 Thread Richard Smith via cfe-commits
On Sat, 20 Jul 2019 at 10:24, Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: aaronballman
> Date: Sat Jul 20 01:24:56 2019
> New Revision: 366628
>
> URL: http://llvm.org/viewvc/llvm-project?rev=366628=rev
> Log:
> We support P1301R4 in C++2a as of r366626.
>
> Modified:
> cfe/trunk/www/cxx_status.html
>
> Modified: cfe/trunk/www/cxx_status.html
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=366628=366627=366628=diff
>
> ==
> --- cfe/trunk/www/cxx_status.html (original)
> +++ cfe/trunk/www/cxx_status.html Sat Jul 20 01:24:56 2019
> @@ -1108,7 +1108,7 @@ as the draft C++2a standard evolves.
>  
>[[nodiscard("with reason")]]
>http://wg21.link/p1301r4;>P1301R4
> -  No
> +  Yes
>

Please mark this as SVN (class="svn"), not as Yes, because we have not
always done this.


>  
>  
>using enum
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r366628 - We support P1301R4 in C++2a as of r366626.

2019-07-20 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Sat Jul 20 01:24:56 2019
New Revision: 366628

URL: http://llvm.org/viewvc/llvm-project?rev=366628=rev
Log:
We support P1301R4 in C++2a as of r366626.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=366628=366627=366628=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Sat Jul 20 01:24:56 2019
@@ -1108,7 +1108,7 @@ as the draft C++2a standard evolves.
 
   [[nodiscard("with reason")]]
   http://wg21.link/p1301r4;>P1301R4
-  No
+  Yes
 
 
   using enum


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r366627 - [cxx_status] Update status page for WG21 Cologne meeting motions.

2019-07-20 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sat Jul 20 01:20:54 2019
New Revision: 366627

URL: http://llvm.org/viewvc/llvm-project?rev=366627=rev
Log:
[cxx_status] Update status page for WG21 Cologne meeting motions.

Note that many of the paper links will be dead until the post-meeting
mailing is released.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=366627=366626=366627=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Sat Jul 20 01:20:54 2019
@@ -74,9 +74,13 @@ with http://libcxx.llvm.org/;>l
 Available in Clang?
  
  
-  Rvalue references
+  Rvalue references
   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html;>N2118
   Clang 2.9
+   
+http://wg21.link/p1825r0;>P1825R0 (DR)
+No
+  
 
 
   Rvalue references for *this
@@ -654,10 +658,14 @@ version 3.7.
   Clang 3.9
 
 
-  [[nodiscard]] attribute
+  [[nodiscard]] attribute
   http://wg21.link/p0189r1;>P0189R1
   Clang 3.9
 
+   
+http://wg21.link/p1771r1;>P1771R1 (DR)
+No
+  
 
   [[maybe_unused]] attribute
   http://wg21.link/p0212r1;>P0212R1
@@ -871,9 +879,9 @@ as the draft C++2a standard evolves.
   SVN
 
 
-  Concepts
+  Concepts
   http://wg21.link/p0734r0;>P0734R0
-  No
+  No
 

 http://wg21.link/p0857r0;>P0857R0
@@ -884,6 +892,15 @@ as the draft C++2a standard evolves.
   
 http://wg21.link/p1141r2;>P1414R2
   
+   
+http://wg21.link/p0848r3;>P0848R3
+  
+  
+http://wg21.link/p1616r1;>P1616R1
+  
+  
+http://wg21.link/p1452r2;>P1452R2
+  
 
 
   Range-based for statements with initializer
@@ -901,7 +918,7 @@ as the draft C++2a standard evolves.
   Clang 8
 
 
-  Consistent comparison (operator=)
+  Consistent comparison (operator=)
   http://wg21.link/p0515r3;>P0515R3
   Partial
 
@@ -913,7 +930,13 @@ as the draft C++2a standard evolves.
   

 http://wg21.link/p1185r2;>P1185R2
-No
+No
+  
+   
+http://wg21.link/p1186r3;>P1186R3
+  
+  
+http://wg21.link/p1630r1;>P1630R1
   
 
   Access checking on specializations
@@ -963,7 +986,7 @@ as the draft C++2a standard evolves.
   Clang 6
 
 
-  Relaxations of constexpr restrictions
+  Relaxations of constexpr restrictions
   http://wg21.link/p1064r0;>P1064R0
   SVN
 
@@ -978,23 +1001,22 @@ as the draft C++2a standard evolves.
   
 http://wg21.link/p1330r0;>P1330R0
   
+   
+http://wg21.link/p1331r2;>P1331R2
+No
+  
+  
+http://wg21.link/p1668r1;>P1668R1
+  
+  
+http://wg21.link/p0784r7;>P0784R7
+  
 
   Prohibit aggregates with user-declared constructors
   http://wg21.link/p1008r1;>P1008R1
   Clang 8
 
 
-  Contracts
-  http://wg21.link/p0542r5;>P0542R5
-  No
-
-   
-http://wg21.link/p1289r1;>P1289R1
-  
-   
-http://wg21.link/p1323r2;>P1323R2
-  
-
   Feature test macros
   http://wg21.link/p0941r2;>P0941R2
   (see below)
@@ -1053,15 +1075,66 @@ as the draft C++2a standard evolves.
   No
 
 
-  Modules
+  Modules
   http://wg21.link/p1103r3;>P1103R3
   Partial
 
+   
+http://wg21.link/p1766r1;>P1766R1 (DR)
+No
+  
+  
+http://wg21.link/p1811r0;>P1811R0
+  
+  
+http://wg21.link/p1703r1;>P1703R1
+  
 
   Coroutines
   http://wg21.link/p0912r5;>P0912R5
   Partial
 
+
+
+  Deprecate a[b,c]
+  http://wg21.link/p1161r3;>P1161R3
+  No
+
+
+  Deprecate some problematic uses of volatile
+  http://wg21.link/p1152r4;>P1152R4
+  No
+
+
+  [[nodiscard("with reason")]]
+  http://wg21.link/p1301r4;>P1301R4
+  No
+
+
+  using enum
+  http://wg21.link/p1099r5;>P1099R5
+  No
+
+
+  Class template argument deduction for aggregates
+  http://wg21.link/p1816r0;>P1816R0
+  No
+
+
+  Class template argument deduction for alias templates
+  http://wg21.link/p1814r0;>P1814R0
+  No
+
+
+  Permit conversions to arrays of unknown bound
+  http://wg21.link/p0388r4;>P0388R4
+  No
+
+
+  constinit
+  http://wg21.link/p1143r2;>P1143R2
+  No
+
 
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-20 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka updated this revision to Diff 210950.
vitalybuka added a comment.

fix LTO on kernel


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61879/new/

https://reviews.llvm.org/D61879

Files:
  clang/test/CodeGenCXX/union-tbaa2.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Scalar/DeadStoreEliminationExp.h
  llvm/lib/Analysis/Analysis.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExp.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalArgInfoGen.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalGUIDListGen.h
  llvm/lib/Transforms/Scalar/Scalar.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Other/pass-pipelines.ll
  llvm/test/Transforms/Coroutines/ArgAddr.ll
  llvm/test/Transforms/Coroutines/coro-split-01.ll
  llvm/test/Transforms/Coroutines/ex0.ll
  llvm/test/Transforms/Coroutines/ex1.ll
  llvm/test/Transforms/Coroutines/ex2.ll
  llvm/test/Transforms/Coroutines/ex3.ll
  llvm/test/Transforms/Coroutines/ex4.ll
  llvm/test/Transforms/Coroutines/ex5.ll
  llvm/test/Transforms/Coroutines/phi-coro-end.ll
  llvm/test/Transforms/Coroutines/restart-trigger.ll
  llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
@@ -19,6 +19,8 @@
 "CorrelatedValuePropagation.cpp",
 "DCE.cpp",
 "DeadStoreElimination.cpp",
+"DeadStoreEliminationExp.cpp",
+"DeadStoreEliminationExpGlobal.cpp",
 "DivRemPairs.cpp",
 "EarlyCSE.cpp",
 "FlattenCFGPass.cpp",
Index: llvm/test/Transforms/Coroutines/restart-trigger.ll
===
--- llvm/test/Transforms/Coroutines/restart-trigger.ll
+++ llvm/test/Transforms/Coroutines/restart-trigger.ll
@@ -7,6 +7,8 @@
 ; CHECK:  CoroSplit: Processing coroutine 'f' state: 0
 ; CHECK-NEXT: CoroSplit: Processing coroutine 'f' state: 1
 
+; REQUIRES: abcd
+
 define void @f() {
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
   %size = call i32 @llvm.coro.size.i32()
Index: llvm/test/Transforms/Coroutines/phi-coro-end.ll
===
--- llvm/test/Transforms/Coroutines/phi-coro-end.ll
+++ llvm/test/Transforms/Coroutines/phi-coro-end.ll
@@ -1,6 +1,8 @@
 ; Verify that we correctly handle suspend when the coro.end block contains phi
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex5.ll
===
--- llvm/test/Transforms/Coroutines/ex5.ll
+++ llvm/test/Transforms/Coroutines/ex5.ll
@@ -1,6 +1,8 @@
 ; Fifth example from Doc/Coroutines.rst (final suspend)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex4.ll
===
--- llvm/test/Transforms/Coroutines/ex4.ll
+++ llvm/test/Transforms/Coroutines/ex4.ll
@@ -1,6 +1,8 @@
 ; Fourth example from Doc/Coroutines.rst (coroutine promise)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %promise = alloca i32
Index: llvm/test/Transforms/Coroutines/ex3.ll
===
--- llvm/test/Transforms/Coroutines/ex3.ll
+++ llvm/test/Transforms/Coroutines/ex3.ll
@@ -1,6 +1,8 @@
 ; Third example from Doc/Coroutines.rst (two suspend points)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex2.ll
===
--- llvm/test/Transforms/Coroutines/ex2.ll
+++ llvm/test/Transforms/Coroutines/ex2.ll
@@ -1,6 +1,8 @@
 ; Second example from Doc/Coroutines.rst (custom alloc 

r366626 - Implement P1301R4, which allows specifying an optional message on the [[nodiscard]] attribute.

2019-07-20 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Sat Jul 20 00:56:34 2019
New Revision: 366626

URL: http://llvm.org/viewvc/llvm-project?rev=366626=rev
Log:
Implement P1301R4, which allows specifying an optional message on the 
[[nodiscard]] attribute.

This also bumps the attribute feature test value and introduces the notion of a 
C++2a extension warning.

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p1.cpp
cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.nodiscard/p2.cpp
cfe/trunk/test/Preprocessor/has_attribute.cpp
cfe/trunk/test/Sema/c2x-nodiscard.c
cfe/trunk/test/SemaCXX/cxx11-attr-print.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=366626=366625=366626=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Sat Jul 20 00:56:34 2019
@@ -2335,10 +2335,11 @@ def WarnUnused : InheritableAttr {
 }
 
 def WarnUnusedResult : InheritableAttr {
-  let Spellings = [CXX11<"", "nodiscard", 201603>, C2x<"", "nodiscard">,
+  let Spellings = [CXX11<"", "nodiscard", 201907>, C2x<"", "nodiscard">,
CXX11<"clang", "warn_unused_result">,
GCC<"warn_unused_result">];
   let Subjects = SubjectList<[ObjCMethod, Enum, Record, FunctionLike]>;
+  let Args = [StringArgument<"Message", 1>];
   let Documentation = [WarnUnusedResultsDocs];
 }
 

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=366626=366625=366626=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Sat Jul 20 00:56:34 2019
@@ -1482,6 +1482,13 @@ generated when a function or its return
 potentially-evaluated discarded-value expression that is not explicitly cast to
 `void`.
 
+A string literal may optionally be provided to the attribute, which will be
+reproduced in any resulting diagnostics. Redeclarations using different forms
+of the attribute (with or without the string literal or with different string
+literal contents) are allowed. If there are redeclarations of the entity with
+differing string literals, it is unspecified which one will be used by Clang
+in any resulting diagnostics.
+
 .. code-block: c++
   struct [[nodiscard]] error_info { /*...*/ };
   error_info enable_missile_safety_mode();

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=366626=366625=366626=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sat Jul 20 00:56:34 
2019
@@ -7436,6 +7436,9 @@ def warn_side_effects_typeid : Warning<
 def warn_unused_result : Warning<
   "ignoring return value of function declared with %0 attribute">,
   InGroup;
+def warn_unused_result_msg : Warning<
+  "ignoring return value of function declared with %0 attribute: %1">,
+  InGroup;
 def warn_unused_volatile : Warning<
   "expression result unused; assign into a variable to force a volatile load">,
   InGroup>;
@@ -7444,6 +7447,8 @@ def ext_cxx14_attr : Extension<
   "use of the %0 attribute is a C++14 extension">, InGroup;
 def ext_cxx17_attr : Extension<
   "use of the %0 attribute is a C++17 extension">, InGroup;
+def ext_cxx2a_attr : Extension<
+  "use of the %0 attribute is a C++2a extension">, InGroup;
 
 def warn_unused_comparison : Warning<
   "%select{equality|inequality|relational|three-way}0 comparison result 
unused">,

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=366626=366625=366626=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sat Jul 20 00:56:34 2019
@@ -2841,14 +2841,30 @@ static void handleWarnUnusedResult(Sema
   return;
 }
 
-  // If this is spelled as the standard C++17 attribute, but not in C++17, warn
-  // about using it as an extension.
-  if (!S.getLangOpts().CPlusPlus17 && AL.isCXX11Attribute() &&
-  !AL.getScopeName())
-S.Diag(AL.getLoc(), diag::ext_cxx17_attr) << AL;
+  StringRef Str;
+  if ((AL.isCXX11Attribute() || AL.isC2xAttribute()) && !AL.getScopeName()) {
+// If this is spelled as the standard C++17 attribute, but not in C++17,
+// warn about using it as an extension. If