[PATCH] D65997: Add options rounding and exceptions to pragma fp

2019-08-15 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff marked an inline comment as done.
sepavloff added inline comments.



Comment at: clang/lib/Parse/ParsePragma.cpp:2678
 
+  auto *AnnotValue = new (PP.getPreprocessorAllocator()) TokFPAnnotValue;
   while (Tok.is(tok::identifier)) {

aaron.ballman wrote:
> Might as well move this down to around line 2710, closer to where it's used. 
> This way we don't allocate something only to ignore it due to errors in fewer 
> situations.
Actually it cannot be closer. It is created just before the loop, in which 
fields of `*AnnotValue` are read.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65997



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


r368976 - [clang] Loop pragma parsing. NFC.

2019-08-15 Thread Sjoerd Meijer via cfe-commits
Author: sjoerdmeijer
Date: Thu Aug 15 00:39:05 2019
New Revision: 368976

URL: http://llvm.org/viewvc/llvm-project?rev=368976&view=rev
Log:
[clang] Loop pragma parsing. NFC.

Just a refactoring and a tidy up.

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

Modified:
cfe/trunk/lib/Parse/ParsePragma.cpp

Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=368976&r1=368975&r2=368976&view=diff
==
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Thu Aug 15 00:39:05 2019
@@ -1006,18 +1006,13 @@ struct PragmaLoopHintInfo {
 } // end anonymous namespace
 
 static std::string PragmaLoopHintString(Token PragmaName, Token Option) {
-  std::string PragmaString;
-  if (PragmaName.getIdentifierInfo()->getName() == "loop") {
-PragmaString = "clang loop ";
-PragmaString += Option.getIdentifierInfo()->getName();
-  } else if (PragmaName.getIdentifierInfo()->getName() == "unroll_and_jam") {
-PragmaString = "unroll_and_jam";
-  } else {
-assert(PragmaName.getIdentifierInfo()->getName() == "unroll" &&
-   "Unexpected pragma name");
-PragmaString = "unroll";
-  }
-  return PragmaString;
+  StringRef Str = PragmaName.getIdentifierInfo()->getName();
+  std::string ClangLoopStr = (llvm::Twine("clang loop ") + Str).str();
+  return llvm::StringSwitch(Str)
+  .Case("loop", ClangLoopStr)
+  .Case("unroll_and_jam", Str)
+  .Case("unroll", Str)
+  .Default("");
 }
 
 bool Parser::HandlePragmaLoopHint(LoopHint &Hint) {
@@ -1041,12 +1036,12 @@ bool Parser::HandlePragmaLoopHint(LoopHi
 
   // Return a valid hint if pragma unroll or nounroll were specified
   // without an argument.
-  bool PragmaUnroll = PragmaNameInfo->getName() == "unroll";
-  bool PragmaNoUnroll = PragmaNameInfo->getName() == "nounroll";
-  bool PragmaUnrollAndJam = PragmaNameInfo->getName() == "unroll_and_jam";
-  bool PragmaNoUnrollAndJam = PragmaNameInfo->getName() == "nounroll_and_jam";
-  if (Toks.empty() && (PragmaUnroll || PragmaNoUnroll || PragmaUnrollAndJam ||
-   PragmaNoUnrollAndJam)) {
+  auto IsLoopHint = llvm::StringSwitch(PragmaNameInfo->getName())
+.Cases("unroll", "nounroll", "unroll_and_jam",
+   "nounroll_and_jam", true)
+.Default(false);
+
+  if (Toks.empty() && IsLoopHint) {
 ConsumeAnnotationToken();
 Hint.Range = Info->PragmaName.getLocation();
 return true;


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


[PATCH] D64564: Loop pragma parsing. NFC.

2019-08-15 Thread Sjoerd Meijer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368976: [clang] Loop pragma parsing. NFC. (authored by 
SjoerdMeijer, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64564?vs=215162&id=215336#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64564

Files:
  cfe/trunk/lib/Parse/ParsePragma.cpp


Index: cfe/trunk/lib/Parse/ParsePragma.cpp
===
--- cfe/trunk/lib/Parse/ParsePragma.cpp
+++ cfe/trunk/lib/Parse/ParsePragma.cpp
@@ -1006,18 +1006,13 @@
 } // end anonymous namespace
 
 static std::string PragmaLoopHintString(Token PragmaName, Token Option) {
-  std::string PragmaString;
-  if (PragmaName.getIdentifierInfo()->getName() == "loop") {
-PragmaString = "clang loop ";
-PragmaString += Option.getIdentifierInfo()->getName();
-  } else if (PragmaName.getIdentifierInfo()->getName() == "unroll_and_jam") {
-PragmaString = "unroll_and_jam";
-  } else {
-assert(PragmaName.getIdentifierInfo()->getName() == "unroll" &&
-   "Unexpected pragma name");
-PragmaString = "unroll";
-  }
-  return PragmaString;
+  StringRef Str = PragmaName.getIdentifierInfo()->getName();
+  std::string ClangLoopStr = (llvm::Twine("clang loop ") + Str).str();
+  return llvm::StringSwitch(Str)
+  .Case("loop", ClangLoopStr)
+  .Case("unroll_and_jam", Str)
+  .Case("unroll", Str)
+  .Default("");
 }
 
 bool Parser::HandlePragmaLoopHint(LoopHint &Hint) {
@@ -1041,12 +1036,12 @@
 
   // Return a valid hint if pragma unroll or nounroll were specified
   // without an argument.
-  bool PragmaUnroll = PragmaNameInfo->getName() == "unroll";
-  bool PragmaNoUnroll = PragmaNameInfo->getName() == "nounroll";
-  bool PragmaUnrollAndJam = PragmaNameInfo->getName() == "unroll_and_jam";
-  bool PragmaNoUnrollAndJam = PragmaNameInfo->getName() == "nounroll_and_jam";
-  if (Toks.empty() && (PragmaUnroll || PragmaNoUnroll || PragmaUnrollAndJam ||
-   PragmaNoUnrollAndJam)) {
+  auto IsLoopHint = llvm::StringSwitch(PragmaNameInfo->getName())
+.Cases("unroll", "nounroll", "unroll_and_jam",
+   "nounroll_and_jam", true)
+.Default(false);
+
+  if (Toks.empty() && IsLoopHint) {
 ConsumeAnnotationToken();
 Hint.Range = Info->PragmaName.getLocation();
 return true;


Index: cfe/trunk/lib/Parse/ParsePragma.cpp
===
--- cfe/trunk/lib/Parse/ParsePragma.cpp
+++ cfe/trunk/lib/Parse/ParsePragma.cpp
@@ -1006,18 +1006,13 @@
 } // end anonymous namespace
 
 static std::string PragmaLoopHintString(Token PragmaName, Token Option) {
-  std::string PragmaString;
-  if (PragmaName.getIdentifierInfo()->getName() == "loop") {
-PragmaString = "clang loop ";
-PragmaString += Option.getIdentifierInfo()->getName();
-  } else if (PragmaName.getIdentifierInfo()->getName() == "unroll_and_jam") {
-PragmaString = "unroll_and_jam";
-  } else {
-assert(PragmaName.getIdentifierInfo()->getName() == "unroll" &&
-   "Unexpected pragma name");
-PragmaString = "unroll";
-  }
-  return PragmaString;
+  StringRef Str = PragmaName.getIdentifierInfo()->getName();
+  std::string ClangLoopStr = (llvm::Twine("clang loop ") + Str).str();
+  return llvm::StringSwitch(Str)
+  .Case("loop", ClangLoopStr)
+  .Case("unroll_and_jam", Str)
+  .Case("unroll", Str)
+  .Default("");
 }
 
 bool Parser::HandlePragmaLoopHint(LoopHint &Hint) {
@@ -1041,12 +1036,12 @@
 
   // Return a valid hint if pragma unroll or nounroll were specified
   // without an argument.
-  bool PragmaUnroll = PragmaNameInfo->getName() == "unroll";
-  bool PragmaNoUnroll = PragmaNameInfo->getName() == "nounroll";
-  bool PragmaUnrollAndJam = PragmaNameInfo->getName() == "unroll_and_jam";
-  bool PragmaNoUnrollAndJam = PragmaNameInfo->getName() == "nounroll_and_jam";
-  if (Toks.empty() && (PragmaUnroll || PragmaNoUnroll || PragmaUnrollAndJam ||
-   PragmaNoUnrollAndJam)) {
+  auto IsLoopHint = llvm::StringSwitch(PragmaNameInfo->getName())
+.Cases("unroll", "nounroll", "unroll_and_jam",
+   "nounroll_and_jam", true)
+.Default(false);
+
+  if (Toks.empty() && IsLoopHint) {
 ConsumeAnnotationToken();
 Hint.Range = Info->PragmaName.getLocation();
 return true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66092: [CodeGen] Generate constrained fp intrinsics depending on FPOptions

2019-08-15 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment.

In D66092#1629460 , @andrew.w.kaylor 
wrote:

> In D66092#1627339 , @sepavloff wrote:
>
> > In D66092#1625380 , @kpn wrote:
> >
> > > Also, if any constrained intrinsics are used in a function then the 
> > > entire function needs to be constrained. Is this handled anywhere?
> >
> >
> > If we decided to make the entire function constrained, it should be done 
> > somewhere in IR transformations, because inlining may mix function bodies 
> > with different fp options.
>
>
> Kevin is right. We have decided that if constrained intrinsics are used 
> anywhere in a function they must be used throughout the function. Otherwise, 
> there would be nothing to prevent the non-constrained FP operations from 
> migrating across constrained operations and the handling could get botched. 
> The "relaxed" arguments ("round.tonearest" and "fpexcept.ignore") should be 
> used where the default settings would apply. The front end should also be 
> setting the "strictfp" attribute on calls within a constrained scope and, I 
> think, functions that contain constrained intrinsics.
>
> We will need to teach the inliner to enforce this rule if it isn't already 
> doing so, but if things aren't correct coming out of the front end an 
> incorrect optimization could already happen before we get to the inliner. We 
> always rely on the front end producing IR with fully correct semantics.


Replacement of floating point operations with constrained intrinsics seems more 
an optimization helper then a semantic requirement. IR where constrained 
operations are mixed with unconstrained is still valid in sense of IR 
specification. Tools that use IR for something other than code generation may 
don't need such replacement. If the replacement is made by a separate pass, 
such tool can turn it off, but if it is a part of clang codegen, there is no 
simple solution, the tool must be reworked.

Another issue is non-standard rounding. It can be represented by constrained 
intrinsics only. The rounding does not require restrictions on code motion, so 
mixture of constrained and unconstrained operation is OK. Replacement of all 
operations with constrained intrinsics would give poorly optimized code, 
because compiler does not optimize them. It would be a bad thing if a user adds 
the pragma to execute a statement with specific rounding mode and loses 
optimization.

Using dedicated pass to shape fp operations seems a flexible solution. It 
allows to implement things like `#pragma STDC FENV_ROUND` without teaching all 
passes to work with constrained intrinsics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66092



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


r368979 - [analyzer] Add docs for cplusplus.InnerPointer

2019-08-15 Thread Kristof Umann via cfe-commits
Author: szelethus
Date: Thu Aug 15 01:52:10 2019
New Revision: 368979

URL: http://llvm.org/viewvc/llvm-project?rev=368979&view=rev
Log:
[analyzer] Add docs for cplusplus.InnerPointer

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

Modified:
cfe/trunk/docs/analyzer/checkers.rst

Modified: cfe/trunk/docs/analyzer/checkers.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/analyzer/checkers.rst?rev=368979&r1=368978&r2=368979&view=diff
==
--- cfe/trunk/docs/analyzer/checkers.rst (original)
+++ cfe/trunk/docs/analyzer/checkers.rst Thu Aug 15 01:52:10 2019
@@ -242,10 +242,35 @@ C++ Checkers.
 
 .. _cplusplus-InnerPointer:
 
-cplusplus.InnerPointer
-""
+cplusplus.InnerPointer (C++)
+
 Check for inner pointers of C++ containers used after re/deallocation.
 
+Many container methods in the C++ standard library are known to invalidate
+"references" (including actual references, iterators and raw pointers) to
+elements of the container. Using such references after they are invalidated
+causes undefined behavior, which is a common source of memory errors in C++ 
that
+this checker is capable of finding.
+
+The checker is currently limited to ``std::string`` objects and doesn't
+recognize some of the more sophisticated approaches to passing unowned pointers
+around, such as ``std::string_view``.
+
+.. code-block:: cpp
+
+ void deref_after_assignment() {
+   std::string s = "llvm";
+   const char *c = s.data(); // note: pointer to inner buffer of 'std::string' 
obtained here
+   s = "clang"; // note: inner buffer of 'std::string' reallocated by call to 
'operator='
+   consume(c); // warn: inner pointer of container used after re/deallocation
+ }
+
+ const char *return_temp(int x) {
+   return std::to_string(x).c_str(); // warn: inner pointer of container used 
after re/deallocation
+   // note: pointer to inner buffer of 'std::string' obtained here
+   // note: inner buffer of 'std::string' deallocated by call to destructor
+ }
+
 .. _cplusplus-NewDelete:
 
 cplusplus.NewDelete (C++)


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


r368980 - [analyzer] Warn about -analyzer-configs being meant for development purposes only

2019-08-15 Thread Kristof Umann via cfe-commits
Author: szelethus
Date: Thu Aug 15 01:53:16 2019
New Revision: 368980

URL: http://llvm.org/viewvc/llvm-project?rev=368980&view=rev
Log:
[analyzer] Warn about -analyzer-configs being meant for development purposes 
only

This is more of a temporary fix, long term, we should convert 
AnalyzerOptions.def
into the universally beloved (*coughs*) TableGen format, where they can more
easily be separated into developer-only, alpha, and user-facing configs.

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

Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=368980&r1=368979&r2=368980&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Aug 15 01:53:16 2019
@@ -140,7 +140,8 @@ def analyzer_checker_help_developer : Fl
"and debug checkers">;
 
 def analyzer_config_help : Flag<["-"], "analyzer-config-help">,
-  HelpText<"Display the list of -analyzer-config options">;
+  HelpText<"Display the list of -analyzer-config options. These are meant for "
+   "development purposes only!">;
 
 def analyzer_list_enabled_checkers : Flag<["-"], 
"analyzer-list-enabled-checkers">,
   HelpText<"Display the list of enabled analyzer checkers">;

Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp?rev=368980&r1=368979&r2=368980&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp Thu Aug 15 
01:53:16 2019
@@ -74,11 +74,22 @@ void ento::printCheckerConfigList(raw_os
 }
 
 void ento::printAnalyzerConfigList(raw_ostream &out) {
-  out << "OVERVIEW: Clang Static Analyzer -analyzer-config Option List\n\n";
-  out << "USAGE: -analyzer-config \n\n";
-  out << "   -analyzer-config OPTION1=VALUE, -analyzer-config "
- "OPTION2=VALUE, ...\n\n";
-  out << "OPTIONS:\n\n";
+  // FIXME: This message sounds scary, should be scary, but incorrectly states
+  // that all configs are super dangerous. In reality, many of them should be
+  // accessible to the user. We should create a user-facing subset of config
+  // options under a different frontend flag.
+  out << R"(
+OVERVIEW: Clang Static Analyzer -analyzer-config Option List
+
+The following list of configurations are meant for development purposes only, 
as
+some of the variables they define are set to result in the most optimal
+analysis. Setting them to other values may drastically change how the analyzer
+behaves, and may even result in instabilities, crashes!
+
+USAGE: -analyzer-config 
+   -analyzer-config OPTION1=VALUE, -analyzer-config OPTION2=VALUE, ...
+OPTIONS:
+)";
 
   using OptionAndDescriptionTy = std::pair;
   OptionAndDescriptionTy PrintableOptions[] = {


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


[PATCH] D60281: [analyzer] Add docs for cplusplus.InnerPointer

2019-08-15 Thread Kristóf Umann via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368979: [analyzer] Add docs for cplusplus.InnerPointer 
(authored by Szelethus, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D60281?vs=215288&id=215343#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D60281

Files:
  cfe/trunk/docs/analyzer/checkers.rst


Index: cfe/trunk/docs/analyzer/checkers.rst
===
--- cfe/trunk/docs/analyzer/checkers.rst
+++ cfe/trunk/docs/analyzer/checkers.rst
@@ -242,10 +242,35 @@
 
 .. _cplusplus-InnerPointer:
 
-cplusplus.InnerPointer
-""
+cplusplus.InnerPointer (C++)
+
 Check for inner pointers of C++ containers used after re/deallocation.
 
+Many container methods in the C++ standard library are known to invalidate
+"references" (including actual references, iterators and raw pointers) to
+elements of the container. Using such references after they are invalidated
+causes undefined behavior, which is a common source of memory errors in C++ 
that
+this checker is capable of finding.
+
+The checker is currently limited to ``std::string`` objects and doesn't
+recognize some of the more sophisticated approaches to passing unowned pointers
+around, such as ``std::string_view``.
+
+.. code-block:: cpp
+
+ void deref_after_assignment() {
+   std::string s = "llvm";
+   const char *c = s.data(); // note: pointer to inner buffer of 'std::string' 
obtained here
+   s = "clang"; // note: inner buffer of 'std::string' reallocated by call to 
'operator='
+   consume(c); // warn: inner pointer of container used after re/deallocation
+ }
+
+ const char *return_temp(int x) {
+   return std::to_string(x).c_str(); // warn: inner pointer of container used 
after re/deallocation
+   // note: pointer to inner buffer of 'std::string' obtained here
+   // note: inner buffer of 'std::string' deallocated by call to destructor
+ }
+
 .. _cplusplus-NewDelete:
 
 cplusplus.NewDelete (C++)


Index: cfe/trunk/docs/analyzer/checkers.rst
===
--- cfe/trunk/docs/analyzer/checkers.rst
+++ cfe/trunk/docs/analyzer/checkers.rst
@@ -242,10 +242,35 @@
 
 .. _cplusplus-InnerPointer:
 
-cplusplus.InnerPointer
-""
+cplusplus.InnerPointer (C++)
+
 Check for inner pointers of C++ containers used after re/deallocation.
 
+Many container methods in the C++ standard library are known to invalidate
+"references" (including actual references, iterators and raw pointers) to
+elements of the container. Using such references after they are invalidated
+causes undefined behavior, which is a common source of memory errors in C++ that
+this checker is capable of finding.
+
+The checker is currently limited to ``std::string`` objects and doesn't
+recognize some of the more sophisticated approaches to passing unowned pointers
+around, such as ``std::string_view``.
+
+.. code-block:: cpp
+
+ void deref_after_assignment() {
+   std::string s = "llvm";
+   const char *c = s.data(); // note: pointer to inner buffer of 'std::string' obtained here
+   s = "clang"; // note: inner buffer of 'std::string' reallocated by call to 'operator='
+   consume(c); // warn: inner pointer of container used after re/deallocation
+ }
+
+ const char *return_temp(int x) {
+   return std::to_string(x).c_str(); // warn: inner pointer of container used after re/deallocation
+   // note: pointer to inner buffer of 'std::string' obtained here
+   // note: inner buffer of 'std::string' deallocated by call to destructor
+ }
+
 .. _cplusplus-NewDelete:
 
 cplusplus.NewDelete (C++)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66261: [analyzer] Warn about -analyzer-configs being meant for development purposes only

2019-08-15 Thread Kristóf Umann via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368980: [analyzer] Warn about -analyzer-configs being meant 
for development purposes… (authored by Szelethus, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66261?vs=215285&id=215344#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66261

Files:
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp


Index: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
@@ -74,11 +74,22 @@
 }
 
 void ento::printAnalyzerConfigList(raw_ostream &out) {
-  out << "OVERVIEW: Clang Static Analyzer -analyzer-config Option List\n\n";
-  out << "USAGE: -analyzer-config \n\n";
-  out << "   -analyzer-config OPTION1=VALUE, -analyzer-config "
- "OPTION2=VALUE, ...\n\n";
-  out << "OPTIONS:\n\n";
+  // FIXME: This message sounds scary, should be scary, but incorrectly states
+  // that all configs are super dangerous. In reality, many of them should be
+  // accessible to the user. We should create a user-facing subset of config
+  // options under a different frontend flag.
+  out << R"(
+OVERVIEW: Clang Static Analyzer -analyzer-config Option List
+
+The following list of configurations are meant for development purposes only, 
as
+some of the variables they define are set to result in the most optimal
+analysis. Setting them to other values may drastically change how the analyzer
+behaves, and may even result in instabilities, crashes!
+
+USAGE: -analyzer-config 
+   -analyzer-config OPTION1=VALUE, -analyzer-config OPTION2=VALUE, ...
+OPTIONS:
+)";
 
   using OptionAndDescriptionTy = std::pair;
   OptionAndDescriptionTy PrintableOptions[] = {
Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -140,7 +140,8 @@
"and debug checkers">;
 
 def analyzer_config_help : Flag<["-"], "analyzer-config-help">,
-  HelpText<"Display the list of -analyzer-config options">;
+  HelpText<"Display the list of -analyzer-config options. These are meant for "
+   "development purposes only!">;
 
 def analyzer_list_enabled_checkers : Flag<["-"], 
"analyzer-list-enabled-checkers">,
   HelpText<"Display the list of enabled analyzer checkers">;


Index: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
@@ -74,11 +74,22 @@
 }
 
 void ento::printAnalyzerConfigList(raw_ostream &out) {
-  out << "OVERVIEW: Clang Static Analyzer -analyzer-config Option List\n\n";
-  out << "USAGE: -analyzer-config \n\n";
-  out << "   -analyzer-config OPTION1=VALUE, -analyzer-config "
- "OPTION2=VALUE, ...\n\n";
-  out << "OPTIONS:\n\n";
+  // FIXME: This message sounds scary, should be scary, but incorrectly states
+  // that all configs are super dangerous. In reality, many of them should be
+  // accessible to the user. We should create a user-facing subset of config
+  // options under a different frontend flag.
+  out << R"(
+OVERVIEW: Clang Static Analyzer -analyzer-config Option List
+
+The following list of configurations are meant for development purposes only, as
+some of the variables they define are set to result in the most optimal
+analysis. Setting them to other values may drastically change how the analyzer
+behaves, and may even result in instabilities, crashes!
+
+USAGE: -analyzer-config 
+   -analyzer-config OPTION1=VALUE, -analyzer-config OPTION2=VALUE, ...
+OPTIONS:
+)";
 
   using OptionAndDescriptionTy = std::pair;
   OptionAndDescriptionTy PrintableOptions[] = {
Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -140,7 +140,8 @@
"and debug checkers">;
 
 def analyzer_config_help : Flag<["-"], "analyzer-config-help">,
-  HelpText<"Display the list of -analyzer-config options">;
+  HelpText<"Display the list of -analyzer-config options. These are meant for "
+   "development purposes only!">;
 
 def analyzer_list_enabled_checkers : Flag<["-"], "analyzer-list-enabled-checkers">,
   HelpText<"Display the list of enabled analyzer checkers">;
___
cfe-commits mailing list
cfe-commits@list

[PATCH] D55562: Atomics: support min/max orthogonally

2019-08-15 Thread Tim Northover via Phabricator via cfe-commits
t.p.northover added a comment.

Ping.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55562



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


[PATCH] D66266: [WIP][RISCV] Set MaxAtomicPromoteWidth and MaxAtomicInlineWidth

2019-08-15 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

Hi Pengxuan,

Thanks for the patch! We have a similar patch from @asb under review at the 
moment, D57450 . There's one question about 
ABI compatibility that still needs to be answered, which we will discuss in the 
RISC-V sync-up later today.

Sam


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66266



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


r368985 - Revert rL368939 "Remove LVALUE / RVALUE workarounds"

2019-08-15 Thread Russell Gallop via cfe-commits
Author: russell_gallop
Date: Thu Aug 15 03:12:11 2019
New Revision: 368985

URL: http://llvm.org/viewvc/llvm-project?rev=368985&view=rev
Log:
Revert rL368939 "Remove LVALUE / RVALUE workarounds"

This reverts commit cad8356d699b36c73abb267f65db575ddacbd652.

To unbreak Windows bots

Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h?rev=368985&r1=368984&r2=368985&view=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h 
Thu Aug 15 03:12:11 2019
@@ -167,7 +167,7 @@ public:
   const ProgramStateRef &getState() const { return State; }
 
   template 
-  Optional getLocationAs() const & {
+  Optional getLocationAs() const LLVM_LVALUE_FUNCTION {
 return Location.getAs();
   }
 


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


r368990 - Replace llvm::integer_sequence and friends with the C++14 standard version

2019-08-15 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Aug 15 03:56:05 2019
New Revision: 368990

URL: http://llvm.org/viewvc/llvm-project?rev=368990&view=rev
Log:
Replace llvm::integer_sequence and friends with the C++14 standard version

The implementation in libc++ takes O(1) compile time, ours was O(n).

Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
cfe/trunk/lib/CodeGen/EHScopeStack.h

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=368990&r1=368989&r2=368990&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Thu Aug 15 
03:56:05 2019
@@ -1334,14 +1334,14 @@ public:
   template  operator Matcher() const {
 return DynTypedMatcher::constructVariadic(
Op, ast_type_traits::ASTNodeKind::getFromNodeKind(),
-   getMatchers(llvm::index_sequence_for()))
+   getMatchers(std::index_sequence_for()))
 .template unconditionalConvertTo();
   }
 
 private:
   // Helper method to unpack the tuple into a vector.
   template 
-  std::vector getMatchers(llvm::index_sequence) const {
+  std::vector getMatchers(std::index_sequence) const {
 return {Matcher(std::get(Params))...};
   }
 

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=368990&r1=368989&r2=368990&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Aug 15 03:56:05 2019
@@ -1621,7 +1621,7 @@ public:
 
 template 
 void emit(const SemaDiagnosticBuilder &DB,
-  llvm::index_sequence) const {
+  std::index_sequence) const {
   // Apply all tuple elements to the builder in order.
   bool Dummy[] = {false, (DB << getPrintable(std::get(Args)))...};
   (void)Dummy;
@@ -1635,7 +1635,7 @@ public:
 
 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
   const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
-  emit(DB, llvm::index_sequence_for());
+  emit(DB, std::index_sequence_for());
   DB << T;
 }
   };

Modified: 
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h?rev=368990&r1=368989&r2=368990&view=diff
==
--- 
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h 
(original)
+++ 
cfe/trunk/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h 
Thu Aug 15 03:56:05 2019
@@ -47,7 +47,7 @@ template  &Requirements,
-llvm::index_sequence) {
+std::index_sequence) {
   // Check if the requirements we're interested in can be evaluated.
   auto Values =
   std::make_tuple(std::get(Requirements).evaluate(Context)...);
@@ -87,7 +87,7 @@ template  &Requirements,
-llvm::index_sequence) {
+std::index_sequence) {
   visitRefactoringOptionsImpl(Visitor, std::get(Requirements)...);
 }
 
@@ -131,7 +131,7 @@ createRefactoringActionRule(const Requir
 RefactoringRuleContext &Context) override {
   internal::invokeRuleAfterValidatingRequirements(
   Consumer, Context, Requirements,
-  llvm::index_sequence_for());
+  std::index_sequence_for());
 }
 
 bool hasSelectionRequirement() override {
@@ -142,7 +142,7 @@ createRefactoringActionRule(const Requir
 void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
   internal::visitRefactoringOptions(
   Visitor, Requirements,
-  llvm::index_sequence_for());
+  std::index_sequence_for());
 }
   private:
 std::tuple Requirements;

Modified: cfe/trunk/lib/CodeGen/EHScopeStack.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/EHScopeStack.h?rev=368990&r1=368989&r2=368990&view=diff
==
--- cfe/trunk/lib/CodeGen/EHScopeStack.h (original)
+++ cfe/trunk/lib/CodeGen/EHScopeStack.h Thu Aug 15 03:56:05 2019
@@ -199,14 +199,14 @@ public:
 SavedTuple Saved;
 
 template 
-T restore(CodeGenFunction &CGF, llvm::index_sequence) {
+T restore(CodeGenFunction &CGF, std::index_sequence) {
   // It's important that the restores are emitted in order. The braced init
   // list guarantees that.
   return T{DominatingValue::restore(CGF, std::get(Saved))...};
 }
 
 void Emit(CodeGenFunction &CGF, Flags flags) overr

[clang-tools-extra] r368990 - Replace llvm::integer_sequence and friends with the C++14 standard version

2019-08-15 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Aug 15 03:56:05 2019
New Revision: 368990

URL: http://llvm.org/viewvc/llvm-project?rev=368990&view=rev
Log:
Replace llvm::integer_sequence and friends with the C++14 standard version

The implementation in libc++ takes O(1) compile time, ours was O(n).

Modified:
clang-tools-extra/trunk/clangd/Function.h
clang-tools-extra/trunk/clangd/unittests/Matchers.h

Modified: clang-tools-extra/trunk/clangd/Function.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Function.h?rev=368990&r1=368989&r2=368990&view=diff
==
--- clang-tools-extra/trunk/clangd/Function.h (original)
+++ clang-tools-extra/trunk/clangd/Function.h Thu Aug 15 03:56:05 2019
@@ -59,14 +59,14 @@ private:
 public:
   template 
   auto operator()(RestArgs &&... Rest)
-  -> decltype(this->CallImpl(llvm::index_sequence_for(),
+  -> decltype(this->CallImpl(std::index_sequence_for(),
  std::forward(Rest)...)) {
 
 #ifndef NDEBUG
 assert(!WasCalled && "Can only call result of Bind once.");
 WasCalled = true;
 #endif
-return CallImpl(llvm::index_sequence_for(),
+return CallImpl(std::index_sequence_for(),
 std::forward(Rest)...);
   }
 };

Modified: clang-tools-extra/trunk/clangd/unittests/Matchers.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/Matchers.h?rev=368990&r1=368989&r2=368990&view=diff
==
--- clang-tools-extra/trunk/clangd/unittests/Matchers.h (original)
+++ clang-tools-extra/trunk/clangd/unittests/Matchers.h Thu Aug 15 03:56:05 2019
@@ -89,12 +89,12 @@ public:
 
   template  operator Matcher &>() const {
 return ::testing::MakeMatcher(new SubsequenceMatcher(
-TypedMatchers(llvm::index_sequence_for{})));
+TypedMatchers(std::index_sequence_for{})));
   }
 
 private:
   template 
-  std::vector> TypedMatchers(llvm::index_sequence) const {
+  std::vector> TypedMatchers(std::index_sequence) const {
 return {std::get(Matchers)...};
   }
 };


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


[clang-tools-extra] r368991 - [clangd] llvm::integer_sequence -> std::integer_sequence.

2019-08-15 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Aug 15 04:09:22 2019
New Revision: 368991

URL: http://llvm.org/viewvc/llvm-project?rev=368991&view=rev
Log:
[clangd] llvm::integer_sequence -> std::integer_sequence.

Modified:
clang-tools-extra/trunk/clangd/Function.h

Modified: clang-tools-extra/trunk/clangd/Function.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Function.h?rev=368991&r1=368990&r2=368991&view=diff
==
--- clang-tools-extra/trunk/clangd/Function.h (original)
+++ clang-tools-extra/trunk/clangd/Function.h Thu Aug 15 04:09:22 2019
@@ -46,7 +46,7 @@ public:
 
 private:
   template 
-  auto CallImpl(llvm::integer_sequence Seq,
+  auto CallImpl(std::integer_sequence Seq,
 RestArgs &&... Rest)
   -> decltype(std::get<0>(this->FuncWithArguments)(
   std::forward(std::get(this->FuncWithArguments))...,


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


[PATCH] D64418: [Docs][OpenCL] Documentation of C++ for OpenCL mode

2019-08-15 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added inline comments.



Comment at: docs/LanguageExtensions.rst:1561
+s3.1.3). For OpenCL it means that implicit conversions are allowed from
+named address space except for ``__constant`` to ``__generic`` address space
+that is a superset of all others except for ``__constant`` (OpenCL C v2.0

"For OpenCL it means that implicit conversions are allowed from a ​named 
address space except for conversion from the ``__constant`` to the 
``__generic`` address space."

I would omit "that is a superset of all others except for ``__constant``" as 
that is already documented in the OpenCL spec and it might confuse readers 
here.  If you want to keep it, I suggest rephrasing it as a separate sentence.



Comment at: docs/LanguageExtensions.rst:1563
+that is a superset of all others except for ``__constant`` (OpenCL C v2.0
+s6.5.5). Reverse conversion is only allowed explicitly.  ``__constant``
+address space does not overlap with any other and therefore no valid conversion

+The+ ``__constant`` address space



Comment at: docs/LanguageExtensions.rst:1570
+
+C style cast will follow OpenCL C v2.0 rules (s6.5.5). All cast operators will
+permit conversion to ``__generic`` implicitly. However converting from

"C-style casts follow"



Comment at: docs/LanguageExtensions.rst:1630
+All non-static member functions take an implicit object parameter ``this`` that
+is a pointer type. By default this pointer parameter is in ``__generic`` 
address
+space. All concrete objects passed as an argument to ``this`` parameter will be

+the+ ``__generic`` address space

(also in the next few lines)



Comment at: docs/LanguageExtensions.rst:1647
+
+Clang allows specifying address space qualifier on member functions to signal 
that
+they are to be used with objects constructed in some specific address space. 
This

+an+ address space qualifier



Comment at: docs/LanguageExtensions.rst:1650
+works just the same as qualifying member functions with ``const`` or any other
+qualifiers. The overloading resolution will select ithe overload with most 
specific
+address space if multiple candidates are provided. If there is no conversion to

ithe -> the



Comment at: docs/LanguageExtensions.rst:1651
+qualifiers. The overloading resolution will select ithe overload with most 
specific
+address space if multiple candidates are provided. If there is no conversion to
+to an address space among existing overloads compilation will fail with a

Duplicate "to" (to to)



Comment at: docs/LanguageExtensions.rst:1652
+address space if multiple candidates are provided. If there is no conversion to
+to an address space among existing overloads compilation will fail with a
+diagnostic.

Add comma:
... overloads, compilation ...



Comment at: docs/LanguageExtensions.rst:1715
+definition and instantiation. If multiple different address spaces are 
specified in
+template definition and instantiation compilation of such a program will fail 
with a
+diagnostic.

Add comma:
... instantiation, compilation ...



Comment at: docs/LanguageExtensions.rst:1730
+
+Once template is instantiated regular restrictions for address spaces will 
apply.
+

Once a template has been instantiated, regular restrictions for address spaces 
will apply.



Comment at: docs/LanguageExtensions.rst:1746
+
+All temporaries are materialized in ``__private`` address space. If a reference
+with some other address space is bound to them, the conversion will be 
generated

the ``__private`` address space



Comment at: docs/LanguageExtensions.rst:1747
+All temporaries are materialized in ``__private`` address space. If a reference
+with some other address space is bound to them, the conversion will be 
generated
+in case it's valid otherwise compilation will fail with a diagnostic.

some other -> another



Comment at: docs/LanguageExtensions.rst:1748
+with some other address space is bound to them, the conversion will be 
generated
+in case it's valid otherwise compilation will fail with a diagnostic.
+

it's -> it is

add comma:
... valid, otherwise ...



Comment at: docs/LanguageExtensions.rst:1776
+API for invoking global constructors. However, an easy workaround would be
+to enqueue constructor initialization kernel that has a name
+``@_GLOBAL__sub_I_``. This kernel is only present if there

enqueue *a* constructor



Comment at: docs/LanguageExtensions.rst:1782
+
+Note that if multiple files are compiled and linked into libraries multiple
+kernels that initialize global objects for multiple modules would have to be
-

[PATCH] D66002: [RISCV] Move architecture parsing code into its own function

2019-08-15 Thread Luís Marques via Phabricator via cfe-commits
luismarques added a comment.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66002



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


[PATCH] D66290: [clang] Pragma vectorize_width() implies vectorize(enable)

2019-08-15 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: Meinersbur, fhahn, hsaito, dorit.

Specifying the vectorization width was supposed to implicitly enable
vectorization, except that it wasn't really doing this. It was only
setting the `vectorize.width` metadata, but not `vectorize.enable`.

 

And related to this, vectorize(disable) was translated to
 `vectorize_width(1)`, but now this simply translates to vectorize.enable = 
false.

 

As also pointed out in the discussion on the cfe dev list, this is probably a 
bit 
of a silly combination:

 
  vectorize(enable) vectorize_width(1)
 

but it could still mean that the vectorizer interleaves. So, with this
simplification, disabled means disabled, and a width of 1 a width of 1.

 

This should also fix PR27643.


https://reviews.llvm.org/D66290

Files:
  clang/lib/CodeGen/CGLoopInfo.cpp
  clang/test/CodeGenCXX/pragma-loop-predicate.cpp
  clang/test/CodeGenCXX/pragma-loop-safety.cpp
  clang/test/CodeGenCXX/pragma-loop.cpp

Index: clang/test/CodeGenCXX/pragma-loop.cpp
===
--- clang/test/CodeGenCXX/pragma-loop.cpp
+++ clang/test/CodeGenCXX/pragma-loop.cpp
@@ -161,31 +161,31 @@
 // CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[UNROLL_FULL:.*]]}
 // CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
 
-// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_8:.*]], ![[INTERLEAVE_4:.*]]}
+// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[VECTORIZE_ENABLE:.*]], ![[WIDTH_8:.*]], ![[INTERLEAVE_4:.*]]}
 // CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}
 // CHECK: ![[DISTRIBUTE_DISABLE]] = !{!"llvm.loop.distribute.enable", i1 false}
+// CHECK: ![[VECTORIZE_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
 // CHECK: ![[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}
 // CHECK: ![[INTERLEAVE_4]] = !{!"llvm.loop.interleave.count", i32 4}
 
-// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], ![[INTENABLE_1:.*]], ![[FOLLOWUP_VECTOR_3:.*]]}
-// CHECK: ![[INTENABLE_1]] = !{!"llvm.loop.vectorize.enable", i1 true}
+// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], ![[VECTORIZE_ENABLE]], ![[FOLLOWUP_VECTOR_3:.*]]}
 // CHECK: ![[FOLLOWUP_VECTOR_3]] = !{!"llvm.loop.vectorize.followup_all", ![[AFTER_VECTOR_3:.*]]}
 // CHECK: ![[AFTER_VECTOR_3]] = distinct !{![[AFTER_VECTOR_3]], ![[ISVECTORIZED:.*]], ![[UNROLL_8:.*]]}
 // CHECK: ![[ISVECTORIZED]] = !{!"llvm.loop.isvectorized"}
 // CHECK: ![[UNROLL_8]] = !{!"llvm.loop.unroll.count", i32 8}
 
-// CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[WIDTH_2:.*]], ![[INTERLEAVE_2:.*]]}
+// CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[VECTORIZE_ENABLE]], ![[WIDTH_2:.*]], ![[INTERLEAVE_2:.*]]}
 // CHECK: ![[WIDTH_2]] = !{!"llvm.loop.vectorize.width", i32 2}
 // CHECK: ![[INTERLEAVE_2]] = !{!"llvm.loop.interleave.count", i32 2}
 
-// CHECK: ![[LOOP_5]] = distinct !{![[LOOP_5]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_1:.*]]}
-// CHECK: ![[WIDTH_1]] = !{!"llvm.loop.vectorize.width", i32 1}
+// CHECK: ![[LOOP_5]] = distinct !{![[LOOP_5]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[VECTORIZE_DISABLE:.*]]}
+// CHECK: ![[VECTORIZE_DISABLE]] = !{!"llvm.loop.vectorize.enable", i1 false}
 
 // CHECK: ![[LOOP_6]] = distinct !{![[LOOP_6]], ![[WIDTH_2:.*]], ![[INTERLEAVE_2:.*]], ![[FOLLOWUP_VECTOR_6:.*]]}
 // CHECK: ![[FOLLOWUP_VECTOR_6]] = !{!"llvm.loop.vectorize.followup_all", ![[AFTER_VECTOR_6:.*]]}
 // CHECK: ![[AFTER_VECTOR_6]] = distinct !{![[AFTER_VECTOR_6]], ![[ISVECTORIZED:.*]], ![[UNROLL_8:.*]]}
 
-// CHECK: ![[LOOP_7]] = distinct !{![[LOOP_7]], ![[WIDTH_5:.*]]}
+// CHECK: ![[LOOP_7]] = distinct !{![[LOOP_7]], ![[VECTORIZE_ENABLE]], ![[WIDTH_5:.*]]}
 // CHECK: ![[WIDTH_5]] = !{!"llvm.loop.vectorize.width", i32 5}
 
 // CHECK: ![[LOOP_8]] = distinct !{![[LOOP_8]], ![[WIDTH_5:.*]]}
@@ -213,5 +213,5 @@
 // CHECK: ![[AFTER_VECTOR_13]] = distinct !{![[AFTER_VECTOR_13]], ![[ISVECTORIZED:.*]], ![[UNROLL_32:.*]]}
 // CHECK: ![[UNROLL_32]] = !{!"llvm.loop.unroll.count", i32 32}
 
-// CHECK: ![[LOOP_14]] = distinct !{![[LOOP_14]], ![[WIDTH_10:.*]]}
+// CHECK: ![[LOOP_14]] = distinct !{![[LOOP_14]], ![[VECTORIZE_ENABLE]], ![[WIDTH_10:.*]]}
 // CHECK: ![[WIDTH_10]] = !{!"llvm.loop.vectorize.width", i32 10}
Index: clang/test/CodeGenCXX/pragma-loop-safety.cpp
===
--- clang/test/CodeGenCXX/pragma-loop-safety.cpp
+++ clang/test/CodeGenCXX/pragma-loop-safety.cpp
@@ -53,6 +53,6 @@
 // CHECK: ![[INTERLEAVE_1]] = !{!"llvm.loop.interleave.count", i32 1}
 // CHECK: ![[INTENABLE_1]] = !{!"llvm.loop.vectorize.enable", i1 true}
 // CHECK: ![[ACCESS_GROUP_8]] = distinct !{}
-// CHECK: ![[LOOP2_HINTS]] = distinct !{![[LOOP2_HINTS]], ![[PARALLEL_ACCESSES_11:[0-9]+]], ![[UNROLL_DISABLE]], ![[WIDTH_1:[0-9]+]], !

[PATCH] D66290: [clang] Pragma vectorize_width() implies vectorize(enable)

2019-08-15 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

> As also pointed out in the discussion on the cfe dev list, this is probably a 
> bit 
>  of a silly combination:
> 
>   
>   vectorize(enable) vectorize_width(1)
>
> 
> but it could still mean that the vectorizer interleaves. So, with this
>  simplification, disabled means disabled, and a width of 1 a width of 1.

It would be good to have a test case for that.


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

https://reviews.llvm.org/D66290



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


[PATCH] D66269: [clang-tidy] Migrate objc-forbidden-subclassing to use isDerivedFrom 🚛

2019-08-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66269



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


[PATCH] D66270: [clang-tidy] Migrate objc-super-self to use isDerivedFrom 🚛

2019-08-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66270



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


[PATCH] D65863: [ARM] Add support for the s,j,x,N,O inline asm constraints

2019-08-15 Thread David Candler via Phabricator via cfe-commits
dcandler added a comment.

Ping. @compnerd any other changes before this could be accepted?


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

https://reviews.llvm.org/D65863



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


[PATCH] D65997: Add options rounding and exceptions to pragma fp

2019-08-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/lib/Parse/ParsePragma.cpp:2678
 
+  auto *AnnotValue = new (PP.getPreprocessorAllocator()) TokFPAnnotValue;
   while (Tok.is(tok::identifier)) {

sepavloff wrote:
> aaron.ballman wrote:
> > Might as well move this down to around line 2710, closer to where it's 
> > used. This way we don't allocate something only to ignore it due to errors 
> > in fewer situations.
> Actually it cannot be closer. It is created just before the loop, in which 
> fields of `*AnnotValue` are read.
Ah, you're right, I didn't see that was inside the loop itself. Nevermind. :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65997



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


[PATCH] D55892: [OpenMP] 'close' map-type-modifier code generation

2019-08-15 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld removed a reviewer: Hahnfeld.
Hahnfeld added a comment.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

Can we close this after D65341  landed?


Repository:
  rC Clang

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

https://reviews.llvm.org/D55892



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


[PATCH] D65819: [Driver][Bundler] Improve bundling of object files.

2019-08-15 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld requested changes to this revision.
Hahnfeld added a comment.
This revision now requires changes to proceed.

The code changes look good to me, but the test doesn't pass on x86. We've faced 
the same problem when `clang-offload-bundler` was initially committed and the 
current testing is the best we were able to do.




Comment at: test/Driver/clang-offload-bundler.c:223-227
 // Check object bundle/unbundle. The content should be bundled into an ELF
 // section (we are using a PowerPC little-endian host which uses ELF). We
 // have an already bundled file to check the unbundle and do a dry run on the
 // bundling as it cannot be tested in all host platforms that will run these
 // tests.

This still holds: I can't partially link PPC object files on x86_64. Please 
revert the test changes to not actually perform the bundling.



Comment at: tools/clang-offload-bundler/ClangOffloadBundler.cpp:373-375
 /// use incremental linking to produce the resulting object. We also add 
section
 /// with a single byte to state the name of the component the main object file
 /// (the one we are bundling into) refers to.

This isn't true anymore.



Comment at: tools/clang-offload-bundler/ClangOffloadBundler.cpp:377
 ///
-/// To unbundle, we use just copy the contents of the designated section. If 
the
-/// requested bundle refer to the main object file, we just copy it with no
-/// changes.
+/// To unbundle, we use just copy the contents of the designated section.
 class ObjectFileHandler final : public FileHandler {

I know this has been wrong before, but can you please fix to `we just copy` 
without `use`?


Repository:
  rC Clang

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

https://reviews.llvm.org/D65819



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


[PATCH] D66290: [clang] Pragma vectorize_width() implies vectorize(enable)

2019-08-15 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer updated this revision to Diff 215388.
SjoerdMeijer edited the summary of this revision.

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

https://reviews.llvm.org/D66290

Files:
  clang/lib/CodeGen/CGLoopInfo.cpp
  clang/test/CodeGenCXX/pragma-loop-predicate.cpp
  clang/test/CodeGenCXX/pragma-loop-safety.cpp
  clang/test/CodeGenCXX/pragma-loop.cpp

Index: clang/test/CodeGenCXX/pragma-loop.cpp
===
--- clang/test/CodeGenCXX/pragma-loop.cpp
+++ clang/test/CodeGenCXX/pragma-loop.cpp
@@ -158,34 +158,53 @@
   for_template_constant_expression_test(List, Length);
 }
 
+void vec_width_1(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}vec_width_1{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_15:.*]]
+
+  #pragma clang loop vectorize(enable) vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+void width_1(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}width_1{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP_16:.*]]
+
+  #pragma clang loop vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+
 // CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[UNROLL_FULL:.*]]}
 // CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
 
-// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_8:.*]], ![[INTERLEAVE_4:.*]]}
+// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[VECTORIZE_ENABLE:.*]], ![[WIDTH_8:.*]], ![[INTERLEAVE_4:.*]]}
 // CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}
 // CHECK: ![[DISTRIBUTE_DISABLE]] = !{!"llvm.loop.distribute.enable", i1 false}
+// CHECK: ![[VECTORIZE_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
 // CHECK: ![[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}
 // CHECK: ![[INTERLEAVE_4]] = !{!"llvm.loop.interleave.count", i32 4}
 
-// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], ![[INTENABLE_1:.*]], ![[FOLLOWUP_VECTOR_3:.*]]}
-// CHECK: ![[INTENABLE_1]] = !{!"llvm.loop.vectorize.enable", i1 true}
+// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], ![[VECTORIZE_ENABLE]], ![[FOLLOWUP_VECTOR_3:.*]]}
 // CHECK: ![[FOLLOWUP_VECTOR_3]] = !{!"llvm.loop.vectorize.followup_all", ![[AFTER_VECTOR_3:.*]]}
 // CHECK: ![[AFTER_VECTOR_3]] = distinct !{![[AFTER_VECTOR_3]], ![[ISVECTORIZED:.*]], ![[UNROLL_8:.*]]}
 // CHECK: ![[ISVECTORIZED]] = !{!"llvm.loop.isvectorized"}
 // CHECK: ![[UNROLL_8]] = !{!"llvm.loop.unroll.count", i32 8}
 
-// CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[WIDTH_2:.*]], ![[INTERLEAVE_2:.*]]}
+// CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[VECTORIZE_ENABLE]], ![[WIDTH_2:.*]], ![[INTERLEAVE_2:.*]]}
 // CHECK: ![[WIDTH_2]] = !{!"llvm.loop.vectorize.width", i32 2}
 // CHECK: ![[INTERLEAVE_2]] = !{!"llvm.loop.interleave.count", i32 2}
 
-// CHECK: ![[LOOP_5]] = distinct !{![[LOOP_5]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_1:.*]]}
-// CHECK: ![[WIDTH_1]] = !{!"llvm.loop.vectorize.width", i32 1}
+// CHECK: ![[LOOP_5]] = distinct !{![[LOOP_5]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[VECTORIZE_DISABLE:.*]]}
+// CHECK: ![[VECTORIZE_DISABLE]] = !{!"llvm.loop.vectorize.enable", i1 false}
 
 // CHECK: ![[LOOP_6]] = distinct !{![[LOOP_6]], ![[WIDTH_2:.*]], ![[INTERLEAVE_2:.*]], ![[FOLLOWUP_VECTOR_6:.*]]}
 // CHECK: ![[FOLLOWUP_VECTOR_6]] = !{!"llvm.loop.vectorize.followup_all", ![[AFTER_VECTOR_6:.*]]}
 // CHECK: ![[AFTER_VECTOR_6]] = distinct !{![[AFTER_VECTOR_6]], ![[ISVECTORIZED:.*]], ![[UNROLL_8:.*]]}
 
-// CHECK: ![[LOOP_7]] = distinct !{![[LOOP_7]], ![[WIDTH_5:.*]]}
+// CHECK: ![[LOOP_7]] = distinct !{![[LOOP_7]], ![[VECTORIZE_ENABLE]], ![[WIDTH_5:.*]]}
 // CHECK: ![[WIDTH_5]] = !{!"llvm.loop.vectorize.width", i32 5}
 
 // CHECK: ![[LOOP_8]] = distinct !{![[LOOP_8]], ![[WIDTH_5:.*]]}
@@ -213,5 +232,9 @@
 // CHECK: ![[AFTER_VECTOR_13]] = distinct !{![[AFTER_VECTOR_13]], ![[ISVECTORIZED:.*]], ![[UNROLL_32:.*]]}
 // CHECK: ![[UNROLL_32]] = !{!"llvm.loop.unroll.count", i32 32}
 
-// CHECK: ![[LOOP_14]] = distinct !{![[LOOP_14]], ![[WIDTH_10:.*]]}
+// CHECK: ![[LOOP_14]] = distinct !{![[LOOP_14]], ![[VECTORIZE_ENABLE]], ![[WIDTH_10:.*]]}
 // CHECK: ![[WIDTH_10]] = !{!"llvm.loop.vectorize.width", i32 10}
+
+// CHECK:  ![[LOOP_15]] = distinct !{![[LOOP_15]], ![[VEC_WIDTH_1:.*]], ![[VECTORIZE_ENABLE]]}
+// CHECK-NEXT: ![[VEC_WIDTH_1]] = !{!"llvm.loop.vectorize.width", i32 1}
+// CHECK-NEXT: ![[LOOP_16]] = distinct !{![[LOOP_16]], ![[VECTORIZE_ENABLE]], ![[VEC_WIDTH_1]]}
Index: clang/test/CodeGenCXX/pragma-loop-safety.cpp
===
--- clang/test/CodeGenCXX/pragma-loop-safety.cpp
+++ clang/test/CodeGenCXX/pragma-loop-safety.cpp
@@ -53,6 +53,6 @@
 // CHECK: ![[INTERLEAVE_1]] = !{!"llvm.loop.interleave.count", i32 1}
 // CHECK: ![[INTENABLE_1]] = !{!"llvm.loop.vectorize.

[PATCH] D66290: [clang] Pragma vectorize_width() implies vectorize(enable)

2019-08-15 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

Thanks for looking again!
Good catch, feedback addressed.

(forgot to add this message when I uploaded the new diff)


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

https://reviews.llvm.org/D66290



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


QualType

2019-08-15 Thread Monalisa Rout via cfe-commits
Hello,
I want to create QualType instances for *const int*, *int* const*,  and *const
int* const.*
How can I do that??

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


[clang-tools-extra] r369005 - [clangd] Don't use Bind() where C++14 move capture works

2019-08-15 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Aug 15 07:16:06 2019
New Revision: 369005

URL: http://llvm.org/viewvc/llvm-project?rev=369005&view=rev
Log:
[clangd] Don't use Bind() where C++14 move capture works

Modified:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/ClangdLSPServer.h
clang-tools-extra/trunk/clangd/ClangdServer.cpp
clang-tools-extra/trunk/clangd/TUScheduler.cpp
clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=369005&r1=369004&r2=369005&view=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Thu Aug 15 07:16:06 2019
@@ -613,9 +613,10 @@ void ClangdLSPServer::onCommand(const Ex
   llvm::inconvertibleErrorCode(),
   "trying to apply a code action for a non-added file"));
 
-auto Action = [this, ApplyEdit, ReplyAfterApplyingEdit](
-  decltype(Reply) Reply, URIForFile File, std::string Code,
-  llvm::Expected R) {
+auto Action = [this, ApplyEdit, ReplyAfterApplyingEdit,
+   Reply = std::move(Reply), File = Params.tweakArgs->file,
+   Code = std::move(*Code)](
+  llvm::Expected R) mutable {
   if (!R)
 return Reply(R.takeError());
 
@@ -636,8 +637,7 @@ void ClangdLSPServer::onCommand(const Ex
 };
 Server->applyTweak(Params.tweakArgs->file.file(),
Params.tweakArgs->selection, Params.tweakArgs->tweakID,
-   Bind(Action, std::move(Reply), Params.tweakArgs->file,
-std::move(*Code)));
+   std::move(Action));
   } else {
 // We should not get here because ExecuteCommandParams would not have
 // parsed in the first place and this handler should not be called. But if
@@ -653,17 +653,15 @@ void ClangdLSPServer::onWorkspaceSymbol(
 Callback> Reply) {
   Server->workspaceSymbols(
   Params.query, CCOpts.Limit,
-  Bind(
-  [this](decltype(Reply) Reply,
- llvm::Expected> Items) {
-if (!Items)
-  return Reply(Items.takeError());
-for (auto &Sym : *Items)
-  Sym.kind = adjustKindToCapability(Sym.kind, 
SupportedSymbolKinds);
-
-Reply(std::move(*Items));
-  },
-  std::move(Reply)));
+  [Reply = std::move(Reply),
+   this](llvm::Expected> Items) mutable {
+if (!Items)
+  return Reply(Items.takeError());
+for (auto &Sym : *Items)
+  Sym.kind = adjustKindToCapability(Sym.kind, SupportedSymbolKinds);
+
+Reply(std::move(*Items));
+  });
 }
 
 void ClangdLSPServer::onPrepareRename(const TextDocumentPositionParams &Params,
@@ -680,19 +678,16 @@ void ClangdLSPServer::onRename(const Ren
 return Reply(llvm::make_error(
 "onRename called for non-added file", ErrorCode::InvalidParams));
 
-  Server->rename(
-  File, Params.position, Params.newName, /*WantFormat=*/true,
-  Bind(
-  [File, Code, Params](decltype(Reply) Reply,
-   llvm::Expected> Edits) {
-if (!Edits)
-  return Reply(Edits.takeError());
-
-WorkspaceEdit WE;
-WE.changes = {{Params.textDocument.uri.uri(), *Edits}};
-Reply(WE);
-  },
-  std::move(Reply)));
+  Server->rename(File, Params.position, Params.newName, /*WantFormat=*/true,
+ [File, Code, Params, Reply = std::move(Reply)](
+ llvm::Expected> Edits) mutable {
+   if (!Edits)
+ return Reply(Edits.takeError());
+
+   WorkspaceEdit WE;
+   WE.changes = {{Params.textDocument.uri.uri(), *Edits}};
+   Reply(WE);
+ });
 }
 
 void ClangdLSPServer::onDocumentDidClose(
@@ -796,18 +791,16 @@ void ClangdLSPServer::onDocumentSymbol(c
   URIForFile FileURI = Params.textDocument.uri;
   Server->documentSymbols(
   Params.textDocument.uri.file(),
-  Bind(
-  [this, FileURI](decltype(Reply) Reply,
-  llvm::Expected> Items) {
-if (!Items)
-  return Reply(Items.takeError());
-adjustSymbolKinds(*Items, SupportedSymbolKinds);
-if (SupportsHierarchicalDocumentSymbol)
-  return Reply(std::move(*Items));
-else
-  return Reply(flattenSymbolHierarchy(*Items, FileURI));
-  },
-  std::move(Reply)));
+  [this, FileURI, Reply = std::move(Reply)](
+  llvm::Expected> Items) mutable {
+if (!Items)
+  return Reply(Items.takeError());
+adjustSymbolKinds(*Items

[PATCH] D66018: [ARM] Take into account -mcpu and -mfpu options while handling 'crypto' feature

2019-08-15 Thread Kristina Bessonova via Phabricator via cfe-commits
krisb updated this revision to Diff 215394.
krisb added a comment.

Applied the comment.


Repository:
  rC Clang

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

https://reviews.llvm.org/D66018

Files:
  lib/Driver/ToolChains/Arch/ARM.cpp
  test/Driver/arm-features.c


Index: test/Driver/arm-features.c
===
--- test/Driver/arm-features.c
+++ test/Driver/arm-features.c
@@ -37,7 +37,7 @@
 // RUN: %clang -target arm-arm-none-eabi -march=armv8.2a+crypto -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-CRYPTO2 %s
 // RUN: %clang -target arm-arm-none-eabi -march=armv8.3a+crypto -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-CRYPTO2 %s
 // RUN: %clang -target arm-arm-none-eabi -march=armv8.4a+crypto -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-CRYPTO2 %s
-// CHECK-CRYPTO2: "-cc1"{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" 
"+crypto" "-target-feature" "+sha2" "-target-feature" "+aes"
+// CHECK-CRYPTO2: "-cc1"{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" 
"+crypto"{{.*}} "-target-feature" "+sha2" "-target-feature" "+aes"
 //
 // Check -crypto:
 //
@@ -47,12 +47,24 @@
 // RUN: %clang -target arm-arm-none-eabi -march=armv8.4a+nocrypto -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO2 %s
 // CHECK-NOCRYPTO2-NOT: "-target-feature" "+crypto" "-target-feature" "+sha2" 
"-target-feature" "+aes"
 //
+// RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-a57+crypto -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-CRYPTO2-CPU %s
+// RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-a57 
-mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-CRYPTO2-CPU %s
+// CHECK-CRYPTO2-CPU: "-cc1"{{.*}} "-target-cpu" "cortex-a57"{{.*}} 
"-target-feature" "+crypto"{{.*}} "-target-feature" "+sha2" "-target-feature" 
"+aes"
+//
+// RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-a57+norypto -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO2-CPU %s
+// RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-a57 -mfpu=neon-fp-armv8 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO2-CPU %s
+// CHECK-NOCRYPTO2-CPU-NOT: "-cc1"{{.*}} "-target-cpu" "cortex-a57"{{.*}} 
"-target-feature" "+crypto"{{.*}} "-target-feature" "+sha2" "-target-feature" 
"+aes"
+//
 // Check +crypto -sha2 -aes:
 //
 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1a+crypto+nosha2+noaes 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO3 %s
+// RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-a57+crypto+nosha2+noaes 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO3 %s
+// RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-a57+nosha2+noaes 
-mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-CRYPTO3 %s
 // CHECK-CRYPTO3-NOT: "-target-feature" "+sha2" "-target-feature" "+aes"
 //
 // Check -crypto +sha2 +aes:
 //
 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1a+nocrypto+sha2+aes 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO4 %s
+// RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-a57+nocrypto+sha2+aes 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO4 %s
+// RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-a57+sha2+aes 
-mfpu=neon-fp-armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO4 %s
 // CHECK-CRYPTO4: "-target-feature" "+sha2" "-target-feature" "+aes"
Index: lib/Driver/ToolChains/Arch/ARM.cpp
===
--- lib/Driver/ToolChains/Arch/ARM.cpp
+++ lib/Driver/ToolChains/Arch/ARM.cpp
@@ -479,21 +479,22 @@
 
   // For Arch >= ARMv8.0:  crypto = sha2 + aes
   // FIXME: this needs reimplementation after the TargetParser rewrite
-  if (ArchName.find_lower("armv8a") != StringRef::npos ||
-  ArchName.find_lower("armv8.1a") != StringRef::npos ||
-  ArchName.find_lower("armv8.2a") != StringRef::npos ||
-  ArchName.find_lower("armv8.3a") != StringRef::npos ||
-  ArchName.find_lower("armv8.4a") != StringRef::npos) {
-if (ArchName.find_lower("+crypto") != StringRef::npos) {
-  if (ArchName.find_lower("+nosha2") == StringRef::npos)
+  llvm::ARM::ArchKind ArchKind = arm::getLLVMArchKindForARM(
+  arm::getARMTargetCPU(CPUName, ArchName, Triple),
+  arm::getARMArch(ArchName, Triple), Triple);
+
+  if (ArchKind == llvm::ARM::ArchKind::ARMV8A ||
+  ArchKind == llvm::ARM::ArchKind::ARMV8_1A ||
+  ArchKind == llvm::ARM::ArchKind::ARMV8_2A ||
+  ArchKind == llvm::ARM::ArchKind::ARMV8_3A ||
+  ArchKind == llvm::ARM::ArchKind::ARMV8_4A) {
+if (find(Features, "+crypto") != Features.end()) {
+  if (ArchName.find_lower("+nosha2") == StringRef::npos &&
+  CPUName.find_lower("+nosha2") == StringRef::npos)
 Features.push_back("+sha2");
-  if (ArchName.find_lower("+noaes") == StringRef::npos)
+  if (ArchName.find_lower("+noaes") == StringRef::npos &&
+  CPUName.find_lower("+noaes") == StringRef::npos)
 Features.push_back(

[PATCH] D66018: [ARM] Take into account -mcpu and -mfpu options while handling 'crypto' feature

2019-08-15 Thread Kristina Bessonova via Phabricator via cfe-commits
krisb added a comment.

@dnsampaio, thanks, this looks better.


Repository:
  rC Clang

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

https://reviews.llvm.org/D66018



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


[PATCH] D66294: [Docs][OpenCL] Release 9.0 notes for OpenCL

2019-08-15 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added reviewers: svenvh, mantognini, hans.
Herald added subscribers: ebevhan, jfb, yaxunl.

https://reviews.llvm.org/D66294

Files:
  docs/ReleaseNotes.rst

Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -46,6 +46,8 @@
 Major New Features
 --
 
+- Full experimental support of :ref:`C++ for OpenCL ` has
+  been added.
 - ...
 
 Improvements to Clang's diagnostics
@@ -133,6 +135,14 @@
 C++ Language Changes in Clang
 -
 
+- Support of address space attribute in various C++ features was improved, refer
+  to :ref:`C++ for OpenCL ` for more details). The following features
+  deviated from OpenCL:
+
+  (1) address spaces as method qualifiers are not accepted yet;
+
+  (2) There is no address space deduction.
+
 - ...
 
 C++1z Feature Support
@@ -152,10 +162,84 @@
   // clang used to encode this as "^{NSArray=#}" instead of "@".
   const char *s0 = @encode(MyArray *);
 
-OpenCL C Language Changes in Clang
---
+OpenCL Kernel Language Changes in Clang
+---
+
+OpenCL C
+
+
+- Enabled use of variadic macro as a Clang extension.
+
+- Added initial support for implicitly including OpenCL BIFs using
+  efficient trie lookup generated by TableGen. A corresponding
+  frontend only flag ``-fadd-opencl-builtins`` has been added to
+  enable trie during parsing.
+
+- Refactored header file to be used for common parts between
+  regular header and TableGen trie.
+
+- Improved string formatting diagnostics in printf for vector types.
+
+- Simplified representation of blocks including their generation in
+  IR i.e. indirect calls to block function has been changed to
+  direct function calls.
+
+- Added diagnostics for conversions of nested pointers with
+  different address spaces.
+
+- Added ``cl_arm_integer_dot_product`` extension.
+
+- Fixed global samplers in OpenCL v2.0.
+
+- Improved math builtin function of long long for x86.
+
+.. _openclcpp:
+
+C++ for OpenCL
+^^
+
+Full experimental support for C++17 features in OpenCL has been
+added and backwards compatibility to OpenCL C v2.0 was enabled.
+The documentation has been added for supported language features
+into :doc:`LanguageExtensions` and :doc:`UsersManual`. 
+
+Implemented features are:
+- Address space behavior is improved in majority of C++ features:
+
+- Templates parameters and arguments
+
+  - Reference types;
+
+  - Type deduction;
+
+  - Objects and member functions including special member
+functions;
+
+  - Builtin operators;
+
+  - Method qualifiers are allowed with address spaces;
+
+  - Address space deduction has been extended for C++ use cases;
+
+  - Improved overload ranking rules.
+
+  - Cast operators are now preventing to converting address
+spaces. They can still be cast using C style cast.
+
+- Vector types as in OpenCL C including compound vector
+  initialization.
+
+- OpenCL specific type: images, samplers, events, pipes, except
+  for blocks.
+
+- OpenCL standard header in Clang can be compiled in C++ mode.
+
+- Global constructor stab is made an executable kernel to allow
+  invoking it from the host side.
+
+- Overloads with generic address space are added to all atomics
+  including the ones from prior to OpenCL v2.0.
 
-...
 
 ABI Changes in Clang
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65819: [Driver][Bundler] Improve bundling of object files.

2019-08-15 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 215399.
ABataev added a comment.

Fixed comments.


Repository:
  rC Clang

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

https://reviews.llvm.org/D65819

Files:
  test/Driver/clang-offload-bundler.c
  test/Driver/clang-offload-bundler.c.o
  tools/clang-offload-bundler/ClangOffloadBundler.cpp

Index: tools/clang-offload-bundler/ClangOffloadBundler.cpp
===
--- tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -370,13 +370,9 @@
 /// designated name.
 ///
 /// In order to bundle we create an IR file with the content of each section and
-/// use incremental linking to produce the resulting object. We also add section
-/// with a single byte to state the name of the component the main object file
-/// (the one we are bundling into) refers to.
+/// use incremental linking to produce the resulting object.
 ///
-/// To unbundle, we use just copy the contents of the designated section. If the
-/// requested bundle refer to the main object file, we just copy it with no
-/// changes.
+/// To unbundle, we just copy the contents of the designated section.
 class ObjectFileHandler final : public FileHandler {
 
   /// The object file we are currently dealing with.
@@ -471,10 +467,7 @@
   return;
 }
 
-if (Content->size() < 2)
-  OS.write(Input.getBufferStart(), Input.getBufferSize());
-else
-  OS.write(Content->data(), Content->size());
+OS.write(Content->data(), Content->size());
   }
 
   void WriteHeader(raw_fd_ostream &OS,
@@ -592,22 +585,14 @@
 std::string SectionName = OFFLOAD_BUNDLER_MAGIC_STR;
 SectionName += CurrentTriple;
 
-// Create the constant with the content of the section. For the input we are
-// bundling into (the host input), this is just a place-holder, so a single
-// byte is sufficient.
-assert(HostInputIndex != ~0u && "Host input index undefined??");
-Constant *Content;
-if (NumberOfProcessedInputs == HostInputIndex + 1) {
-  uint8_t Byte[] = {0};
-  Content = ConstantDataArray::get(VMContext, Byte);
-} else
-  Content = ConstantDataArray::get(
-  VMContext, ArrayRef(reinterpret_cast(
-   Input.getBufferStart()),
-   Input.getBufferSize()));
-
-// Create the global in the desired section. We don't want these globals in
-// the symbol table, so we mark them private.
+// Create the constant with the content of the section.
+auto *Content = ConstantDataArray::get(
+VMContext, ArrayRef(reinterpret_cast(
+ Input.getBufferStart()),
+ Input.getBufferSize()));
+
+// Create the global in the desired section. We don't want these globals
+// in the symbol table, so we mark them private.
 auto *GV = new GlobalVariable(*M, Content->getType(), /*IsConstant=*/true,
   GlobalVariable::PrivateLinkage, Content);
 GV->setSection(SectionName);
Index: test/Driver/clang-offload-bundler.c
===
--- test/Driver/clang-offload-bundler.c
+++ test/Driver/clang-offload-bundler.c
@@ -1,16 +1,18 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: powerpc-registered-target
+// REQUIRES: shell
+// UNSUPPORTED: ms-sdk
 
 //
 // Generate all the types of files we can bundle.
 //
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -E -o %t.i
-// RUN: %clangxx -O0 -target powerpc64le-ibm-linux-gnu -x c++ %s -E -o %t.ii
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -emit-llvm -o %t.ll
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -emit-llvm -o %t.bc
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -o %t.s
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -o %t.o
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -emit-ast -o %t.ast
+// RUN: %clang -O0 -target %itanium_abi_triple %s -E -o %t.i
+// RUN: %clangxx -O0 -target %itanium_abi_triple -x c++ %s -E -o %t.ii
+// RUN: %clang -O0 -target %itanium_abi_triple %s -S -emit-llvm -o %t.ll
+// RUN: %clang -O0 -target %itanium_abi_triple %s -c -emit-llvm -o %t.bc
+// RUN: %clang -O0 -target %itanium_abi_triple %s -S -o %t.s
+// RUN: %clang -O0 -target %itanium_abi_triple %s -c -o %t.o
+// RUN: %clang -O0 -target %itanium_abi_triple %s -emit-ast -o %t.ast
 
 //
 // Generate an empty file to help with the checks of empty files.
@@ -50,27 +52,27 @@
 //
 // Check errors.
 //
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_tripl

[PATCH] D65819: [Driver][Bundler] Improve bundling of object files.

2019-08-15 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D65819#1631410 , @Hahnfeld wrote:

> The code changes look good to me, but the test doesn't pass on x86. We've 
> faced the same problem when `clang-offload-bundler` was initially committed 
> and the current testing is the best we were able to do.


I reworked the test to make it more portable, try to test it on x86


Repository:
  rC Clang

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

https://reviews.llvm.org/D65819



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


[PATCH] D65819: [Driver][Bundler] Improve bundling of object files.

2019-08-15 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

Please submit the test changes unrelated to the code changes in a separate 
patch!


Repository:
  rC Clang

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

https://reviews.llvm.org/D65819



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


[PATCH] D66296: [BUNDLER]Improve the test, NFC.

2019-08-15 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev created this revision.
ABataev added reviewers: Hahnfeld, hfinkel.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

Make the test more portable and do not rely on the pre-bundled object
file.


Repository:
  rC Clang

https://reviews.llvm.org/D66296

Files:
  test/Driver/clang-offload-bundler.c
  test/Driver/clang-offload-bundler.c.o

Index: test/Driver/clang-offload-bundler.c
===
--- test/Driver/clang-offload-bundler.c
+++ test/Driver/clang-offload-bundler.c
@@ -1,16 +1,18 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: powerpc-registered-target
+// REQUIRES: shell
+// UNSUPPORTED: ms-sdk
 
 //
 // Generate all the types of files we can bundle.
 //
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -E -o %t.i
-// RUN: %clangxx -O0 -target powerpc64le-ibm-linux-gnu -x c++ %s -E -o %t.ii
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -emit-llvm -o %t.ll
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -emit-llvm -o %t.bc
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -o %t.s
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -o %t.o
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -emit-ast -o %t.ast
+// RUN: %clang -O0 -target %itanium_abi_triple %s -E -o %t.i
+// RUN: %clangxx -O0 -target %itanium_abi_triple -x c++ %s -E -o %t.ii
+// RUN: %clang -O0 -target %itanium_abi_triple %s -S -emit-llvm -o %t.ll
+// RUN: %clang -O0 -target %itanium_abi_triple %s -c -emit-llvm -o %t.bc
+// RUN: %clang -O0 -target %itanium_abi_triple %s -S -o %t.s
+// RUN: %clang -O0 -target %itanium_abi_triple %s -c -o %t.o
+// RUN: %clang -O0 -target %itanium_abi_triple %s -emit-ast -o %t.ast
 
 //
 // Generate an empty file to help with the checks of empty files.
@@ -50,27 +52,27 @@
 //
 // Check errors.
 //
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1
 // CK-ERR1: error: only one input file supported in unbundling mode.
 // CK-ERR1: error: number of output files and targets should match in unbundling mode.
 
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
 // CK-ERR2: error: number of input files and targets should match in bundling mode.
 
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR3
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR3
 // CK-ERR3: error: only one output file supported in bundling mode.
 // CK-ERR3: error: number of input files and targets should match in bundling mode.
 
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
 // CK-ERR4

[PATCH] D66298: [clang-doc] Fix records in global namespace

2019-08-15 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran created this revision.
DiegoAstiazaran added reviewers: juliehockett, jakehehrlich.
DiegoAstiazaran added a project: clang-tools-extra.

When a Record is declared in the global namespace, clang-doc serializes it as a 
child of the global namespace, so the global namespace is now one if its parent 
namespaces. This namespace was not being included in the list of namespaces of 
the Info causing paths to be incorrect and the index rendered incorrectly.
Affected tests have been fixed.


https://reviews.llvm.org/D66298

Files:
  clang-tools-extra/clang-doc/Serialize.cpp
  clang-tools-extra/test/clang-doc/single-file-public.cpp
  clang-tools-extra/unittests/clang-doc/SerializeTest.cpp

Index: clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
===
--- clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
+++ clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
@@ -136,7 +136,9 @@
10, /*Public=*/false, Infos);
 
   RecordInfo *E = InfoAsRecord(Infos[0].get());
-  RecordInfo ExpectedE(EmptySID, "E");
+  RecordInfo ExpectedE(EmptySID, /*Name=*/"E", /*Path=*/"GlobalNamespace");
+  ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
+   InfoType::IT_namespace);
   ExpectedE.TagType = TagTypeKind::TTK_Class;
   ExpectedE.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
   CheckRecordInfo(&ExpectedE, E);
@@ -149,6 +151,8 @@
   EConstructor.ReturnType = TypeInfo(EmptySID, "void", InfoType::IT_default);
   EConstructor.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
   EConstructor.Namespace.emplace_back(EmptySID, "E", InfoType::IT_record);
+  EConstructor.Namespace.emplace_back(EmptySID, "GlobalNamespace",
+  InfoType::IT_namespace);
   EConstructor.Access = AccessSpecifier::AS_public;
   EConstructor.IsMethod = true;
   ExpectedRecordWithEConstructor.ChildFunctions.emplace_back(
@@ -163,13 +167,17 @@
   Method.ReturnType = TypeInfo(EmptySID, "void", InfoType::IT_default);
   Method.Loc.emplace_back(0, llvm::SmallString<16>{"test.cpp"});
   Method.Namespace.emplace_back(EmptySID, "E", InfoType::IT_record);
+  Method.Namespace.emplace_back(EmptySID, "GlobalNamespace",
+InfoType::IT_namespace);
   Method.Access = AccessSpecifier::AS_protected;
   Method.IsMethod = true;
   ExpectedRecordWithMethod.ChildFunctions.emplace_back(std::move(Method));
   CheckRecordInfo(&ExpectedRecordWithMethod, RecordWithMethod);
 
   RecordInfo *F = InfoAsRecord(Infos[4].get());
-  RecordInfo ExpectedF(EmptySID, "F");
+  RecordInfo ExpectedF(EmptySID, /*Name=*/"F", /*Path=*/"GlobalNamespace");
+  ExpectedF.Namespace.emplace_back(EmptySID, "GlobalNamespace",
+   InfoType::IT_namespace);
   ExpectedF.TagType = TagTypeKind::TTK_Struct;
   ExpectedF.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
   CheckRecordInfo(&ExpectedF, F);
@@ -182,6 +190,8 @@
   TemplateMethod.ReturnType = TypeInfo(EmptySID, "void", InfoType::IT_default);
   TemplateMethod.Loc.emplace_back(0, llvm::SmallString<16>{"test.cpp"});
   TemplateMethod.Namespace.emplace_back(EmptySID, "F", InfoType::IT_record);
+  TemplateMethod.Namespace.emplace_back(EmptySID, "GlobalNamespace",
+InfoType::IT_namespace);
   TemplateMethod.Access = AccessSpecifier::AS_public;
   TemplateMethod.IsMethod = true;
   ExpectedRecordWithTemplateMethod.ChildFunctions.emplace_back(
@@ -200,6 +210,8 @@
  llvm::SmallString<16>{"test.cpp"});
   SpecializedTemplateMethod.Namespace.emplace_back(EmptySID, "F",
InfoType::IT_record);
+  SpecializedTemplateMethod.Namespace.emplace_back(EmptySID, "GlobalNamespace",
+   InfoType::IT_namespace);
   SpecializedTemplateMethod.Access = AccessSpecifier::AS_public;
   SpecializedTemplateMethod.IsMethod = true;
   ExpectedTemplatedRecord.ChildFunctions.emplace_back(
@@ -207,7 +219,9 @@
   CheckRecordInfo(&ExpectedTemplatedRecord, TemplatedRecord);
 
   RecordInfo *G = InfoAsRecord(Infos[8].get());
-  RecordInfo ExpectedG(EmptySID, "G");
+  RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/"GlobalNamespace");
+  ExpectedG.Namespace.emplace_back(EmptySID, "GlobalNamespace",
+   InfoType::IT_namespace);
   ExpectedG.TagType = TagTypeKind::TTK_Struct;
   ExpectedG.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
   ExpectedG.IsTypeDef = true;
@@ -247,7 +261,9 @@
   ExtractInfosFromCode("class E;", 2, /*Public=*/false, Infos);
 
   RecordInfo *E = InfoAsRecord(Infos[0].get());
-  RecordInfo ExpectedE(EmptySID, "E");
+  RecordInfo ExpectedE(EmptySID, /*Name=*/"E", /*Path=*/"GlobalNamespace");
+  ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
+

[PATCH] D66299: [clang-doc] Sort index elements case insensitive

2019-08-15 Thread Diego Astiazarán via Phabricator via cfe-commits
DiegoAstiazaran created this revision.
DiegoAstiazaran added reviewers: juliehockett, jakehehrlich.
DiegoAstiazaran added a project: clang-tools-extra.
Herald added a subscriber: arphaman.

Implement logic to compare the references of the index case insensitive.


https://reviews.llvm.org/D66299

Files:
  clang-tools-extra/clang-doc/Representation.cpp
  clang-tools-extra/clang-doc/Representation.h
  clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp


Index: clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp
===
--- clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp
+++ clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp
@@ -70,5 +70,24 @@
   CheckIndex(ExpectedIdx, Idx);
 }
 
+TEST(GeneratorTest, sortIndex) {
+  Index Idx;
+  Idx.Children.emplace_back("b");
+  Idx.Children.emplace_back("aA");
+  Idx.Children.emplace_back("aa");
+  Idx.Children.emplace_back("A");
+  Idx.Children.emplace_back("a");
+  Idx.sort();
+
+  Index ExpectedIdx;
+  ExpectedIdx.Children.emplace_back("a");
+  ExpectedIdx.Children.emplace_back("A");
+  ExpectedIdx.Children.emplace_back("aa");
+  ExpectedIdx.Children.emplace_back("aA");
+  ExpectedIdx.Children.emplace_back("b");
+
+  CheckIndex(ExpectedIdx, Idx);
+}
+
 } // namespace doc
 } // namespace clang
Index: clang-tools-extra/clang-doc/Representation.h
===
--- clang-tools-extra/clang-doc/Representation.h
+++ clang-tools-extra/clang-doc/Representation.h
@@ -291,7 +291,8 @@
   SymbolInfo(InfoType IT) : Info(IT) {}
   SymbolInfo(InfoType IT, SymbolID USR) : Info(IT, USR) {}
   SymbolInfo(InfoType IT, SymbolID USR, StringRef Name) : Info(IT, USR, Name) 
{}
-  SymbolInfo(InfoType IT, SymbolID USR, StringRef Name, StringRef Path) : 
Info(IT, USR, Name, Path) {}
+  SymbolInfo(InfoType IT, SymbolID USR, StringRef Name, StringRef Path)
+  : Info(IT, USR, Name, Path) {}
 
   void merge(SymbolInfo &&I);
 
@@ -364,13 +365,14 @@
 
 struct Index : public Reference {
   Index() = default;
+  Index(StringRef Name) : Reference(Name) {}
   Index(StringRef Name, StringRef JumpToSection)
   : Reference(Name), JumpToSection(JumpToSection) {}
   Index(SymbolID USR, StringRef Name, InfoType IT, StringRef Path)
   : Reference(USR, Name, IT, Path) {}
   // This is used to look for a USR in a vector of Indexes using std::find
   bool operator==(const SymbolID &Other) const { return USR == Other; }
-  bool operator<(const Index &Other) const { return Name < Other.Name; }
+  bool operator<(const Index &Other) const;
 
   llvm::Optional> JumpToSection;
   std::vector Children;
Index: clang-tools-extra/clang-doc/Representation.cpp
===
--- clang-tools-extra/clang-doc/Representation.cpp
+++ clang-tools-extra/clang-doc/Representation.cpp
@@ -245,6 +245,26 @@
   return llvm::SmallString<16>("");
 }
 
+// Order is based on the Name attribute: case insensitive order
+bool Index::operator<(const Index &Other) const {
+  // Loop through each character of both strings
+  for (unsigned I = 0; I < Name.size() && I < Other.Name.size(); ++I) {
+// Compare them after converting both to lower case
+int D = tolower(Name[I]) - tolower(Other.Name[I]);
+if (D == 0)
+  continue;
+return D < 0;
+  }
+  // If both strings have the size it means they would be equal if changed to
+  // lower case. In here, lower case will be smaller than upper case
+  // Example: string < stRing = true
+  // This is the opposite of how operator < handles strings
+  if (Name.size() == Other.Name.size())
+return Name > Other.Name;
+  // If they are not the same size; the shorter string is smaller
+  return Name.size() < Other.Name.size();
+}
+
 void Index::sort() {
   std::sort(Children.begin(), Children.end());
   for (auto &C : Children)


Index: clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp
===
--- clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp
+++ clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp
@@ -70,5 +70,24 @@
   CheckIndex(ExpectedIdx, Idx);
 }
 
+TEST(GeneratorTest, sortIndex) {
+  Index Idx;
+  Idx.Children.emplace_back("b");
+  Idx.Children.emplace_back("aA");
+  Idx.Children.emplace_back("aa");
+  Idx.Children.emplace_back("A");
+  Idx.Children.emplace_back("a");
+  Idx.sort();
+
+  Index ExpectedIdx;
+  ExpectedIdx.Children.emplace_back("a");
+  ExpectedIdx.Children.emplace_back("A");
+  ExpectedIdx.Children.emplace_back("aa");
+  ExpectedIdx.Children.emplace_back("aA");
+  ExpectedIdx.Children.emplace_back("b");
+
+  CheckIndex(ExpectedIdx, Idx);
+}
+
 } // namespace doc
 } // namespace clang
Index: clang-tools-extra/clang-doc/Representation.h
===
--- clang-tools-extra/clang-doc/Representation.h
+++ clang-tools-extra/clang-doc/Representation.

[PATCH] D66296: [BUNDLER]Improve the test, NFC.

2019-08-15 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld accepted this revision.
Hahnfeld added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rC Clang

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

https://reviews.llvm.org/D66296



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


[PATCH] D66294: [Docs][OpenCL] Release 9.0 notes for OpenCL

2019-08-15 Thread Marco Antognini via Phabricator via cfe-commits
mantognini requested changes to this revision.
mantognini added a comment.
This revision now requires changes to proceed.

The overall structure seems alright. I'll let people more familiar with the 
code-base judge whether other important features should be added there as well.




Comment at: docs/ReleaseNotes.rst:49
 
+- Full experimental support of :ref:`C++ for OpenCL ` has
+  been added.

"Full experimental" feels like an oxymoron. I would drop the "full".



Comment at: docs/ReleaseNotes.rst:49
 
+- Full experimental support of :ref:`C++ for OpenCL ` has
+  been added.

mantognini wrote:
> "Full experimental" feels like an oxymoron. I would drop the "full".
"support of" -> "support for"



Comment at: docs/ReleaseNotes.rst:138
 
+- Support of address space attribute in various C++ features was improved, 
refer
+  to :ref:`C++ for OpenCL ` for more details). The following 
features

Support //for// address space attribute//s// [...] improved //(refer// [...]

Alternatively, if you don't want to use parenthesis, drop the closing 
parenthesis on the next line.



Comment at: docs/ReleaseNotes.rst:142
+
+  (1) address spaces as method qualifiers are not accepted yet;
+

Inconsistent sentence capitalization between the two bullet points.



Comment at: docs/ReleaseNotes.rst:173
+
+- Added initial support for implicitly including OpenCL BIFs using
+  efficient trie lookup generated by TableGen. A corresponding

If the BIF acronym wasn't introduced before, it should be replaced with 
"builtin functions". It seems we don't have more file context in this review so 
I cannot tell.



Comment at: docs/ReleaseNotes.rst:175
+  efficient trie lookup generated by TableGen. A corresponding
+  frontend only flag ``-fadd-opencl-builtins`` has been added to
+  enable trie during parsing.

I'm not 100% sure about the grammar rule in English, but shouldn't there be a 
"-" between "frontend" and "only" here to make it an adjective-ish?



Comment at: docs/ReleaseNotes.rst:183
+
+- Simplified representation of blocks including their generation in
+  IR i.e. indirect calls to block function has been changed to

Simplified //the// representation of blocks//**,**// including their generation 
//into// IR. //Furthermore,// indirect calls [...]

(I'm assuming here that the indirect calls to block function is not the only 
improvement. And even if it is, "i.e." is less impressive, isn't it?)



Comment at: docs/ReleaseNotes.rst:194
+
+- Improved math builtin function of long long for x86.
+

Maybe this would be better?

Improved math builtin functions with parameters of type `long long` for x86.





Comment at: docs/ReleaseNotes.rst:201
+
+Full experimental support for C++17 features in OpenCL has been
+added and backwards compatibility to OpenCL C v2.0 was enabled.

Ditto, I would drop "full" here.



Comment at: docs/ReleaseNotes.rst:202
+Full experimental support for C++17 features in OpenCL has been
+added and backwards compatibility to OpenCL C v2.0 was enabled.
+The documentation has been added for supported language features

compatible //with//



Comment at: docs/ReleaseNotes.rst:209
+
+- Templates parameters and arguments
+

Did you meant to indent this bullet point as well?



Comment at: docs/ReleaseNotes.rst:215
+
+  - Objects and member functions including special member
+functions;

Missing comma: "functions, including"



Comment at: docs/ReleaseNotes.rst:220
+
+  - Method qualifiers are allowed with address spaces;
+

Maybe something along these line would be better?

Methods can be overloaded for different address spaces.

Or, if you want to emphasis the qualifiers,

Method qualifiers now include address space.



Comment at: docs/ReleaseNotes.rst:222
+
+  - Address space deduction has been extended for C++ use cases;
+

This seems to be already included in previous point.



Comment at: docs/ReleaseNotes.rst:226
+
+  - Cast operators are now preventing to converting address
+spaces. They can still be cast using C style cast.

Which "cast" operators?



Comment at: docs/ReleaseNotes.rst:226
+
+  - Cast operators are now preventing to converting address
+spaces. They can still be cast using C style cast.

mantognini wrote:
> Which "cast" operators?
[...] are now prevent//ed from// converting [...]



Comment at: docs/ReleaseNotes.rst:229
+
+- Vector types as in OpenCL C including compound vector
+  initialization.

missing comma: "C, including"



C

[PATCH] D65634: [RISCV] Default to ilp32d/lp64d in RISC-V Linux

2019-08-15 Thread Luís Marques via Phabricator via cfe-commits
luismarques added inline comments.



Comment at: clang/lib/Driver/ToolChains/Arch/RISCV.cpp:386
+  else
+return Triple.getArch() == llvm::Triple::riscv32 ? "ilp32" : "lp64";
 }

When I compile a bare metal GNU toolchain (using 
, reports GCC 8.3.0) I seem to 
get lp64d by default. Should we not match that behaviour?

```

$ cat test.c
float foo() { return 42.0; }
$ riscv64-unknown-elf-gcc -O2 -S test.c
$ cat test.s
(...)
foo:
lui a5,%hi(.LC0)
flw fa0,%lo(.LC0)(a5)
(...)
```


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

https://reviews.llvm.org/D65634



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


[PATCH] D66294: [Docs][OpenCL] Release 9.0 notes for OpenCL

2019-08-15 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added inline comments.



Comment at: docs/ReleaseNotes.rst:173
+
+- Added initial support for implicitly including OpenCL BIFs using
+  efficient trie lookup generated by TableGen. A corresponding

mantognini wrote:
> If the BIF acronym wasn't introduced before, it should be replaced with 
> "builtin functions". It seems we don't have more file context in this review 
> so I cannot tell.
BIFs -> built-in functions



Comment at: docs/ReleaseNotes.rst:175
+  efficient trie lookup generated by TableGen. A corresponding
+  frontend only flag ``-fadd-opencl-builtins`` has been added to
+  enable trie during parsing.

mantognini wrote:
> I'm not 100% sure about the grammar rule in English, but shouldn't there be a 
> "-" between "frontend" and "only" here to make it an adjective-ish?
The flag is called `-fdeclare-opencl-builtins` (not -fadd...).



Comment at: docs/ReleaseNotes.rst:176
+  frontend only flag ``-fadd-opencl-builtins`` has been added to
+  enable trie during parsing.
+

The option does not only "enable a trie" during parsing.  I'd suggest to just 
drop "to enable trie during parsing".



Comment at: docs/ReleaseNotes.rst:179
+- Refactored header file to be used for common parts between
+  regular header and TableGen trie.
+

Refactored the `opencl-c.h` header file ...

TableGen trie -> `-fdeclare-opencl-builtins`.


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

https://reviews.llvm.org/D66294



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


[PATCH] D65634: [RISCV] Default to ilp32d/lp64d in RISC-V Linux

2019-08-15 Thread Luís Marques via Phabricator via cfe-commits
luismarques added inline comments.



Comment at: clang/lib/Driver/ToolChains/Arch/RISCV.cpp:386
+  else
+return Triple.getArch() == llvm::Triple::riscv32 ? "ilp32" : "lp64";
 }

luismarques wrote:
> When I compile a bare metal GNU toolchain (using 
> , reports GCC 8.3.0) I seem to 
> get lp64d by default. Should we not match that behaviour?
> 
> ```
> 
> $ cat test.c
> float foo() { return 42.0; }
> $ riscv64-unknown-elf-gcc -O2 -S test.c
> $ cat test.s
> (...)
> foo:
> lui a5,%hi(.LC0)
> flw fa0,%lo(.LC0)(a5)
> (...)
> ```
To clarify, that's a toolchain configured with `--enable-multilib`.


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

https://reviews.llvm.org/D65634



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


[PATCH] D66298: [clang-doc] Fix records in global namespace

2019-08-15 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: clang-tools-extra/unittests/clang-doc/SerializeTest.cpp:299
   RecordInfo *G = InfoAsRecord(Infos[2].get());
-  RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/"E");
+  RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/"GlobalNamespace/E");
   ExpectedG.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});

Native path?



Comment at: clang-tools-extra/unittests/clang-doc/SerializeTest.cpp:434
   ExpectedParentB.ChildRecords.emplace_back(EmptySID, "B", InfoType::IT_record,
-"A");
+"GlobalNamespace/A");
   CheckRecordInfo(&ExpectedParentB, ParentB);

Native path?


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

https://reviews.llvm.org/D66298



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


[PATCH] D66302: [SVE][Inline-Asm] Support for SVE asm operands

2019-08-15 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin created this revision.
kmclaughlin added reviewers: t.p.northover, sdesmalen, rovka, momchil.velikov.
Herald added subscribers: psnobl, rkruppe, tschuett, javed.absar.
Herald added a reviewer: rengolin.
Herald added a project: LLVM.

Adds the following inline asm constraints for SVE:

- w: SVE vector register with full range, Z0 to Z31
- x: Restricted to registers Z0 to Z15 inclusive.
- y: Restricted to registers Z0 to Z7 inclusive.

This change also adds the "z" modifier to interpret a register as an SVE 
register.

Not all of the bitconvert patterns added by this patch are used, but they have 
been included here for completeness.


Repository:
  rL LLVM

https://reviews.llvm.org/D66302

Files:
  docs/LangRef.rst
  lib/Target/AArch64/AArch64AsmPrinter.cpp
  lib/Target/AArch64/AArch64ISelLowering.cpp
  lib/Target/AArch64/AArch64InstrInfo.cpp
  lib/Target/AArch64/AArch64SVEInstrInfo.td
  test/CodeGen/AArch64/aarch64-sve-asm.ll
  test/CodeGen/AArch64/arm64-inline-asm.ll

Index: test/CodeGen/AArch64/arm64-inline-asm.ll
===
--- test/CodeGen/AArch64/arm64-inline-asm.ll
+++ test/CodeGen/AArch64/arm64-inline-asm.ll
@@ -138,6 +138,8 @@
   %a = alloca [2 x float], align 4
   %arraydecay = getelementptr inbounds [2 x float], [2 x float]* %a, i32 0, i32 0
   %0 = load <2 x float>, <2 x float>* %data, align 8
+  call void asm sideeffect "ldr ${1:z}, [$0]\0A", "r,w"(float* %arraydecay, <2 x float> %0) nounwind
+  ; CHECK: ldr {{z[0-9]+}}, [{{x[0-9]+}}]
   call void asm sideeffect "ldr ${1:q}, [$0]\0A", "r,w"(float* %arraydecay, <2 x float> %0) nounwind
   ; CHECK: ldr {{q[0-9]+}}, [{{x[0-9]+}}]
   call void asm sideeffect "ldr ${1:d}, [$0]\0A", "r,w"(float* %arraydecay, <2 x float> %0) nounwind
Index: test/CodeGen/AArch64/aarch64-sve-asm.ll
===
--- /dev/null
+++ test/CodeGen/AArch64/aarch64-sve-asm.ll
@@ -0,0 +1,46 @@
+; RUN: llc < %s -mtriple aarch64-none-linux-gnu -mattr=+sve -stop-after=finalize-isel | FileCheck %s --check-prefix=CHECK
+
+target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64-none-linux-gnu"
+
+; Function Attrs: nounwind readnone
+; CHECK: [[ARG1:%[0-9]+]]:zpr = COPY $z1
+; CHECK: [[ARG2:%[0-9]+]]:zpr = COPY $z0
+; CHECK: [[ARG3:%[0-9]+]]:zpr = COPY [[ARG2]]
+; CHECK: [[ARG4:%[0-9]+]]:zpr_3b = COPY [[ARG1]]
+define  @test_svadd_i8( %Zn,  %Zm) {
+  %1 = tail call  asm "add $0.b, $1.b, $2.b", "=w,w,y"( %Zn,  %Zm)
+  ret  %1
+}
+
+; Function Attrs: nounwind readnone
+; CHECK: [[ARG1:%[0-9]+]]:zpr = COPY $z1
+; CHECK: [[ARG2:%[0-9]+]]:zpr = COPY $z0
+; CHECK: [[ARG3:%[0-9]+]]:zpr = COPY [[ARG2]]
+; CHECK: [[ARG4:%[0-9]+]]:zpr_4b = COPY [[ARG1]]
+define  @test_svsub_i64( %Zn,  %Zm) {
+  %1 = tail call  asm "sub $0.d, $1.d, $2.d", "=w,w,x"( %Zn,  %Zm)
+  ret  %1
+}
+
+; Function Attrs: nounwind readnone
+; CHECK: [[ARG1:%[0-9]+]]:zpr = COPY $z1
+; CHECK: [[ARG2:%[0-9]+]]:zpr = COPY $z0
+; CHECK: [[ARG3:%[0-9]+]]:zpr = COPY [[ARG2]]
+; CHECK: [[ARG4:%[0-9]+]]:zpr_3b = COPY [[ARG1]]
+define  @test_svfmul_f16( %Zn,  %Zm) {
+  %1 = tail call  asm "fmul $0.h, $1.h, $2.h", "=w,w,y"( %Zn,  %Zm)
+  ret  %1
+}
+
+; Function Attrs: nounwind readnone
+; CHECK: [[ARG1:%[0-9]+]]:zpr = COPY $z1
+; CHECK: [[ARG2:%[0-9]+]]:zpr = COPY $z0
+; CHECK: [[ARG3:%[0-9]+]]:zpr = COPY [[ARG2]]
+; CHECK: [[ARG4:%[0-9]+]]:zpr_4b = COPY [[ARG1]]
+define  @test_svfmul_f( %Zn,  %Zm) {
+  %1 = tail call  asm "fmul $0.s, $1.s, $2.s", "=w,w,x"( %Zn,  %Zm)
+  ret  %1
+}
+
+!0 = !{i32 188, i32 210}
Index: lib/Target/AArch64/AArch64SVEInstrInfo.td
===
--- lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -1020,6 +1020,56 @@
   (FCMGT_PPzZZ_S PPR32:$Zd, PPR3bAny:$Pg, ZPR32:$Zn, ZPR32:$Zm), 0>;
   def : InstAlias<"fcmlt $Zd, $Pg/z, $Zm, $Zn",
   (FCMGT_PPzZZ_D PPR64:$Zd, PPR3bAny:$Pg, ZPR64:$Zn, ZPR64:$Zm), 0>;
+
+  def : Pat<(nxv16i8 (bitconvert (nxv8i16 ZPR:$src))), (nxv16i8 ZPR:$src)>;
+  def : Pat<(nxv16i8 (bitconvert (nxv4i32 ZPR:$src))), (nxv16i8 ZPR:$src)>;
+  def : Pat<(nxv16i8 (bitconvert (nxv2i64 ZPR:$src))), (nxv16i8 ZPR:$src)>;
+  def : Pat<(nxv16i8 (bitconvert (nxv8f16 ZPR:$src))), (nxv16i8 ZPR:$src)>;
+  def : Pat<(nxv16i8 (bitconvert (nxv4f32 ZPR:$src))), (nxv16i8 ZPR:$src)>;
+  def : Pat<(nxv16i8 (bitconvert (nxv2f64 ZPR:$src))), (nxv16i8 ZPR:$src)>;
+
+  def : Pat<(nxv8i16 (bitconvert (nxv16i8 ZPR:$src))), (nxv8i16 ZPR:$src)>;
+  def : Pat<(nxv8i16 (bitconvert (nxv4i32 ZPR:$src))), (nxv8i16 ZPR:$src)>;
+  def : Pat<(nxv8i16 (bitconvert (nxv2i64 ZPR:$src))), (nxv8i16 ZPR:$src)>;
+  def : Pat<(nxv8i16 (bitconvert (nxv8f16 ZPR:$src))), (nxv8i16 ZPR:$src)>;
+  def : Pat<(nxv8i16 (bitconvert (nxv4f32 ZPR:$src))), (nxv8i16 ZPR:$src)>;
+  def : Pat<(nxv8i16 (bitconvert (nxv2f64 ZPR:$src))), (nxv8i16 ZPR:$src)>;
+
+  def : Pat<(nxv4i32 

[PATCH] D52524: Add -Wno-poison-system-directories flag

2019-08-15 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Ok, makes sense, thanks for explaining. Please add a summary of that discussion 
to the patch description / commit message :)


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

https://reviews.llvm.org/D52524



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


[PATCH] D66040: [Sema] Implement DR2386 for C++17 structured binding

2019-08-15 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

rnk, what's the status here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66040



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


[PATCH] D66040: [Sema] Implement DR2386 for C++17 structured binding

2019-08-15 Thread Reid Kleckner via Phabricator via cfe-commits
rnk marked an inline comment as done.
rnk added a comment.

In D66040#1631658 , @thakis wrote:

> rnk, what's the status here?


I think I can get this in today, things just got busy here and I forgot about 
this. I have to add that test.




Comment at: clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp:15
 template<> struct std::tuple_size {};
-void no_tuple_size_3() { auto [x, y] = Bad1(); } // expected-error {{cannot 
decompose this type; 'std::tuple_size::value' is not a valid integral 
constant expression}}
+void no_tuple_size_3() { auto [x, y] = Bad1(); } // ok, omitting value is 
valid after DR2386
 

Jeroen wrote:
> In the reproduction of https://bugs.llvm.org/show_bug.cgi?id=33236 there is 
> explicit mentioning of `const T`. It would be nice if the test cases for this 
> fix would also have coverage for that.
I'll work it into the dr2386 test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66040



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


[PATCH] D66303: [LifetimeAnalysis] Add support for free functions

2019-08-15 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun created this revision.
xazax.hun added reviewers: mgehre, gribozavr.
xazax.hun added a project: clang.
Herald added subscribers: Szelethus, Charusso, gamesh411, dkrupp, rnkovacs.

This patch adds support to the idiom when people using the free version of 
`begin`, `end` and the like instead of the member functions. Moreover, some 
containers, like `any` or `variant` only support this idiom.

Once this patch is accepted we do not anticipate adding more hard coded rules. 
Hopefully, they will all be subsumed by function annotations in the future.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66303

Files:
  clang/lib/Sema/SemaInit.cpp
  clang/test/Sema/warn-lifetime-analysis-nocfg.cpp

Index: clang/test/Sema/warn-lifetime-analysis-nocfg.cpp
===
--- clang/test/Sema/warn-lifetime-analysis-nocfg.cpp
+++ clang/test/Sema/warn-lifetime-analysis-nocfg.cpp
@@ -131,13 +131,16 @@
 }
 
 namespace std {
-template struct remove_reference   { typedef T type; };
-template struct remove_reference  { typedef T type; };
-template struct remove_reference { typedef T type; };
+template struct remove_reference   { typedef T type; };
+template struct remove_reference  { typedef T type; };
+template struct remove_reference { typedef T type; };
 
-template
+template
 typename remove_reference::type &&move(T &&t) noexcept;
 
+template 
+auto data(const C &c) -> decltype(c.data());
+
 template 
 struct vector {
   typedef __gnu_cxx::basic_iterator iterator;
@@ -182,6 +185,11 @@
 struct stack {
   T &top();
 };
+
+struct any {};
+
+template
+T any_cast(const any& operand);
 }
 
 void modelIterators() {
@@ -193,6 +201,22 @@
   return std::vector().begin(); // expected-warning {{returning address of local temporary object}}
 }
 
+const int *modelFreeFunctions() {
+  return std::data(std::vector()); // expected-warning {{returning address of local temporary object}}
+}
+
+int &modelAnyCast() {
+  return std::any_cast(std::any{}); // expected-warning {{returning reference to local temporary object}}
+}
+
+int modelAnyCast2() {
+  return std::any_cast(std::any{}); // ok
+}
+
+int modelAnyCast3() {
+  return std::any_cast(std::any{}); // ok
+}
+
 const char *danglingRawPtrFromLocal() {
   std::basic_string s;
   return s.c_str(); // expected-warning {{address of stack memory associated with local variable 's' returned}}
Index: clang/lib/Sema/SemaInit.cpp
===
--- clang/lib/Sema/SemaInit.cpp
+++ clang/lib/Sema/SemaInit.cpp
@@ -6616,6 +6616,30 @@
   return false;
 }
 
+static bool shouldTrackFirstArgument(const FunctionDecl *FD) {
+  if (!FD->getIdentifier())
+return false;
+  const auto *RD = FD->getParamDecl(0)->getType()->getPointeeCXXRecordDecl();
+  if (!FD->isInStdNamespace() || !RD || !RD->isInStdNamespace())
+return false;
+  if (!isRecordWithAttr(QualType(RD->getTypeForDecl(), 0)) &&
+  !isRecordWithAttr(QualType(RD->getTypeForDecl(), 0)))
+return false;
+  if (FD->getReturnType()->isPointerType() ||
+  isRecordWithAttr(FD->getReturnType())) {
+return llvm::StringSwitch(FD->getName())
+.Cases("begin", "rbegin", "cbegin", "crbegin", true)
+.Cases("end", "rend", "cend", "crend", true)
+.Case("data", true)
+.Default(false);
+  } else if (FD->getReturnType()->isReferenceType()) {
+return llvm::StringSwitch(FD->getName())
+.Cases("get", "any_cast", true)
+.Default(false);
+  }
+  return false;
+}
+
 static void handleGslAnnotatedTypes(IndirectLocalPath &Path, Expr *Call,
 LocalVisitor Visit) {
   auto VisitPointerArg = [&](const Decl *D, Expr *Arg) {
@@ -6639,6 +6663,12 @@
 shouldTrackImplicitObjectArg(cast(Callee)))
   VisitPointerArg(Callee, OCE->getArg(0));
 return;
+  } else if (auto *CE = dyn_cast(Call)) {
+FunctionDecl *Callee = CE->getDirectCallee();
+if (Callee && Callee->getNumParams() == 1 &&
+shouldTrackFirstArgument(Callee))
+  VisitPointerArg(Callee, CE->getArg(0));
+return;
   }
 
   if (auto *CCE = dyn_cast(Call)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66003: [RISCV] Make -march=rv{32, 64}gc the default in RISC-V Linux

2019-08-15 Thread Luís Marques via Phabricator via cfe-commits
luismarques accepted this revision.
luismarques added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66003



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


r369015 - [BUNDLER]Improve the test, NFC.

2019-08-15 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Aug 15 09:28:24 2019
New Revision: 369015

URL: http://llvm.org/viewvc/llvm-project?rev=369015&view=rev
Log:
[BUNDLER]Improve the test, NFC.

Summary:
Make the test more portable and do not rely on the pre-bundled object
file.

Reviewers: Hahnfeld, hfinkel, jdoerfert

Subscribers: caomhin, kkwli0, cfe-commits

Tags: #clang

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

Removed:
cfe/trunk/test/Driver/clang-offload-bundler.c.o
Modified:
cfe/trunk/test/Driver/clang-offload-bundler.c

Modified: cfe/trunk/test/Driver/clang-offload-bundler.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=369015&r1=369014&r2=369015&view=diff
==
--- cfe/trunk/test/Driver/clang-offload-bundler.c (original)
+++ cfe/trunk/test/Driver/clang-offload-bundler.c Thu Aug 15 09:28:24 2019
@@ -1,16 +1,18 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: powerpc-registered-target
+// REQUIRES: shell
+// UNSUPPORTED: ms-sdk
 
 //
 // Generate all the types of files we can bundle.
 //
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -E -o %t.i
-// RUN: %clangxx -O0 -target powerpc64le-ibm-linux-gnu -x c++ %s -E -o %t.ii
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -emit-llvm -o %t.ll
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -emit-llvm -o %t.bc
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -o %t.s
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -o %t.o
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -emit-ast -o %t.ast
+// RUN: %clang -O0 -target %itanium_abi_triple %s -E -o %t.i
+// RUN: %clangxx -O0 -target %itanium_abi_triple -x c++ %s -E -o %t.ii
+// RUN: %clang -O0 -target %itanium_abi_triple %s -S -emit-llvm -o %t.ll
+// RUN: %clang -O0 -target %itanium_abi_triple %s -c -emit-llvm -o %t.bc
+// RUN: %clang -O0 -target %itanium_abi_triple %s -S -o %t.s
+// RUN: %clang -O0 -target %itanium_abi_triple %s -c -o %t.o
+// RUN: %clang -O0 -target %itanium_abi_triple %s -emit-ast -o %t.ast
 
 //
 // Generate an empty file to help with the checks of empty files.
@@ -50,27 +52,27 @@
 //
 // Check errors.
 //
-// RUN: not clang-offload-bundler -type=i 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck 
%s --check-prefix CK-ERR1
+// RUN: not clang-offload-bundler -type=i 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck 
%s --check-prefix CK-ERR1
 // CK-ERR1: error: only one input file supported in unbundling mode.
 // CK-ERR1: error: number of output files and targets should match in 
unbundling mode.
 
-// RUN: not clang-offload-bundler -type=i 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu 
-inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s 
--check-prefix CK-ERR2
-// RUN: not clang-offload-bundler -type=i 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.i,%t.tgt1 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix 
CK-ERR2
+// RUN: not clang-offload-bundler -type=i 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu 
-inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s 
--check-prefix CK-ERR2
+// RUN: not clang-offload-bundler -type=i 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.i,%t.tgt1 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix 
CK-ERR2
 // CK-ERR2: error: number of input files and targets should match in bundling 
mode.
 
-// RUN: not clang-offload-bundler -type=i 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i 2>&1 | FileCheck %s 
--check-prefix CK-ERR3
+// RUN: not clang-offload-bundler -type=i 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i 2>&1 | FileCheck %s 
--check-prefix CK-ERR3
 // CK-ERR3: error: only one output file supported in bundling mode.
 // CK-ERR3: error: number of input files and targets should match in bundling 
mode.
 
-// RUN: not clang-offload-bundler -type=i 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu 
-outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s 
--check-prefix CK-ERR4
-// RUN: not clang-offload-bundler -type=i 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.i,%t.tgt1 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s 
--check-prefix CK-ERR4
+// RUN: not clang-offload-bundler -type=i 
-tar

[PATCH] D66014: [analyzer] Avoid unnecessary enum range check on LValueToRValue casts

2019-08-15 Thread Chris Hamilton via Phabricator via cfe-commits
chrish_ericsson_atx marked 5 inline comments as done.
chrish_ericsson_atx added a comment.

In D66014#1627858 , @Szelethus wrote:

> LGTM, thanks! Do you need someone to commit this on your behalf? Also, could 
> you please make the comments capitalized, terminated, and fitting in 80 
> columns?


I have updated the comments and line formatting as you recommended.  Given that 
this change is already "Accepted", can I (should I) upload new differential for 
this change, or should this be delivered as-is, and I'll upload the new diffs 
as a new/separate change?

And yes, I will need someone to commit on my behalf.  I'm too new to have 
commit privs. :)


Repository:
  rC Clang

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

https://reviews.llvm.org/D66014



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


[PATCH] D66296: [BUNDLER]Improve the test, NFC.

2019-08-15 Thread Alexey Bataev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369015: [BUNDLER]Improve the test, NFC. (authored by 
ABataev, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66296

Files:
  cfe/trunk/test/Driver/clang-offload-bundler.c
  cfe/trunk/test/Driver/clang-offload-bundler.c.o

Index: cfe/trunk/test/Driver/clang-offload-bundler.c
===
--- cfe/trunk/test/Driver/clang-offload-bundler.c
+++ cfe/trunk/test/Driver/clang-offload-bundler.c
@@ -1,16 +1,18 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: powerpc-registered-target
+// REQUIRES: shell
+// UNSUPPORTED: ms-sdk
 
 //
 // Generate all the types of files we can bundle.
 //
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -E -o %t.i
-// RUN: %clangxx -O0 -target powerpc64le-ibm-linux-gnu -x c++ %s -E -o %t.ii
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -emit-llvm -o %t.ll
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -emit-llvm -o %t.bc
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -o %t.s
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -o %t.o
-// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -emit-ast -o %t.ast
+// RUN: %clang -O0 -target %itanium_abi_triple %s -E -o %t.i
+// RUN: %clangxx -O0 -target %itanium_abi_triple -x c++ %s -E -o %t.ii
+// RUN: %clang -O0 -target %itanium_abi_triple %s -S -emit-llvm -o %t.ll
+// RUN: %clang -O0 -target %itanium_abi_triple %s -c -emit-llvm -o %t.bc
+// RUN: %clang -O0 -target %itanium_abi_triple %s -S -o %t.s
+// RUN: %clang -O0 -target %itanium_abi_triple %s -c -o %t.o
+// RUN: %clang -O0 -target %itanium_abi_triple %s -emit-ast -o %t.ast
 
 //
 // Generate an empty file to help with the checks of empty files.
@@ -50,27 +52,27 @@
 //
 // Check errors.
 //
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1
 // CK-ERR1: error: only one input file supported in unbundling mode.
 // CK-ERR1: error: number of output files and targets should match in unbundling mode.
 
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -inputs=%t.i,%t.tgt1 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
 // CK-ERR2: error: number of input files and targets should match in bundling mode.
 
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR3
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR3
 // CK-ERR3: error: only one output file supported in bundling mode.
 // CK-ERR3: error: number of input files and targets should match in bundling mode.
 
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
-// RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -outputs=%t.i,%t.tgt1 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
+// RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux

[PATCH] D66014: [analyzer] Avoid unnecessary enum range check on LValueToRValue casts

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

Yup, you can upload it and the green checkmark will stay. If it doesn't, I'll 
accept again.

I think there was one case when I added like 800 extra LOCs to a patch and 
phabricator automatically marked it as "needs reviews", but I never came across 
this after that, even when I completely rewrote the entire thing.


Repository:
  rC Clang

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

https://reviews.llvm.org/D66014



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


[PATCH] D65819: [Driver][Bundler] Improve bundling of object files.

2019-08-15 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 215421.
ABataev added a comment.

Rebase


Repository:
  rC Clang

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

https://reviews.llvm.org/D65819

Files:
  test/Driver/clang-offload-bundler.c
  tools/clang-offload-bundler/ClangOffloadBundler.cpp


Index: tools/clang-offload-bundler/ClangOffloadBundler.cpp
===
--- tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -370,13 +370,9 @@
 /// designated name.
 ///
 /// In order to bundle we create an IR file with the content of each section 
and
-/// use incremental linking to produce the resulting object. We also add 
section
-/// with a single byte to state the name of the component the main object file
-/// (the one we are bundling into) refers to.
+/// use incremental linking to produce the resulting object.
 ///
-/// To unbundle, we use just copy the contents of the designated section. If 
the
-/// requested bundle refer to the main object file, we just copy it with no
-/// changes.
+/// To unbundle, we just copy the contents of the designated section.
 class ObjectFileHandler final : public FileHandler {
 
   /// The object file we are currently dealing with.
@@ -471,10 +467,7 @@
   return;
 }
 
-if (Content->size() < 2)
-  OS.write(Input.getBufferStart(), Input.getBufferSize());
-else
-  OS.write(Content->data(), Content->size());
+OS.write(Content->data(), Content->size());
   }
 
   void WriteHeader(raw_fd_ostream &OS,
@@ -592,22 +585,14 @@
 std::string SectionName = OFFLOAD_BUNDLER_MAGIC_STR;
 SectionName += CurrentTriple;
 
-// Create the constant with the content of the section. For the input we 
are
-// bundling into (the host input), this is just a place-holder, so a single
-// byte is sufficient.
-assert(HostInputIndex != ~0u && "Host input index undefined??");
-Constant *Content;
-if (NumberOfProcessedInputs == HostInputIndex + 1) {
-  uint8_t Byte[] = {0};
-  Content = ConstantDataArray::get(VMContext, Byte);
-} else
-  Content = ConstantDataArray::get(
-  VMContext, ArrayRef(reinterpret_cast(
-   Input.getBufferStart()),
-   Input.getBufferSize()));
-
-// Create the global in the desired section. We don't want these globals in
-// the symbol table, so we mark them private.
+// Create the constant with the content of the section.
+auto *Content = ConstantDataArray::get(
+VMContext, ArrayRef(reinterpret_cast(
+ Input.getBufferStart()),
+ Input.getBufferSize()));
+
+// Create the global in the desired section. We don't want these globals
+// in the symbol table, so we mark them private.
 auto *GV = new GlobalVariable(*M, Content->getType(), /*IsConstant=*/true,
   GlobalVariable::PrivateLinkage, Content);
 GV->setSection(SectionName);
Index: test/Driver/clang-offload-bundler.c
===
--- test/Driver/clang-offload-bundler.c
+++ test/Driver/clang-offload-bundler.c
@@ -231,18 +231,18 @@
 
 // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.o,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.o -### -dump-temporary-files 
2>&1 \
 // RUN: | FileCheck %s --check-prefix CK-OBJ-CMD
-// CK-OBJ-CMD: private constant [1 x i8] zeroinitializer, section 
"__CLANG_OFFLOAD_BUNDLE__host-[[HOST:.+]]"
+// CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"{{.+}}", section 
"__CLANG_OFFLOAD_BUNDLE__host-[[HOST:.+]]"
 // CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"Content of device file 
1{{.+}}", section "__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu"
 // CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"Content of device file 
2{{.+}}", section "__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu"
 // CK-OBJ-CMD: clang{{(.exe)?}}" "-r" "-target" "[[HOST]]" "-o" "{{.+}}.o" 
"{{.+}}.o" "{{.+}}.bc" "-nostdlib"
 
 // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.o,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.o
 // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.o -unbundle
-// RUN: diff %t.bundle3.o %t.res.o
+// RUN: diff %t.o %t.res.o
 // RUN: diff %t.tgt1 %t.res.tgt1
 // RUN: diff %t.tgt2 %t.res.tgt2
 // RUN: clang-offload-bundler -type=o 
-targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.tgt1,%t.res.o,%t.res.tgt2 -inputs=%t.bundle3.o -unbundle
-// RUN: 

[PATCH] D66014: [analyzer] Avoid unnecessary enum range check on LValueToRValue casts

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

Oh, there is no need for a new differential, you can update this one by 
clicking on 'update diff' in the right panel.


Repository:
  rC Clang

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

https://reviews.llvm.org/D66014



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


Re: r368874 - Document clang-cpp in the release notes for clang

2019-08-15 Thread Chris Bieneman via cfe-commits
It actually does not. Getting the MSVC export list is a much harder problem. 
I'll update the release note.

-Chris

> On Aug 14, 2019, at 10:32 PM, Kim Gräsman  wrote:
> 
> On Wed, Aug 14, 2019 at 6:48 PM Chris Bieneman via cfe-commits
>  wrote:
>> 
>> Author: cbieneman
>> Date: Wed Aug 14 09:49:52 2019
>> New Revision: 368874
>> --  ...
>> +- In 9.0.0 and later Clang added a new target, clang-cpp, which generates a
>> +  shared library comprised of all the clang component libraries and 
>> exporting
>> +  the clang C++ APIs. Additionally the build system gained the new
>> +  "CLANG_LINK_CLANG_DYLIB" option, which defaults Off, and when set to On, 
>> will
>> +  force clang (and clang-based tools) to link the clang-cpp library instead 
>> of
>> +  statically linking clang's components. This option will reduce the size of
>> +  binary distributions at the expense of compiler performance.
> 
> Does this also work for Windows/MSVC builds?
> 
> Thanks,
> - Kim

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


[PATCH] D65819: [Driver][Bundler] Improve bundling of object files.

2019-08-15 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld accepted this revision.
Hahnfeld added a comment.
This revision is now accepted and ready to land.

LG, thanks for the changes.


Repository:
  rC Clang

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

https://reviews.llvm.org/D65819



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


r369019 - [Driver][Bundler] Improve bundling of object files.

2019-08-15 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Aug 15 10:15:35 2019
New Revision: 369019

URL: http://llvm.org/viewvc/llvm-project?rev=369019&view=rev
Log:
[Driver][Bundler] Improve bundling of object files.

Summary:
Previously, object files were bundled using partial linking. It resulted
in the following structure of the bundled objects:
```

clang-offload-bundle
__CLANG_OFFLOAD_BUNDLE__

```
But when we tried to unbundle object files, it worked correctly only for
the target objects. The host object remains bundled. It produced a lot of
junk sections in the host object files and in some cases may caused
incorrect linking.

Patch improves bundling of the object files. After this patch the
bundled object looks like this:

```

clang-offload-bundle
__CLANG_OFFLOAD_BUNDLE__

__CLANG_OFFLOAD_BUNDLE__

```

With this structure we are able to unbundle the host object files too so
that after unbundling they are the same as were before.
The host section is bundled twice. The bundled section is used to
unbundle the original host section.

Reviewers: yaxunl, tra, jlebar, hfinkel, jdoerfert

Subscribers: caomhin, kkwli0, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/test/Driver/clang-offload-bundler.c
cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp

Modified: cfe/trunk/test/Driver/clang-offload-bundler.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=369019&r1=369018&r2=369019&view=diff
==
--- cfe/trunk/test/Driver/clang-offload-bundler.c (original)
+++ cfe/trunk/test/Driver/clang-offload-bundler.c Thu Aug 15 10:15:35 2019
@@ -231,18 +231,18 @@
 
 // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.o,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.o -### -dump-temporary-files 
2>&1 \
 // RUN: | FileCheck %s --check-prefix CK-OBJ-CMD
-// CK-OBJ-CMD: private constant [1 x i8] zeroinitializer, section 
"__CLANG_OFFLOAD_BUNDLE__host-[[HOST:.+]]"
+// CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"{{.+}}", section 
"__CLANG_OFFLOAD_BUNDLE__host-[[HOST:.+]]"
 // CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"Content of device file 
1{{.+}}", section "__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu"
 // CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"Content of device file 
2{{.+}}", section "__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu"
 // CK-OBJ-CMD: clang{{(.exe)?}}" "-r" "-target" "[[HOST]]" "-o" "{{.+}}.o" 
"{{.+}}.o" "{{.+}}.bc" "-nostdlib"
 
 // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.o,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.o
 // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.o -unbundle
-// RUN: diff %t.bundle3.o %t.res.o
+// RUN: diff %t.o %t.res.o
 // RUN: diff %t.tgt1 %t.res.tgt1
 // RUN: diff %t.tgt2 %t.res.tgt2
 // RUN: clang-offload-bundler -type=o 
-targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.tgt1,%t.res.o,%t.res.tgt2 -inputs=%t.bundle3.o -unbundle
-// RUN: diff %t.bundle3.o %t.res.o
+// RUN: diff %t.o %t.res.o
 // RUN: diff %t.tgt1 %t.res.tgt1
 // RUN: diff %t.tgt2 %t.res.tgt2
 

Modified: cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp?rev=369019&r1=369018&r2=369019&view=diff
==
--- cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp (original)
+++ cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp Thu Aug 15 
10:15:35 2019
@@ -370,13 +370,9 @@ public:
 /// designated name.
 ///
 /// In order to bundle we create an IR file with the content of each section 
and
-/// use incremental linking to produce the resulting object. We also add 
section
-/// with a single byte to state the name of the component the main object file
-/// (the one we are bundling into) refers to.
+/// use incremental linking to produce the resulting object.
 ///
-/// To unbundle, we use just copy the contents of the designated section. If 
the
-/// requested bundle refer to the main object file, we just copy it with no
-/// changes.
+/// To unbundle, we just copy the contents of the designated section.
 class ObjectFileHandler final : public FileHandler {
 
   /// The object file we are currently dealing with.
@@ -471,10 +467,7 @@ public:
   return;
 }
 
-if (Content->size() < 2)
-  OS.write(Input.getBufferStart(), Input.getBufferSize());
-else
-  OS.write(Content->data(), Content->size());
+OS.write(Content->data(), C

r369020 - Test commit #2.

2019-08-15 Thread George Karpenkov via cfe-commits
Author: george.karpenkov
Date: Thu Aug 15 10:17:21 2019
New Revision: 369020

URL: http://llvm.org/viewvc/llvm-project?rev=369020&view=rev
Log:
Test commit #2.

Modified:
cfe/trunk/www/index.html

Modified: cfe/trunk/www/index.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/index.html?rev=369020&r1=369019&r2=369020&view=diff
==
--- cfe/trunk/www/index.html (original)
+++ cfe/trunk/www/index.html Thu Aug 15 10:17:21 2019
@@ -105,6 +105,7 @@
  interested in
  following the development of Clang, signing up for a mailing list is a 
good
  way to learn about how the project works.
+
 
 
 


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


[PATCH] D65819: [Driver][Bundler] Improve bundling of object files.

2019-08-15 Thread Alexey Bataev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369019: [Driver][Bundler] Improve bundling of object files. 
(authored by ABataev, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65819

Files:
  cfe/trunk/test/Driver/clang-offload-bundler.c
  cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp


Index: cfe/trunk/test/Driver/clang-offload-bundler.c
===
--- cfe/trunk/test/Driver/clang-offload-bundler.c
+++ cfe/trunk/test/Driver/clang-offload-bundler.c
@@ -231,18 +231,18 @@
 
 // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.o,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.o -### -dump-temporary-files 
2>&1 \
 // RUN: | FileCheck %s --check-prefix CK-OBJ-CMD
-// CK-OBJ-CMD: private constant [1 x i8] zeroinitializer, section 
"__CLANG_OFFLOAD_BUNDLE__host-[[HOST:.+]]"
+// CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"{{.+}}", section 
"__CLANG_OFFLOAD_BUNDLE__host-[[HOST:.+]]"
 // CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"Content of device file 
1{{.+}}", section "__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu"
 // CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"Content of device file 
2{{.+}}", section "__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu"
 // CK-OBJ-CMD: clang{{(.exe)?}}" "-r" "-target" "[[HOST]]" "-o" "{{.+}}.o" 
"{{.+}}.o" "{{.+}}.bc" "-nostdlib"
 
 // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.o,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.o
 // RUN: clang-offload-bundler -type=o 
-targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%t.bundle3.o -unbundle
-// RUN: diff %t.bundle3.o %t.res.o
+// RUN: diff %t.o %t.res.o
 // RUN: diff %t.tgt1 %t.res.tgt1
 // RUN: diff %t.tgt2 %t.res.tgt2
 // RUN: clang-offload-bundler -type=o 
-targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.tgt1,%t.res.o,%t.res.tgt2 -inputs=%t.bundle3.o -unbundle
-// RUN: diff %t.bundle3.o %t.res.o
+// RUN: diff %t.o %t.res.o
 // RUN: diff %t.tgt1 %t.res.tgt1
 // RUN: diff %t.tgt2 %t.res.tgt2
 
Index: cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
===
--- cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -370,13 +370,9 @@
 /// designated name.
 ///
 /// In order to bundle we create an IR file with the content of each section 
and
-/// use incremental linking to produce the resulting object. We also add 
section
-/// with a single byte to state the name of the component the main object file
-/// (the one we are bundling into) refers to.
-///
-/// To unbundle, we use just copy the contents of the designated section. If 
the
-/// requested bundle refer to the main object file, we just copy it with no
-/// changes.
+/// use incremental linking to produce the resulting object.
+///
+/// To unbundle, we just copy the contents of the designated section.
 class ObjectFileHandler final : public FileHandler {
 
   /// The object file we are currently dealing with.
@@ -471,10 +467,7 @@
   return;
 }
 
-if (Content->size() < 2)
-  OS.write(Input.getBufferStart(), Input.getBufferSize());
-else
-  OS.write(Content->data(), Content->size());
+OS.write(Content->data(), Content->size());
   }
 
   void WriteHeader(raw_fd_ostream &OS,
@@ -592,22 +585,14 @@
 std::string SectionName = OFFLOAD_BUNDLER_MAGIC_STR;
 SectionName += CurrentTriple;
 
-// Create the constant with the content of the section. For the input we 
are
-// bundling into (the host input), this is just a place-holder, so a single
-// byte is sufficient.
-assert(HostInputIndex != ~0u && "Host input index undefined??");
-Constant *Content;
-if (NumberOfProcessedInputs == HostInputIndex + 1) {
-  uint8_t Byte[] = {0};
-  Content = ConstantDataArray::get(VMContext, Byte);
-} else
-  Content = ConstantDataArray::get(
-  VMContext, ArrayRef(reinterpret_cast(
-   Input.getBufferStart()),
-   Input.getBufferSize()));
+// Create the constant with the content of the section.
+auto *Content = ConstantDataArray::get(
+VMContext, ArrayRef(reinterpret_cast(
+ Input.getBufferStart()),
+ Input.getBufferSize()));
 
-// Create the global in the desired section. We don't want t

[PATCH] D64811: Warn when NumParams overflows

2019-08-15 Thread Mark de Wever via Phabricator via cfe-commits
Mordante updated this revision to Diff 215425.
Mordante added a comment.

Moved the testing from Parse to Sema.
Added additional safeguards for template instantiation.
Added more unit tests.
The comments may be a bit noisy, but they explain why the templates need to be 
tested at two locations.


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

https://reviews.llvm.org/D64811

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/Sema/function_parameter_overflow.cpp
  clang/test/Sema/lambda_function_parameter_overflow.cpp
  clang/test/Sema/parameter_overflow.h
  clang/test/Sema/template_function_parameter_overflow.cpp
  clang/test/Sema/variadic_function_instantiation_parameter_overflow.cpp
  clang/test/Sema/variadic_function_parameter_overflow.cpp
  clang/test/Sema/variadic_template_function_parameter_overflow.cpp

Index: clang/test/Sema/variadic_template_function_parameter_overflow.cpp
===
--- /dev/null
+++ clang/test/Sema/variadic_template_function_parameter_overflow.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+// RUN: not %clang_cc1 %s -fsyntax-only -DFAIL 2>&1 | FileCheck %s
+
+#define ARG 42
+#include "parameter_overflow.h"
+
+template 
+void foo(P &&... p);
+
+void bar() {
+  foo(A65535
+#ifdef FAIL
+  , ARG
+#endif
+  );
+}
+
+// CHECK: fatal error: number of function parameters exceeded maximum of 65535
Index: clang/test/Sema/variadic_function_parameter_overflow.cpp
===
--- /dev/null
+++ clang/test/Sema/variadic_function_parameter_overflow.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+// RUN: %clang_cc1 %s -fsyntax-only -DFAIL 2>&1
+
+#define ARG 42
+#include "parameter_overflow.h"
+
+// Unlike the other parameter overflow tests this one is not limited by
+// NumParamsBits so the test does not generate an error.
+
+void foo(...);
+
+void bar() {
+  foo(A65535
+#ifdef FAIL
+  , ARG
+#endif
+  );
+}
Index: clang/test/Sema/variadic_function_instantiation_parameter_overflow.cpp
===
--- /dev/null
+++ clang/test/Sema/variadic_function_instantiation_parameter_overflow.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+// RUN: %clang_cc1 %s -fsyntax-only -verify -DFAIL
+
+#define ARG int
+#include "parameter_overflow.h"
+
+// The expansion of T... and the existance of fp cause the overflow.
+
+void foo(A65534
+#ifdef FAIL
+  , ARG
+#endif
+);
+
+template  void foobar(void (*fp)(T...)); // expected-note {{number of function parameters exceeded maximum of 65535}}
+
+void bar() {
+  foobar(foo);
+}
Index: clang/test/Sema/template_function_parameter_overflow.cpp
===
--- /dev/null
+++ clang/test/Sema/template_function_parameter_overflow.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+// RUN: not %clang_cc1 %s -fsyntax-only -DFAIL 2>&1 | FileCheck %s
+
+#define ARG INT
+#include "parameter_overflow.h"
+
+template 
+void foo(A65535
+#ifdef FAIL
+, ARG
+#endif
+);
+// CHECK: fatal error: number of function parameters exceeded maximum of 65535
Index: clang/test/Sema/parameter_overflow.h
===
--- /dev/null
+++ clang/test/Sema/parameter_overflow.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#define A10 ARG, ARG, ARG, ARG, ARG, ARG, ARG, ARG, ARG, ARG
+#define A50 A10, A10, A10, A10, A10
+#define A500 A50, A50, A50, A50, A50, A50, A50, A50, A50, A50
+#define A5000 A500, A500, A500, A500, A500, A500, A500, A500, A500, A500
+#define A6 A5000, A5000, A5000, A5000, A5000, A5000, A5000, A5000, A5000, A5000, A5000, A5000
+
+#define  A65534 A6, A5000, A500, A10, A10, A10, ARG, ARG, ARG, ARG
+#define  A65535 A65534, ARG
Index: clang/test/Sema/lambda_function_parameter_overflow.cpp
===
--- /dev/null
+++ clang/test/Sema/lambda_function_parameter_overflow.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+// RUN: not %clang_cc1 %s -fsyntax-only -DFAIL 2>&1 | FileCheck %s
+
+#define ARG int
+#include "parameter_overflow.h"
+
+auto foo = [](A65535
+#ifdef FAIL
+, ARG
+#endif
+){};
+// CHECK: fatal error: number of function parameters exceeded maximum of 65535
Index: clang/test/Sema/function_parameter_overflow.cpp
===
--- /dev/null
+++ clang/test/Sema/function_parameter_overflow.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+// RUN: not %clang_cc1 %s -fsyntax-only -DFAIL 2>&1 | FileCheck %s
+
+#define ARG int
+#include "parameter_overflow.h"
+
+void foo(A65535
+#

[PATCH] D66014: [analyzer] Avoid unnecessary enum range check on LValueToRValue casts

2019-08-15 Thread Chris Hamilton via Phabricator via cfe-commits
chrish_ericsson_atx updated this revision to Diff 215433.
chrish_ericsson_atx added a comment.

Follow-up on reviewer feedback.  Changed from blacklisting LValueToRValue to 
whitelisting IntegralCast.  This was a good call -- additional testing with 
different cast kinds showed that the assertion tripped for other casts besides 
LValueToRValue, e.g., FloatToIntegral.  I couldn't see any casts other than 
Integral where the enum check seemed appropriate.  Testing with only 
IntegralCast enabled gave expected (correct) results.

Also reformatted the new regtest file per reviewer comments.


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

https://reviews.llvm.org/D66014

Files:
  clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
  clang/test/Analysis/enum-cast-out-of-range.c


Index: clang/test/Analysis/enum-cast-out-of-range.c
===
--- clang/test/Analysis/enum-cast-out-of-range.c
+++ clang/test/Analysis/enum-cast-out-of-range.c
@@ -2,33 +2,34 @@
 // RUN:   -analyzer-checker=core,alpha.cplusplus.EnumCastOutOfRange \
 // RUN:   -verify %s
 
-enum unscoped_unspecified_t {
-  unscoped_unspecified_0 = -4,
-  unscoped_unspecified_1,
-  unscoped_unspecified_2 = 1,
-  unscoped_unspecified_3,
-  unscoped_unspecified_4 = 4
+enum En_t {
+  En_0 = -4,
+  En_1,
+  En_2 = 1,
+  En_3,
+  En_4 = 4
 };
 
 void unscopedUnspecifiedCStyle() {
-  enum unscoped_unspecified_t InvalidBeforeRangeBegin = (enum 
unscoped_unspecified_t)(-5); // expected-warning {{The value provided to the 
cast expression is not in the valid range of values for the enum}}
-  enum unscoped_unspecified_t ValidNegativeValue1 = (enum 
unscoped_unspecified_t)(-4); // OK.
-  enum unscoped_unspecified_t ValidNegativeValue2 = (enum 
unscoped_unspecified_t)(-3); // OK.
-  enum unscoped_unspecified_t InvalidInsideRange1 = (enum 
unscoped_unspecified_t)(-2); // expected-warning {{The value provided to the 
cast expression is not in the valid range of values for the enum}}
-  enum unscoped_unspecified_t InvalidInsideRange2 = (enum 
unscoped_unspecified_t)(-1); // expected-warning {{The value provided to the 
cast expression is not in the valid range of values for the enum}}
-  enum unscoped_unspecified_t InvalidInsideRange3 = (enum 
unscoped_unspecified_t)(0); // expected-warning {{The value provided to the 
cast expression is not in the valid range of values for the enum}}
-  enum unscoped_unspecified_t ValidPositiveValue1 = (enum 
unscoped_unspecified_t)(1); // OK.
-  enum unscoped_unspecified_t ValidPositiveValue2 = (enum 
unscoped_unspecified_t)(2); // OK.
-  enum unscoped_unspecified_t InvalidInsideRange4 = (enum 
unscoped_unspecified_t)(3); // expected-warning {{The value provided to the 
cast expression is not in the valid range of values for the enum}}
-  enum unscoped_unspecified_t ValidPositiveValue3 = (enum 
unscoped_unspecified_t)(4); // OK.
-  enum unscoped_unspecified_t InvalidAfterRangeEnd = (enum 
unscoped_unspecified_t)(5); // expected-warning {{The value provided to the 
cast expression is not in the valid range of values for the enum}}
+  enum En_t Below= (enum En_t)(-5); // expected-warning {{not in the valid 
range}}
+  enum En_t NegVal1  = (enum En_t)(-4); // OK.
+  enum En_t NegVal2  = (enum En_t)(-3); // OK.
+  enum En_t InRange1 = (enum En_t)(-2); // expected-warning {{not in the valid 
range}}
+  enum En_t InRange2 = (enum En_t)(-1); // expected-warning {{not in the valid 
range}}
+  enum En_t InRange3 = (enum En_t)(0);  // expected-warning {{not in the valid 
range}}
+  enum En_t PosVal1  = (enum En_t)(1);  // OK.
+  enum En_t PosVal2  = (enum En_t)(2);  // OK.
+  enum En_t InRange4 = (enum En_t)(3);  // expected-warning {{not in the valid 
range}}
+  enum En_t PosVal3  = (enum En_t)(4);  // OK.
+  enum En_t Above= (enum En_t)(5);  // expected-warning {{not in the valid 
range}}
 }
 
-enum unscoped_unspecified_t unused;
+enum En_t unused;
 void unusedExpr() {
-// following line is not something that EnumCastOutOfRangeChecker should 
evaluate.  checker should either ignore this line
-// or process it without producing any warnings.  However, compilation 
will (and should) still generate a warning having 
-// nothing to do with this checker.
+// Following line is not something that EnumCastOutOfRangeChecker should
+// evaluate.  Checker should either ignore this line or process it without
+// producing any warnings.  However, compilation will (and should) still
+// generate a warning having nothing to do with this checker.
 unused; // expected-warning {{expression result unused}}
 }
 
Index: clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
@@ -91,10 +91,21 @@
 
 void EnumCastOutOfRangeChecker

[PATCH] D66040: [Sema] Implement DR2386 for C++17 structured binding

2019-08-15 Thread Reid Kleckner via Phabricator via cfe-commits
rnk updated this revision to Diff 215442.
rnk added a comment.

- add DR test case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66040

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp
  clang/test/CXX/drs/dr23xx.cpp


Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -40,6 +40,21 @@
 #pragma clang __debug dump not_use_2
 }
 
+#if __cplusplus >= 201707L
+// Otherwise, if the qualified-id std::tuple_size names a complete class
+// type **with a member value**, the expression std::tuple_size::value shall
+// be a well-formed integral constant expression
+namespace std {
+template  struct tuple_size;
+struct Bad1 { int a, b; };
+template<> struct std::tuple_size {};
+void no_value() { auto [x, y] = Bad1(); }
+struct Bad2 { int a, b; };
+template<> struct std::tuple_size { static const int value = 42;};
+void wrong_value() { auto [x, y] = Bad2(); } // expected-error {{decomposes 
into 42 elements}}
+}
+#endif
+
 namespace dr2387 { // dr2387: 9
 #if __cplusplus >= 201402L
   template int a = 0;
Index: clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp
===
--- clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp
+++ clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp
@@ -12,7 +12,7 @@
 
 struct Bad1 { int a, b; };
 template<> struct std::tuple_size {};
-void no_tuple_size_3() { auto [x, y] = Bad1(); } // expected-error {{cannot 
decompose this type; 'std::tuple_size::value' is not a valid integral 
constant expression}}
+void no_tuple_size_3() { auto [x, y] = Bad1(); } // ok, omitting value is 
valid after DR2386
 
 struct Bad2 {};
 template<> struct std::tuple_size { const int value = 5; };
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -1030,8 +1030,10 @@
   TemplateArgumentListInfo Args(Loc, Loc);
   Args.addArgument(getTrivialTypeTemplateArgument(S, Loc, T));
 
-  // If there's no tuple_size specialization, it's not tuple-like.
-  if (lookupStdTypeTraitMember(S, R, Loc, "tuple_size", Args, /*DiagID*/0))
+  // If there's no tuple_size specialization or the lookup of 'value' is empty,
+  // it's not tuple-like.
+  if (lookupStdTypeTraitMember(S, R, Loc, "tuple_size", Args, /*DiagID*/ 0) ||
+  R.empty())
 return IsTupleLike::NotTupleLike;
 
   // If we get this far, we've committed to the tuple interpretation, but
@@ -1048,11 +1050,6 @@
 }
   } Diagnoser(R, Args);
 
-  if (R.empty()) {
-Diagnoser.diagnoseNotICE(S, Loc, SourceRange());
-return IsTupleLike::Error;
-  }
-
   ExprResult E =
   S.BuildDeclarationNameExpr(CXXScopeSpec(), R, /*NeedsADL*/false);
   if (E.isInvalid())


Index: clang/test/CXX/drs/dr23xx.cpp
===
--- clang/test/CXX/drs/dr23xx.cpp
+++ clang/test/CXX/drs/dr23xx.cpp
@@ -40,6 +40,21 @@
 #pragma clang __debug dump not_use_2
 }
 
+#if __cplusplus >= 201707L
+// Otherwise, if the qualified-id std::tuple_size names a complete class
+// type **with a member value**, the expression std::tuple_size::value shall
+// be a well-formed integral constant expression
+namespace std {
+template  struct tuple_size;
+struct Bad1 { int a, b; };
+template<> struct std::tuple_size {};
+void no_value() { auto [x, y] = Bad1(); }
+struct Bad2 { int a, b; };
+template<> struct std::tuple_size { static const int value = 42;};
+void wrong_value() { auto [x, y] = Bad2(); } // expected-error {{decomposes into 42 elements}}
+}
+#endif
+
 namespace dr2387 { // dr2387: 9
 #if __cplusplus >= 201402L
   template int a = 0;
Index: clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp
===
--- clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp
+++ clang/test/CXX/dcl.decl/dcl.decomp/p3.cpp
@@ -12,7 +12,7 @@
 
 struct Bad1 { int a, b; };
 template<> struct std::tuple_size {};
-void no_tuple_size_3() { auto [x, y] = Bad1(); } // expected-error {{cannot decompose this type; 'std::tuple_size::value' is not a valid integral constant expression}}
+void no_tuple_size_3() { auto [x, y] = Bad1(); } // ok, omitting value is valid after DR2386
 
 struct Bad2 {};
 template<> struct std::tuple_size { const int value = 5; };
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -1030,8 +1030,10 @@
   TemplateArgumentListInfo Args(Loc, Loc);
   Args.addArgument(getTrivialTypeTemplateArgument(S, Loc, T));
 
-  // If there's no tuple_size specialization, it's not tuple-like.
-  if (lookupStdTypeTraitMember(S, R, Loc, "tuple_size", Args, /*DiagID*/0))
+  // If there's no tuple_size speciali

r369028 - Fix the test, NFC.

2019-08-15 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Aug 15 10:53:49 2019
New Revision: 369028

URL: http://llvm.org/viewvc/llvm-project?rev=369028&view=rev
Log:
Fix the test, NFC.

Modified:
cfe/trunk/test/Driver/clang-offload-bundler.c

Modified: cfe/trunk/test/Driver/clang-offload-bundler.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=369028&r1=369027&r2=369028&view=diff
==
--- cfe/trunk/test/Driver/clang-offload-bundler.c (original)
+++ cfe/trunk/test/Driver/clang-offload-bundler.c Thu Aug 15 10:53:49 2019
@@ -117,7 +117,7 @@
 // CK-TEXTI: // __CLANG_OFFLOAD_BUNDLEEND__ openmp-x86_64-pc-linux-gnu
 
 // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLESTART__ host-[[HOST:.+]]
-// CK-TEXTLL: @A = dso_local global i32 0
+// CK-TEXTLL: @A = {{.*}}global i32 0
 // CK-TEXTLL: define {{.*}}@test_func()
 // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLEEND__ host-[[HOST]]
 // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLESTART__ 
openmp-powerpc64le-ibm-linux-gnu


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


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

2019-08-15 Thread Nathan Huckleberry via Phabricator via cfe-commits
Nathan-Huckleberry added a comment.

In D66186#1630427 , @aaron.ballman 
wrote:

> There was a request in the linked bug for some code archaeology to see why 
> this behavior exists in the first place. What were the results of that? I'm 
> not opposed to the patch, but I would like to understand why it behaves the 
> way it does.


Since printf is a variadic function, integral argument types are promoted to 
int. The warning code runs the matchesType check twice, once to check if the 
promoted type (int) is able to be printed with the format and once to check if 
the original type (char) is able to be printed with the format.

`printf("%d", [char])` is caught by the first case
`printf("%hhd", [char])` is caught by the second case.

`printf("%hd", [char])` is a warning because an exception has not been made for 
that case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66186



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


[PATCH] D63260: [Attr] Support _attribute__ ((fallthrough))

2019-08-15 Thread Kees Cook via Phabricator via cfe-commits
kees added a comment.

For latest version see https://reviews.llvm.org/D64838


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

https://reviews.llvm.org/D63260



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


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

2019-08-15 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In D66186#1631921 , 
@Nathan-Huckleberry wrote:

> In D66186#1630427 , @aaron.ballman 
> wrote:
>
> > There was a request in the linked bug for some code archaeology to see why 
> > this behavior exists in the first place. What were the results of that? I'm 
> > not opposed to the patch, but I would like to understand why it behaves the 
> > way it does.
>
>
> Since printf is a variadic function, integral argument types are promoted to 
> int. The warning code runs the matchesType check twice, once to check if the 
> promoted type (int) is able to be printed with the format and once to check 
> if the original type (char) is able to be printed with the format.
>
> `printf("%d", [char])` is caught by the first case
>  `printf("%hhd", [char])` is caught by the second case.
>
> `printf("%hd", [char])` is a warning because an exception has not been made 
> for that case.


That explains what the implementation does, but does not attempt to answer the 
question *why* things are the way they are.

I read https://bugs.llvm.org/show_bug.cgi?id=41467#c4 as

- any narrowing is always diagnosed
- promotion to wider than int is diagnosed
- passthrough is not diagnosed
- promotion to something smaller than int is diagnosed (the current case)

I can interpret it as: we already know that

In D66186#1631921 , 
@Nathan-Huckleberry wrote:

> Since printf is a variadic function, integral argument types are promoted to 
> int.


therefore why are you first implicitly promoting to int and then implicitly 
truncating?
Did you mean to print the original value? Did you mean to print int?

That doesn't sound too outlandish to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66186



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


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

2019-08-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D66186#1631921 , 
@Nathan-Huckleberry wrote:

> In D66186#1630427 , @aaron.ballman 
> wrote:
>
> > There was a request in the linked bug for some code archaeology to see why 
> > this behavior exists in the first place. What were the results of that? I'm 
> > not opposed to the patch, but I would like to understand why it behaves the 
> > way it does.
>
>
> Since printf is a variadic function, integral argument types are promoted to 
> int. The warning code runs the matchesType check twice, once to check if the 
> promoted type (int) is able to be printed with the format and once to check 
> if the original type (char) is able to be printed with the format.
>
> `printf("%d", [char])` is caught by the first case
>  `printf("%hhd", [char])` is caught by the second case.
>
> `printf("%hd", [char])` is a warning because an exception has not been made 
> for that case.


This all makes sense as to how things work today, but I was more wondering why 
they worked that way in the first place. I'm especially interested to know 
whether this is diagnosed because it shows confusion of the user's intent, 
because that seems like a valuable behavior to retain (though perhaps it 
doesn't need to be default-on).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66186



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


[PATCH] D61466: [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug

2019-08-15 Thread Jan Korous via Phabricator via cfe-commits
jkorous accepted this revision.
jkorous added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


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

https://reviews.llvm.org/D61466



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


[PATCH] D65696: Implements CWG 2082 Referring to parameters in unevaluated operands of default arguments

2019-08-15 Thread Mark de Wever via Phabricator via cfe-commits
Mordante updated this revision to Diff 215448.
Mordante added a comment.

Updated the unit tests as requested. This required the 
`Sema::ActOnParamDefaultArgument` to delay a part of the ODR validation until 
the default argument has been 'instantiated'.
As discussed on IRC; the up to date `cwg_index.html` is not public, so I only 
updated the unit test and removed the changes to `cxx_dr_status.html`.


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

https://reviews.llvm.org/D65696

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p9.cpp
  clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp
  clang/test/CXX/drs/dr20xx.cpp

Index: clang/test/CXX/drs/dr20xx.cpp
===
--- clang/test/CXX/drs/dr20xx.cpp
+++ clang/test/CXX/drs/dr20xx.cpp
@@ -8,6 +8,76 @@
 #define static_assert(...) _Static_assert(__VA_ARGS__)
 #endif
 
+
+namespace dr2082 { // dr2082: 10
+namespace local_var {
+void g() {
+  int k = 42;
+  void l(int m = k); // expected-error {{default argument references local variable 'k' of enclosing function}}
+}
+} // namespace local_var
+namespace local_const {
+void g() {
+  const int k = 42;
+  void l(int m = k);
+}
+} // namespace local_const
+#if __cplusplus >= 201103L
+namespace local_constexpr {
+void g() {
+  constexpr int k = 42;
+  void l(int m = k);
+}
+} // namespace local_constexpr
+#endif
+
+namespace local_const_float_to_integral {
+void g() {
+  const double k = 42;
+  void l(int m = k); // expected-error {{default argument references local variable 'k' of enclosing function}}
+}
+} // namespace local_const_float_to_integral
+#if __cplusplus >= 201103L
+namespace local_constexpr_float_to_integral {
+void g() {
+  constexpr double k = 42;
+  void l(int m = k);
+}
+} // namespace local_constexpr_float_to_integral
+
+namespace local_member_const {
+struct a {
+  int b;
+  int c;
+};
+void g() {
+  const a n{42, 42};
+  void l(int m = n.b); // expected-error {{default argument references local variable 'n' of enclosing function}}
+}
+} // namespace local_member_const
+namespace local_member_constexpr {
+struct a {
+  int b;
+  int c;
+};
+void g() {
+  constexpr a n{42, 42};
+  void l(int m = n.b);
+}
+} // namespace local_member_constexpr
+namespace local_member_mutable {
+struct a {
+  int b;
+  mutable int c;
+};
+void g() {
+  constexpr a n{42, 42};
+  void l(int m = n.b); // expected-error {{default argument references local variable 'n' of enclosing function}}
+}
+} // namespace local_member_mutable
+#endif
+}
+
 namespace dr2083 { // dr2083: partial
 #if __cplusplus >= 201103L
   void non_const_mem_ptr() {
Index: clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp
===
--- clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp
+++ clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p7.cpp
@@ -1,7 +1,8 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
-void h()
+void f()
 {
   int i;
-  extern void h2(int x = sizeof(i)); // expected-error {{default argument references local variable 'i' of enclosing function}}
+  extern void g(int x = i); // expected-error {{default argument references local variable 'i' of enclosing function}}
+  extern void h(int x = sizeof(i));
 }
Index: clang/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p9.cpp
===
--- /dev/null
+++ clang/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p9.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int a;
+int f(int a, int b = a); // expected-error {{default argument references parameter 'a'}}
+typedef int I;
+int g(float I, int b = I(2)); // expected-error {{called object type 'float' is not a function or function pointer}}
+int h(int a, int b = sizeof(a));
+
+int b;
+class X {
+  int a;
+  int mem1(int i = a); // expected-error {{invalid use of non-static data member 'a'}}
+  int mem2(int i = b);
+  static int b;
+};
+
+int f(int = 0);
+void h() {
+  int j = f(1);
+  int k = f();
+}
+int (*p1)(int) = &f;
+int (*p2)() = &f; // expected-error {{cannot initialize a variable of type 'int (*)()' with an rvalue of type 'int (*)(int)': different number of parameters (0 vs 1)}}
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -86,29 +86,22 @@
 NamedDecl *Decl = DRE->getDecl();
 if (ParmVarDecl *Param = dyn_cast(Decl)) {
   // C++ [dcl.fct.default]p9
-  //   Default arguments are evaluated each time the function is
-  //   called. The order of evaluation of function arguments is
-  //   unspecified. Consequently, parameters of a function shall not
-  //   be used in default argument expressions, even if they are not
-  //   evaluated. Parameters of a function declared before a default

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

2019-08-15 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Aug 15 11:35:44 2019
New Revision: 369033

URL: http://llvm.org/viewvc/llvm-project?rev=369033&view=rev
Log:
Allow standards-based attributes to have leading and trailing underscores.

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

Modified:
cfe/trunk/lib/Sema/ParsedAttr.cpp
cfe/trunk/test/Preprocessor/has_attribute.cpp
cfe/trunk/test/Preprocessor/has_c_attribute.c
cfe/trunk/test/Sema/attr-cx2.c
cfe/trunk/test/SemaCXX/attr-cxx0x.cpp

Modified: cfe/trunk/lib/Sema/ParsedAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/ParsedAttr.cpp?rev=369033&r1=369032&r2=369033&view=diff
==
--- cfe/trunk/lib/Sema/ParsedAttr.cpp (original)
+++ cfe/trunk/lib/Sema/ParsedAttr.cpp Thu Aug 15 11:35:44 2019
@@ -125,7 +125,8 @@ static StringRef normalizeAttrName(Strin
   SyntaxUsed == ParsedAttr::AS_GNU ||
   ((SyntaxUsed == ParsedAttr::AS_CXX11 ||
 SyntaxUsed == ParsedAttr::AS_C2x) &&
-   (NormalizedScopeName == "gnu" || NormalizedScopeName == "clang"));
+   (NormalizedScopeName.empty() || NormalizedScopeName == "gnu" ||
+NormalizedScopeName == "clang"));
   if (ShouldNormalize && AttrName.size() >= 4 && AttrName.startswith("__") &&
   AttrName.endswith("__"))
 AttrName = AttrName.slice(2, AttrName.size() - 2);

Modified: cfe/trunk/test/Preprocessor/has_attribute.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/has_attribute.cpp?rev=369033&r1=369032&r2=369033&view=diff
==
--- cfe/trunk/test/Preprocessor/has_attribute.cpp (original)
+++ cfe/trunk/test/Preprocessor/has_attribute.cpp Thu Aug 15 11:35:44 2019
@@ -31,6 +31,9 @@ __clang__::fallthrough: __has_cpp_attrib
 // CHECK: _Clang::fallthrough: 201603L
 CXX11(_Clang::fallthrough)
 
+// CHECK: __nodiscard__: 201907L
+CXX11(__nodiscard__)
+
 // CHECK: __gnu__::__const__: 1
 CXX11(__gnu__::__const__)
 

Modified: cfe/trunk/test/Preprocessor/has_c_attribute.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/has_c_attribute.c?rev=369033&r1=369032&r2=369033&view=diff
==
--- cfe/trunk/test/Preprocessor/has_c_attribute.c (original)
+++ cfe/trunk/test/Preprocessor/has_c_attribute.c Thu Aug 15 11:35:44 2019
@@ -10,3 +10,7 @@
   int does_not_have_selectany();
 #endif
 
+// CHECK: has_nodiscard_underscore
+#if __has_c_attribute(__nodiscard__)
+  int has_nodiscard_underscore();
+#endif

Modified: cfe/trunk/test/Sema/attr-cx2.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-cx2.c?rev=369033&r1=369032&r2=369033&view=diff
==
--- cfe/trunk/test/Sema/attr-cx2.c (original)
+++ cfe/trunk/test/Sema/attr-cx2.c Thu Aug 15 11:35:44 2019
@@ -24,3 +24,6 @@ void foo2(void) [[clang::unavailable("no
 void bar(void) {
   foo2(); // expected-error {{'foo2' is unavailable: not available - replaced}}
 }
+
+[[nodiscard]] int without_underscores(void);
+[[__nodiscard__]] int underscores(void);

Modified: cfe/trunk/test/SemaCXX/attr-cxx0x.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-cxx0x.cpp?rev=369033&r1=369032&r2=369033&view=diff
==
--- cfe/trunk/test/SemaCXX/attr-cxx0x.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-cxx0x.cpp Thu Aug 15 11:35:44 2019
@@ -46,7 +46,7 @@ static_assert(alignof(outer::i
 
 static_assert(alignof(int(int)) >= 1, "alignof(function) not positive"); // 
expected-error{{invalid application of 'alignof' to a function type}}
 
-[[__carries_dependency__]]  // expected-warning{{unknown attribute 
'__carries_dependency__' ignored}}
+[[__carries_dependency__]]
 void func(void);
 
 alignas(4) auto PR19252 = 0;


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


r369035 - Rename this file from cx2.c to c2x.c; NFC.

2019-08-15 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Aug 15 11:37:30 2019
New Revision: 369035

URL: http://llvm.org/viewvc/llvm-project?rev=369035&view=rev
Log:
Rename this file from cx2.c to c2x.c; NFC.

Added:
cfe/trunk/test/Sema/attr-c2x.c
  - copied unchanged from r369034, cfe/trunk/test/Sema/attr-cx2.c
Removed:
cfe/trunk/test/Sema/attr-cx2.c

Removed: cfe/trunk/test/Sema/attr-cx2.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-cx2.c?rev=369034&view=auto
==
--- cfe/trunk/test/Sema/attr-cx2.c (original)
+++ cfe/trunk/test/Sema/attr-cx2.c (removed)
@@ -1,29 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify 
-std=c2x %s
-
-struct S {};
-struct S * [[clang::address_space(1)]] Foo;
-
-enum [[clang::enum_extensibility(open)]] EnumOpen {
-  C0 = 1, C1 = 10
-};
-
-enum [[clang::flag_enum]] EnumFlag {
-  D0 = 1, D1 = 8
-};
-
-void foo(void *c) [[clang::overloadable]];
-void foo(char *c) [[clang::overloadable]];
-
-void context_okay(void *context [[clang::swift_context]]) [[clang::swiftcall]];
-void context_okay2(void *context [[clang::swift_context]], void *selfType, 
char **selfWitnessTable) [[clang::swiftcall]];
-
-void *f1(void) [[clang::ownership_returns(foo)]];
-void *f2() [[clang::ownership_returns(foo)]]; // expected-warning 
{{'ownership_returns' attribute only applies to non-K&R-style functions}}
-
-void foo2(void) [[clang::unavailable("not available - replaced")]]; // 
expected-note {{'foo2' has been explicitly marked unavailable here}}
-void bar(void) {
-  foo2(); // expected-error {{'foo2' is unavailable: not available - replaced}}
-}
-
-[[nodiscard]] int without_underscores(void);
-[[__nodiscard__]] int underscores(void);


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


[PATCH] D62731: [RFC] Add support for options -fp-model= and -fp-speculation= : specify floating point behavior

2019-08-15 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn added inline comments.



Comment at: clang/docs/UsersManual.rst:1307
+
+   ``precise   `` Disables optimizations that are not value-safe on 
+   floating-point data, although FP contraction (FMA) is enabled.

Extra spaces?



Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:126
+  case LangOptions::FPM_Precise:
+  case LangOptions::FPM_Fast:
+break;

Wait, so "fast" and "precise" are the same thing? That doesn't sound like where 
the documentation you put in the ticket says "the compiler preserves the source 
expression ordering and rounding properties of floating-point".

(Yes, I saw below where "fast" turns on the fast math flags but "precise" 
doesn't. That doesn't affect my point here.)



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3052
+else
+  llvm_unreachable("invalid -fp-model setting");
+  }

Shouldn't this be a call to Diags.Report() like in the code just above it and 
below? Same question for _some_ other uses of llvm_unreachable().



Comment at: clang/test/CodeGen/fpconstrained.c:22
+  // STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %0, float 
%1, metadata !"round.dynamic", metadata !"fpexcept.ignore")
+  // PRECISE: fadd float
+  // FAST: fadd fast

This is another case of "fast" and "precise" doing the same thing. If we're 
using the regular fadd then it cannot be that "the compiler preserves the 
source expression ordering and rounding properties of floating-point".


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62731



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


[PATCH] D66296: [BUNDLER]Improve the test, NFC.

2019-08-15 Thread Azharuddin Mohammed via Phabricator via cfe-commits
azharudd added a comment.

Looks like this is failing on Darwin:

  
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/1193/consoleFull#-2382751928254eaf0-7326-4999-85b0-388101f2d404
  
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/clang/test/Driver/clang-offload-bundler.c:120:15:
 error: CK-TEXTLL: expected string not found in input
  // CK-TEXTLL: @A = dso_local global i32 0
^
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/tools/clang/test/Driver/Output/clang-offload-bundler.c.tmp.bundle3.ll:3:1:
 note: scanning from here
  ; ModuleID = 
'/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/clang/test/Driver/clang-offload-bundler.c'
  ^
  
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/tools/clang/test/Driver/Output/clang-offload-bundler.c.tmp.bundle3.ll:8:1:
 note: possible intended match here
  @A = global i32 0, align 4


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66296



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


RE: QualType

2019-08-15 Thread Eli Friedman via cfe-commits
Usually the cfe-dev mailing list is better for questions like this.

The type “int” is ASTContext::IntTy.  You can use QualType::withConst to add a 
“const” qualifier, and ASTContext::getPointerType to construct a pointer type.  
Putting that together, you can construct a “const int*” with something like 
“Context->getPointerType(Context->IntTy.withConst())”.

If you haven’t looked at the documentation yet, you might want to read 
https://clang.llvm.org/docs/IntroductionToTheClangAST.html and 
https://clang.llvm.org/docs/InternalsManual.html .

-Eli

From: cfe-commits  On Behalf Of Monalisa 
Rout via cfe-commits
Sent: Thursday, August 15, 2019 7:03 AM
To: cfe-commits@lists.llvm.org
Subject: [EXT] QualType

Hello,
I want to create QualType instances for const int, int* const,  and const int* 
const.
How can I do that??

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


[PATCH] D66296: [BUNDLER]Improve the test, NFC.

2019-08-15 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D66296#1632003 , @azharudd wrote:

> Looks like this is failing on Darwin:
>
> http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/1193/consoleFull#-2382751928254eaf0-7326-4999-85b0-388101f2d404
>
>   
> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/clang/test/Driver/clang-offload-bundler.c:120:15:
>  error: CK-TEXTLL: expected string not found in input
>   // CK-TEXTLL: @A = dso_local global i32 0
> ^
>   
> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/tools/clang/test/Driver/Output/clang-offload-bundler.c.tmp.bundle3.ll:3:1:
>  note: scanning from here
>   ; ModuleID = 
> '/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/clang/test/Driver/clang-offload-bundler.c'
>   ^
>   
> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/tools/clang/test/Driver/Output/clang-offload-bundler.c.tmp.bundle3.ll:8:1:
>  note: possible intended match here
>   @A = global i32 0, align 4
>


Committed the fix already


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66296



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


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

2019-08-15 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.

(just want to mark it as "unanswered questions")


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66186



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


[PATCH] D66040: [Sema] Implement DR2386 for C++17 structured binding

2019-08-15 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM with minor adjustments to the test.




Comment at: clang/test/CXX/drs/dr23xx.cpp:43-57
+#if __cplusplus >= 201707L
+// Otherwise, if the qualified-id std::tuple_size names a complete class
+// type **with a member value**, the expression std::tuple_size::value shall
+// be a well-formed integral constant expression
+namespace std {
+template  struct tuple_size;
+struct Bad1 { int a, b; };

Please add a comment

```
// dr2386: 9
```

so that the script that generates cxx_dr_status.html knows to mark that issue 
as done.

It'd be good to also move as much of this test into a `namespace dr2386` as 
possible. (Clearly some parts of it need to be in `namespace std`, but I'd 
prefer that those parts be kept as small as possible to isolate this test from 
others in the same file.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66040



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


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

2019-08-15 Thread Guanzhong Chen via cfe-commits
Author: quantum
Date: Thu Aug 15 12:33:36 2019
New Revision: 369042

URL: http://llvm.org/viewvc/llvm-project?rev=369042&view=rev
Log:
[WebAssembly] Correctly handle va_arg of zero-sized structures

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

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

Reviewers: dschuff, tlively, sbc100

Reviewed By: dschuff

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

Tags: #clang

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

Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/wasm-varargs.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=369042&r1=369041&r2=369042&view=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Aug 15 12:33:36 2019
@@ -833,8 +833,9 @@ ABIArgInfo WebAssemblyABIInfo::classifyR
 
 Address WebAssemblyABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
   QualType Ty) const {
-  bool IsIndirect =
-  isAggregateTypeForABI(Ty) && !isSingleElementStruct(Ty, getContext());
+  bool IsIndirect = isAggregateTypeForABI(Ty) &&
+!isEmptyRecord(getContext(), Ty, true) &&
+!isSingleElementStruct(Ty, getContext());
   return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect,
   getContext().getTypeInfoInChars(Ty),
   CharUnits::fromQuantity(4),

Modified: cfe/trunk/test/CodeGen/wasm-varargs.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/wasm-varargs.c?rev=369042&r1=369041&r2=369042&view=diff
==
--- cfe/trunk/test/CodeGen/wasm-varargs.c (original)
+++ cfe/trunk/test/CodeGen/wasm-varargs.c Thu Aug 15 12:33:36 2019
@@ -80,21 +80,61 @@ struct S test_struct(char *fmt, ...) {
   return v;
 }
 
-// CHECK: define void @test_struct([[STRUCT_S:%[^,=]+]]*{{.*}} noalias sret 
[[AGG_RESULT:%.*]], i8*{{.*}} %fmt, ...) {{.*}} {
-// CHECK:   [[FMT_ADDR:%[^,=]+]] = alloca i8*, align 4
-// CHECK:   [[VA:%[^,=]+]] = alloca i8*, align 4
-// CHECK:   store i8* %fmt, i8** [[FMT_ADDR]], align 4
-// CHECK:   [[VA1:%[^,=]+]] = bitcast i8** [[VA]] to i8*
-// CHECK:   call void @llvm.va_start(i8* [[VA1]])
-// CHECK:   [[ARGP_CUR:%[^,=]+]] = load i8*, i8** [[VA]], align 4
-// CHECK:   [[ARGP_NEXT:%[^,=]+]] = getelementptr inbounds i8, i8* 
[[ARGP_CUR]], i32 4
-// CHECK:   store i8* [[ARGP_NEXT]], i8** [[VA]], align 4
-// CHECK:   [[R3:%[^,=]+]] = bitcast i8* [[ARGP_CUR]] to [[STRUCT_S]]**
-// CHECK:   [[R4:%[^,=]+]] = load [[STRUCT_S]]*, [[STRUCT_S]]** %0, align 4
-// CHECK:   [[R5:%[^,=]+]] = bitcast [[STRUCT_S]]* [[AGG_RESULT]] to i8*
-// CHECK:   [[R6:%[^,=]+]] = bitcast [[STRUCT_S]]* [[R4]] to i8*
-// CHECK:   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 [[R5]], i8* align 
4 [[R6]], i32 12, i1 false)
-// CHECK:   [[VA2:%[^,=]+]] = bitcast i8** [[VA]] to i8*
-// CHECK:   call void @llvm.va_end(i8* [[VA2]])
-// CHECK:   ret void
-// CHECK: }
+// CHECK:  define void @test_struct([[STRUCT_S:%[^,=]+]]*{{.*}} noalias 
sret [[AGG_RESULT:%.*]], i8*{{.*}} %fmt, ...) {{.*}} {
+// CHECK:[[FMT_ADDR:%[^,=]+]] = alloca i8*, align 4
+// CHECK-NEXT:   [[VA:%[^,=]+]] = alloca i8*, align 4
+// CHECK-NEXT:   store i8* %fmt, i8** [[FMT_ADDR]], align 4
+// CHECK-NEXT:   [[VA1:%[^,=]+]] = bitcast i8** [[VA]] to i8*
+// CHECK-NEXT:   call void @llvm.va_start(i8* [[VA1]])
+// CHECK-NEXT:   [[ARGP_CUR:%[^,=]+]] = load i8*, i8** [[VA]], align 4
+// CHECK-NEXT:   [[ARGP_NEXT:%[^,=]+]] = getelementptr inbounds i8, i8* 
[[ARGP_CUR]], i32 4
+// CHECK-NEXT:   store i8* [[ARGP_NEXT]], i8** [[VA]], align 4
+// CHECK-NEXT:   [[R3:%[^,=]+]] = bitcast i8* [[ARGP_CUR]] to [[STRUCT_S]]**
+// CHECK-NEXT:   [[R4:%[^,=]+]] = load [[STRUCT_S]]*, [[STRUCT_S]]** [[R3]], 
align 4
+// CHECK-NEXT:   [[R5:%[^,=]+]] = bitcast [[STRUCT_S]]* [[AGG_RESULT]] to i8*
+// CHECK-NEXT:   [[R6:%[^,=]+]] = bitcast [[STRUCT_S]]* [[R4]] to i8*
+// CHECK-NEXT:   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 [[R5]], i8* 
align 4 [[R6]], i32 12, i1 false)
+// CHECK-NEXT:   [[VA2:%[^,=]+]] = bitcast i8** [[VA]] to i8*
+// CHECK-NEXT:   call void @llvm.va_end(i8* [[VA2]])
+// CHECK-NEXT:   ret void
+// CHECK-NEXT: }
+
+struct Z {};
+
+struct S test_empty_struct(char *fmt, ...) {
+  va_list va;
+
+  va_start(va, fmt);
+  struct Z u = va_arg(va, struct Z);
+  struct S v = va_arg(va, struct S);
+  va_end(va);
+
+  return v;
+}
+
+// CHECK:  define void @test_empty_struct([[STRUCT_S:%[^,=]+]]*{{.*}} 
noalias sret [[AGG_RESULT:%.*]], i8*{{.*}} %fmt, ...) {{.*}} {
+// CHECK:[[FMT_ADDR:%[^,=]+]] = alloca i

[PATCH] D66255: [WebAssembly] Correctly handle va_arg of zero-sized structures

2019-08-15 Thread Guanzhong Chen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369042: [WebAssembly] Correctly handle va_arg of zero-sized 
structures (authored by quantum, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66255?vs=215272&id=215455#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66255

Files:
  cfe/trunk/lib/CodeGen/TargetInfo.cpp
  cfe/trunk/test/CodeGen/wasm-varargs.c


Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -833,8 +833,9 @@
 
 Address WebAssemblyABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
   QualType Ty) const {
-  bool IsIndirect =
-  isAggregateTypeForABI(Ty) && !isSingleElementStruct(Ty, getContext());
+  bool IsIndirect = isAggregateTypeForABI(Ty) &&
+!isEmptyRecord(getContext(), Ty, true) &&
+!isSingleElementStruct(Ty, getContext());
   return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect,
   getContext().getTypeInfoInChars(Ty),
   CharUnits::fromQuantity(4),
Index: cfe/trunk/test/CodeGen/wasm-varargs.c
===
--- cfe/trunk/test/CodeGen/wasm-varargs.c
+++ cfe/trunk/test/CodeGen/wasm-varargs.c
@@ -80,21 +80,61 @@
   return v;
 }
 
-// CHECK: define void @test_struct([[STRUCT_S:%[^,=]+]]*{{.*}} noalias sret 
[[AGG_RESULT:%.*]], i8*{{.*}} %fmt, ...) {{.*}} {
-// CHECK:   [[FMT_ADDR:%[^,=]+]] = alloca i8*, align 4
-// CHECK:   [[VA:%[^,=]+]] = alloca i8*, align 4
-// CHECK:   store i8* %fmt, i8** [[FMT_ADDR]], align 4
-// CHECK:   [[VA1:%[^,=]+]] = bitcast i8** [[VA]] to i8*
-// CHECK:   call void @llvm.va_start(i8* [[VA1]])
-// CHECK:   [[ARGP_CUR:%[^,=]+]] = load i8*, i8** [[VA]], align 4
-// CHECK:   [[ARGP_NEXT:%[^,=]+]] = getelementptr inbounds i8, i8* 
[[ARGP_CUR]], i32 4
-// CHECK:   store i8* [[ARGP_NEXT]], i8** [[VA]], align 4
-// CHECK:   [[R3:%[^,=]+]] = bitcast i8* [[ARGP_CUR]] to [[STRUCT_S]]**
-// CHECK:   [[R4:%[^,=]+]] = load [[STRUCT_S]]*, [[STRUCT_S]]** %0, align 4
-// CHECK:   [[R5:%[^,=]+]] = bitcast [[STRUCT_S]]* [[AGG_RESULT]] to i8*
-// CHECK:   [[R6:%[^,=]+]] = bitcast [[STRUCT_S]]* [[R4]] to i8*
-// CHECK:   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 [[R5]], i8* align 
4 [[R6]], i32 12, i1 false)
-// CHECK:   [[VA2:%[^,=]+]] = bitcast i8** [[VA]] to i8*
-// CHECK:   call void @llvm.va_end(i8* [[VA2]])
-// CHECK:   ret void
-// CHECK: }
+// CHECK:  define void @test_struct([[STRUCT_S:%[^,=]+]]*{{.*}} noalias 
sret [[AGG_RESULT:%.*]], i8*{{.*}} %fmt, ...) {{.*}} {
+// CHECK:[[FMT_ADDR:%[^,=]+]] = alloca i8*, align 4
+// CHECK-NEXT:   [[VA:%[^,=]+]] = alloca i8*, align 4
+// CHECK-NEXT:   store i8* %fmt, i8** [[FMT_ADDR]], align 4
+// CHECK-NEXT:   [[VA1:%[^,=]+]] = bitcast i8** [[VA]] to i8*
+// CHECK-NEXT:   call void @llvm.va_start(i8* [[VA1]])
+// CHECK-NEXT:   [[ARGP_CUR:%[^,=]+]] = load i8*, i8** [[VA]], align 4
+// CHECK-NEXT:   [[ARGP_NEXT:%[^,=]+]] = getelementptr inbounds i8, i8* 
[[ARGP_CUR]], i32 4
+// CHECK-NEXT:   store i8* [[ARGP_NEXT]], i8** [[VA]], align 4
+// CHECK-NEXT:   [[R3:%[^,=]+]] = bitcast i8* [[ARGP_CUR]] to [[STRUCT_S]]**
+// CHECK-NEXT:   [[R4:%[^,=]+]] = load [[STRUCT_S]]*, [[STRUCT_S]]** [[R3]], 
align 4
+// CHECK-NEXT:   [[R5:%[^,=]+]] = bitcast [[STRUCT_S]]* [[AGG_RESULT]] to i8*
+// CHECK-NEXT:   [[R6:%[^,=]+]] = bitcast [[STRUCT_S]]* [[R4]] to i8*
+// CHECK-NEXT:   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 [[R5]], i8* 
align 4 [[R6]], i32 12, i1 false)
+// CHECK-NEXT:   [[VA2:%[^,=]+]] = bitcast i8** [[VA]] to i8*
+// CHECK-NEXT:   call void @llvm.va_end(i8* [[VA2]])
+// CHECK-NEXT:   ret void
+// CHECK-NEXT: }
+
+struct Z {};
+
+struct S test_empty_struct(char *fmt, ...) {
+  va_list va;
+
+  va_start(va, fmt);
+  struct Z u = va_arg(va, struct Z);
+  struct S v = va_arg(va, struct S);
+  va_end(va);
+
+  return v;
+}
+
+// CHECK:  define void @test_empty_struct([[STRUCT_S:%[^,=]+]]*{{.*}} 
noalias sret [[AGG_RESULT:%.*]], i8*{{.*}} %fmt, ...) {{.*}} {
+// CHECK:[[FMT_ADDR:%[^,=]+]] = alloca i8*, align 4
+// CHECK-NEXT:   [[VA:%[^,=]+]] = alloca i8*, align 4
+// CHECK-NEXT:   [[U:%[^,=]+]] = alloca [[STRUCT_Z:%[^,=]+]], align 1
+// CHECK-NEXT:   store i8* %fmt, i8** [[FMT_ADDR]], align 4
+// CHECK-NEXT:   [[VA1:%[^,=]+]] = bitcast i8** [[VA]] to i8*
+// CHECK-NEXT:   call void @llvm.va_start(i8* [[VA1]])
+// CHECK-NEXT:   [[ARGP_CUR:%[^,=]+]] = load i8*, i8** [[VA]], align 4
+// CHECK-NEXT:   [[ARGP_NEXT:%[^,=]+]] = getelementptr inbounds i8, i8* 
[[ARGP_CUR]], i32 0
+// CHECK-NEXT:   store i8* [[ARGP_NEXT]], i8** [[VA]], align 4
+// CHECK-NEXT:   [[R0:%[^,=]

[PATCH] D66266: [WIP][RISCV] Set MaxAtomicPromoteWidth and MaxAtomicInlineWidth

2019-08-15 Thread Pengxuan Zheng via Phabricator via cfe-commits
pzheng abandoned this revision.
pzheng added a comment.

Hi Sam,

Thanks for pointing me to the patch. I can abandon this one now.

Pengxuan


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66266



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


[PATCH] D66040: [Sema] Implement DR2386 for C++17 structured binding

2019-08-15 Thread Reid Kleckner via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369043: [Sema] Implement DR2386 for C++17 structured binding 
(authored by rnk, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66040?vs=215442&id=215456#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66040

Files:
  cfe/trunk/lib/Sema/SemaDeclCXX.cpp
  cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp
  cfe/trunk/test/CXX/drs/dr23xx.cpp


Index: cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp
===
--- cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp
+++ cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp
@@ -12,7 +12,7 @@
 
 struct Bad1 { int a, b; };
 template<> struct std::tuple_size {};
-void no_tuple_size_3() { auto [x, y] = Bad1(); } // expected-error {{cannot 
decompose this type; 'std::tuple_size::value' is not a valid integral 
constant expression}}
+void no_tuple_size_3() { auto [x, y] = Bad1(); } // ok, omitting value is 
valid after DR2386
 
 struct Bad2 {};
 template<> struct std::tuple_size { const int value = 5; };
Index: cfe/trunk/test/CXX/drs/dr23xx.cpp
===
--- cfe/trunk/test/CXX/drs/dr23xx.cpp
+++ cfe/trunk/test/CXX/drs/dr23xx.cpp
@@ -40,6 +40,27 @@
 #pragma clang __debug dump not_use_2
 }
 
+#if __cplusplus >= 201707L
+// Otherwise, if the qualified-id std::tuple_size names a complete class
+// type **with a member value**, the expression std::tuple_size::value shall
+// be a well-formed integral constant expression
+namespace dr2386 { // dr2386: 9
+struct Bad1 { int a, b; };
+struct Bad2 { int a, b; };
+} // namespace dr2386
+namespace std {
+template  struct tuple_size;
+template <> struct std::tuple_size {};
+template <> struct std::tuple_size {
+  static const int value = 42;
+};
+} // namespace std
+namespace dr2386 {
+void no_value() { auto [x, y] = Bad1(); }
+void wrong_value() { auto [x, y] = Bad2(); } // expected-error {{decomposes 
into 42 elements}}
+} // namespace dr2386
+#endif
+
 namespace dr2387 { // dr2387: 9
 #if __cplusplus >= 201402L
   template int a = 0;
Index: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp
@@ -1030,8 +1030,10 @@
   TemplateArgumentListInfo Args(Loc, Loc);
   Args.addArgument(getTrivialTypeTemplateArgument(S, Loc, T));
 
-  // If there's no tuple_size specialization, it's not tuple-like.
-  if (lookupStdTypeTraitMember(S, R, Loc, "tuple_size", Args, /*DiagID*/0))
+  // If there's no tuple_size specialization or the lookup of 'value' is empty,
+  // it's not tuple-like.
+  if (lookupStdTypeTraitMember(S, R, Loc, "tuple_size", Args, /*DiagID*/ 0) ||
+  R.empty())
 return IsTupleLike::NotTupleLike;
 
   // If we get this far, we've committed to the tuple interpretation, but
@@ -1048,11 +1050,6 @@
 }
   } Diagnoser(R, Args);
 
-  if (R.empty()) {
-Diagnoser.diagnoseNotICE(S, Loc, SourceRange());
-return IsTupleLike::Error;
-  }
-
   ExprResult E =
   S.BuildDeclarationNameExpr(CXXScopeSpec(), R, /*NeedsADL*/false);
   if (E.isInvalid())


Index: cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp
===
--- cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp
+++ cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp
@@ -12,7 +12,7 @@
 
 struct Bad1 { int a, b; };
 template<> struct std::tuple_size {};
-void no_tuple_size_3() { auto [x, y] = Bad1(); } // expected-error {{cannot decompose this type; 'std::tuple_size::value' is not a valid integral constant expression}}
+void no_tuple_size_3() { auto [x, y] = Bad1(); } // ok, omitting value is valid after DR2386
 
 struct Bad2 {};
 template<> struct std::tuple_size { const int value = 5; };
Index: cfe/trunk/test/CXX/drs/dr23xx.cpp
===
--- cfe/trunk/test/CXX/drs/dr23xx.cpp
+++ cfe/trunk/test/CXX/drs/dr23xx.cpp
@@ -40,6 +40,27 @@
 #pragma clang __debug dump not_use_2
 }
 
+#if __cplusplus >= 201707L
+// Otherwise, if the qualified-id std::tuple_size names a complete class
+// type **with a member value**, the expression std::tuple_size::value shall
+// be a well-formed integral constant expression
+namespace dr2386 { // dr2386: 9
+struct Bad1 { int a, b; };
+struct Bad2 { int a, b; };
+} // namespace dr2386
+namespace std {
+template  struct tuple_size;
+template <> struct std::tuple_size {};
+template <> struct std::tuple_size {
+  static const int value = 42;
+};
+} // namespace std
+namespace dr2386 {
+void no_value() { auto [x, y] = Bad1(); }
+void wrong_value() { auto [x, y] = Bad2(); } // expected-error {{decomposes into 42 elements}}
+} // namespace dr2386
+#endif
+
 namespace dr23

r369043 - [Sema] Implement DR2386 for C++17 structured binding

2019-08-15 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu Aug 15 12:45:28 2019
New Revision: 369043

URL: http://llvm.org/viewvc/llvm-project?rev=369043&view=rev
Log:
[Sema] Implement DR2386 for C++17 structured binding

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

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

Fixes PR33236

Reviewers: rsmith

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

Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp
cfe/trunk/test/CXX/drs/dr23xx.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=369043&r1=369042&r2=369043&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Aug 15 12:45:28 2019
@@ -1030,8 +1030,10 @@ static IsTupleLike isTupleLike(Sema &S,
   TemplateArgumentListInfo Args(Loc, Loc);
   Args.addArgument(getTrivialTypeTemplateArgument(S, Loc, T));
 
-  // If there's no tuple_size specialization, it's not tuple-like.
-  if (lookupStdTypeTraitMember(S, R, Loc, "tuple_size", Args, /*DiagID*/0))
+  // If there's no tuple_size specialization or the lookup of 'value' is empty,
+  // it's not tuple-like.
+  if (lookupStdTypeTraitMember(S, R, Loc, "tuple_size", Args, /*DiagID*/ 0) ||
+  R.empty())
 return IsTupleLike::NotTupleLike;
 
   // If we get this far, we've committed to the tuple interpretation, but
@@ -1048,11 +1050,6 @@ static IsTupleLike isTupleLike(Sema &S,
 }
   } Diagnoser(R, Args);
 
-  if (R.empty()) {
-Diagnoser.diagnoseNotICE(S, Loc, SourceRange());
-return IsTupleLike::Error;
-  }
-
   ExprResult E =
   S.BuildDeclarationNameExpr(CXXScopeSpec(), R, /*NeedsADL*/false);
   if (E.isInvalid())

Modified: cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp?rev=369043&r1=369042&r2=369043&view=diff
==
--- cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp (original)
+++ cfe/trunk/test/CXX/dcl.decl/dcl.decomp/p3.cpp Thu Aug 15 12:45:28 2019
@@ -12,7 +12,7 @@ void no_tuple_size_2() { auto [x, y] = A
 
 struct Bad1 { int a, b; };
 template<> struct std::tuple_size {};
-void no_tuple_size_3() { auto [x, y] = Bad1(); } // expected-error {{cannot 
decompose this type; 'std::tuple_size::value' is not a valid integral 
constant expression}}
+void no_tuple_size_3() { auto [x, y] = Bad1(); } // ok, omitting value is 
valid after DR2386
 
 struct Bad2 {};
 template<> struct std::tuple_size { const int value = 5; };

Modified: cfe/trunk/test/CXX/drs/dr23xx.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr23xx.cpp?rev=369043&r1=369042&r2=369043&view=diff
==
--- cfe/trunk/test/CXX/drs/dr23xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr23xx.cpp Thu Aug 15 12:45:28 2019
@@ -40,6 +40,27 @@ namespace dr2353 { // dr2353: 9
 #pragma clang __debug dump not_use_2
 }
 
+#if __cplusplus >= 201707L
+// Otherwise, if the qualified-id std::tuple_size names a complete class
+// type **with a member value**, the expression std::tuple_size::value shall
+// be a well-formed integral constant expression
+namespace dr2386 { // dr2386: 9
+struct Bad1 { int a, b; };
+struct Bad2 { int a, b; };
+} // namespace dr2386
+namespace std {
+template  struct tuple_size;
+template <> struct std::tuple_size {};
+template <> struct std::tuple_size {
+  static const int value = 42;
+};
+} // namespace std
+namespace dr2386 {
+void no_value() { auto [x, y] = Bad1(); }
+void wrong_value() { auto [x, y] = Bad2(); } // expected-error {{decomposes 
into 42 elements}}
+} // namespace dr2386
+#endif
+
 namespace dr2387 { // dr2387: 9
 #if __cplusplus >= 201402L
   template int a = 0;


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


[PATCH] D65695: Implements CWG 1601 in [over.ics.rank/4.2]

2019-08-15 Thread Mark de Wever via Phabricator via cfe-commits
Mordante updated this revision to Diff 215457.
Mordante added a comment.

Add the proper markers in the unit test to update `cxx_dr_status.html`. As 
discussed on IRC; the up to date `cwg_index.html` is not public, so I only 
updated the unit test and removed the changes to `cxx_dr_status.html`.


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

https://reviews.llvm.org/D65695

Files:
  clang/lib/Sema/SemaOverload.cpp
  clang/test/CXX/drs/dr16xx.cpp
  clang/test/CXX/drs/dr6xx.cpp


Index: clang/test/CXX/drs/dr6xx.cpp
===
--- clang/test/CXX/drs/dr6xx.cpp
+++ clang/test/CXX/drs/dr6xx.cpp
@@ -1007,9 +1007,10 @@
   void j(long); // expected-note {{candidate}}
   int d = j(g); // expected-error {{ambiguous}}
 
-  int k(short); // expected-note {{candidate}}
-  void k(int); // expected-note {{candidate}}
-  int x = k(g); // expected-error {{ambiguous}}
+  // Valid per dr1601
+  int k(short);
+  void k(int);
+  int x = k(g);
 }
 #endif
 
Index: clang/test/CXX/drs/dr16xx.cpp
===
--- clang/test/CXX/drs/dr16xx.cpp
+++ clang/test/CXX/drs/dr16xx.cpp
@@ -23,6 +23,17 @@
 } // std
 #endif
 
+namespace dr1601 { // dr1601: 10 c++11
+#if __cplusplus >= 201103L
+enum E : char { e };
+void f(char);
+void f(int);
+void g() {
+  f(e);
+}
+#endif
+} // namespace dr1601
+
 namespace dr1611 { // dr1611: dup 1658
   struct A { A(int); };
   struct B : virtual A { virtual void f() = 0; };
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -3751,6 +3751,26 @@
   !SCS2.IsLvalueReference && SCS2.BindsToFunctionLvalue);
 }
 
+/// Returns the underlaying type of a fixed enum of the \a SCS's \c FromType
+/// if the \a SCS uses an integral promotion. Upon failure an empty type is
+/// returned.
+static QualType
+getFixedEnumUnderlayingType(const StandardConversionSequence &SCS) {
+
+  if (SCS.Second != ICK_Integral_Promotion)
+return QualType();
+
+  QualType FromType = SCS.getFromType();
+  if (!FromType->isEnumeralType())
+return QualType();
+
+  EnumDecl *Enum = FromType->getAs()->getDecl();
+  if (!Enum->isFixed())
+return QualType();
+
+  return Enum->getIntegerType();
+}
+
 /// CompareStandardConversionSequences - Compare two standard
 /// conversion sequences to determine whether one is better than the
 /// other or if they are indistinguishable (C++ 13.3.3.2p3).
@@ -3792,6 +3812,23 @@
  ? ImplicitConversionSequence::Better
  : ImplicitConversionSequence::Worse;
 
+  // C++14 [over.ics.rank]p4b2:
+  // This is retroactively applied to C++11 by CWG 1601.
+  //
+  //   A conversion that promotes an enumeration whose underlying type is fixed
+  //   to its underlying type is better than one that promotes to the promoted
+  //   underlying type, if the two are different.
+  QualType UnderlayingType1 = getFixedEnumUnderlayingType(SCS1);
+  QualType UnderlayingType2 = getFixedEnumUnderlayingType(SCS2);
+  if (!UnderlayingType1.isNull() && !UnderlayingType2.isNull()) {
+if (SCS1.getToType(1) == UnderlayingType1 &&
+SCS2.getToType(1) != UnderlayingType2)
+  return ImplicitConversionSequence::Better;
+else if (SCS1.getToType(1) != UnderlayingType1 &&
+ SCS2.getToType(1) == UnderlayingType2)
+  return ImplicitConversionSequence::Worse;
+  }
+
   // C++ [over.ics.rank]p4b2:
   //
   //   If class B is derived directly or indirectly from class A,


Index: clang/test/CXX/drs/dr6xx.cpp
===
--- clang/test/CXX/drs/dr6xx.cpp
+++ clang/test/CXX/drs/dr6xx.cpp
@@ -1007,9 +1007,10 @@
   void j(long); // expected-note {{candidate}}
   int d = j(g); // expected-error {{ambiguous}}
 
-  int k(short); // expected-note {{candidate}}
-  void k(int); // expected-note {{candidate}}
-  int x = k(g); // expected-error {{ambiguous}}
+  // Valid per dr1601
+  int k(short);
+  void k(int);
+  int x = k(g);
 }
 #endif
 
Index: clang/test/CXX/drs/dr16xx.cpp
===
--- clang/test/CXX/drs/dr16xx.cpp
+++ clang/test/CXX/drs/dr16xx.cpp
@@ -23,6 +23,17 @@
 } // std
 #endif
 
+namespace dr1601 { // dr1601: 10 c++11
+#if __cplusplus >= 201103L
+enum E : char { e };
+void f(char);
+void f(int);
+void g() {
+  f(e);
+}
+#endif
+} // namespace dr1601
+
 namespace dr1611 { // dr1611: dup 1658
   struct A { A(int); };
   struct B : virtual A { virtual void f() = 0; };
Index: clang/lib/Sema/SemaOverload.cpp
===
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -3751,6 +3751,26 @@
   !SCS2.IsLvalueReference && SCS2.BindsToFunctionLvalue);
 }
 
+/// Returns the underlaying type of a fixed enum of the \a SCS's \c From

[PATCH] D62731: [RFC] Add support for options -fp-model= and -fp-speculation= : specify floating point behavior

2019-08-15 Thread Melanie Blower via Phabricator via cfe-commits
mibintc marked 3 inline comments as done.
mibintc added inline comments.



Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:126
+  case LangOptions::FPM_Precise:
+  case LangOptions::FPM_Fast:
+break;

kpn wrote:
> Wait, so "fast" and "precise" are the same thing? That doesn't sound like 
> where the documentation you put in the ticket says "the compiler preserves 
> the source expression ordering and rounding properties of floating-point".
> 
> (Yes, I saw below where "fast" turns on the fast math flags but "precise" 
> doesn't. That doesn't affect my point here.)
"precise" doesn't necessitate the use of Constrained Intrinsics, And likewise 
for "fast".   The words "compiler preserves the source expression ordering" 
were copied from the msdn documentation for /fp:precise as you explained it 
would be useful to have the msdn documentation for the option in case it goes 
offline in, say, 30 years.  The ICL Intel compiler also provides equivalent 
floating point options. The Intel documentation for precise is phrased 
differently "Disables optimizations that are not value-safe on floating-point 
data."  

fp-model=precise should enable contractions, if that's not true at default (I 
mean, clang -c) then this patch is missing that.

fp-model=fast is the same as requesting ffast-math 



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3052
+else
+  llvm_unreachable("invalid -fp-model setting");
+  }

kpn wrote:
> Shouldn't this be a call to Diags.Report() like in the code just above it and 
> below? Same question for _some_ other uses of llvm_unreachable().
I put it in as unreachable because the clang driver shouldn't build this 
combination, but that's a good point I can just switch it to match the other 
code in this function, thanks.



Comment at: clang/test/CodeGen/fpconstrained.c:22
+  // STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %0, float 
%1, metadata !"round.dynamic", metadata !"fpexcept.ignore")
+  // PRECISE: fadd float
+  // FAST: fadd fast

kpn wrote:
> This is another case of "fast" and "precise" doing the same thing. If we're 
> using the regular fadd then it cannot be that "the compiler preserves the 
> source expression ordering and rounding properties of floating-point".
I need an fp wizard to address this point, @andrew.w.kaylor ??

The msdn documentation says that strict and precise both preserve ... 


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62731



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


[PATCH] D65935: [ASTImporter] Import ctor initializers after setting flags.

2019-08-15 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

I was hoping to be able reproduce this in LLDB via an expression like this:

  expr testImportOfDelegateConstructor(10) == 10

but it does not. I am assuming the test ctu test case invokes the issues 
without the patch? I wonder why we don't also see it in as well.

Otherwise LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65935



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


Re: [PATCH] D66296: [BUNDLER]Improve the test, NFC.

2019-08-15 Thread Azhar Mohammed via cfe-commits
Seeing this now:

fatal error: error in backend: Global variable '' has an invalid section 
specifier '__CLANG_OFFLOAD_BUNDLE__host-x86_64-apple-darwin17.6.0': mach-o 
section specifier requires a segment whose length is between 1 and 16 
characters.
 <>clang-10: error: clang frontend command failed with exit code 70 (use -v to 
see invocation)
clang version 10.0.0 (http://labmaster3.local/git/llvm-project.git 
 
00782a4b68c71b9fb80b403b13f9ec67f07a87a4)
Target: x86_64-apple-darwin17.6.0
Thread model: posix
InstalledDir: 
/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to 
https://bugs.llvm.org/  and include the crash 
backtrace, preprocessed source, and associated run script.
clang-10: note: diagnostic msg: Error generating preprocessed source(s) - no 
preprocessable inputs.
error: incremental linking by external tool failed.

http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/1196/consoleFull#-2382751928254eaf0-7326-4999-85b0-388101f2d404
 



> On Aug 15, 2019, at 12:00 PM, Alexey Bataev via Phabricator via llvm-commits 
>  wrote:
> 
> ABataev added a comment.
> 
> In D66296#1632003 , @azharudd wrote:
> 
>> Looks like this is failing on Darwin:
>> 
>> http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/1193/consoleFull#-2382751928254eaf0-7326-4999-85b0-388101f2d404
>> 
>>  
>> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/clang/test/Driver/clang-offload-bundler.c:120:15:
>>  error: CK-TEXTLL: expected string not found in input
>>  // CK-TEXTLL: @A = dso_local global i32 0
>>^
>>  
>> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/tools/clang/test/Driver/Output/clang-offload-bundler.c.tmp.bundle3.ll:3:1:
>>  note: scanning from here
>>  ; ModuleID = 
>> '/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/clang/test/Driver/clang-offload-bundler.c'
>>  ^
>>  
>> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/tools/clang/test/Driver/Output/clang-offload-bundler.c.tmp.bundle3.ll:8:1:
>>  note: possible intended match here
>>  @A = global i32 0, align 4
>> 
> 
> 
> Committed the fix already
> 
> 
> Repository:
>  rL LLVM
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D66296/new/
> 
> https://reviews.llvm.org/D66296
> 
> 
> 
> ___
> llvm-commits mailing list
> llvm-comm...@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits

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


Re: [PATCH] D66296: [BUNDLER]Improve the test, NFC.

2019-08-15 Thread Alexey Bataev via cfe-commits
Will fix this shortly.

-
Best regards,
Alexey Bataev

15.08.2019 16:23, Azhar Mohammed пишет:
> Seeing this now:
>
> fatal error: error in backend: Global variable '' has an invalid
> section specifier
> '__CLANG_OFFLOAD_BUNDLE__host-x86_64-apple-darwin17.6.0': mach-o
> section specifier requires a segment whose length is between 1 and 16
> characters. clang-10: error: clang frontend command failed with exit
> code 70 (use -v to see invocation) clang version 10.0.0
> (http://labmaster3.local/git/llvm-project.git00782a4b68c71b9fb80b403b13f9ec67f07a87a4)
> Target: x86_64-apple-darwin17.6.0 Thread model: posix InstalledDir:
> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/bin
> clang-10: note: diagnostic msg: PLEASE submit a bug report to
> https://bugs.llvm.org/and include the crash backtrace, preprocessed
> source, and associated run script. clang-10: note: diagnostic msg:
> Error generating preprocessed source(s) - no preprocessable inputs.
> error: incremental linking by external tool failed.
> http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/1196/consoleFull#-2382751928254eaf0-7326-4999-85b0-388101f2d404
>
>
>
>> On Aug 15, 2019, at 12:00 PM, Alexey Bataev via Phabricator via
>> llvm-commits > > wrote:
>>
>> ABataev added a comment.
>>
>> In D66296#1632003 ,
>> @azharudd wrote:
>>
>>> Looks like this is failing on Darwin:
>>>
>>> http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/1193/consoleFull#-2382751928254eaf0-7326-4999-85b0-388101f2d404
>>>
>>>  
>>> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/clang/test/Driver/clang-offload-bundler.c:120:15:
>>> error: CK-TEXTLL: expected string not found in input
>>>  // CK-TEXTLL: @A = dso_local global i32 0
>>>                ^
>>>  
>>> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/tools/clang/test/Driver/Output/clang-offload-bundler.c.tmp.bundle3.ll:3:1:
>>> note: scanning from here
>>>  ; ModuleID =
>>> '/Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm-project/clang/test/Driver/clang-offload-bundler.c'
>>>  ^
>>>  
>>> /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/clang-build/tools/clang/test/Driver/Output/clang-offload-bundler.c.tmp.bundle3.ll:8:1:
>>> note: possible intended match here
>>>  @A = global i32 0, align 4
>>>
>>
>>
>> Committed the fix already
>>
>>
>> Repository:
>>  rL LLVM
>>
>> CHANGES SINCE LAST ACTION
>>  https://reviews.llvm.org/D66296/new/
>>
>> https://reviews.llvm.org/D66296
>>
>>
>>
>> ___
>> llvm-commits mailing list
>> llvm-comm...@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>


signature.asc
Description: OpenPGP digital signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65453: Improve the accuracy of the Clang call graph analysis

2019-08-15 Thread Joshua Cranmer via Phabricator via cfe-commits
jcranmer-intel updated this revision to Diff 215462.
jcranmer-intel added a comment.

I've rolled the relevant call graph analysis changes from the prior commit into 
this updated patch.


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

https://reviews.llvm.org/D65453

Files:
  clang/include/clang/Analysis/CallGraph.h
  clang/lib/Analysis/CallGraph.cpp
  clang/test/Analysis/cxx-callgraph.cpp

Index: clang/test/Analysis/cxx-callgraph.cpp
===
--- /dev/null
+++ clang/test/Analysis/cxx-callgraph.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCallGraph %s 2>&1 | FileCheck %s
+
+static int aaa() {
+  return 0;
+}
+
+static int bbb(int param=aaa()) {
+  return 1;
+}
+
+int ddd();
+
+struct c {
+  c(int param=2) : val(bbb(param)) {}
+  int val;
+  int val2 = ddd();
+};
+
+int ddd() {
+  c c;
+  return bbb();
+}
+
+// CHECK:--- Call graph Dump ---
+// CHECK-NEXT: {{Function: < root > calls: aaa bbb c::c ddd}}
+// CHECK-NEXT: {{Function: c::c calls: bbb ddd $}}
+// CHECK-NEXT: {{Function: ddd calls: c::c bbb aaa $}}
+// CHECK-NEXT: {{Function: bbb calls: $}}
+// CHECK-NEXT: {{Function: aaa calls: $}}
Index: clang/lib/Analysis/CallGraph.cpp
===
--- clang/lib/Analysis/CallGraph.cpp
+++ clang/lib/Analysis/CallGraph.cpp
@@ -79,6 +79,40 @@
 VisitChildren(CE);
   }
 
+  void VisitLambdaExpr(LambdaExpr *LE) {
+if (CXXMethodDecl *MD = LE->getCallOperator())
+  G->VisitFunctionDecl(MD);
+  }
+
+  void VisitCXXNewExpr(CXXNewExpr *E) {
+if (FunctionDecl *FD = E->getOperatorNew())
+  addCalledDecl(FD);
+VisitChildren(E);
+  }
+
+  void VisitCXXConstructExpr(CXXConstructExpr *E) {
+CXXConstructorDecl *Ctor = E->getConstructor();
+if (FunctionDecl *Def = Ctor->getDefinition())
+  addCalledDecl(Def);
+const auto *ConstructedType = Ctor->getParent();
+if (ConstructedType->hasUserDeclaredDestructor()) {
+  CXXDestructorDecl *Dtor = ConstructedType->getDestructor();
+  if (FunctionDecl *Def = Dtor->getDefinition())
+addCalledDecl(Def);
+}
+VisitChildren(E);
+  }
+
+  // Include the evaluation of the default argument.
+  void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
+Visit(E->getExpr());
+  }
+
+  // Include the evaluation of the default initializers in a class.
+  void VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {
+Visit(E->getExpr());
+  }
+
   // Adds may-call edges for the ObjC message sends.
   void VisitObjCMessageExpr(ObjCMessageExpr *ME) {
 if (ObjCInterfaceDecl *IDecl = ME->getReceiverInterface()) {
@@ -143,13 +177,20 @@
 void CallGraph::addNodeForDecl(Decl* D, bool IsGlobal) {
   assert(D);
 
-  // Allocate a new node, mark it as root, and process it's calls.
+  // Allocate a new node, mark it as root, and process its calls.
   CallGraphNode *Node = getOrInsertNode(D);
 
   // Process all the calls by this function as well.
   CGBuilder builder(this, Node);
   if (Stmt *Body = D->getBody())
 builder.Visit(Body);
+
+  // Include C++ constructor member initializers.
+  if (auto constructor = dyn_cast(D)) {
+for (CXXCtorInitializer *init : constructor->inits()) {
+  builder.Visit(init->getInit());
+}
+  }
 }
 
 CallGraphNode *CallGraph::getNode(const Decl *F) const {
Index: clang/include/clang/Analysis/CallGraph.h
===
--- clang/include/clang/Analysis/CallGraph.h
+++ clang/include/clang/Analysis/CallGraph.h
@@ -131,6 +131,7 @@
 
   bool shouldWalkTypesOfTypeLocs() const { return false; }
   bool shouldVisitTemplateInstantiations() const { return true; }
+  bool shouldVisitImplicitCode() const { return true; }
 
 private:
   /// Add the given declaration to the call graph.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r369044 - Mark the test as unsupported on darwin, NFC.

2019-08-15 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Aug 15 13:31:47 2019
New Revision: 369044

URL: http://llvm.org/viewvc/llvm-project?rev=369044&view=rev
Log:
Mark the test as unsupported on darwin, NFC.

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

Modified:
cfe/trunk/test/Driver/clang-offload-bundler.c

Modified: cfe/trunk/test/Driver/clang-offload-bundler.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=369044&r1=369043&r2=369044&view=diff
==
--- cfe/trunk/test/Driver/clang-offload-bundler.c (original)
+++ cfe/trunk/test/Driver/clang-offload-bundler.c Thu Aug 15 13:31:47 2019
@@ -1,7 +1,7 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: powerpc-registered-target
 // REQUIRES: shell
-// UNSUPPORTED: ms-sdk
+// UNSUPPORTED: ms-sdk, darwin
 
 //
 // Generate all the types of files we can bundle.


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


[PATCH] D65997: Add options rounding and exceptions to pragma fp

2019-08-15 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added inline comments.



Comment at: clang/docs/LanguageExtensions.rst:3127
 
 The pragma can take three values: ``on``, ``fast`` and ``off``.  The ``on``
 option is identical to using ``#pragma STDC FP_CONTRACT(ON)`` and it allows

This part of the documentation is ambiguous in light of the new options. I 
suppose "[t]he pragma" here refers to "#pragma clang fp contract" but the first 
paragraph refers to "#pragma clang fp" as "the pragma."



Comment at: clang/docs/LanguageExtensions.rst:3152
+rounding mode. This option is experimental; the compiler may ignore an explicit
+rounding mode in some situations.
+

You should say something about whether the rounding mode is applied or assumed. 
The rounding mode argument in the constrained FP intrinsics is assumed. The 
compiler is not required to do anything to force the hardware into that 
rounding mode. I think we want that behavior here as well. I believe this 
follows the semantics of the STDC FENV_ROUND pragmas that were introduced by 
ISO TS-18661.



Comment at: clang/docs/LanguageExtensions.rst:3159
+This option is experimental; the compiler may ignore an explicit exception
+behavior in some situations.
+

I'm not sure what this is supposed to mean. What are the circumstances under 
which the compiler may ignore an explicit exception behavior? Do you mean that 
it isn't supposed to happen but it might while the feature is under development?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65997



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


[PATCH] D65695: Implements CWG 1601 in [over.ics.rank/4.2]

2019-08-15 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: clang/lib/Sema/SemaOverload.cpp:3758
+static QualType
+getFixedEnumUnderlayingType(const StandardConversionSequence &SCS) {
+

Underlaying -> Underlying (here and below)



Comment at: clang/lib/Sema/SemaOverload.cpp:3821-3828
+  QualType UnderlayingType1 = getFixedEnumUnderlayingType(SCS1);
+  QualType UnderlayingType2 = getFixedEnumUnderlayingType(SCS2);
+  if (!UnderlayingType1.isNull() && !UnderlayingType2.isNull()) {
+if (SCS1.getToType(1) == UnderlayingType1 &&
+SCS2.getToType(1) != UnderlayingType2)
+  return ImplicitConversionSequence::Better;
+else if (SCS1.getToType(1) != UnderlayingType1 &&

I think this would be cleaner if you moved the comparison of the target type 
against the underlying type into `getFixedEnumUnderlyingType`, and changed it 
to return an enumeration of "not a fixed enum promotion", or "fixed enum 
promotion to underlying type", or "fixed enum promotion to promoted underlying 
type".



Comment at: clang/test/CXX/drs/dr16xx.cpp:26
 
+namespace dr1601 { // dr1601: 10 c++11
+#if __cplusplus >= 201103L

No need for the "c++11" marker here. (We accept fixed underlying types in C++98 
as an extension, and your change applies there too.)


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

https://reviews.llvm.org/D65695



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


[PATCH] D66303: [LifetimeAnalysis] Add support for free functions

2019-08-15 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added inline comments.



Comment at: clang/lib/Sema/SemaInit.cpp:6622
+return false;
+  const auto *RD = FD->getParamDecl(0)->getType()->getPointeeCXXRecordDecl();
+  if (!FD->isInStdNamespace() || !RD || !RD->isInStdNamespace())

Maybe move the `Callee->getNumParams() == 1` check from the caller into this 
function so it's obvious that `getParamDecl(0)` is allowed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66303



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


[PATCH] D59692: [ASTImporter] Fix name conflict handling

2019-08-15 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment.

Just wanted to see if you were planning on landing this soon, the fix `Name` -> 
`SearchName` is probably an important one since we have seen several issues w/ 
bugs like that but I really would like to see more tests. Are you having issues 
coming up w/ tests?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59692



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


r369049 - [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug

2019-08-15 Thread Joel E. Denny via cfe-commits
Author: jdenny
Date: Thu Aug 15 14:17:48 2019
New Revision: 369049

URL: http://llvm.org/viewvc/llvm-project?rev=369049&view=rev
Log:
[Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug

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

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

Reviewed By: jkorous

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

Modified:
cfe/trunk/include/clang/Rewrite/Core/Rewriter.h
cfe/trunk/lib/Rewrite/Rewriter.cpp
cfe/trunk/unittests/Rewrite/RewriteBufferTest.cpp

Modified: cfe/trunk/include/clang/Rewrite/Core/Rewriter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Rewrite/Core/Rewriter.h?rev=369049&r1=369048&r2=369049&view=diff
==
--- cfe/trunk/include/clang/Rewrite/Core/Rewriter.h (original)
+++ cfe/trunk/include/clang/Rewrite/Core/Rewriter.h Thu Aug 15 14:17:48 2019
@@ -46,6 +46,17 @@ public:
 
 /// If true and removing some text leaves a blank line
 /// also remove the empty line (false by default).
+///
+/// FIXME: This sometimes corrupts the file's rewrite buffer due to
+/// incorrect indexing in the implementation (see the FIXME in
+/// clang::RewriteBuffer::RemoveText).  Moreover, it's inefficient because
+/// it must scan the buffer from the beginning to find the start of the
+/// line.  When feasible, it's better for the caller to check for a blank
+/// line and then, if found, expand the removal range to include it.
+/// Checking for a blank line is easy if, for example, the caller can
+/// guarantee this is the first edit of a line.  In that case, it can just
+/// scan before and after the removal range until the next newline or
+/// begin/end of the input.
 bool RemoveLineIfEmpty = false;
 
 RewriteOptions() {}

Modified: cfe/trunk/lib/Rewrite/Rewriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Rewriter.cpp?rev=369049&r1=369048&r2=369049&view=diff
==
--- cfe/trunk/lib/Rewrite/Rewriter.cpp (original)
+++ cfe/trunk/lib/Rewrite/Rewriter.cpp Thu Aug 15 14:17:48 2019
@@ -96,6 +96,17 @@ void RewriteBuffer::RemoveText(unsigned
 }
 if (posI != end() && *posI == '\n') {
   Buffer.erase(curLineStartOffs, lineSize + 1/* + '\n'*/);
+  // FIXME: Here, the offset of the start of the line is supposed to be
+  // expressed in terms of the original input not the "real" rewrite
+  // buffer.  How do we compute that reliably?  It might be tempting to use
+  // curLineStartOffs + OrigOffset - RealOffset, but that assumes the
+  // difference between the original and real offset is the same at the
+  // removed text and at the start of the line, but that's not true if
+  // edits were previously made earlier on the line.  This bug is also
+  // documented by a FIXME on the definition of
+  // clang::Rewriter::RewriteOptions::RemoveLineIfEmpty.  A reproducer for
+  // the implementation below is the test RemoveLineIfEmpty in
+  // clang/unittests/Rewrite/RewriteBufferTest.cpp.
   AddReplaceDelta(curLineStartOffs, -(lineSize + 1/* + '\n'*/));
 }
   }

Modified: cfe/trunk/unittests/Rewrite/RewriteBufferTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Rewrite/RewriteBufferTest.cpp?rev=369049&r1=369048&r2=369049&view=diff
==
--- cfe/trunk/unittests/Rewrite/RewriteBufferTest.cpp (original)
+++ cfe/trunk/unittests/Rewrite/RewriteBufferTest.cpp Thu Aug 15 14:17:48 2019
@@ -14,6 +14,16 @@ using namespace clang;
 
 namespace {
 
+#define EXPECT_OUTPUT(Buf, Output) EXPECT_EQ(Output, writeOutput(Buf))
+
+static std::string writeOutput(const RewriteBuffer &Buf) {
+  std::string Result;
+  raw_string_ostream OS(Result);
+  Buf.write(OS);
+  OS.flush();
+  return Result;
+}
+
 static void tagRange(unsigned Offset, unsigned Len, StringRef tagName,
  RewriteBuffer &Buf) {
   std::string BeginTag;
@@ -40,11 +50,64 @@ TEST(RewriteBuffer, TagRanges) {
   tagRange(Pos, TagStr.size(), "outer", Buf);
   tagRange(Pos, TagStr.size(), "inner", Buf);
 
-  std::string Result;
-  raw_string_ostream OS(Result);
-  Buf.write(OS);
-  OS.flush();
-  EXPECT_EQ(Output, Result);
+  EXPECT_OUTPUT(Buf, Output);
+}
+
+TEST(RewriteBuffer, 

[PATCH] D61466: [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug

2019-08-15 Thread Joel E. Denny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369049: [Rewrite][NFC] Add FIXMEs and tests for 
RemoveLineIfEmpty bug (authored by jdenny, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61466?vs=213197&id=215468#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61466

Files:
  cfe/trunk/include/clang/Rewrite/Core/Rewriter.h
  cfe/trunk/lib/Rewrite/Rewriter.cpp
  cfe/trunk/unittests/Rewrite/RewriteBufferTest.cpp

Index: cfe/trunk/include/clang/Rewrite/Core/Rewriter.h
===
--- cfe/trunk/include/clang/Rewrite/Core/Rewriter.h
+++ cfe/trunk/include/clang/Rewrite/Core/Rewriter.h
@@ -46,6 +46,17 @@
 
 /// If true and removing some text leaves a blank line
 /// also remove the empty line (false by default).
+///
+/// FIXME: This sometimes corrupts the file's rewrite buffer due to
+/// incorrect indexing in the implementation (see the FIXME in
+/// clang::RewriteBuffer::RemoveText).  Moreover, it's inefficient because
+/// it must scan the buffer from the beginning to find the start of the
+/// line.  When feasible, it's better for the caller to check for a blank
+/// line and then, if found, expand the removal range to include it.
+/// Checking for a blank line is easy if, for example, the caller can
+/// guarantee this is the first edit of a line.  In that case, it can just
+/// scan before and after the removal range until the next newline or
+/// begin/end of the input.
 bool RemoveLineIfEmpty = false;
 
 RewriteOptions() {}
Index: cfe/trunk/lib/Rewrite/Rewriter.cpp
===
--- cfe/trunk/lib/Rewrite/Rewriter.cpp
+++ cfe/trunk/lib/Rewrite/Rewriter.cpp
@@ -96,6 +96,17 @@
 }
 if (posI != end() && *posI == '\n') {
   Buffer.erase(curLineStartOffs, lineSize + 1/* + '\n'*/);
+  // FIXME: Here, the offset of the start of the line is supposed to be
+  // expressed in terms of the original input not the "real" rewrite
+  // buffer.  How do we compute that reliably?  It might be tempting to use
+  // curLineStartOffs + OrigOffset - RealOffset, but that assumes the
+  // difference between the original and real offset is the same at the
+  // removed text and at the start of the line, but that's not true if
+  // edits were previously made earlier on the line.  This bug is also
+  // documented by a FIXME on the definition of
+  // clang::Rewriter::RewriteOptions::RemoveLineIfEmpty.  A reproducer for
+  // the implementation below is the test RemoveLineIfEmpty in
+  // clang/unittests/Rewrite/RewriteBufferTest.cpp.
   AddReplaceDelta(curLineStartOffs, -(lineSize + 1/* + '\n'*/));
 }
   }
Index: cfe/trunk/unittests/Rewrite/RewriteBufferTest.cpp
===
--- cfe/trunk/unittests/Rewrite/RewriteBufferTest.cpp
+++ cfe/trunk/unittests/Rewrite/RewriteBufferTest.cpp
@@ -14,6 +14,16 @@
 
 namespace {
 
+#define EXPECT_OUTPUT(Buf, Output) EXPECT_EQ(Output, writeOutput(Buf))
+
+static std::string writeOutput(const RewriteBuffer &Buf) {
+  std::string Result;
+  raw_string_ostream OS(Result);
+  Buf.write(OS);
+  OS.flush();
+  return Result;
+}
+
 static void tagRange(unsigned Offset, unsigned Len, StringRef tagName,
  RewriteBuffer &Buf) {
   std::string BeginTag;
@@ -40,11 +50,64 @@
   tagRange(Pos, TagStr.size(), "outer", Buf);
   tagRange(Pos, TagStr.size(), "inner", Buf);
 
-  std::string Result;
-  raw_string_ostream OS(Result);
-  Buf.write(OS);
-  OS.flush();
-  EXPECT_EQ(Output, Result);
+  EXPECT_OUTPUT(Buf, Output);
+}
+
+TEST(RewriteBuffer, DISABLED_RemoveLineIfEmpty_XFAIL) {
+  StringRef Input = "def\n"
+"ghi\n"
+"jkl\n";
+  RewriteBuffer Buf;
+  Buf.Initialize(Input);
+
+  // Insert "abc\n" at the start.
+  Buf.InsertText(0, "abc\n");
+  EXPECT_OUTPUT(Buf, "abc\n"
+ "def\n"
+ "ghi\n"
+ "jkl\n");
+
+  // Remove "def\n".
+  //
+  // After the removal of "def", we have:
+  //
+  //   "abc\n"
+  //   "\n"
+  //   "ghi\n"
+  //   "jkl\n"
+  //
+  // Because removeLineIfEmpty=true, RemoveText has to remove the "\n" left on
+  // the line.  This happens correctly for the rewrite buffer itself, so the
+  // next check below passes.
+  //
+  // However, RemoveText's implementation incorrectly records the delta for
+  // removing the "\n" using the rewrite buffer offset, 4, where it was
+  // supposed to use the original input offset, 3.  Interpreted as an original
+  // input offset, 4 points to "g" not to "\n".  Thus, any future modifications
+  // at the original input's "g" will incorrectly see "g" as

[PATCH] D66267: [analyzer] TrackConstraintBRVisitor: Do not track unknown values

2019-08-15 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

This code is super messy. It'd be great to actually test this change on 
something to see if it has any unwanted side effects.

Could you see if it also fixes https://bugs.llvm.org/show_bug.cgi?id=42938 and, 
if so, add it as a test?


Repository:
  rC Clang

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

https://reviews.llvm.org/D66267



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


[PATCH] D66267: [analyzer] TrackConstraintBRVisitor: Do not track unknown values

2019-08-15 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In D66267#1630728 , @Szelethus wrote:

> Shouldn't we just delete this entire visitor altogether and merge it into 
> ConditionBRVisitor (like, eventually, not right now)? It seems to be a relic 
> of the past.


I'm actually curious about one particular mess that we have here. Namely, 
there's a visitor that says "assuming..." and there's checker notes when 
checkers themselves assume something; how can we be sure they don't duplicate 
each other?


Repository:
  rC Clang

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

https://reviews.llvm.org/D66267



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


[PATCH] D66092: [CodeGen] Generate constrained fp intrinsics depending on FPOptions

2019-08-15 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added a comment.

In D66092#1630997 , @sepavloff wrote:

> Replacement of floating point operations with constrained intrinsics seems 
> more an optimization helper then a semantic requirement. IR where constrained 
> operations are mixed with unconstrained is still valid in sense of IR 
> specification.


The thing that makes the IR semantically incomplete is that there is nothing 
there to prevent incorrect code motion of the non-constrained operations. 
Consider this case:

  if (someCondition) {
#pragma clang fp rounding(downward)
fesetround(FE_DOWNWARD);
x = y/z;
fesetround(FE_TONEAREST);
  }
  a = b/c;

If you generate a regular fdiv instruction for the 'a = b/c;' statement, there 
is nothing that would prevent it from being hoisted above the call to 
fesetround() and so it might be rounded incorrectly.

In D66092#1630997 , @sepavloff wrote:

> Another issue is non-standard rounding. It can be represented by constrained 
> intrinsics only. The rounding does not require restrictions on code motion, 
> so mixture of constrained and unconstrained operation is OK. Replacement of 
> all operations with constrained intrinsics would give poorly optimized code, 
> because compiler does not optimize them. It would be a bad thing if a user 
> adds the pragma to execute a statement with specific rounding mode and loses 
> optimization.


I agree that loss of optimization would be a bad thing, but I think it's 
unavoidable. By using non-default rounding modes the user is implicitly 
accepting some loss of optimization. This may be more than they would have 
expected, but I can't see any way around it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66092



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


[PATCH] D65453: Improve the accuracy of the Clang call graph analysis

2019-08-15 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Thanks! This looks very useful.




Comment at: clang/lib/Analysis/CallGraph.cpp:97-102
+const auto *ConstructedType = Ctor->getParent();
+if (ConstructedType->hasUserDeclaredDestructor()) {
+  CXXDestructorDecl *Dtor = ConstructedType->getDestructor();
+  if (FunctionDecl *Def = Dtor->getDefinition())
+addCalledDecl(Def);
+}

Ugh this is questionable. The object may easily outlive the function, so the 
destructor may be called from another function. I see where this was supposed 
to go (i.e., this is perfectly correct when the constructor is constructing a 
non-RVO'd temporary or a non-NRVO'd local variable), but in the general case 
it's not true.

The really nice way to implement this functionality would be to rely on the 
constructor's `ConstructionContext`, but as of now it's only available in the 
CFG and there's no easy way to retrieve it by looking at the AST node (and if 
you have a CFG you might as well look at destructors directly, as they're 
listed there explicitly).

It should also be possible to do that by hand by matching `DeclStmt`s and 
`CXXBindTemporaryExpr`s.

Let's omit this part for now because currently the analysis seems to be 
conservative in the sense that it doesn't add calls when it's not sure.


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

https://reviews.llvm.org/D65453



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


  1   2   >