[PATCH] D73775: [clang-tidy] Cover cases like (b && c && b) in the redundant expression check

2020-02-12 Thread Alexey Romanov via Phabricator via cfe-commits
alexeyr added a comment.

Ping. Are any other changes needed?


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

https://reviews.llvm.org/D73775



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


[PATCH] D74467: [analyzer] Teach scan-build how to rebuild index.html without analyzing.

2020-02-12 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ created this revision.
NoQ added reviewers: dcoughlin, Charusso.
Herald added subscribers: cfe-commits, martong, dkrupp, donat.nagy, Szelethus, 
arphaman, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: clang.
NoQ marked an inline comment as done.
NoQ added inline comments.



Comment at: 
clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test:11-12
+RUN: cp %S/report-3.html %t.output_dir
+RUN: mkdir %t.output_dir/subdirectory
+RUN: cp %S/subdirectory/report-4.html %t.output_dir/subdirectory
+

The script is indeed capable of finding html reports in sub-directories and 
it's a fairly useful feature because in a custom build system integration it's 
likely that clang's `-o` flag will be very messed up.


This is useful for performing custom build system integration that works by 
appending '--analyze --analyzer-output html' to all clang build commands. In 
this case there is now still a way to have a fancy index.html with the output.


Repository:
  rC Clang

https://reviews.llvm.org/D74467

Files:
  clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test
  clang/test/Analysis/scan-build/rebuild_index/report-1.html
  clang/test/Analysis/scan-build/rebuild_index/report-2.html
  clang/test/Analysis/scan-build/rebuild_index/report-3.html
  clang/test/Analysis/scan-build/rebuild_index/subdirectory/report-4.html
  clang/tools/scan-build/bin/scan-build

Index: clang/tools/scan-build/bin/scan-build
===
--- clang/tools/scan-build/bin/scan-build
+++ clang/tools/scan-build/bin/scan-build
@@ -72,8 +72,9 @@
   MaxLoop => 0,
   PluginsToLoad => [],
   AnalyzerDiscoveryMethod => undef,
-  OverrideCompiler => 0,  # The flag corresponding to the --override-compiler command line option.
-  ForceAnalyzeDebugCode => 0
+  OverrideCompiler => 0, # The flag corresponding to the --override-compiler command line option.
+  ForceAnalyzeDebugCode => 0,
+  GenerateIndex => 0 # Skip the analysis, only generate index.html.
 );
 lock_keys(%Options);
 
@@ -946,6 +947,42 @@
   return $Num;
 }
 
+sub Finalize {
+  my $BaseDir = shift;
+  my $ExitStatus = shift;
+
+  if (defined $Options{OutputFormat}) {
+if ($Options{OutputFormat} =~ /plist/ ||
+$Options{OutputFormat} =~ /sarif/) {
+  Diag "Analysis run complete.\n";
+  Diag "Analysis results (" .
+($Options{OutputFormat} =~ /plist/ ? "plist" : "sarif") .
+" files) deposited in '$Options{OutputDir}'\n";
+}
+if ($Options{OutputFormat} =~ /html/) {
+  # Postprocess the HTML directory.
+  my $NumBugs = Postprocess($Options{OutputDir}, $BaseDir,
+$Options{AnalyzerStats}, $Options{KeepEmpty});
+
+  if ($Options{ViewResults} and -r "$Options{OutputDir}/index.html") {
+Diag "Analysis run complete.\n";
+Diag "Viewing analysis results in '$Options{OutputDir}' using scan-view.\n";
+my $ScanView = Cwd::realpath("$RealBin/scan-view");
+if (! -x $ScanView) { $ScanView = "scan-view"; }
+if (! -x $ScanView) { $ScanView = Cwd::realpath("$RealBin/../../scan-view/bin/scan-view"); }
+exec $ScanView, "$Options{OutputDir}";
+  }
+
+  if ($Options{ExitStatusFoundBugs}) {
+exit 1 if ($NumBugs > 0);
+exit $ExitStatus;
+  }
+}
+  }
+
+  exit $ExitStatus;
+}
+
 ####
 # RunBuildCommand - Run the build command.
 ####
@@ -1259,6 +1296,12 @@
 
View analysis results in a web browser when the build completes.
 
+ --generate-index 
+
+   Do not perform the analysis, but only regenerate the index.html file
+   from existing report.html files. Useful for making a custom Static Analyzer
+   integration into a build system that isn't otherwise supported by scan-build.
+
 ADVANCED OPTIONS:
 
  -no-failure-reports
@@ -1550,6 +1593,10 @@
 }
 
 if ($arg eq "-o") {
+  if (defined($Options{OutputDir})) {
+DieDiag("Only one of '-o' or '--generate-index' can be specified.\n");
+  }
+
   shift @$Args;
 
   if (!@$Args) {
@@ -1565,6 +1612,27 @@
   next;
 }
 
+if ($arg eq "--generate-index") {
+  if (defined($Options{OutputDir})) {
+DieDiag("Only one of '-o' or '--generate-index' can be specified.\n");
+  }
+
+  shift @$Args;
+
+  if (!@$Args) {
+DieDiag("'--generate-index' option requires a target directory name.\n");
+  }
+
+  # Construct an absolute path.  Uses the current working directory
+  # as a base if the original path was not absolute.
+  my $OutDir = shift @$Args;
+  mkpath($OutDir) unless (-e $OutDir);  # abs_path wants existing dir
+  $Options{OutputDir} = abs_path($OutDir);
+  $Options{GenerateIndex} = 1;
+
+  next;
+}
+

[PATCH] D74467: [analyzer] Teach scan-build how to rebuild index.html without analyzing.

2020-02-12 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ marked an inline comment as done.
NoQ added inline comments.



Comment at: 
clang/test/Analysis/scan-build/rebuild_index/rebuild_index.test:11-12
+RUN: cp %S/report-3.html %t.output_dir
+RUN: mkdir %t.output_dir/subdirectory
+RUN: cp %S/subdirectory/report-4.html %t.output_dir/subdirectory
+

The script is indeed capable of finding html reports in sub-directories and 
it's a fairly useful feature because in a custom build system integration it's 
likely that clang's `-o` flag will be very messed up.


Repository:
  rC Clang

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

https://reviews.llvm.org/D74467



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


[PATCH] D73052: [clang-tidy] RenamerClangTidy now renames dependent member expr when the member can be resolved

2020-02-12 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 244087.
njames93 added a comment.

- Made AggressiveDependentMemberLookup option Global


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73052

Files:
  clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.h
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
  
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp
@@ -1,7 +1,9 @@
 // RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
 // RUN:   -config='{CheckOptions: [ \
 // RUN: {key: readability-identifier-naming.MemberCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ParameterCase, value: CamelCase} \
+// RUN: {key: readability-identifier-naming.ParameterCase, value: CamelCase}, \
+// RUN: {key: readability-identifier-naming.MethodCase, value: camelBack}, \
+// RUN: {key: readability-identifier-naming.AggressiveDependentMemberLookup, value: 1} \
 // RUN:  ]}' -- -fno-delayed-template-parsing
 
 int set_up(int);
@@ -63,32 +65,23 @@
   // CHECK-FIXES: {{^}}  int getBar2() const { return this->BarBaz; } // comment-9
 };
 
-TempTest x; //force an instantiation
-
-int blah() {
-  return x.getBar2(); // gotta have a reference to the getBar2 so that the
-  // compiler will generate the function and resolve
-  // the DependantScopeMemberExpr
-}
-
 namespace Bug41122 {
 namespace std {
 
 // for this example we aren't bothered about how std::vector is treated
-template  //NOLINT
-class vector { //NOLINT
-public:
-  void push_back(bool); //NOLINT
-  void pop_back(); //NOLINT
-}; //NOLINT
-}; // namespace std
+template// NOLINT
+struct vector { // NOLINT
+  void push_back(bool); // NOLINT
+  void pop_back();  // NOLINT
+};  // NOLINT
+};  // namespace std
 
-class Foo { 
+class Foo {
   std::vector &stack;
   // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: invalid case style for member 'stack' [readability-identifier-naming]
 public:
   Foo(std::vector &stack)
-  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for parameter 'stack' [readability-identifier-naming]
+  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for parameter 'stack' [readability-identifier-naming]
   // CHECK-FIXES: {{^}}  Foo(std::vector &Stack)
   : stack(stack) {
 // CHECK-FIXES: {{^}}  : Stack(Stack) {
@@ -134,4 +127,92 @@
 void foo() {
   Container container;
 }
-}; // namespace CtorInits
+} // namespace CtorInits
+
+namespace resolved_dependance {
+template 
+struct A0 {
+  int value;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for member 'value'
+  A0 &operator=(const A0 &Other) {
+value = Other.value;   // A0
+this->value = Other.value; // A0
+// CHECK-FIXES:  {{^}}Value = Other.Value;   // A0
+// CHECK-FIXES-NEXT: {{^}}this->Value = Other.Value; // A0
+return *this;
+  }
+  void outOfLineReset();
+};
+
+template 
+void A0::outOfLineReset() {
+  this->value -= value; // A0
+  // CHECK-FIXES: {{^}}  this->Value -= Value; // A0
+}
+
+template 
+struct A1 {
+  int value; // A1
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for member 'value'
+  // CHECK-FIXES: {{^}}  int Value; // A1
+  int GetValue() const { return value; } // A1
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for method 'GetValue'
+  // CHECK-FIXES {{^}}  int getValue() const { return Value; } // A1
+  void SetValue(int Value) { this->value = Value; } // A1
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for method 'SetValue'
+  // CHECK-FIXES {{^}}  void setValue(int Value) { this->Value = Value; } // A1
+  A1 &operator=(const A1 &Other) {
+this->SetValue(Other.GetValue()); // A1
+this->value = Other.value;// A1
+// CHECK-FIXES:  {{^}}this->setValue(Other.getValue()); // A1
+// CHECK-FIXES-NEXT: {{^}}this->Value = Other.Value;// A1
+return *this;
+  }
+  void outOfLineReset();
+};
+
+template 
+void A1::outOfLineReset() {
+  this->value -= va

[PATCH] D74468: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

2020-02-12 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: gribozavr2.
Herald added a subscriber: xazax.hun.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74468

Files:
  clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
  clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable template is allowed.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;


Index: clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable template is allowed.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70876: [clang-tidy] Add spuriously-wake-up-functions check

2020-02-12 Thread Kocsis Ábel via Phabricator via cfe-commits
abelkocsis updated this revision to Diff 244098.
abelkocsis added a comment.

docs/list.rst update


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D70876

Files:
  clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
  clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
  clang-tools-extra/clang-tidy/bugprone/SpuriouslyWakeUpFunctionsCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/SpuriouslyWakeUpFunctionsCheck.h
  clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/docs/clang-tidy/checks/bugprone-spuriously-wake-up-functions.rst
  clang-tools-extra/docs/clang-tidy/checks/cert-con36-c.rst
  clang-tools-extra/docs/clang-tidy/checks/cert-con54-cpp.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/test/clang-tidy/bugprone-spuriously-wake-up-functions.c
  clang-tools-extra/test/clang-tidy/bugprone-spuriously-wake-up-functions.cpp

Index: clang-tools-extra/test/clang-tidy/bugprone-spuriously-wake-up-functions.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/bugprone-spuriously-wake-up-functions.cpp
@@ -0,0 +1,191 @@
+// RUN: %check_clang_tidy %s bugprone-spuriously-wake-up-functions %t -- --
+#define NULL 0
+
+namespace std {
+using intmax_t = int;
+
+template 
+class ratio {
+public:
+  static constexpr intmax_t num = 0;
+  static constexpr intmax_t den = 0;
+  typedef ratio type;
+};
+typedef ratio<1, 1000> milli;
+namespace chrono {
+
+template >
+class duration {
+public:
+  using rep = Rep;
+  using period = Period;
+
+public:
+  constexpr duration() = default;
+  template 
+  constexpr explicit duration(const Rep2 &r);
+  template 
+  constexpr duration(const duration &d);
+  ~duration() = default;
+  duration(const duration &) = default;
+};
+
+template 
+class time_point {
+public:
+  using clock = Clock;
+  using duration = Duration;
+
+public:
+  constexpr time_point();
+  constexpr explicit time_point(const duration &d);
+  template 
+  constexpr time_point(const time_point &t);
+};
+
+using milliseconds = duration;
+
+class system_clock {
+public:
+  typedef milliseconds duration;
+  typedef duration::rep rep;
+  typedef duration::period period;
+  typedef chrono::time_point time_point;
+
+  static time_point now() noexcept;
+};
+} // namespace chrono
+
+class mutex;
+template 
+class unique_lock {
+public:
+  typedef Mutex mutex_type;
+
+  unique_lock() noexcept;
+  explicit unique_lock(mutex_type &m);
+};
+
+class mutex {
+public:
+  constexpr mutex() noexcept;
+  ~mutex();
+  mutex(const mutex &) = delete;
+  mutex &operator=(const mutex &) = delete;
+};
+
+enum class cv_status {
+  no_timeout,
+  timeout
+};
+
+class condition_variable {
+public:
+  condition_variable();
+  ~condition_variable();
+  condition_variable(const condition_variable &) = delete;
+
+  void wait(unique_lock &lock);
+  template 
+  void wait(unique_lock &lock, Predicate pred);
+  template 
+  cv_status wait_until(unique_lock &lock,
+   const chrono::time_point &abs_time){};
+  template 
+  bool wait_until(unique_lock &lock,
+  const chrono::time_point &abs_time,
+  Predicate pred){};
+  template 
+  cv_status wait_for(unique_lock &lock,
+ const chrono::duration &rel_time){};
+  template 
+  bool wait_for(unique_lock &lock,
+const chrono::duration &rel_time,
+Predicate pred){};
+};
+
+} // namespace std
+
+struct Node1 {
+  void *Node1;
+  struct Node1 *next;
+};
+
+static Node1 list;
+static std::mutex m;
+static std::condition_variable condition;
+
+void consume_list_element(std::condition_variable &condition) {
+  std::unique_lock lk(m);
+
+  if (list.next == nullptr) {
+condition.wait(lk);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: 'wait' should be placed inside a while statement or used with a conditional parameter [bugprone-spuriously-wake-up-functions]
+  }
+
+  while (list.next == nullptr) {
+condition.wait(lk);
+  }
+
+  do {
+condition.wait(lk);
+  } while (list.next == nullptr);
+
+  for (;; list.next == nullptr) {
+condition.wait(lk);
+  }
+
+  if (list.next == nullptr) {
+while (list.next == nullptr) {
+  condition.wait(lk);
+}
+  }
+
+  if (list.next == nullptr) {
+do {
+  condition.wait(lk);
+} while (list.next == nullptr);
+  }
+
+  if (list.next == nullptr) {
+for (;; list.next == nullptr) {
+  condition.wait(lk);
+}
+  }
+  using durtype = std::chrono::duration;
+  durtype dur = std::chrono::duration();
+  if (list.next == nullptr) {
+condition.wait_for(lk, dur);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: 'wait_for' should be placed inside a while statement or used with a conditional parameter [bugprone-spuriously-wake-up-functions]
+  }
+  if (list.next == nullptr) {
+conditi

[clang] 9f6ff07 - [DebugInfo] Enable the debug entry values feature by default

2020-02-12 Thread Djordje Todorovic via cfe-commits

Author: Djordje Todorovic
Date: 2020-02-12T10:25:14+01:00
New Revision: 9f6ff07f8a396dfc736c4cb6f9fba9a203531329

URL: 
https://github.com/llvm/llvm-project/commit/9f6ff07f8a396dfc736c4cb6f9fba9a203531329
DIFF: 
https://github.com/llvm/llvm-project/commit/9f6ff07f8a396dfc736c4cb6f9fba9a203531329.diff

LOG: [DebugInfo] Enable the debug entry values feature by default

This patch enables the debug entry values feature.

  - Remove the (CC1) experimental -femit-debug-entry-values option
  - Enable it for x86, arm and aarch64 targets
  - Resolve the test failures
  - Leave the llc experimental option for targets that do not
support the CallSiteInfo yet

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

Added: 
llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll

Modified: 
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Driver/CC1Options.td
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/debug-info-extern-call.c
clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
lldb/packages/Python/lldbsuite/test/decorators.py

lldb/test/API/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile
llvm/include/llvm/CodeGen/CommandFlags.inc
llvm/include/llvm/Target/TargetMachine.h
llvm/include/llvm/Target/TargetOptions.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/LiveDebugValues.cpp
llvm/lib/CodeGen/MIRParser/MIRParser.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
llvm/lib/CodeGen/TargetOptionsImpl.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMTargetMachine.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/CodeGen/ARM/smml.ll
llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error1.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error2.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error3.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error4.mir
llvm/test/CodeGen/X86/call-site-info-output.ll
llvm/test/DebugInfo/AArch64/call-site-info-output.ll
llvm/test/DebugInfo/ARM/call-site-info-output.ll
llvm/test/DebugInfo/ARM/entry-value-multi-byte-expr.ll
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir
llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll
llvm/test/DebugInfo/X86/dbg-value-range.ll
llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
llvm/test/DebugInfo/X86/loclists-dwp.ll
llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
llvm/test/tools/llvm-dwarfdump/X86/valid-call-site-GNU-extensions.ll
llvm/test/tools/llvm-locstats/locstats.ll

Removed: 




diff  --git a/clang/include/clang/Basic/CodeGenOptions.

[PATCH] D73742: [Clang][Driver] After default -fintegrated-cc1, fix report_fatal_error no longer generates preprocessed source + reproducer.sh

2020-02-12 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

In D73742#1871037 , @smeenai wrote:

> In D73742#1871012 , @aganea wrote:
>
> > In D73742#1870961 , @smeenai wrote:
> >
> > > I'm assuming this needs to be picked to 10.0?
> >
> >
> > Yes! Is it up to the authors to integrate their patches to the release 
> > branch? I'm seeing @hans is merging a lot of the patches.
>
>
> I believe @hans takes care of the merging; I just wanted to make sure this 
> hadn't been missed :) I'm gonna assume this is on his radar.


Yup :) Pushed to 10.x as fd04cb43e1d83c6f18c932de94c1e341272ed160 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73742



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


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-12 Thread Djordje Todorovic via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f6ff07f8a39: [DebugInfo] Enable the debug entry values 
feature by default (authored by djtodoro).
Herald added subscribers: lldb-commits, cfe-commits, jrtc27.
Herald added projects: clang, LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D73534?vs=243759&id=244101#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73534

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/debug-info-extern-call.c
  clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
  lldb/packages/Python/lldbsuite/test/decorators.py
  
lldb/test/API/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile
  llvm/include/llvm/CodeGen/CommandFlags.inc
  llvm/include/llvm/Target/TargetMachine.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/LiveDebugValues.cpp
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/lib/CodeGen/MachineFunction.cpp
  llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
  llvm/lib/CodeGen/TargetOptionsImpl.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/CodeGen/ARM/smml.ll
  llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error1.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error2.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error3.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error4.mir
  llvm/test/CodeGen/X86/call-site-info-output.ll
  llvm/test/DebugInfo/AArch64/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/entry-value-multi-byte-expr.ll
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
  llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
  llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
  llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
  llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
  llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
  llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
  llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
  llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
  llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir
  llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
  llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
  llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll
  llvm/test/DebugInfo/X86/dbg-value-range.ll
  llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
  llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
  llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
  llvm/test/DebugInfo/X86/loclists-dwp.ll
  llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll
  llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
  llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
  llvm/test/tools/llvm-dwarfdump/X86/valid-call-site-GNU-extensions.ll
  llvm/test/tools/llvm-locstats/locstats.ll

Index: llvm/test/tools/llvm-locstats/locstats.ll
===
--- llvm/test/tools/llvm-locstats/locstats.ll
+++ llvm/test/tools/llvm-locstats/locstats.ll
@@ -9,9 +9,9 @@
 ; LOCSTATS: [10%,20%) 0 0%
 ; LOCSTATS: [20%,30%) 1 11%
 ; LOCSTATS: [30%,40%) 0 0%
-; LOCSTATS: [40%,50%) 1 11%
-; LOCSTATS: [50%,60%) 1 11%
-; LOCSTATS: [60%,70%) 1 11%
+; LOCSTATS: [40%,50%) 0 0%
+; LOCSTATS: [50%,60%) 0 0%
+; LOCSTATS: [60%,70%) 3 33%
 ; LOCSTATS: [70%,80%) 0 0%
 ; LOCST

[PATCH] D74433: [llvm-objdump] Print file format in lowercase to match GNU output.

2020-02-12 Thread James Henderson via Phabricator via cfe-commits
jhenderson added a comment.

I don't really have a strong opinion either way. By strict style rules, "ELF" 
is an acronym, so should be all upper-case. In regular text, I'd expect it to 
be ELF everywhere too. On the other hand, as pointed out, "elf" is the bfd 
naming style.

For WASM, I recall there being some discussion to standardise on a particular 
format, and it would make sense if we can be consistent across all file 
formats. Perhaps @sbc100 could bring his insights from that side over.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74433



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


[PATCH] D44609: [clang-format] New option BeforeLambdaBody to manage lambda line break inside function parameter call (in Allman style)

2020-02-12 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

Correct follow that description on how to request commit access


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D44609



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


[PATCH] D74467: [analyzer] Teach scan-build how to rebuild index.html without analyzing.

2020-02-12 Thread Csaba Dabis via Phabricator via cfe-commits
Charusso accepted this revision.
Charusso added a comment.
This revision is now accepted and ready to land.

Thanks! I would mention in the Summary the necessary flags to perform 
index-only output. (May write some release notes?)

That option sounds very strange, but I like it. For example to run only 
necessary custom tests one could write:

  -analyzer-checker=core,unix,custom.checkers \
  -analyzer-config silence-checkers="core;unix"




Comment at: clang/tools/scan-build/bin/scan-build:953
+  my $ExitStatus = shift;
+
+  if (defined $Options{OutputFormat}) {

May inject `Diag "Analysis run complete.\n";` here?



Comment at: clang/tools/scan-build/bin/scan-build:976
+
+  if ($Options{ExitStatusFoundBugs}) {
+exit 1 if ($NumBugs > 0);

If we stick to printing information to the user: `Diag "No bugs found.\n"`?.



Comment at: clang/tools/scan-build/bin/scan-build:1303
+   from existing report.html files. Useful for making a custom Static Analyzer
+   integration into a build system that isn't otherwise supported by 
scan-build.
+

What about `--index-only`?



Comment at: clang/tools/scan-build/bin/scan-build:1618
+DieDiag("Only one of '-o' or '--generate-index' can be specified.\n");
+  }
+

I may smash this duplicated error-handling above in one if-stmt, given that the 
options are correlate with each other.


Repository:
  rC Clang

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

https://reviews.llvm.org/D74467



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


[PATCH] D74336: [ARM,MVE] Add the vmovlbq,vmovltq intrinsic family.

2020-02-12 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham updated this revision to Diff 244104.
simon_tatham added a comment.

Cosmetic tweak: don't put the new `arm_mve.td` section in between the 
definition and the uses of an unrelated multiclass.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74336

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/include/clang/Basic/arm_mve_defs.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/arm-mve-intrinsics/vmovl.c
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/test/CodeGen/Thumb2/mve-intrinsics/vmovl.ll
  llvm/test/CodeGen/Thumb2/mve-shuffleext.ll

Index: llvm/test/CodeGen/Thumb2/mve-shuffleext.ll
===
--- llvm/test/CodeGen/Thumb2/mve-shuffleext.ll
+++ llvm/test/CodeGen/Thumb2/mve-shuffleext.ll
@@ -15,8 +15,7 @@
 define arm_aapcs_vfpcc <4 x i32> @sext_1357(<8 x i16> %src) {
 ; CHECK-LABEL: sext_1357:
 ; CHECK:   @ %bb.0: @ %entry
-; CHECK-NEXT:vrev32.16 q0, q0
-; CHECK-NEXT:vmovlb.s16 q0, q0
+; CHECK-NEXT:vmovlt.s16 q0, q0
 ; CHECK-NEXT:bx lr
 entry:
   %strided.vec = shufflevector <8 x i16> %src, <8 x i16> undef, <4 x i32> 
@@ -38,8 +37,7 @@
 define arm_aapcs_vfpcc <4 x i32> @zext_1357(<8 x i16> %src) {
 ; CHECK-LABEL: zext_1357:
 ; CHECK:   @ %bb.0: @ %entry
-; CHECK-NEXT:vrev32.16 q0, q0
-; CHECK-NEXT:vmovlb.u16 q0, q0
+; CHECK-NEXT:vmovlt.s16 q0, q0
 ; CHECK-NEXT:bx lr
 entry:
   %strided.vec = shufflevector <8 x i16> %src, <8 x i16> undef, <4 x i32> 
@@ -61,8 +59,7 @@
 define arm_aapcs_vfpcc <8 x i16> @sext_13579111315(<16 x i8> %src) {
 ; CHECK-LABEL: sext_13579111315:
 ; CHECK:   @ %bb.0: @ %entry
-; CHECK-NEXT:vrev16.8 q0, q0
-; CHECK-NEXT:vmovlb.s8 q0, q0
+; CHECK-NEXT:vmovlt.s8 q0, q0
 ; CHECK-NEXT:bx lr
 entry:
   %strided.vec = shufflevector <16 x i8> %src, <16 x i8> undef, <8 x i32> 
@@ -84,8 +81,7 @@
 define arm_aapcs_vfpcc <8 x i16> @zext_13579111315(<16 x i8> %src) {
 ; CHECK-LABEL: zext_13579111315:
 ; CHECK:   @ %bb.0: @ %entry
-; CHECK-NEXT:vrev16.8 q0, q0
-; CHECK-NEXT:vmovlb.u8 q0, q0
+; CHECK-NEXT:vmovlt.u8 q0, q0
 ; CHECK-NEXT:bx lr
 entry:
   %strided.vec = shufflevector <16 x i8> %src, <16 x i8> undef, <8 x i32> 
Index: llvm/test/CodeGen/Thumb2/mve-intrinsics/vmovl.ll
===
--- /dev/null
+++ llvm/test/CodeGen/Thumb2/mve-intrinsics/vmovl.ll
@@ -0,0 +1,90 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve.fp -verify-machineinstrs -o - %s | FileCheck %s
+
+define arm_aapcs_vfpcc <8 x i16> @test_vmovlbq_s8(<16 x i8> %a) {
+; CHECK-LABEL: test_vmovlbq_s8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovlb.s8 q0, q0
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <16 x i8> %a, <16 x i8> undef, <8 x i32> 
+  %1 = sext <8 x i8> %0 to <8 x i16>
+  ret <8 x i16> %1
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vmovlbq_s16(<8 x i16> %a) {
+; CHECK-LABEL: test_vmovlbq_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovlb.s16 q0, q0
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <8 x i16> %a, <8 x i16> undef, <4 x i32> 
+  %1 = sext <4 x i16> %0 to <4 x i32>
+  ret <4 x i32> %1
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vmovlbq_u8(<16 x i8> %a) {
+; CHECK-LABEL: test_vmovlbq_u8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovlb.u8 q0, q0
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <16 x i8> %a, <16 x i8> undef, <8 x i32> 
+  %1 = zext <8 x i8> %0 to <8 x i16>
+  ret <8 x i16> %1
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vmovlbq_u16(<8 x i16> %a) {
+; CHECK-LABEL: test_vmovlbq_u16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovlb.u16 q0, q0
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <8 x i16> %a, <8 x i16> undef, <4 x i32> 
+  %1 = zext <4 x i16> %0 to <4 x i32>
+  ret <4 x i32> %1
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vmovltq_s8(<16 x i8> %a) {
+; CHECK-LABEL: test_vmovltq_s8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovlt.s8 q0, q0
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <16 x i8> %a, <16 x i8> undef, <8 x i32> 
+  %1 = sext <8 x i8> %0 to <8 x i16>
+  ret <8 x i16> %1
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vmovltq_s16(<8 x i16> %a) {
+; CHECK-LABEL: test_vmovltq_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovlt.s16 q0, q0
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <8 x i16> %a, <8 x i16> undef, <4 x i32> 
+  %1 = sext <4 x i16> %0 to <4 x i32>
+  ret <4 x i32> %1
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vmovltq_u8(<16 x i8> %a) {
+; CHECK-LABEL: test_vmovltq_u8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovlt.u8 q0, q0
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <16 x i8> %a, <16 x i8> undef, <8 x i32> 
+  %1 = zext <8 x i8> %0 to <8 x i16>
+  ret <8 x i16> 

[clang] 55e2678 - [clang] Add -fignore-exceptions

2020-02-12 Thread via cfe-commits

Author: jasonliu
Date: 2020-02-12T09:56:18Z
New Revision: 55e2678fcd4d7eca3f9a602a919da499c1103041

URL: 
https://github.com/llvm/llvm-project/commit/55e2678fcd4d7eca3f9a602a919da499c1103041
DIFF: 
https://github.com/llvm/llvm-project/commit/55e2678fcd4d7eca3f9a602a919da499c1103041.diff

LOG: [clang] Add -fignore-exceptions

Summary:

This is trying to implement the functionality proposed in:
http://lists.llvm.org/pipermail/cfe-dev/2017-April/053417.html
An exception can throw, but no cleanup is going to happen.
A module compiled with exceptions on, can catch the exception throws
from module compiled with -fignore-exceptions.

The use cases for enabling this option are:
1. Performance analysis of EH instrumentation overhead
2. The ability to QA non EH functionality when EH functionality is not 
available.
3. User of EH enabled headers knows the calls won't throw in their program and
   wants the performance gain from ignoring EH construct.

The implementation tried to accomplish that by removing any landing pad code
 that might get generated.

Reviewed by: aaron.ballman

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

Added: 
clang/test/CodeGen/ignore-exceptions.cpp

Modified: 
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CGException.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index 4c7f7dde1f7d..3cc7c384ac10 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -132,6 +132,7 @@ LANGOPT(DWARFExceptions   , 1, 0, "dwarf exception 
handling")
 LANGOPT(SjLjExceptions, 1, 0, "setjmp-longjump exception handling")
 LANGOPT(SEHExceptions , 1, 0, "SEH .xdata exception handling")
 LANGOPT(WasmExceptions, 1, 0, "WebAssembly exception handling")
+LANGOPT(IgnoreExceptions  , 1, 0, "ignore exceptions")
 LANGOPT(ExternCNoUnwind   , 1, 0, "Assume extern C functions don't unwind")
 LANGOPT(TraditionalCPP, 1, 0, "traditional CPP emulation")
 LANGOPT(RTTI  , 1, 1, "run-time type information")

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 5987e735c77a..b0e9d9590fde 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -932,6 +932,8 @@ def fseh_exceptions : Flag<["-"], "fseh-exceptions">, 
Group,
   Flags<[CC1Option]>, HelpText<"Use SEH style exceptions">;
 def fwasm_exceptions : Flag<["-"], "fwasm-exceptions">, Group,
   Flags<[CC1Option]>, HelpText<"Use WebAssembly style exceptions">;
+def fignore_exceptions : Flag<["-"], "fignore-exceptions">, Group, 
Flags<[CC1Option]>,
+  HelpText<"Enable support for ignoring exception handling constructs">;
 def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">,
 Group;
 def : Flag<["-"], "fexpensive-optimizations">, 
Group;

diff  --git a/clang/lib/CodeGen/CGException.cpp 
b/clang/lib/CodeGen/CGException.cpp
index fffd9897270e..a542c3d85a84 100644
--- a/clang/lib/CodeGen/CGException.cpp
+++ b/clang/lib/CodeGen/CGException.cpp
@@ -703,12 +703,12 @@ llvm::BasicBlock *CodeGenFunction::getInvokeDestImpl() {
   assert(EHStack.requiresLandingPad());
   assert(!EHStack.empty());
 
-  // If exceptions are disabled and SEH is not in use, then there is no invoke
-  // destination. SEH "works" even if exceptions are off. In practice, this
-  // means that C++ destructors and other EH cleanups don't run, which is
+  // If exceptions are disabled/ignored and SEH is not in use, then there is no
+  // invoke destination. SEH "works" even if exceptions are off. In practice,
+  // this means that C++ destructors and other EH cleanups don't run, which is
   // consistent with MSVC's behavior.
   const LangOptions &LO = CGM.getLangOpts();
-  if (!LO.Exceptions) {
+  if (!LO.Exceptions || LO.IgnoreExceptions) {
 if (!LO.Borland && !LO.MicrosoftExt)
   return nullptr;
 if (!currentFunctionUsesSEHTry())
@@ -751,7 +751,9 @@ llvm::BasicBlock *CodeGenFunction::getInvokeDestImpl() {
 
 llvm::BasicBlock *CodeGenFunction::EmitLandingPad() {
   assert(EHStack.requiresLandingPad());
-
+  assert(!CGM.getLangOpts().IgnoreExceptions &&
+ "LandingPad should not be emitted when -fignore-exceptions are in "
+ "effect.");
   EHScope &innermostEHScope = *EHStack.find(EHStack.getInnermostEHScope());
   switch (innermostEHScope.getKind()) {
   case EHScope::Terminate:

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 7901f8a48f5f..4424d8e6f72c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -463,6 +463,11 @@ static void addExceptionArgs(const ArgList &Args, 
types::ID InputType,
 }
   }
 

[PATCH] D74337: [ARM,MVE] Add the vmovnbq,vmovntq intrinsic family.

2020-02-12 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham updated this revision to Diff 244105.
simon_tatham added a comment.

Cosmetic tweak: don't put the new `arm_mve.td` section in between the 
definition and the uses of an unrelated multiclass.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74337

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/include/clang/Basic/arm_mve_defs.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/arm-mve-intrinsics/vmovn.c
  clang/utils/TableGen/MveEmitter.cpp
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/test/CodeGen/Thumb2/mve-intrinsics/vmovn.ll

Index: llvm/test/CodeGen/Thumb2/mve-intrinsics/vmovn.ll
===
--- /dev/null
+++ llvm/test/CodeGen/Thumb2/mve-intrinsics/vmovn.ll
@@ -0,0 +1,102 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve -verify-machineinstrs -o - %s | FileCheck %s
+
+define arm_aapcs_vfpcc <16 x i8> @test_vmovnbq_s16(<16 x i8> %a, <8 x i16> %b) {
+; CHECK-LABEL: test_vmovnbq_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovnb.i16 q0, q1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <16 x i8> %a, <16 x i8> undef, <16 x i32> 
+  %1 = bitcast <16 x i8> %0 to <8 x i16>
+  %2 = shufflevector <8 x i16> %b, <8 x i16> %1, <16 x i32> 
+  %3 = trunc <16 x i16> %2 to <16 x i8>
+  ret <16 x i8> %3
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vmovnbq_s32(<8 x i16> %a, <4 x i32> %b) {
+; CHECK-LABEL: test_vmovnbq_s32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovnb.i32 q0, q1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <8 x i16> %a, <8 x i16> undef, <8 x i32> 
+  %1 = bitcast <8 x i16> %0 to <4 x i32>
+  %2 = shufflevector <4 x i32> %b, <4 x i32> %1, <8 x i32> 
+  %3 = trunc <8 x i32> %2 to <8 x i16>
+  ret <8 x i16> %3
+}
+
+define arm_aapcs_vfpcc <16 x i8> @test_vmovnbq_u16(<16 x i8> %a, <8 x i16> %b) {
+; CHECK-LABEL: test_vmovnbq_u16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovnb.i16 q0, q1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <16 x i8> %a, <16 x i8> undef, <16 x i32> 
+  %1 = bitcast <16 x i8> %0 to <8 x i16>
+  %2 = shufflevector <8 x i16> %b, <8 x i16> %1, <16 x i32> 
+  %3 = trunc <16 x i16> %2 to <16 x i8>
+  ret <16 x i8> %3
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vmovnbq_u32(<8 x i16> %a, <4 x i32> %b) {
+; CHECK-LABEL: test_vmovnbq_u32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovnb.i32 q0, q1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shufflevector <8 x i16> %a, <8 x i16> undef, <8 x i32> 
+  %1 = bitcast <8 x i16> %0 to <4 x i32>
+  %2 = shufflevector <4 x i32> %b, <4 x i32> %1, <8 x i32> 
+  %3 = trunc <8 x i32> %2 to <8 x i16>
+  ret <8 x i16> %3
+}
+
+define arm_aapcs_vfpcc <16 x i8> @test_vmovntq_s16(<16 x i8> %a, <8 x i16> %b) {
+; CHECK-LABEL: test_vmovntq_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovnt.i16 q0, q1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = bitcast <16 x i8> %a to <8 x i16>
+  %1 = shufflevector <8 x i16> %0, <8 x i16> %b, <16 x i32> 
+  %2 = trunc <16 x i16> %1 to <16 x i8>
+  ret <16 x i8> %2
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vmovntq_s32(<8 x i16> %a, <4 x i32> %b) {
+; CHECK-LABEL: test_vmovntq_s32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovnt.i32 q0, q1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = bitcast <8 x i16> %a to <4 x i32>
+  %1 = shufflevector <4 x i32> %0, <4 x i32> %b, <8 x i32> 
+  %2 = trunc <8 x i32> %1 to <8 x i16>
+  ret <8 x i16> %2
+}
+
+define arm_aapcs_vfpcc <16 x i8> @test_vmovntq_u16(<16 x i8> %a, <8 x i16> %b) {
+; CHECK-LABEL: test_vmovntq_u16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovnt.i16 q0, q1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = bitcast <16 x i8> %a to <8 x i16>
+  %1 = shufflevector <8 x i16> %0, <8 x i16> %b, <16 x i32> 
+  %2 = trunc <16 x i16> %1 to <16 x i8>
+  ret <16 x i8> %2
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vmovntq_u32(<8 x i16> %a, <4 x i32> %b) {
+; CHECK-LABEL: test_vmovntq_u32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmovnt.i32 q0, q1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = bitcast <8 x i16> %a to <4 x i32>
+  %1 = shufflevector <4 x i32> %0, <4 x i32> %b, <8 x i32> 
+  %2 = trunc <8 x i32> %1 to <8 x i16>
+  ret <8 x i16> %2
+}
Index: llvm/lib/Target/ARM/ARMInstrMVE.td
===
--- llvm/lib/Target/ARM/ARMInstrMVE.td
+++ llvm/lib/Target/ARM/ARMInstrMVE.td
@@ -4333,8 +4333,16 @@
 (v16i8 (MVE_VMOVNi16bh (v16i8 MQPR:$Qd_src), (v16i8 MQPR:$Qm)))>;
   def : Pat<(v16i8 (MVEvmovn (v16i8 MQPR:$Qd_src), (v16i8 MQPR:$Qm), (i32 1))),
 (v16i8 (MVE_VMOVNi16th (v16i8 MQPR:$Qd_src), (v16i8 MQPR:$Qm)))>;
+
+  def : Pat<(v8i16 (MVEvmovn (v8i16 MQPR:$Qm),
+ (v8i16 (ARMvrev32 MQPR:$Qd_src)), (i32 1))),
+(v8i16 (MVE_VMOVNi32bh (v8i16 M

[PATCH] D72644: [clang] Add -fignore-exceptions

2020-02-12 Thread Jason Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG55e2678fcd4d: [clang] Add -fignore-exceptions (authored by 
jasonliu).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D72644?vs=237766&id=244106#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72644

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CGException.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/ignore-exceptions.cpp

Index: clang/test/CodeGen/ignore-exceptions.cpp
===
--- /dev/null
+++ clang/test/CodeGen/ignore-exceptions.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple powerpc64-linux -fexceptions -fcxx-exceptions -fignore-exceptions -emit-llvm -o - | FileCheck %s
+
+struct A {
+  ~A(){}
+};
+
+void f(void) {
+// CHECK-NOT: personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*)
+  A a;
+  try {
+throw 1;
+  } catch(...) {
+  }
+// CHECK:  %a = alloca %struct.A, align 1
+// CHECK:  %exception = call i8* @__cxa_allocate_exception(i64 4) #1
+// CHECK:  %0 = bitcast i8* %exception to i32*
+// CHECK:  store i32 1, i32* %0, align 16
+// CHECK:  call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #2
+// CHECK:  unreachable
+
+// CHECK-NOT: invoke
+// CHECK-NOT: landingpad
+// CHECK-NOT: __cxa_begin_catch
+// CHECK-NOT: __cxa_end_catch
+}
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2773,6 +2773,7 @@
   if (Args.hasArg(OPT_fno_threadsafe_statics))
 Opts.ThreadsafeStatics = 0;
   Opts.Exceptions = Args.hasArg(OPT_fexceptions);
+  Opts.IgnoreExceptions = Args.hasArg(OPT_fignore_exceptions);
   Opts.ObjCExceptions = Args.hasArg(OPT_fobjc_exceptions);
   Opts.CXXExceptions = Args.hasArg(OPT_fcxx_exceptions);
 
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -463,6 +463,11 @@
 }
   }
 
+  // OPT_fignore_exceptions means exception could still be thrown,
+  // but no clean up or catch would happen in current module.
+  // So we do not set EH to false.
+  Args.AddLastArg(CmdArgs, options::OPT_fignore_exceptions);
+
   if (EH)
 CmdArgs.push_back("-fexceptions");
 }
Index: clang/lib/CodeGen/CGException.cpp
===
--- clang/lib/CodeGen/CGException.cpp
+++ clang/lib/CodeGen/CGException.cpp
@@ -703,12 +703,12 @@
   assert(EHStack.requiresLandingPad());
   assert(!EHStack.empty());
 
-  // If exceptions are disabled and SEH is not in use, then there is no invoke
-  // destination. SEH "works" even if exceptions are off. In practice, this
-  // means that C++ destructors and other EH cleanups don't run, which is
+  // If exceptions are disabled/ignored and SEH is not in use, then there is no
+  // invoke destination. SEH "works" even if exceptions are off. In practice,
+  // this means that C++ destructors and other EH cleanups don't run, which is
   // consistent with MSVC's behavior.
   const LangOptions &LO = CGM.getLangOpts();
-  if (!LO.Exceptions) {
+  if (!LO.Exceptions || LO.IgnoreExceptions) {
 if (!LO.Borland && !LO.MicrosoftExt)
   return nullptr;
 if (!currentFunctionUsesSEHTry())
@@ -751,7 +751,9 @@
 
 llvm::BasicBlock *CodeGenFunction::EmitLandingPad() {
   assert(EHStack.requiresLandingPad());
-
+  assert(!CGM.getLangOpts().IgnoreExceptions &&
+ "LandingPad should not be emitted when -fignore-exceptions are in "
+ "effect.");
   EHScope &innermostEHScope = *EHStack.find(EHStack.getInnermostEHScope());
   switch (innermostEHScope.getKind()) {
   case EHScope::Terminate:
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -932,6 +932,8 @@
   Flags<[CC1Option]>, HelpText<"Use SEH style exceptions">;
 def fwasm_exceptions : Flag<["-"], "fwasm-exceptions">, Group,
   Flags<[CC1Option]>, HelpText<"Use WebAssembly style exceptions">;
+def fignore_exceptions : Flag<["-"], "fignore-exceptions">, Group, Flags<[CC1Option]>,
+  HelpText<"Enable support for ignoring exception handling constructs">;
 def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">,
 Group;
 def : Flag<["-"], "fexpensive-optimizations">, Group;
Index: clang/include/clang/Basic/LangOptions.def
===
--- clang/include/clang/Basi

[PATCH] D72644: [clang] Add -fignore-exceptions

2020-02-12 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added a comment.

In D72644#1868812 , @aaron.ballman 
wrote:

> Sorry about the delayed review. I think this patch basically LG, thank you!


Thanks Aaron. Addressed your comments in the commits.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72644



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


[PATCH] D72644: [clang] Add -fignore-exceptions

2020-02-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

This review omitted cfe-commits list


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72644



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


[PATCH] D72644: [clang] Add -fignore-exceptions

2020-02-12 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added a comment.

In D72644#1871662 , @lebedev.ri wrote:

> This review omitted cfe-commits list


Didn't realized that. Since this is approved and committed, I guess I will keep 
monitor messages in this review, and address any post-commit comments. I could 
revert the commit if the comments gets controversial. 
Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72644



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


[PATCH] D72644: [clang] Add -fignore-exceptions

2020-02-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D72644#1871662 , @lebedev.ri wrote:

> This review omitted cfe-commits list


Good catch, I didn't notice that in the review. I think we can address any 
concerns with post-commit feedback.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72644



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


[PATCH] D74335: [ARM,MVE] Add intrinsics vclzq and vclsq.

2020-02-12 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki accepted this revision.
miyuki 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/D74335/new/

https://reviews.llvm.org/D74335



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


[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision.
martong added reviewers: Szelethus, NoQ.
Herald added subscribers: cfe-commits, steakhal, Charusso, gamesh411, dkrupp, 
donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, 
kristof.beyls, xazax.hun, whisperity.
Herald added a project: clang.
martong added a child revision: D73898: [analyzer] StdLibraryFunctionsChecker: 
Add argument constraints.

Both EOF and the max value of unsigned char is platform dependent. In this
patch we try our best to deduce the value of EOF from the Preprocessor,
if we can't we fall back to -1.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74473

Files:
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  clang/test/Analysis/std-c-library-functions-eof.c

Index: clang/test/Analysis/std-c-library-functions-eof.c
===
--- /dev/null
+++ clang/test/Analysis/std-c-library-functions-eof.c
@@ -0,0 +1,26 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+
+void clang_analyzer_eval(int);
+
+typedef struct FILE FILE;
+// Unorthodox EOF value.
+#define EOF -2
+
+int getc(FILE *);
+void test_getc(FILE *fp) {
+
+  int x;
+  while ((x = getc(fp)) != EOF) {
+clang_analyzer_eval(x > 255); // expected-warning{{FALSE}}
+clang_analyzer_eval(x >= 0); // expected-warning{{TRUE}}
+  }
+
+  int y = getc(fp);
+  if (y < 0) {
+clang_analyzer_eval(y == EOF); // expected-warning{{TRUE}}
+  }
+}
Index: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -241,7 +241,7 @@
 const CallExpr *CE,
 CheckerContext &C) const;
 
-  void initFunctionSummaries(BasicValueFactory &BVF) const;
+  void initFunctionSummaries(CheckerContext &C) const;
 };
 } // end of anonymous namespace
 
@@ -312,10 +312,11 @@
 for (size_t I = 1; I != E; ++I) {
   const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T);
   const llvm::APSInt &Max = BVF.getValue(R[I].first - 1ULL, T);
-  assert(Min <= Max);
-  State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
-  if (!State)
-return nullptr;
+  if (Min <= Max) {
+State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
+if (!State)
+  return nullptr;
+  }
 }
   }
 
@@ -449,9 +450,7 @@
   if (!FD)
 return None;
 
-  SValBuilder &SVB = C.getSValBuilder();
-  BasicValueFactory &BVF = SVB.getBasicValueFactory();
-  initFunctionSummaries(BVF);
+  initFunctionSummaries(C);
 
   IdentifierInfo *II = FD->getIdentifier();
   if (!II)
@@ -478,11 +477,13 @@
 }
 
 void StdLibraryFunctionsChecker::initFunctionSummaries(
-BasicValueFactory &BVF) const {
+CheckerContext &C) const {
   if (!FunctionSummaryMap.empty())
 return;
 
-  ASTContext &ACtx = BVF.getContext();
+  SValBuilder &SVB = C.getSValBuilder();
+  BasicValueFactory &BVF = SVB.getBasicValueFactory();
+  const ASTContext &ACtx = BVF.getContext();
 
   // These types are useful for writing specifications quickly,
   // New specifications should probably introduce more types.
@@ -491,15 +492,47 @@
   // of function summary for common cases (eg. ssize_t could be int or long
   // or long long, so three summary variants would be enough).
   // Of course, function variants are also useful for C++ overloads.
-  QualType Irrelevant; // A placeholder, whenever we do not care about the type.
-  QualType IntTy = ACtx.IntTy;
-  QualType LongTy = ACtx.LongTy;
-  QualType LongLongTy = ACtx.LongLongTy;
-  QualType SizeTy = ACtx.getSizeType();
-
-  RangeInt IntMax = BVF.getMaxValue(IntTy).getLimitedValue();
-  RangeInt LongMax = BVF.getMaxValue(LongTy).getLimitedValue();
-  RangeInt LongLongMax = BVF.getMaxValue(LongLongTy).getLimitedValue();
+  const QualType
+  Irrelevant; // A placeholder, whenever we do not care about the type.
+  const QualType IntTy = ACtx.IntTy;
+  const QualType LongTy = AC

[clang] 97ed706 - Revert "[DebugInfo] Enable the debug entry values feature by default"

2020-02-12 Thread Djordje Todorovic via cfe-commits

Author: Djordje Todorovic
Date: 2020-02-12T11:59:04+01:00
New Revision: 97ed706a962af7c6835c7b6716207c4072011ac1

URL: 
https://github.com/llvm/llvm-project/commit/97ed706a962af7c6835c7b6716207c4072011ac1
DIFF: 
https://github.com/llvm/llvm-project/commit/97ed706a962af7c6835c7b6716207c4072011ac1.diff

LOG: Revert "[DebugInfo] Enable the debug entry values feature by default"

This reverts commit rG9f6ff07f8a39.

Found a test failure on clang-with-thin-lto-ubuntu buildbot.

Added: 


Modified: 
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Driver/CC1Options.td
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/debug-info-extern-call.c
clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
lldb/packages/Python/lldbsuite/test/decorators.py

lldb/test/API/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile
llvm/include/llvm/CodeGen/CommandFlags.inc
llvm/include/llvm/Target/TargetMachine.h
llvm/include/llvm/Target/TargetOptions.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/LiveDebugValues.cpp
llvm/lib/CodeGen/MIRParser/MIRParser.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
llvm/lib/CodeGen/TargetOptionsImpl.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMTargetMachine.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/CodeGen/ARM/smml.ll
llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error1.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error2.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error3.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error4.mir
llvm/test/CodeGen/X86/call-site-info-output.ll
llvm/test/DebugInfo/AArch64/call-site-info-output.ll
llvm/test/DebugInfo/ARM/call-site-info-output.ll
llvm/test/DebugInfo/ARM/entry-value-multi-byte-expr.ll
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir
llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll
llvm/test/DebugInfo/X86/dbg-value-range.ll
llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
llvm/test/DebugInfo/X86/loclists-dwp.ll
llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
llvm/test/tools/llvm-dwarfdump/X86/valid-call-site-GNU-extensions.ll
llvm/test/tools/llvm-locstats/locstats.ll

Removed: 
llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll



diff  --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index fa450724ddd4..48c0df49e32d 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -63,6 +63,7 @@ CODEGENOPT(ExperimentalNewPa

[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:533
+
+IntValue.dump();
+return IntValue.getSExtValue();

Debug message (to be removed)?



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:535
+return IntValue.getSExtValue();
+  }();
 

It would be good to have this function available generally to other checkers, 
the same functionality is needed in https://reviews.llvm.org/D72705 too.
It could work with any (specified) macro name, there are other special values 
in API calls. But there can be more difficult cases if the EOF (or other) is 
not a simple value but another macro or constructed from values some way. (The 
`ULONG_MAX` and similar can be get in the same way.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473



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


[PATCH] D71830: [OpenMP][Part 2] Use reusable OpenMP context/traits handling

2020-02-12 Thread Kiran Chandramohan via Phabricator via cfe-commits
kiranchandramohan accepted this revision.
kiranchandramohan added a comment.
This revision is now accepted and ready to land.

LGTM. You can wait for a day in case other reviewers have comments.




Comment at: clang/lib/Serialization/ASTWriter.cpp:6575
 
+template <> void ASTRecordWriter::writeUserType(OMPTraitInfo *TI) {
+  writeUInt32(TI->Sets.size());

jdoerfert wrote:
> kiranchandramohan wrote:
> > Had to also move this up in the file to avoid an instantiation after use 
> > error.
> I didn't get that but I have it in the header, I'll figure it out.
You should remove the declaration of this specialization from the header file 
first.
Then move this definition of the specialization up in the file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71830



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


[PATCH] D57054: [MachineOutliner][ARM][RFC] Add Machine Outliner support for ARM

2020-02-12 Thread Yvan Roux via Phabricator via cfe-commits
yroux added a comment.

Ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D57054



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


[PATCH] D73904: [clang] stop baremetal driver to append .a to lib

2020-02-12 Thread Christof Douma via Phabricator via cfe-commits
christof added a comment.

The function @MaskRay suggested does not address the problem with `-march=` and 
others, but it does sound good to use that function. I'm also not sure if `-L` 
is a feature that is relied upon at the moment by anybody that uses the 
baremetal driver. For the moment I'll commit this patch, but a single place 
across drivers that handles the compiler_rt selection mechanism certainly 
sounds nice.


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

https://reviews.llvm.org/D73904



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


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-12 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro added a comment.

Reverted due to 
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/21373/steps/build-stage3-compiler/logs/stdio.

I will reland this as soon as I fix the issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73534



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


[PATCH] D73629: [analyzer] vfork checker: allow execve after vfork

2020-02-12 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

LGTM granted the test is supplied, nice catch!


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

https://reviews.llvm.org/D73629



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


[clang] 5b3983b - [analyzer]StreamChecker refactoring (NFC).

2020-02-12 Thread Balázs Kéri via cfe-commits

Author: Balázs Kéri
Date: 2020-02-12T12:50:49+01:00
New Revision: 5b3983ba3716b155d0cb740d4f1940c1bb0a97d5

URL: 
https://github.com/llvm/llvm-project/commit/5b3983ba3716b155d0cb740d4f1940c1bb0a97d5
DIFF: 
https://github.com/llvm/llvm-project/commit/5b3983ba3716b155d0cb740d4f1940c1bb0a97d5.diff

LOG: [analyzer]StreamChecker refactoring (NFC).

Reviewers: Szelethus

Reviewed By: Szelethus

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, 
donat.nagy, Charusso, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index dc6bd4f1544e..ab4c9fafae1d 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -94,15 +94,15 @@ class StreamChecker : public CheckergetAsSymbol();
@@ -208,7 +207,8 @@ void StreamChecker::evalFreopen(const CallEvent &Call,
 
 void StreamChecker::evalFclose(const CallEvent &Call, CheckerContext &C) const 
{
   ProgramStateRef State = C.getState();
-  if (checkDoubleClose(Call, C, State))
+  State = checkDoubleClose(Call, C, State);
+  if (State)
 C.addTransition(State);
 }
 
@@ -219,30 +219,31 @@ void StreamChecker::evalFseek(const CallEvent &Call, 
CheckerContext &C) const {
 
   ProgramStateRef State = C.getState();
 
-  bool StateChanged = checkNullStream(Call.getArgSVal(0), C, State);
-  // Check if error was generated.
-  if (C.isDifferent())
+  State = checkNullStream(Call.getArgSVal(0), C, State);
+  if (!State)
 return;
 
-  // Check the legality of the 'whence' argument of 'fseek'.
-  checkFseekWhence(State->getSVal(AE2, C.getLocationContext()), C, State);
+  State =
+  checkFseekWhence(State->getSVal(AE2, C.getLocationContext()), C, State);
+  if (!State)
+return;
 
-  if (!C.isDifferent() && StateChanged)
-C.addTransition(State);
+  C.addTransition(State);
 }
 
 void StreamChecker::checkArgNullStream(const CallEvent &Call, CheckerContext 
&C,
unsigned ArgI) const {
   ProgramStateRef State = C.getState();
-  if (checkNullStream(Call.getArgSVal(ArgI), C, State))
+  State = checkNullStream(Call.getArgSVal(ArgI), C, State);
+  if (State)
 C.addTransition(State);
 }
 
-bool StreamChecker::checkNullStream(SVal SV, CheckerContext &C,
-ProgramStateRef &State) const {
+ProgramStateRef StreamChecker::checkNullStream(SVal SV, CheckerContext &C,
+   ProgramStateRef State) const {
   Optional DV = SV.getAs();
   if (!DV)
-return false;
+return State;
 
   ConstraintManager &CM = C.getConstraintManager();
   ProgramStateRef StateNotNull, StateNull;
@@ -256,26 +257,22 @@ bool StreamChecker::checkNullStream(SVal SV, 
CheckerContext &C,
   C.emitReport(std::make_unique(
   *BT_nullfp, BT_nullfp->getDescription(), N));
 }
-return false;
-  }
-
-  if (StateNotNull) {
-State = StateNotNull;
-return true;
+return nullptr;
   }
 
-  return false;
+  return StateNotNull;
 }
 
-void StreamChecker::checkFseekWhence(SVal SV, CheckerContext &C,
- ProgramStateRef &State) const {
+// Check the legality of the 'whence' argument of 'fseek'.
+ProgramStateRef StreamChecker::checkFseekWhence(SVal SV, CheckerContext &C,
+ProgramStateRef State) const {
   Optional CI = SV.getAs();
   if (!CI)
-return;
+return State;
 
   int64_t X = CI->getValue().getSExtValue();
   if (X >= 0 && X <= 2)
-return;
+return State;
 
   if (ExplodedNode *N = C.generateNonFatalErrorNode(State)) {
 if (!BT_illegalwhence)
@@ -285,20 +282,24 @@ void StreamChecker::checkFseekWhence(SVal SV, 
CheckerContext &C,
  "SEEK_SET, SEEK_END, or SEEK_CUR."));
 C.emitReport(std::make_unique(
 *BT_illegalwhence, BT_illegalwhence->getDescription(), N));
+return nullptr;
   }
+
+  return State;
 }
 
-bool StreamChecker::checkDoubleClose(const CallEvent &Call, CheckerContext &C,
- ProgramStateRef &State) const {
+ProgramStateRef StreamChecker::checkDoubleClose(const CallEvent &Call,
+CheckerContext &C,
+ProgramStateRef State) const {
   SymbolRef Sym = Call.getArgSVal(0).getAsSymbol();
   if (!Sym)
-return false;
+return State;
 
   const StreamState *SS = State->get(Sym);
 
   // If the file stream is not tracked, return.
   if (!SS)
-return false;
+return State;
 
   // Check: Double close a File Descriptor could cause undefined beh

[PATCH] D71830: [OpenMP][Part 2] Use reusable OpenMP context/traits handling

2020-02-12 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Procedural note - adding someone as a blocking reviewer to someone else's patch 
isn't great. What if the new reviewer never gets around to looking at the patch?

I've adjusted that to non-blocking, but feel free to leave a comment if I've 
missed something.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71830



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


[PATCH] D73359: [analyzer]StreamChecker refactoring (NFC).

2020-02-12 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b3983ba3716: [analyzer]StreamChecker refactoring (NFC). 
(authored by balazske).
Herald added a subscriber: martong.

Changed prior to commit:
  https://reviews.llvm.org/D73359?vs=243488&id=244125#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73359

Files:
  clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp

Index: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -94,15 +94,15 @@
   void evalFreopen(const CallEvent &Call, CheckerContext &C) const;
   void evalFclose(const CallEvent &Call, CheckerContext &C) const;
   void evalFseek(const CallEvent &Call, CheckerContext &C) const;
-
   void checkArgNullStream(const CallEvent &Call, CheckerContext &C,
   unsigned ArgI) const;
-  bool checkNullStream(SVal SV, CheckerContext &C,
-   ProgramStateRef &State) const;
-  void checkFseekWhence(SVal SV, CheckerContext &C,
-ProgramStateRef &State) const;
-  bool checkDoubleClose(const CallEvent &Call, CheckerContext &C,
-ProgramStateRef &State) const;
+
+  ProgramStateRef checkNullStream(SVal SV, CheckerContext &C,
+  ProgramStateRef State) const;
+  ProgramStateRef checkFseekWhence(SVal SV, CheckerContext &C,
+   ProgramStateRef State) const;
+  ProgramStateRef checkDoubleClose(const CallEvent &Call, CheckerContext &C,
+   ProgramStateRef State) const;
 };
 
 } // end anonymous namespace
@@ -176,9 +176,8 @@
 return;
   // Do not allow NULL as passed stream pointer.
   // This is not specified in the man page but may crash on some system.
-  checkNullStream(*StreamVal, C, State);
-  // Check if error was generated.
-  if (C.isDifferent())
+  State = checkNullStream(*StreamVal, C, State);
+  if (!State)
 return;
 
   SymbolRef StreamSym = StreamVal->getAsSymbol();
@@ -208,7 +207,8 @@
 
 void StreamChecker::evalFclose(const CallEvent &Call, CheckerContext &C) const {
   ProgramStateRef State = C.getState();
-  if (checkDoubleClose(Call, C, State))
+  State = checkDoubleClose(Call, C, State);
+  if (State)
 C.addTransition(State);
 }
 
@@ -219,30 +219,31 @@
 
   ProgramStateRef State = C.getState();
 
-  bool StateChanged = checkNullStream(Call.getArgSVal(0), C, State);
-  // Check if error was generated.
-  if (C.isDifferent())
+  State = checkNullStream(Call.getArgSVal(0), C, State);
+  if (!State)
 return;
 
-  // Check the legality of the 'whence' argument of 'fseek'.
-  checkFseekWhence(State->getSVal(AE2, C.getLocationContext()), C, State);
+  State =
+  checkFseekWhence(State->getSVal(AE2, C.getLocationContext()), C, State);
+  if (!State)
+return;
 
-  if (!C.isDifferent() && StateChanged)
-C.addTransition(State);
+  C.addTransition(State);
 }
 
 void StreamChecker::checkArgNullStream(const CallEvent &Call, CheckerContext &C,
unsigned ArgI) const {
   ProgramStateRef State = C.getState();
-  if (checkNullStream(Call.getArgSVal(ArgI), C, State))
+  State = checkNullStream(Call.getArgSVal(ArgI), C, State);
+  if (State)
 C.addTransition(State);
 }
 
-bool StreamChecker::checkNullStream(SVal SV, CheckerContext &C,
-ProgramStateRef &State) const {
+ProgramStateRef StreamChecker::checkNullStream(SVal SV, CheckerContext &C,
+   ProgramStateRef State) const {
   Optional DV = SV.getAs();
   if (!DV)
-return false;
+return State;
 
   ConstraintManager &CM = C.getConstraintManager();
   ProgramStateRef StateNotNull, StateNull;
@@ -256,26 +257,22 @@
   C.emitReport(std::make_unique(
   *BT_nullfp, BT_nullfp->getDescription(), N));
 }
-return false;
-  }
-
-  if (StateNotNull) {
-State = StateNotNull;
-return true;
+return nullptr;
   }
 
-  return false;
+  return StateNotNull;
 }
 
-void StreamChecker::checkFseekWhence(SVal SV, CheckerContext &C,
- ProgramStateRef &State) const {
+// Check the legality of the 'whence' argument of 'fseek'.
+ProgramStateRef StreamChecker::checkFseekWhence(SVal SV, CheckerContext &C,
+ProgramStateRef State) const {
   Optional CI = SV.getAs();
   if (!CI)
-return;
+return State;
 
   int64_t X = CI->getValue().getSExtValue();
   if (X >= 0 && X <= 2)
-return;
+return State;
 
   if (ExplodedNode *N = C.generateNonFatalErrorNode(State)) {
 if (!BT_illegalwhence)
@@ -285,20 +282,24 @@
  "SEEK_SET, SEEK_END, or SEEK_CUR."));
 

[PATCH] D71110: [clangd] A tool to evaluate cross-file rename.

2020-02-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

Renaming `llvm::Optional` also fails (clangd-rename says the symbol is not of a 
supported kind even though it's a class).

Renaming `llvm::None` is also not working: there seem to be many problems but a 
lot of them are connected with function's argument default values (`void 
foo(llvm::Optional Bar = None`).

  llvm/include/llvm/ADT/Optional.h llvm::Optional clangd
  llvm/include/llvm/ADT/None.h llvm::None clangd


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71110



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


[PATCH] D74468: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

2020-02-12 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 accepted this revision.
gribozavr2 added inline comments.
This revision is now accepted and ready to land.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst:86
 
+   // OK: C++14 variable template is allowed.
+   template 

s/is allowed/are inline/



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp:14
+template
+constexpr T pi = T(3.1415926L);

I would prefer if you could make the test compatible with all language modes 
after C++11. You can do it by wrapping the variable template in `#if`s on the 
`__cplusplus` macro that contains the language version.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74468



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


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-12 Thread David Stenberg via Phabricator via cfe-commits
dstenb added inline comments.



Comment at: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:870
 if (MI->isCandidateForCallSiteEntry() &&
-DAG->getTarget().Options.EnableDebugEntryValues)
+DAG->getTarget().Options.SupportsDebugEntryValues)
   MF.addCallArgsForwardingRegs(MI, DAG->getSDCallSiteInfo(Node));

I'm sorry for commenting on this so late, but when now adapting this patch for 
our downstream target, for which we will not enable call site info by default 
yet, I noticed that the call site information wasn't added. I think that this 
should be `ShouldEmitDebugEntryValues()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73534



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


[PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-12 Thread Djordje Todorovic via Phabricator via cfe-commits
djtodoro marked an inline comment as done.
djtodoro added inline comments.



Comment at: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:870
 if (MI->isCandidateForCallSiteEntry() &&
-DAG->getTarget().Options.EnableDebugEntryValues)
+DAG->getTarget().Options.SupportsDebugEntryValues)
   MF.addCallArgsForwardingRegs(MI, DAG->getSDCallSiteInfo(Node));

dstenb wrote:
> I'm sorry for commenting on this so late, but when now adapting this patch 
> for our downstream target, for which we will not enable call site info by 
> default yet, I noticed that the call site information wasn't added. I think 
> that this should be `ShouldEmitDebugEntryValues()`.
I thought to restrict the production of the call site info here and only to 
allow a hand-made testing, but I think you are right, we should use the 
`ShouldEmitDebugEntryValues()`. I'll update the patch, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73534



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


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Hans Wennborg via Phabricator via cfe-commits
hans added inline comments.



Comment at: clang/include/clang/Driver/Job.h:90
+  /// Whether the command will be executed in this process or not.
+  bool InProcess : 1;
+

I think Reid just meant put the bool fields after each other to minimize 
padding. Using bitfields is taking it one step further. I think in LLVM we 
generally use "unsigned" for bitfield types, but I'm not sure using bitfields 
at all is worth it here.



Comment at: clang/include/clang/Driver/Job.h:134
 
-  /// Set whether to print the input filenames when executing.
-  void setPrintInputFilenames(bool P) { PrintInputFilenames = P; }
+  /// Prevent burying pointers, and ensure we free everything after execution.
+  void forceCleanUp();

I hadn't heard the term "burying pointers" before, and the name is also pretty 
broad: "clean up" could refer to a lot more than just freeing memory.

Maybe "enableFree()" or something would be a better name?



Comment at: clang/lib/Driver/Driver.cpp:3758
+  JobList &Jobs = C.getJobs();
+  if (!Jobs.empty()) {
+Command &Last = *Jobs.getJobs().back();

Is this if-statement really necessary? If you just do the for-loop directly, it 
will not execute if Jobs is empty anyway.

Also, with an old-school for-loop it's easier to not iterate over the last 
element. How about something like:

```
for (size_t i = 0, e = C.getJobs().size(); i + 1 < e; i++) {
  auto &Job = C.getJobs().getJobs()[i];
  if (Job.InProcess)
Job.forceCleanup();
}
```



Comment at: clang/lib/Driver/Job.cpp:325
+  llvm::erase_if(Arguments, RemoveDisableFree);
+}
+

I wish it were possible to avoid adding the -disable-free flag to 
in-process-cc1 jobs in the first place, but I guess maybe that's not practical.


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

https://reviews.llvm.org/D74447



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


[PATCH] D71110: [clangd] A tool to evaluate cross-file rename.

2020-02-12 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

Thanks for the feedback!

Yeah, currently template classes are not supported in cross-file rename, see 
https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clangd/refactor/Rename.cpp#L187.

So `llvm::Optional` and `llvm::Optional` should fail to rename, but StringRef 
and llvm::None should work (if you remove the hard-coded max limit 50).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71110



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


[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong planned changes to this revision.
martong marked 3 inline comments as done.
martong added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:533
+
+IntValue.dump();
+return IntValue.getSExtValue();

balazske wrote:
> Debug message (to be removed)?
Thanks, good catch!



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:535
+return IntValue.getSExtValue();
+  }();
 

balazske wrote:
> It would be good to have this function available generally to other checkers, 
> the same functionality is needed in https://reviews.llvm.org/D72705 too.
> It could work with any (specified) macro name, there are other special values 
> in API calls. But there can be more difficult cases if the EOF (or other) is 
> not a simple value but another macro or constructed from values some way. 
> (The `ULONG_MAX` and similar can be get in the same way.)
Ok, I am gonna put a generic version of this under `CheckerHelpers.h`, so all 
checkers can use it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473



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


[PATCH] D74116: [Sema][C++] Strawman patch to propagate conversion type in order to specialize the diagnostics

2020-02-12 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia updated this revision to Diff 244135.
Anastasia added a comment.

If I reuse the helper `checkPointerTypesForAssignment` I end up with lots of 
error turned into warnings, see example in 
test/SemaCXX/addr-of-overloaded-function.cpp

I guess we don't want them to be warnings? Should we duplicate all those as 
errors in C++?

It seems there are about 3 of them that would have to be duplicated:

  [40/41] Running the Clang regression tests
  llvm-lit: ...llvm/utils/lit/lit/llvm/config.py:342: note: using clang: 
...build/bin/clang
  FAIL: Clang :: CXX/conv/conv.fctptr/p1.cpp (1051 of 16808)
   TEST 'Clang :: CXX/conv/conv.fctptr/p1.cpp' FAILED 

  Script:
  --
  : 'RUN: at line 1';   ...build/bin/clang -cc1 -internal-isystem 
...build/lib/clang/11.0.0/include -nostdsysteminc -std=c++1z -verify 
...clang/test/CXX/conv/conv.fctptr/p1.cpp -triple x86_64-unknown-unknown
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'error' diagnostics expected but not seen: 
File ...clang/test/CXX/conv/conv.fctptr/p1.cpp Line 14: assigning to 
'Nothrow *' (aka 'void (*)() noexcept') from incompatible type 'Throw *' (aka 
'void (*)()'): different exception specifications
  error: 'warning' diagnostics seen but not expected: 
File ...clang/test/CXX/conv/conv.fctptr/p1.cpp Line 14: incompatible 
function pointer types assigning to 'Nothrow *' (aka 'void (*)() noexcept') 
from 'Throw *' (aka 'void (*)()')
  2 errors generated.
  
  --
  
  
  FAIL: Clang :: CXX/except/except.handle/p16.cpp (1234 of 16808)
   TEST 'Clang :: CXX/except/except.handle/p16.cpp' FAILED 

  Script:
  --
  : 'RUN: at line 1';   ...build/bin/clang -cc1 -internal-isystem 
...build/lib/clang/11.0.0/include -nostdsysteminc -fcxx-exceptions -fexceptions 
-fsyntax-only -verify ...clang/test/CXX/except/except.handle/p16.cpp
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'error' diagnostics expected but not seen: 
File ...clang/test/CXX/except/except.handle/p16.cpp Line 14: assigning to 
'float *' from incompatible type 'int *'
File ...clang/test/CXX/except/except.handle/p16.cpp Line 19: assigning to 
'int *' from incompatible type 'float *'
  error: 'warning' diagnostics seen but not expected: 
File ...clang/test/CXX/except/except.handle/p16.cpp Line 14: incompatible 
pointer types assigning to 'float *' from 'int *'
File ...clang/test/CXX/except/except.handle/p16.cpp Line 19: incompatible 
pointer types assigning to 'int *' from 'float *'
  4 errors generated.
  
  --
  
  
  FAIL: Clang :: CXX/expr/p13.cpp (1350 of 16808)
   TEST 'Clang :: CXX/expr/p13.cpp' FAILED 

  Script:
  --
  : 'RUN: at line 1';   ...build/bin/clang -cc1 -internal-isystem 
...build/lib/clang/11.0.0/include -nostdsysteminc -std=c++1z -verify 
...clang/test/CXX/expr/p13.cpp -fexceptions -fcxx-exceptions 
-Wno-dynamic-exception-spec
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'error' diagnostics expected but not seen: 
File ...clang/test/CXX/expr/p13.cpp Line 14: different exception 
specifications
  error: 'warning' diagnostics seen but not expected: 
File ...clang/test/CXX/expr/p13.cpp Line 14: incompatible function pointer 
types assigning to 'A' (aka 'void (*)() noexcept') from 'void (*)()'
  2 errors generated.
  
  --
  
  
  FAIL: Clang :: CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp (1519 of 
16808)
   TEST 'Clang :: 
CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp' FAILED 

  Script:
  --
  : 'RUN: at line 1';   ...build/bin/clang -cc1 -internal-isystem 
...build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
...clang/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  error: 'error' diagnostics expected but not seen: 
File ...clang/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp 
Line 13: incompatible
  error: 'warning' diagnostics seen but not expected: 
File ...clang/test/CXX/temp/temp.decls/temp.class/temp.mem.class/p1.cpp 
Line 13: incompatible pointer types assigning to 'int *' from 'float *'
  2 errors generated.
  
  --
  
  
  FAIL: Clang :: SemaCXX/addr-of-overloaded-function.cpp (9959 of 16808)
   TEST 'Clang :: SemaCXX/addr-of-overloaded-function.cpp' 
FAILED 
  Script:
  --
  : 'RUN: at line 1';   ...build/bin/clang -cc1 -internal-isystem 
...build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
...clang/test/SemaCXX/addr-of-overloaded-function.cpp
  : 'RUN: at line 2';   ...build/bin/clang -cc1 -internal-isystem 
...build/lib/clang/11.0.0/include -nostdsysteminc -fsyntax-only -verify 
-std=c++98 ...clang/test/SemaCXX/addr-of-overloaded-function.cpp
  : 'RUN: at line 3';   ..

[PATCH] D74015: [AIX][Frontend] C++ ABI customizations for AIX boilerplate

2020-02-12 Thread Chris Bowler via Phabricator via cfe-commits
cebowleratibm added a comment.

Looks fine, but we need to settle on the name for the ABI.  My preference would 
be "XLC++11", or perhaps "XLCXX11" (I propose the latter because of the common 
reference CXXABI.)




Comment at: clang/include/clang/Basic/TargetCXXABI.h:116
+///   - static initialization is adjusted to use sinit and sterm functions;
+XL_Clang,
+

sfertile wrote:
> Xiangling_L wrote:
> > daltenty wrote:
> > > Why the underscore in the name? This is a bit inconsistent with both the 
> > > LLVM naming convention here and the name as it appears in other sources.
> > There are various AIX ABI. So to distinguish the one we are implementing, 
> > we choose `XL` and `Clang` as two parts of the abi name. 
> > `XL` - not g++;
> > `Clang` - it's a  ABI implemented in Clang;
> > 
> > And also `XLClang` is misleading because it represents our AIX XL C/C++ 
> > compiler itself externally.
> So do we need the 'Clang' part in the name? For example the ABI below is not 
> `Microsoft_Clang`. Or is the `_Clang` differentiating between multiple XL 
> ABIs?
I suspect the concern is that "XL" ABI is ambiguious between legacy xlC and 
xlclang++.  The two differ at the C++11 language level so perhaps it makes 
sense to have "XLC++11"?  (and theoretically just "XL" if we ever decide xlC)



Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:4428
+   llvm::Constant *addr) {
+  llvm::report_fatal_error("Static initialization has not been fully"
+   " implemented on XL_Clang ABI yet.");

Omit "fully".  Fix the name XL_Clang when we've settled on a name.



Comment at: clang/test/CodeGen/static-init.cpp:9
+public:
+test(int c) {a = c;}
+~test() {a = 0;}

Nit: formatting.  

The test is fine but I'd usually write this test even more briefly:
struct S { ~S(); } s;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74015



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


Re: [clang] 0130b6c - Don't assume a reference refers to at least sizeof(T) bytes.

2020-02-12 Thread Richard Smith via cfe-commits
It's a wrong-code bugfix, but we've had the bug since Clang 3.5, so it
doesn't seem urgent.

Hans, what do you think? I don't think we've had any field reports of
miscompiles (though someone did notice the ubsan false-positive).

On Sat, 1 Feb 2020 at 05:04, Shoaib Meenai  wrote:

> Should this be cherry-picked to 10.0?
>
> On 1/31/20, 7:09 PM, "cfe-commits on behalf of Richard Smith via
> cfe-commits"  cfe-commits@lists.llvm.org> wrote:
>
>
> Author: Richard Smith
> Date: 2020-01-31T19:08:17-08:00
> New Revision: 0130b6cb5a8d94511e2bb09ac2f5a613a59f70b4
>
> URL:
> https://github.com/llvm/llvm-project/commit/0130b6cb5a8d94511e2bb09ac2f5a613a59f70b4
> DIFF:
> https://github.com/llvm/llvm-project/commit/0130b6cb5a8d94511e2bb09ac2f5a613a59f70b4.diff
>
> LOG: Don't assume a reference refers to at least sizeof(T) bytes.
>
> When T is a class type, only nvsize(T) bytes need be accessible through
> the reference. We had matching bugs in the application of the
> dereferenceable attribute and in -fsanitize=undefined.
>
> Added:
>
>
> Modified:
> clang/include/clang/AST/DeclCXX.h
> clang/lib/AST/DeclCXX.cpp
> clang/lib/CodeGen/CGCall.cpp
> clang/lib/CodeGen/CGClass.cpp
> clang/lib/CodeGen/CGExpr.cpp
> clang/lib/CodeGen/CodeGenModule.h
> clang/test/CodeGenCXX/catch-undef-behavior.cpp
> clang/test/CodeGenCXX/thunks.cpp
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang/include/clang/AST/DeclCXX.h
> b/clang/include/clang/AST/DeclCXX.h
> index 2e8e31dbf4c7..6d3a833b5037 100644
> --- a/clang/include/clang/AST/DeclCXX.h
> +++ b/clang/include/clang/AST/DeclCXX.h
> @@ -1696,6 +1696,10 @@ class CXXRecordDecl : public RecordDecl {
>/// actually abstract.
>bool mayBeAbstract() const;
>
> +  /// Determine whether it's impossible for a class to be derived
> from this
> +  /// class. This is best-effort, and may conservatively return false.
> +  bool isEffectivelyFinal() const;
> +
>/// If this is the closure type of a lambda expression, retrieve the
>/// number to be used for name mangling in the Itanium C++ ABI.
>///
>
> diff  --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
> index 227fe80ccab4..931a1141b1b4 100644
> --- a/clang/lib/AST/DeclCXX.cpp
> +++ b/clang/lib/AST/DeclCXX.cpp
> @@ -1923,6 +1923,18 @@ bool CXXRecordDecl::mayBeAbstract() const {
>return false;
>  }
>
> +bool CXXRecordDecl::isEffectivelyFinal() const {
> +  auto *Def = getDefinition();
> +  if (!Def)
> +return false;
> +  if (Def->hasAttr())
> +return true;
> +  if (const auto *Dtor = Def->getDestructor())
> +if (Dtor->hasAttr())
> +  return true;
> +  return false;
> +}
> +
>  void CXXDeductionGuideDecl::anchor() {}
>
>  bool ExplicitSpecifier::isEquivalent(const ExplicitSpecifier Other)
> const {
> @@ -2142,12 +2154,8 @@ CXXMethodDecl
> *CXXMethodDecl::getDevirtualizedMethod(const Expr *Base,
>// Similarly, if the class itself or its destructor is marked
> 'final',
>// the class can't be derived from and we can therefore
> devirtualize the
>// member function call.
> -  if (BestDynamicDecl->hasAttr())
> +  if (BestDynamicDecl->isEffectivelyFinal())
>  return DevirtualizedMethod;
> -  if (const auto *dtor = BestDynamicDecl->getDestructor()) {
> -if (dtor->hasAttr())
> -  return DevirtualizedMethod;
> -  }
>
>if (const auto *DRE = dyn_cast(Base)) {
>  if (const auto *VD = dyn_cast(DRE->getDecl()))
>
> diff  --git a/clang/lib/CodeGen/CGCall.cpp
> b/clang/lib/CodeGen/CGCall.cpp
> index 3f132a0a62aa..9ed2ccd54487 100644
> --- a/clang/lib/CodeGen/CGCall.cpp
> +++ b/clang/lib/CodeGen/CGCall.cpp
> @@ -2054,8 +2054,8 @@ void CodeGenModule::ConstructAttributeList(
>if (const auto *RefTy = RetTy->getAs()) {
>  QualType PTy = RefTy->getPointeeType();
>  if (!PTy->isIncompleteType() && PTy->isConstantSizeType())
> -
> RetAttrs.addDereferenceableAttr(getContext().getTypeSizeInChars(PTy)
> -.getQuantity());
> +  RetAttrs.addDereferenceableAttr(
> +  getMinimumObjectSize(PTy).getQuantity());
>  else if (getContext().getTargetAddressSpace(PTy) == 0 &&
>   !CodeGenOpts.NullPointerIsValid)
>RetAttrs.addAttribute(llvm::Attribute::NonNull);
> @@ -2164,8 +2164,8 @@ void CodeGenModule::ConstructAttributeList(
>  if (const auto *RefTy = ParamType->getAs()) {
>QualType PTy = RefTy->getPointeeType();
>if (!PTy->isIncompleteType() && PTy->isConstantSizeType())
> -
> Attrs.addDereferenceableAttr(getContext().getTypeSizeInChars(PTy)
> -   

[PATCH] D73720: [Analyzer] Use note tags to track container begin and and changes

2020-02-12 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

Do we have a test where 2 containers are present but only one of them should be 
marked as interesting?

  void deref_end_after_pop_back(std::vector &V, std::vector &V2) {
const auto i = --V.end();
const auto i2 = --V2.end();
  
V.pop_back();  // expected-note{{Container 'V' shrinked from the right by 1 
position}}
V2.pop_back(); // no-note
  
*i; // expected-warning{{Past-the-end iterator dereferenced}}
// expected-note@-1{{Past-the-end iterator dereferenced}}
  }




Comment at: clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp:95-103
+const NoteTag *InterestingTag =
+  C.getNoteTag([Cont](BugReport &BR) -> std::string {
+  auto *PSBR = dyn_cast(&BR);
+  if (PSBR) {
+PSBR->markInteresting(Cont);
+  }
+  return "";

Aha, makes sense, when calling `clang_analyzer_container_end(V)`, we want to 
make the analyzer emit more information about `V` so its obviously interesting.



Comment at: clang/test/Analysis/container-modeling.cpp:35
 
 

 ///

I hate to be that guy, but this is quite ugly :). How about the handsome
```
//===--===//
// Container assignment tests.
//===--===//
```
But I don't insist, especially within the scope of this patch.


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

https://reviews.llvm.org/D73720



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


[PATCH] D71110: [clangd] A tool to evaluate cross-file rename.

2020-02-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

In D71110#1871896 , @hokein wrote:

> Thanks for the feedback!
>
> Yeah, currently template classes are not supported in cross-file rename, see 
> https://github.com/llvm/llvm-project/blob/master/clang-tools-extra/clangd/refactor/Rename.cpp#L187.
>
> So `llvm::Optional` and `llvm::Optional` should fail to rename, but StringRef 
> and llvm::None should work (if you remove the hard-coded max limit 50).


Ah, I see, thank you for the explanation! I think it would be super useful to 
have the error message reflecting that!

Also, the `llvm::Twine` fails too, many of the failures are related to the 
forward declarations (I think the problem is that they are treated differently 
from the original symbol and are not being renamed at all in the corresponding 
files, but that's just my guess). It`s probably a good idea to keep track of 
all the entries that can break global rename in some issue on the Github so 
that they're not lost?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71110



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


[PATCH] D74411: [clangd] Query constructors in the index during rename.

2020-02-12 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments.



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:326
+  // When querying references for a class, clangd's own index will also return
+  // references of the corresponding class constructors, but this is not true
+  // for all index backends, e.g. kythe, so we add all constructors to the 
query

What about desctructors? Should they always be handled separately?



Comment at: clang-tools-extra/clangd/unittests/RenameTests.cpp:772
+TEST(CrossFileRename, QueryCtorInIndex) {
+  auto MainCode = Annotations("F^oo f;");
+  auto TU = TestTU::withCode(MainCode.code());

nit: I think most variables are not being modified here, so maybe const 
everywhere?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74411



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


[PATCH] D73720: [Analyzer] Use note tags to track container begin and and changes

2020-02-12 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment.

In D73720#1871955 , @Szelethus wrote:

> Do we have a test where 2 containers are present but only one of them should 
> be marked as interesting?


Yes, of course we have, that was the starting point of the discussion. However, 
I try to make the tests orthogonal, so this test is in `container-modeling.cpp` 
where we do not dereference it, but print its begin or end.


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

https://reviews.llvm.org/D73720



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


[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 244140.
martong added a comment.

- Remove debug dump
- Add TryExpandAsInteger to CheckerHelpers.h


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
  clang/test/Analysis/std-c-library-functions-eof.c

Index: clang/test/Analysis/std-c-library-functions-eof.c
===
--- /dev/null
+++ clang/test/Analysis/std-c-library-functions-eof.c
@@ -0,0 +1,26 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+
+void clang_analyzer_eval(int);
+
+typedef struct FILE FILE;
+// Unorthodox EOF value.
+#define EOF -2
+
+int getc(FILE *);
+void test_getc(FILE *fp) {
+
+  int x;
+  while ((x = getc(fp)) != EOF) {
+clang_analyzer_eval(x > 255); // expected-warning{{FALSE}}
+clang_analyzer_eval(x >= 0); // expected-warning{{TRUE}}
+  }
+
+  int y = getc(fp);
+  if (y < 0) {
+clang_analyzer_eval(y == EOF); // expected-warning{{TRUE}}
+  }
+}
Index: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
===
--- clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
+++ clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
@@ -109,6 +109,29 @@
   return Nullability::Unspecified;
 }
 
+llvm::Optional TryExpandAsInteger(StringRef Macro,
+   const Preprocessor &PP) {
+  const auto EOFMacroIt = llvm::find_if(
+  PP.macros(), [&](const auto &K) { return K.first->getName() == Macro; });
+  if (EOFMacroIt == PP.macro_end())
+return llvm::None;
+  const MacroInfo *MI = PP.getMacroInfo(EOFMacroIt->first);
+
+  // Parse an integer at the end of the macro definition.
+  const Token &T = MI->tokens().back();
+  StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength());
+  llvm::APInt IntValue;
+  constexpr unsigned AutoSenseRadix = 0;
+  if (ValueStr.getAsInteger(AutoSenseRadix, IntValue))
+return llvm::None;
+
+  // Parse an optional minus sign.
+  if (MI->tokens().size() == 2)
+if (MI->tokens().front().is(tok::minus))
+  IntValue = -IntValue;
+
+  return IntValue.getSExtValue();
+}
 
-} // end namespace ento
-} // end namespace clang
+} // namespace ento
+} // namespace clang
Index: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -55,6 +55,7 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 
 using namespace clang;
 using namespace clang::ento;
@@ -241,7 +242,7 @@
 const CallExpr *CE,
 CheckerContext &C) const;
 
-  void initFunctionSummaries(BasicValueFactory &BVF) const;
+  void initFunctionSummaries(CheckerContext &C) const;
 };
 } // end of anonymous namespace
 
@@ -312,10 +313,11 @@
 for (size_t I = 1; I != E; ++I) {
   const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T);
   const llvm::APSInt &Max = BVF.getValue(R[I].first - 1ULL, T);
-  assert(Min <= Max);
-  State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
-  if (!State)
-return nullptr;
+  if (Min <= Max) {
+State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
+if (!State)
+  return nullptr;
+  }
 }
   }
 
@@ -449,9 +451,7 @@
   if (!FD)
 return None;
 
-  SValBuilder &SVB = C.getSValBuilder();
-  BasicValueFactory &BVF = SVB.getBasicValueFactory();
-  initFunctionSummaries(BVF);
+  initFunctionSummaries(C);
 
   IdentifierInfo *II = FD->getIdentifier();
   if (!II)
@@ -478,11 +478,13

[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 244141.
martong added a comment.

- Remove PP declaration


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
  clang/test/Analysis/std-c-library-functions-eof.c

Index: clang/test/Analysis/std-c-library-functions-eof.c
===
--- /dev/null
+++ clang/test/Analysis/std-c-library-functions-eof.c
@@ -0,0 +1,26 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+
+void clang_analyzer_eval(int);
+
+typedef struct FILE FILE;
+// Unorthodox EOF value.
+#define EOF -2
+
+int getc(FILE *);
+void test_getc(FILE *fp) {
+
+  int x;
+  while ((x = getc(fp)) != EOF) {
+clang_analyzer_eval(x > 255); // expected-warning{{FALSE}}
+clang_analyzer_eval(x >= 0); // expected-warning{{TRUE}}
+  }
+
+  int y = getc(fp);
+  if (y < 0) {
+clang_analyzer_eval(y == EOF); // expected-warning{{TRUE}}
+  }
+}
Index: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
===
--- clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
+++ clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
@@ -109,6 +109,29 @@
   return Nullability::Unspecified;
 }
 
+llvm::Optional TryExpandAsInteger(StringRef Macro,
+   const Preprocessor &PP) {
+  const auto EOFMacroIt = llvm::find_if(
+  PP.macros(), [&](const auto &K) { return K.first->getName() == Macro; });
+  if (EOFMacroIt == PP.macro_end())
+return llvm::None;
+  const MacroInfo *MI = PP.getMacroInfo(EOFMacroIt->first);
+
+  // Parse an integer at the end of the macro definition.
+  const Token &T = MI->tokens().back();
+  StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength());
+  llvm::APInt IntValue;
+  constexpr unsigned AutoSenseRadix = 0;
+  if (ValueStr.getAsInteger(AutoSenseRadix, IntValue))
+return llvm::None;
+
+  // Parse an optional minus sign.
+  if (MI->tokens().size() == 2)
+if (MI->tokens().front().is(tok::minus))
+  IntValue = -IntValue;
+
+  return IntValue.getSExtValue();
+}
 
-} // end namespace ento
-} // end namespace clang
+} // namespace ento
+} // namespace clang
Index: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -55,6 +55,7 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 
 using namespace clang;
 using namespace clang::ento;
@@ -241,7 +242,7 @@
 const CallExpr *CE,
 CheckerContext &C) const;
 
-  void initFunctionSummaries(BasicValueFactory &BVF) const;
+  void initFunctionSummaries(CheckerContext &C) const;
 };
 } // end of anonymous namespace
 
@@ -312,10 +313,11 @@
 for (size_t I = 1; I != E; ++I) {
   const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T);
   const llvm::APSInt &Max = BVF.getValue(R[I].first - 1ULL, T);
-  assert(Min <= Max);
-  State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
-  if (!State)
-return nullptr;
+  if (Min <= Max) {
+State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
+if (!State)
+  return nullptr;
+  }
 }
   }
 
@@ -449,9 +451,7 @@
   if (!FD)
 return None;
 
-  SValBuilder &SVB = C.getSValBuilder();
-  BasicValueFactory &BVF = SVB.getBasicValueFactory();
-  initFunctionSummaries(BVF);
+  initFunctionSummaries(C);
 
   IdentifierInfo *II = FD->getIdentifier();
   if (!II)
@@ -478,11 +478,13 @@
 }
 
 void StdLibraryFunctionsChecker

[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 244143.
martong added a comment.

- EOFMacroIt -> MacroIt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
  clang/test/Analysis/std-c-library-functions-eof.c

Index: clang/test/Analysis/std-c-library-functions-eof.c
===
--- /dev/null
+++ clang/test/Analysis/std-c-library-functions-eof.c
@@ -0,0 +1,26 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+
+void clang_analyzer_eval(int);
+
+typedef struct FILE FILE;
+// Unorthodox EOF value.
+#define EOF -2
+
+int getc(FILE *);
+void test_getc(FILE *fp) {
+
+  int x;
+  while ((x = getc(fp)) != EOF) {
+clang_analyzer_eval(x > 255); // expected-warning{{FALSE}}
+clang_analyzer_eval(x >= 0); // expected-warning{{TRUE}}
+  }
+
+  int y = getc(fp);
+  if (y < 0) {
+clang_analyzer_eval(y == EOF); // expected-warning{{TRUE}}
+  }
+}
Index: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
===
--- clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
+++ clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
@@ -109,6 +109,29 @@
   return Nullability::Unspecified;
 }
 
+llvm::Optional TryExpandAsInteger(StringRef Macro,
+   const Preprocessor &PP) {
+  const auto MacroIt = llvm::find_if(
+  PP.macros(), [&](const auto &K) { return K.first->getName() == Macro; });
+  if (MacroIt == PP.macro_end())
+return llvm::None;
+  const MacroInfo *MI = PP.getMacroInfo(MacroIt->first);
+
+  // Parse an integer at the end of the macro definition.
+  const Token &T = MI->tokens().back();
+  StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength());
+  llvm::APInt IntValue;
+  constexpr unsigned AutoSenseRadix = 0;
+  if (ValueStr.getAsInteger(AutoSenseRadix, IntValue))
+return llvm::None;
+
+  // Parse an optional minus sign.
+  if (MI->tokens().size() == 2)
+if (MI->tokens().front().is(tok::minus))
+  IntValue = -IntValue;
+
+  return IntValue.getSExtValue();
+}
 
-} // end namespace ento
-} // end namespace clang
+} // namespace ento
+} // namespace clang
Index: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -55,6 +55,7 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 
 using namespace clang;
 using namespace clang::ento;
@@ -241,7 +242,7 @@
 const CallExpr *CE,
 CheckerContext &C) const;
 
-  void initFunctionSummaries(BasicValueFactory &BVF) const;
+  void initFunctionSummaries(CheckerContext &C) const;
 };
 } // end of anonymous namespace
 
@@ -312,10 +313,11 @@
 for (size_t I = 1; I != E; ++I) {
   const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T);
   const llvm::APSInt &Max = BVF.getValue(R[I].first - 1ULL, T);
-  assert(Min <= Max);
-  State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
-  if (!State)
-return nullptr;
+  if (Min <= Max) {
+State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
+if (!State)
+  return nullptr;
+  }
 }
   }
 
@@ -449,9 +451,7 @@
   if (!FD)
 return None;
 
-  SValBuilder &SVB = C.getSValBuilder();
-  BasicValueFactory &BVF = SVB.getBasicValueFactory();
-  initFunctionSummaries(BVF);
+  initFunctionSummaries(C);
 
   IdentifierInfo *II = FD->getIdentifier();
   if (!II)
@@ -478,11 +478,13 @@
 }
 
 void StdLibraryFunctionsChecker::initFun

[PATCH] D71110: [clangd] A tool to evaluate cross-file rename.

2020-02-12 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

> Also, the llvm::Twine fails too, many of the failures are related to the 
> forward declarations (I think the problem is that they are treated 
> differently from the original symbol and are not being renamed at all in the 
> corresponding files, but that's just my guess). It`s probably a good idea to 
> keep track of all the entries that can break global rename in some issue on 
> the Github so that they're not lost?

Yeap, that sounds good to me. Just create an issue, and put all details there, 
attach the detailed log would be helpful. I suspect we may encounter bugs in 
xrefs/rename code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71110



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


[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

2020-02-12 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

One of the things that stood out for me was the lack of the usage of the 
`check::BranchCondition` callback, but there you'd have to grind out whether it 
is relevant to a return value, so I'm probably wrong on that regard.

So I guess I don't have any immediate high level objections. Using a recursive 
statement visitor seems overkill, but maybe its appropriate here, and lets 
leave that discussion for later anyways. Overriding `CheckerBase::printState` 
to show the current set of values stored in `CalledFunctionDataMap` would be 
nice sometime, but that can wait as well.

@NoQ, @xazax.hun, @baloghadamsoftware, how do you like this patch? I think the 
high level idea is correct.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72705



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

I think giving comments a semantic meaning is a bad idea. Do we really have to 
do this?

In addition to this making comments have semantic meaning, the meaning is 
different from gcc.
I don't think we should support this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added inline comments.



Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:1239
+  llvm::Regex("(/\\*[ \\t]*fall(s | |-)?thr(ough|u)\\.?[ 
\\t]*\\*/)"
+  "|(//[ \\t]*fall(s | |-)?thr(ough|u)\\.?[ \\t]*)",
+  llvm::Regex::IgnoreCase);

Also, this adds a regex match for every comment line, yes? Isn't this terrible 
for build performance? Did you do any benchmarking of this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

Now this patch should be reverted.
This patch also omitted cfe-commits lists.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

I also jumped when I saw that this now makes certain comments "load bearing". 
That doesn't seem like a great idea to me.

The warning may be all right for C++ code, which has an attribute to suppress 
it, but C code does not normally use such attributes, and has no standard 
syntax for them. I think it would be better if the warning was off by default 
for C code. Those C projects that wish could opt-in to it and jump through the 
hoops of applying attributes to silence the warning.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

Also, rG398b wasn't sent to cfe-dev lists.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Isn't a better approach to only do in-process cc1 if there's just one TU?


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

https://reviews.llvm.org/D74447



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


[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment.

> Harbormaster failed remote builds in B46321 
> : Diff 244141!

This is actually true, I have a test that crashes! Finally, a case where remote 
builds are proved to be useful!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D73852#1872000 , @thakis wrote:

> I think giving comments a semantic meaning is a bad idea. Do we really have 
> to do this?


I think that ship has sailed, for instance, see // NOLINT comments that are 
also supported to silence diagnostics. Also, the original bug report mentions 
that flex generates code using these constructs, so there are real world 
libraries using this construct.

> In addition to this making comments have semantic meaning, the meaning is 
> different from gcc.

We're covering the cases GCC does that make sense within Clang -- or have we 
deviated from GCC in a way that is significant to our users?

> I don't think we should support this.

I think we should -- C did not have any other way to resolve this issue without 
C2x support or compiler extensions, and fallthrough is definitely an issue in 
C. While it's not my favorite solution to silencing the diagnostics, it solves 
a real problem that C programmers are hitting.

In D73852#1872013 , @lebedev.ri wrote:

> Now this patch should be reverted.
>  This patch also omitted cfe-commits lists.


That is not an automatic reason to revert a patch, especially one that has been 
accepted by a code owner.




Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:1239
+  llvm::Regex("(/\\*[ \\t]*fall(s | |-)?thr(ough|u)\\.?[ 
\\t]*\\*/)"
+  "|(//[ \\t]*fall(s | |-)?thr(ough|u)\\.?[ \\t]*)",
+  llvm::Regex::IgnoreCase);

thakis wrote:
> Also, this adds a regex match for every comment line, yes? Isn't this 
> terrible for build performance? Did you do any benchmarking of this?
https://reviews.llvm.org/D73852#inline-671309


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D73852#1872019 , @hans wrote:

> I also jumped when I saw that this now makes certain comments "load bearing". 
> That doesn't seem like a great idea to me.


It's an idea we already have in the project though with NOLINT comments, though 
that is a clang-tidy approach. So this does add load bearing comments in the 
frontend, but with plenty of precedence (both with clang-tidy and with GCC).

> The warning may be all right for C++ code, which has an attribute to suppress 
> it, but C code does not normally use such attributes, and has no standard 
> syntax for them.

That's not quite true. C2x has [[attr]] attributes, but that requires enabling 
a custom compiler extension for non-C2x mode. Given that there are reasonably 
popular libraries like flex which already using comments, this is supporting a 
real use case that is also supported by GCC.

> I think it would be better if the warning was off by default for C code. 
> Those C projects that wish could opt-in to it and jump through the hoops of 
> applying attributes to silence the warning.

The warning is off by default already for both C and C++. The issue being 
solved here is projects that enable the option in C.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 244149.
martong added a comment.

- Fix crash in TryExpandAsInteger


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
  clang/test/Analysis/std-c-library-functions-eof.c

Index: clang/test/Analysis/std-c-library-functions-eof.c
===
--- /dev/null
+++ clang/test/Analysis/std-c-library-functions-eof.c
@@ -0,0 +1,26 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+
+void clang_analyzer_eval(int);
+
+typedef struct FILE FILE;
+// Unorthodox EOF value.
+#define EOF -2
+
+int getc(FILE *);
+void test_getc(FILE *fp) {
+
+  int x;
+  while ((x = getc(fp)) != EOF) {
+clang_analyzer_eval(x > 255); // expected-warning{{FALSE}}
+clang_analyzer_eval(x >= 0); // expected-warning{{TRUE}}
+  }
+
+  int y = getc(fp);
+  if (y < 0) {
+clang_analyzer_eval(y == EOF); // expected-warning{{TRUE}}
+  }
+}
Index: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
===
--- clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
+++ clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
@@ -109,6 +109,31 @@
   return Nullability::Unspecified;
 }
 
+llvm::Optional TryExpandAsInteger(StringRef Macro,
+   const Preprocessor &PP) {
+  const auto MacroIt = llvm::find_if(
+  PP.macros(), [&](const auto &K) { return K.first->getName() == Macro; });
+  if (MacroIt == PP.macro_end())
+return llvm::None;
+  const MacroInfo *MI = PP.getMacroInfo(MacroIt->first);
+
+  // Parse an integer at the end of the macro definition.
+  const Token &T = MI->tokens().back();
+  if (!T.isLiteral())
+return llvm::None;
+  StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength());
+  llvm::APInt IntValue;
+  constexpr unsigned AutoSenseRadix = 0;
+  if (ValueStr.getAsInteger(AutoSenseRadix, IntValue))
+return llvm::None;
+
+  // Parse an optional minus sign.
+  if (MI->tokens().size() == 2)
+if (MI->tokens().front().is(tok::minus))
+  IntValue = -IntValue;
+
+  return IntValue.getSExtValue();
+}
 
-} // end namespace ento
-} // end namespace clang
+} // namespace ento
+} // namespace clang
Index: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -55,6 +55,7 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 
 using namespace clang;
 using namespace clang::ento;
@@ -241,7 +242,7 @@
 const CallExpr *CE,
 CheckerContext &C) const;
 
-  void initFunctionSummaries(BasicValueFactory &BVF) const;
+  void initFunctionSummaries(CheckerContext &C) const;
 };
 } // end of anonymous namespace
 
@@ -312,10 +313,11 @@
 for (size_t I = 1; I != E; ++I) {
   const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T);
   const llvm::APSInt &Max = BVF.getValue(R[I].first - 1ULL, T);
-  assert(Min <= Max);
-  State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
-  if (!State)
-return nullptr;
+  if (Min <= Max) {
+State = CM.assumeInclusiveRange(State, *N, Min, Max, false);
+if (!State)
+  return nullptr;
+  }
 }
   }
 
@@ -449,9 +451,7 @@
   if (!FD)
 return None;
 
-  SValBuilder &SVB = C.getSValBuilder();
-  BasicValueFactory &BVF = SVB.getBasicValueFactory();
-  initFunctionSummaries(BVF);
+  initFunctionSummaries(C);
 
   IdentifierInfo *II = FD->getIdentifier();
   if (!II)
@@ -478,11 

[PATCH] D74483: [AArch64] Add Cortex-A34 Support for clang and llvm

2020-02-12 Thread Luke Geeson via Phabricator via cfe-commits
LukeGeeson created this revision.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya, kristof.beyls.
Herald added projects: clang, LLVM.

This patch upstreams support for the AArch64 Armv8-A cpu Cortex-A34.


   

In detail adding support for:

- mcpu option in clang
- AArch64 Target Features in clang
- llvm AArch64 TargetParser definitions

  details of the cpu can be found here: 
https://developer.arm.com/ip-products/processors/cortex-a/cortex-a34


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74483

Files:
  clang/test/Driver/aarch64-cpus.c
  clang/test/Preprocessor/aarch64-target-features.c
  llvm/include/llvm/Support/AArch64TargetParser.def
  llvm/lib/Target/AArch64/AArch64.td
  llvm/test/CodeGen/AArch64/cpus.ll
  llvm/test/CodeGen/AArch64/remat.ll
  llvm/unittests/Support/TargetParserTest.cpp

Index: llvm/unittests/Support/TargetParserTest.cpp
===
--- llvm/unittests/Support/TargetParserTest.cpp
+++ llvm/unittests/Support/TargetParserTest.cpp
@@ -781,6 +781,11 @@
   AArch64::AEK_NONE, ""));
 
   EXPECT_TRUE(testAArch64CPU(
+  "cortex-a34", "armv8-a", "crypto-neon-fp-armv8",
+  AArch64::AEK_CRC | AArch64::AEK_SIMD |
+  AArch64::AEK_FP | AArch64::AEK_CRYPTO,
+  "8-A"));
+  EXPECT_TRUE(testAArch64CPU(
   "cortex-a35", "armv8-a", "crypto-neon-fp-armv8",
   AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
   AArch64::AEK_SIMD, "8-A"));
@@ -957,7 +962,7 @@
   "8.2-A"));
 }
 
-static constexpr unsigned NumAArch64CPUArchs = 35;
+static constexpr unsigned NumAArch64CPUArchs = 36;
 
 TEST(TargetParserTest, testAArch64CPUArchList) {
   SmallVector List;
@@ -1002,6 +1007,8 @@
 }
 
 TEST(TargetParserTest, testAArch64Extension) {
+  EXPECT_FALSE(testAArch64Extension("cortex-a34",
+AArch64::ArchKind::INVALID, "ras"));
   EXPECT_FALSE(testAArch64Extension("cortex-a35",
 AArch64::ArchKind::INVALID, "ras"));
   EXPECT_FALSE(testAArch64Extension("cortex-a53",
Index: llvm/test/CodeGen/AArch64/remat.ll
===
--- llvm/test/CodeGen/AArch64/remat.ll
+++ llvm/test/CodeGen/AArch64/remat.ll
@@ -1,3 +1,4 @@
+; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=cortex-a34 -o - %s | FileCheck %s
 ; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=cortex-a35 -o - %s | FileCheck %s
 ; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=cortex-a53 -o - %s | FileCheck %s
 ; RUN: llc -mtriple=aarch64-linux-gnuabi -mcpu=cortex-a55 -o - %s | FileCheck %s
Index: llvm/test/CodeGen/AArch64/cpus.ll
===
--- llvm/test/CodeGen/AArch64/cpus.ll
+++ llvm/test/CodeGen/AArch64/cpus.ll
@@ -3,6 +3,7 @@
 
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=generic 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=cortex-a35 2>&1 | FileCheck %s
+; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=cortex-a34 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=cortex-a53 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=cortex-a55 2>&1 | FileCheck %s
 ; RUN: llc < %s -mtriple=arm64-unknown-unknown -mcpu=cortex-a57 2>&1 | FileCheck %s
Index: llvm/lib/Target/AArch64/AArch64.td
===
--- llvm/lib/Target/AArch64/AArch64.td
+++ llvm/lib/Target/AArch64/AArch64.td
@@ -853,6 +853,7 @@
  ]>;
 
 def : ProcessorModel<"cortex-a35", CortexA53Model, [ProcA35]>;
+def : ProcessorModel<"cortex-a34", CortexA53Model, [ProcA35]>;
 def : ProcessorModel<"cortex-a53", CortexA53Model, [ProcA53]>;
 def : ProcessorModel<"cortex-a55", CortexA53Model, [ProcA55]>;
 def : ProcessorModel<"cortex-a57", CortexA57Model, [ProcA57]>;
Index: llvm/include/llvm/Support/AArch64TargetParser.def
===
--- llvm/include/llvm/Support/AArch64TargetParser.def
+++ llvm/include/llvm/Support/AArch64TargetParser.def
@@ -85,6 +85,8 @@
 #ifndef AARCH64_CPU_NAME
 #define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT)
 #endif
+AARCH64_CPU_NAME("cortex-a34", ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
+ (AArch64::AEK_CRC))
 AARCH64_CPU_NAME("cortex-a35", ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false,
  (AArch64::AEK_CRC))
 AARCH64_CPU_NAME("cortex-a53", ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, true,
Index: clang/test/Preprocessor/aarch64-target-features.c
===
--- clang/test/Preprocessor/aarch64-target-features.c
+++ clang/test/Preprocessor/aarch64-target-features.c
@@ -152,6 +152,7 @@
 // RUN: %clang -target aarch64 -mcpu=apple-s4 -### -c %s 2>&1 | FileCheck -check-pref

[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added inline comments.



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h:17
 #include "clang/AST/Stmt.h"
+#include "clang/Lex/Preprocessor.h"
+#include "llvm/ADT/Optional.h"

We do not need to include Preprocessor.h here (fwd declaration is enough).



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h:70
+/// token for an integer. If we cannot parse the value then None is returned.
+llvm::Optional TryExpandAsInteger(StringRef Macro, const Preprocessor 
&PP);
 

Name should begin with lowercase letter?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D73852#1872044 , @aaron.ballman 
wrote:

> In D73852#1872000 , @thakis wrote:
>
> > I think giving comments a semantic meaning is a bad idea. Do we really have 
> > to do this?
>
>
> I think that ship has sailed, for instance, see // NOLINT comments that are 
> also supported to silence diagnostics.


That's for linters, not for compilers.

> Also, the original bug report mentions that flex generates code using these 
> constructs, so there are real world libraries using this construct.

So what? If we went down this road, we'd now have `/*OVERRIDE*/` instead of 
`override`, `/*FINAL*/` instead of `final`, etc. Real world libraries can be 
updated. That's what we already did everywhere in C++ mode. No reason it can't 
happen in C mode too.

The usual progression is:

- compiler-specific extensions (we now have `__attribute__((fallthrough))` 
attached to an empty statement)
- eventually, if it has legs, standardization

This disrupts this path.

>> In addition to this making comments have semantic meaning, the meaning is 
>> different from gcc.
> 
> We're covering the cases GCC does that make sense within Clang -- or have we 
> deviated from GCC in a way that is significant to our users?

We give a not-well-specified and not documented subset of comments some 
meaning. We do this in a way that's different from GCC.

Also, as mentioned above, as-is I'd expect this patch to make builds measurably 
slower. That alone is revert reason enough.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[clang] 5fef14d - [Concepts] Do not check constraints if not all template arguments have been deduced

2020-02-12 Thread Saar Raz via cfe-commits

Author: Saar Raz
Date: 2020-02-12T16:02:12+02:00
New Revision: 5fef14d932fe602bf998b8fb8a809ff85ca1e245

URL: 
https://github.com/llvm/llvm-project/commit/5fef14d932fe602bf998b8fb8a809ff85ca1e245
DIFF: 
https://github.com/llvm/llvm-project/commit/5fef14d932fe602bf998b8fb8a809ff85ca1e245.diff

LOG: [Concepts] Do not check constraints if not all template arguments have 
been deduced

We previously checked the constraints of instantiated function templates even 
in cases where
PartialOverloading was true and not all template arguments have been deduced, 
which caused crashes
in clangd (bug 44714).

We now check if all arguments have been deduced before checking constraints in 
partial overloading
scenarios.

Added: 
clang/test/CXX/temp/temp.deduct/p5.cpp

Modified: 
clang/lib/Sema/SemaTemplateDeduction.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 24019bf7975b..a0b92cdf3a5e 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3439,13 +3439,16 @@ Sema::TemplateDeductionResult 
Sema::FinishTemplateArgumentDeduction(
   //   ([temp.constr.decl]), those constraints are checked for satisfaction
   //   ([temp.constr.constr]). If the constraints are not satisfied, type
   //   deduction fails.
-  if (CheckInstantiatedFunctionTemplateConstraints(Info.getLocation(),
-  Specialization, Builder, Info.AssociatedConstraintsSatisfaction))
-return TDK_MiscellaneousDeductionFailure;
+  if (!PartialOverloading ||
+  (Builder.size() == FunctionTemplate->getTemplateParameters()->size())) {
+if (CheckInstantiatedFunctionTemplateConstraints(Info.getLocation(),
+Specialization, Builder, Info.AssociatedConstraintsSatisfaction))
+  return TDK_MiscellaneousDeductionFailure;
 
-  if (!Info.AssociatedConstraintsSatisfaction.IsSatisfied) {
-Info.reset(TemplateArgumentList::CreateCopy(Context, Builder));
-return TDK_ConstraintsNotSatisfied;
+if (!Info.AssociatedConstraintsSatisfaction.IsSatisfied) {
+  Info.reset(TemplateArgumentList::CreateCopy(Context, Builder));
+  return TDK_ConstraintsNotSatisfied;
+}
   }
 
   if (OriginalCallArgs) {

diff  --git a/clang/test/CXX/temp/temp.deduct/p5.cpp 
b/clang/test/CXX/temp/temp.deduct/p5.cpp
new file mode 100644
index ..0c998b19f181
--- /dev/null
+++ b/clang/test/CXX/temp/temp.deduct/p5.cpp
@@ -0,0 +1,6 @@
+// RUN:  %clang_cc1 -std=c++2a -verify %s -code-completion-at=%s:6:16
+// expected-no-diagnostics
+
+template  concept C = true;
+void bar(C auto foo);
+int y = bar(
\ No newline at end of file



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


[PATCH] D74464: Fix integration of pass plugins with llvm dylib

2020-02-12 Thread serge via Phabricator via cfe-commits
serge-sans-paille updated this revision to Diff 244150.
serge-sans-paille edited the summary of this revision.
serge-sans-paille added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Totally different, and much cleaner approach of the issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74464

Files:
  clang/CMakeLists.txt
  llvm/CMakeLists.txt


Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -1075,6 +1075,7 @@
 # after all targets are created.
 include(LLVMDistributionSupport)
 llvm_distribution_add_targets()
+process_llvm_pass_plugins()
 
 # This allows us to deploy the Universal CRT DLLs by passing 
-DCMAKE_INSTALL_UCRT_LIBRARIES=ON to CMake
 if (MSVC AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND 
CMAKE_INSTALL_UCRT_LIBRARIES)
@@ -1099,5 +1100,3 @@
 if (LLVM_INCLUDE_UTILS AND LLVM_INCLUDE_TOOLS)
   add_subdirectory(utils/llvm-locstats)
 endif()
-
-process_llvm_pass_plugins()
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -864,6 +864,7 @@
 
 if(CLANG_BUILT_STANDALONE)
   llvm_distribution_add_targets()
+  process_llvm_pass_plugins()
 endif()
 
 configure_file(


Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -1075,6 +1075,7 @@
 # after all targets are created.
 include(LLVMDistributionSupport)
 llvm_distribution_add_targets()
+process_llvm_pass_plugins()
 
 # This allows us to deploy the Universal CRT DLLs by passing -DCMAKE_INSTALL_UCRT_LIBRARIES=ON to CMake
 if (MSVC AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_INSTALL_UCRT_LIBRARIES)
@@ -1099,5 +1100,3 @@
 if (LLVM_INCLUDE_UTILS AND LLVM_INCLUDE_TOOLS)
   add_subdirectory(utils/llvm-locstats)
 endif()
-
-process_llvm_pass_plugins()
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -864,6 +864,7 @@
 
 if(CLANG_BUILT_STANDALONE)
   llvm_distribution_add_targets()
+  process_llvm_pass_plugins()
 endif()
 
 configure_file(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus requested changes to this revision.
Szelethus added inline comments.
This revision now requires changes to proceed.



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h:67-69
+/// Try to parse the value of a defined preprocessor macro. We can only parse
+/// simple expressions that consist of an optional minus sign token and then a
+/// token for an integer. If we cannot parse the value then None is returned.

While I agree that we shouldn't have to reinvent the `Preprocessor` every time 
we need something macro related, I doubt that this will catch anything. I 
checker my system's standard library, and this is what I found:

```lang=c
#ifndef EOF
# define EOF (-1)
#endif
```
Lets go just one step further and cover the probably majority of the cases 
where the definition is in parentheses.



Comment at: 
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:512-517
+  const auto EOFv = [&C]() -> RangeInt {
+if (const llvm::Optional OptInt =
+TryExpandAsInteger("EOF", C.getPreprocessor()))
+  return *OptInt;
+return -1;
+  }();

Hah, would've never thought of doing this with a lambda. Me likey.



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:571
+.Case(
+{ReturnValueCondition(WithinRange, {{EOFv, EOFv}, {0, 
UCharMax}})});
   };

Huh, what's happening here exactly? Doesn't `Range` take 2 `RangeInt`s as ctor 
arguments? What does `{EOFv, EOFv}, {0, UCharMax}` mean in this context?



Comment at: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp:114-117
+  const auto MacroIt = llvm::find_if(
+  PP.macros(), [&](const auto &K) { return K.first->getName() == Macro; });
+  if (MacroIt == PP.macro_end())
+return llvm::None;

This seems a bit clunky even for the `Preprocessor` -- how about

```lang=c++
const auto *MacroII = PP.getIdentifierInfo(Macro);
if (!MacroII)
  return;
const MacroInfo *MI = PP.getMacroInfo(MacroII);
assert(MI);
```



Comment at: clang/test/Analysis/std-c-library-functions-eof.c:24
+  if (y < 0) {
+clang_analyzer_eval(y == EOF); // expected-warning{{TRUE}}
+  }

So the test is about checking whether the analyzer correctly assigned `-2` to 
`y`, right? Then let's check that too.
```lang=c++
clang_analyzer_eval(y == 2);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473



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


[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

2020-02-12 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added reviewers: xazax.hun, Charusso, dcoughlin.
Szelethus added a comment.

Also, allow me to add a few other folks, because they are very active and 
knowledgeable individuals :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72705



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D73852#1872064 , @thakis wrote:

> In D73852#1872044 , @aaron.ballman 
> wrote:
>
> > In D73852#1872000 , @thakis wrote:
> >
> > > I think giving comments a semantic meaning is a bad idea. Do we really 
> > > have to do this?
> >
> >
> > I think that ship has sailed, for instance, see // NOLINT comments that are 
> > also supported to silence diagnostics.
>
>
> That's for linters, not for compilers.


Yeah, I realized that later that we only support that in clang-tidy, so this is 
introducing a new concept to the frontend.

>> Also, the original bug report mentions that flex generates code using these 
>> constructs, so there are real world libraries using this construct.
> 
> So what? If we went down this road, we'd now have `/*OVERRIDE*/` instead of 
> `override`, `/*FINAL*/` instead of `final`, etc. Real world libraries can be 
> updated. That's what we already did everywhere in C++ mode. No reason it 
> can't happen in C mode too.

This is a red herring. The feature we have is a comment that disables a 
diagnostic and has no semantics. You are equating that to features with 
semantic requirements like `override` or `final`. I don't think that's a 
particularly compelling argument.

> The usual progression is:
> 
> - compiler-specific extensions (we now have `__attribute__((fallthrough))` 
> attached to an empty statement)
> - eventually, if it has legs, standardization
> 
>   This disrupts this path.

Fair points. We also add features to Clang that exist in GCC and solve real 
problems as part of the usual progression.

>>> In addition to this making comments have semantic meaning, the meaning is 
>>> different from gcc.
>> 
>> We're covering the cases GCC does that make sense within Clang -- or have we 
>> deviated from GCC in a way that is significant to our users?
> 
> We give a not-well-specified and not documented subset of comments some 
> meaning. We do this in a way that's different from GCC.

We can (and should!) fix up the documentation to make this more obvious. I am 
still not convinced we deviate from GCC in a meaningful way, but if it would 
make you more comfortable if we exactly match the GCC behavior identically, 
that seems reasonable.

> Also, as mentioned above, as-is I'd expect this patch to make builds 
> measurably slower. That alone is revert reason enough.

As mentioned above, the author did the timing measurements at reviewer request 
and it did not make it measurably slower. If we have evidence that this really 
does add a sufficient performance regression, I totally agree that we should 
revert (I had the same worries). Thus far, no one has provided actual evidence 
that this is the case and I would not want to see a feature rejected on the 
hunch that it might be a performance regression.

All this said, I am comfortable reverting this back out of the 10.0 branch 
while we consider it harder. It does not seem so critical that we can't take 
time to discuss it further.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D73720: [Analyzer] Use note tags to track container begin and and changes

2020-02-12 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus accepted this revision.
Szelethus added a comment.
This revision is now accepted and ready to land.

LGTM, I like everything here, you worded the notes very nicely and the test 
cases seems to cover everything I could find! Please wait for @NoQ's approval, 
since he's the ranking member of  among the `NoteTag` users.

In D73720#1871975 , 
@baloghadamsoftware wrote:

> In D73720#1871955 , @Szelethus wrote:
>
> > Do we have a test where 2 containers are present but only one of them 
> > should be marked as interesting?
>
>
> Yes, of course we have, that was the starting point of the discussion. 
> However, I try to make the tests orthogonal, so this test is in 
> `container-modeling.cpp` where we do not dereference it, but print its begin 
> or end.


Yea, right, silly me.


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

https://reviews.llvm.org/D73720



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D73852#1872104 , @aaron.ballman 
wrote:

> All this said, I am comfortable reverting this back out of the 10.0 branch 
> while we consider it harder. It does not seem so critical that we can't take 
> time to discuss it further.


Ah, this may not be in the 10.0 branch yet anyway. I mostly would prefer to 
avoid churn where we put it in, pull it out, and put it back in, if there's a 
way to salvage the feature by addressing issues post-commit as we typically do. 
Obviously, if there's sufficient justification to pull it out and not put it 
back in, that's the solution we should pick.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[clang] 271e495 - [Concepts] Add missing TPA commit to requires expression parsing

2020-02-12 Thread Saar Raz via cfe-commits

Author: Saar Raz
Date: 2020-02-12T16:26:34+02:00
New Revision: 271e495399170d69627c1acd591c9298cb0b5b4b

URL: 
https://github.com/llvm/llvm-project/commit/271e495399170d69627c1acd591c9298cb0b5b4b
DIFF: 
https://github.com/llvm/llvm-project/commit/271e495399170d69627c1acd591c9298cb0b5b4b.diff

LOG: [Concepts] Add missing TPA commit to requires expression parsing

If an error had occurred when annotating a scope spec during the tentative parse
for a type-requirement, we would not revert nor commit the tentative parse, 
triggerring
an assertion failure.

Commit the TPA in this case and then do error recovery.

Added: 


Modified: 
clang/lib/Parse/ParseExprCXX.cpp

Removed: 




diff  --git a/clang/lib/Parse/ParseExprCXX.cpp 
b/clang/lib/Parse/ParseExprCXX.cpp
index 617c2917d8ad..550bf7045425 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -3486,6 +3486,7 @@ ExprResult Parser::ParseRequiresExpression() {
   // We need to consume the typename to allow 'requires { typename a; 
}'
   SourceLocation TypenameKWLoc = ConsumeToken();
   if (TryAnnotateCXXScopeToken()) {
+TPA.Commit();
 SkipUntil(tok::semi, tok::r_brace, 
SkipUntilFlags::StopBeforeMatch);
 break;
   }



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


[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

I think that this patch is needed since we need to deal with this situation 
somehow because fallthru comments are used in many real world code.

But I am personally against extending it more and use comments to disable 
warnings generally.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added a comment.

In D74447#1872043 , @thakis wrote:

> Isn't a better approach to only do in-process cc1 if there's just one TU?


One of the reasons of the in-process cc1 was the debuggability. If we can 
compile several TUs in-process, why not doing it?

As for build times, we found that even with the clean up, in-process+clean-up 
is faster than out-of-process+disable-free. That is, on Windows and in the 
context of the `llvm-buildozer` app I've presented at the LLVM conf., where all 
the TUs for a project are compiled in the same process (meaning there's a clean 
up after each TU).

Any other issues you were seeing with this current approach?


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

https://reviews.llvm.org/D74447



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


[PATCH] D74483: [AArch64] Add Cortex-A34 Support for clang and llvm

2020-02-12 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer accepted this revision.
SjoerdMeijer added a comment.
This revision is now accepted and ready to land.

Looks like the usual business of adding a cpu to me, with one nit inlined that 
can be fixed before committing.

Looks like you're doing the LLVM part separately. Now with the monorepo you 
could have conveniently done it in one patch, but nothing wrong with doing it 
separately.  You could have linked to the llvm part here if that is ready, 
which would be nice to get an overview.




Comment at: llvm/unittests/Support/TargetParserTest.cpp:784
   EXPECT_TRUE(testAArch64CPU(
+  "cortex-a34", "armv8-a", "crypto-neon-fp-armv8",
+  AArch64::AEK_CRC | AArch64::AEK_SIMD |

nit: this looks the same as the a35. Would be better to keep the same order of 
arch extension and also the formatting (to make it easier to eyeball 
differences).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74483



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


Re: [PATCH] D73904: [clang] stop baremetal driver to append .a to lib

2020-02-12 Thread Jon Roelofs via cfe-commits
> I'm also not sure if `-L` is a feature that is relied upon at the moment
by anybody that uses the baremetal driver

Unlikely, IMO. There aren’t that many users of this stuff yet, and it’s
still quite rough around the edges in comparison to the GNU toolchain.
Also, the compiler support libraries really should be bundled with the
compiler, and not dumped in the sysroot or otherwise, which motivates
passing exact paths for this as well.

re: the -march= stuff: I thought I had added selection logic in the driver
for that 🤔. Perhaps that never got upstreamed.


Cheers,

Jon

On Wed, Feb 12, 2020 at 4:28 AM Christof Douma via Phabricator <
revi...@reviews.llvm.org> wrote:

> christof added a comment.
>
> The function @MaskRay suggested does not address the problem with
> `-march=` and others, but it does sound good to use that function. I'm also
> not sure if `-L` is a feature that is relied upon at the moment by anybody
> that uses the baremetal driver. For the moment I'll commit this patch, but
> a single place across drivers that handles the compiler_rt selection
> mechanism certainly sounds nice.
>
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D73904/new/
>
> https://reviews.llvm.org/D73904
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

I'd think that everyone debugging clang always passes a single TU to it, so I'm 
not sure debuggability does much here :)

The `-disable-free` code has never been used in normal compilations, so we 
didn't have to worry about this path. This patch here brings us to 3 modes 
(in-process cc1 with and without disable-free, out-of-process cc1). My 
suggestion keeps us to two modes (in-process cc1, out-of-process cc1).


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

https://reviews.llvm.org/D74447



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


[PATCH] D74483: [AArch64] Add Cortex-A34 Support for clang and llvm

2020-02-12 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

Ah, sorry, looks like this is all there is to it, both clang and llvm. It's 
just that a quick grep locally (for a similar core) showed some more results.

Can you (double) check if it needs adding to e.g. a switch in 
`llvm/lib/Support/Host.cpp`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74483



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


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

The performance benefit of disable-free is still valuable, I'd not want to make 
every TU pay the price for a multiple TU invocation. Additionally, if we're 
willing to put up with the 3rd form (which i think is worth it), the multiple 
TU case cleaning up on all but the last makes sense.


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

https://reviews.llvm.org/D74447



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


[PATCH] D72872: [ObjC generics] Fix not inheriting type bounds in categories/extensions.

2020-02-12 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

In D72872#1870256 , @vsapsai wrote:

> In D72872#1868989 , @hans wrote:
>
> > I don't have the context here. Was I added as a subscriber because it's 
> > related to the clang 10 release?
>
>
> It's not related to clang 10 release. I've added you because earlier you've 
> found a problem with a previous approach 
> https://github.com/llvm/llvm-project/commit/4c539e8da1b3de38a53ef3f7497f5c45a3243b61
>  So in case it breaks something else, you have extra visibility into the 
> change.


Thanks! I applied the patch and was able to build large parts of Chromium 
without any problems.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72872



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


[PATCH] D74384: Use std::foo_t rather than std::foo in LLVM.

2020-02-12 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Looks like this broke building on windows with clang-cl as host compiler in 
some situations: http://45.33.8.238/win/8160/step_4.txt

I'm not sure if that's a bug in the version of the host clang I'm using yet. 
I'll poke around a bit and let you know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74384



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


[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 2 inline comments as done.
martong added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:571
+.Case(
+{ReturnValueCondition(WithinRange, {{EOFv, EOFv}, {0, 
UCharMax}})});
   };

Szelethus wrote:
> Huh, what's happening here exactly? Doesn't `Range` take 2 `RangeInt`s as 
> ctor arguments? What does `{EOFv, EOFv}, {0, UCharMax}` mean in this context?
`Range` is a convenience function that creates a `IntRangeVector` from the two 
params. This way we can easily create a list of ranges from two ints. Range(-1, 
255) results a list of ranges with one list: {{-1, 255}}.
Now, because EOF's value can be less than the minimum value of the next range 
we have to explicitly enlist the ranges.
E.g. if EOF is -2 then we will have a list of {-2,-2} and {0, 255}.



Comment at: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp:114-117
+  const auto MacroIt = llvm::find_if(
+  PP.macros(), [&](const auto &K) { return K.first->getName() == Macro; });
+  if (MacroIt == PP.macro_end())
+return llvm::None;

Szelethus wrote:
> This seems a bit clunky even for the `Preprocessor` -- how about
> 
> ```lang=c++
> const auto *MacroII = PP.getIdentifierInfo(Macro);
> if (!MacroII)
>   return;
> const MacroInfo *MI = PP.getMacroInfo(MacroII);
> assert(MI);
> ```
Ok, but we cannot assert on `MI`, because there may be cases when the macro is 
not defined in a TU. In that case we should just return with None.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473



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


[PATCH] D74473: [analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

2020-02-12 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 244173.
martong marked 6 inline comments as done.
martong added a comment.

- Move include of Preprocessor.h to CheckerHelpers.cpp
- Try -> try
- Use PP.getIdentifierInfo
- Handle parens in tryExpandAsInteger


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74473

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
  clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
  clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
  clang/test/Analysis/std-c-library-functions-eof.c

Index: clang/test/Analysis/std-c-library-functions-eof.c
===
--- /dev/null
+++ clang/test/Analysis/std-c-library-functions-eof.c
@@ -0,0 +1,26 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=apiModeling.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
+
+void clang_analyzer_eval(int);
+
+typedef struct FILE FILE;
+// Unorthodox EOF value.
+#define EOF (-2)
+
+int getc(FILE *);
+void test_getc(FILE *fp) {
+
+  int x;
+  while ((x = getc(fp)) != EOF) {
+clang_analyzer_eval(x > 255); // expected-warning{{FALSE}}
+clang_analyzer_eval(x >= 0); // expected-warning{{TRUE}}
+  }
+
+  int y = getc(fp);
+  if (y < 0) {
+clang_analyzer_eval(y == -2); // expected-warning{{TRUE}}
+  }
+}
Index: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
===
--- clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
+++ clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
@@ -13,6 +13,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/Expr.h"
+#include "clang/Lex/Preprocessor.h"
 
 namespace clang {
 
@@ -109,6 +110,45 @@
   return Nullability::Unspecified;
 }
 
+llvm::Optional tryExpandAsInteger(StringRef Macro,
+   const Preprocessor &PP) {
+  const auto *MacroII = PP.getIdentifierInfo(Macro);
+  if (!MacroII)
+return llvm::None;
+  const MacroInfo *MI = PP.getMacroInfo(MacroII);
+  if (!MI)
+return llvm::None;
+
+  // Filter out parens.
+  std::vector FilteredTokens;
+  FilteredTokens.reserve(MI->tokens().size());
+  for (auto &T : MI->tokens())
+if (!T.isOneOf(tok::l_paren, tok::r_paren))
+  FilteredTokens.push_back(T);
+
+  if (FilteredTokens.size() > 2)
+return llvm::None;
+
+  // Parse an integer at the end of the macro definition.
+  const Token &T = FilteredTokens.back();
+  if (!T.isLiteral())
+return llvm::None;
+  StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength());
+  llvm::APInt IntValue;
+  constexpr unsigned AutoSenseRadix = 0;
+  if (ValueStr.getAsInteger(AutoSenseRadix, IntValue))
+return llvm::None;
+
+  // Parse an optional minus sign.
+  if (FilteredTokens.size() == 2) {
+if (FilteredTokens.front().is(tok::minus))
+  IntValue = -IntValue;
+else
+  return llvm::None;
+  }
+
+  return IntValue.getSExtValue();
+}
 
-} // end namespace ento
-} // end namespace clang
+} // namespace ento
+} // namespace clang
Index: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -55,6 +55,7 @@
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 
 using namespace clang;
 using namespace clang::ento;
@@ -241,7 +242,7 @@
 const CallExpr *CE,
 CheckerContext &C) const;
 
-  void initFunctionSummaries(BasicValueFactory &BVF) const;
+  void initFunctionSummaries(CheckerContext &C) const;
 };
 } // end of anonymous namespace
 
@@ -312,10 +313,11 @@
 for (size_t I = 1; I != E; ++I) {
   const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T);
   const llvm::APSInt &Ma

[clang] abd0905 - Revert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on""

2020-02-12 Thread Melanie Blower via cfe-commits

Author: Melanie Blower
Date: 2020-02-12T07:30:43-08:00
New Revision: abd09053bc7aa6144873c196a7d50aa6ce6ca430

URL: 
https://github.com/llvm/llvm-project/commit/abd09053bc7aa6144873c196a7d50aa6ce6ca430
DIFF: 
https://github.com/llvm/llvm-project/commit/abd09053bc7aa6144873c196a7d50aa6ce6ca430.diff

LOG: Revert "Revert "Change clang option -ffp-model=precise to select 
ffp-contract=on""

This reverts commit 99c5bcbce89f07e68ccd89891a0300346705d013.
Change clang option -ffp-model=precise to select ffp-contract=on
Including some small touch-ups to the original commit

Reviewers: rjmccall, Andy Kaylor

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

Added: 


Modified: 
clang/docs/UsersManual.rst
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/ppc-emmintrin.c
clang/test/CodeGen/ppc-xmmintrin.c
clang/test/Driver/fp-model.c

Removed: 




diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 856d5e34bbcc..6c8c9f802082 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -1190,8 +1190,50 @@ installed.
 Controlling Floating Point Behavior
 ---
 
-Clang provides a number of ways to control floating point behavior. The options
-are listed below.
+Clang provides a number of ways to control floating point behavior, including
+with command line options and source pragmas. This section
+describes the various floating point semantic modes and the corresponding 
options.
+
+.. csv-table:: Floating Point Semantic Modes
+  :header: "Mode", "Values"
+  :widths: 15, 30, 30
+
+  "except_behavior", "{ignore, strict, may_trap}", "ffp-exception-behavior"
+  "fenv_access", "{off, on}", "(none)"
+  "rounding_mode", "{dynamic, tonearest, downward, upward, towardzero}", 
"frounding-math"
+  "contract", "{on, off, fast}", "ffp-contract"
+  "denormal_fp_math", "{IEEE, PreserveSign, PositiveZero}", "fdenormal-fp-math"
+  "denormal_fp32_math", "{IEEE, PreserveSign, PositiveZero}", 
"fdenormal-fp-math-fp32"
+  "support_math_errno", "{on, off}", "fmath-errno"
+  "no_honor_nans", "{on, off}", "fhonor-nans"
+  "no_honor_infinities", "{on, off}", "fhonor-infinities"
+  "no_signed_zeros", "{on, off}", "fsigned-zeros"
+  "allow_reciprocal", "{on, off}", "freciprocal-math"
+  "allow_approximate_fns", "{on, off}", "(none)"
+  "allow_reassociation", "{on, off}", "fassociative-math"
+
+
+This table describes the option settings that correspond to the three
+floating point semantic models: precise (the default), strict, and fast.
+
+
+.. csv-table:: Floating Point Models
+  :header: "Mode", "Precise", "Strict", "Fast"
+  :widths: 25, 15, 15, 15
+
+  "except_behavior", "ignore", "strict", "ignore"
+  "fenv_access", "off", "on", "off"
+  "rounding_mode", "tonearest", "dynamic", "tonearest"
+  "contract", "on", "off", "fast"
+  "denormal_fp_math", "IEEE", "IEEE", "PreserveSign"
+  "denormal_fp32_math", "IEEE","IEEE", "PreserveSign"
+  "support_math_errno", "on", "on", "off"
+  "no_honor_nans", "off", "off", "on"
+  "no_honor_infinities", "off", "off", "on"
+  "no_signed_zeros", "off", "off", "on"
+  "allow_reciprocal", "off", "off", "on"
+  "allow_approximate_fns", "off", "off", "on"
+  "allow_reassociation", "off", "off", "on"
 
 .. option:: -ffast-math
 
@@ -1385,7 +1427,7 @@ Note that floating-point operations performed as part of 
constant initialization
and ``fast``.
Details:
 
-   * ``precise`` Disables optimizations that are not value-safe on 
floating-point data, although FP contraction (FMA) is enabled 
(``-ffp-contract=fast``).  This is the default behavior.
+   * ``precise`` Disables optimizations that are not value-safe on 
floating-point data, although FP contraction (FMA) is enabled 
(``-ffp-contract=on``).  This is the default behavior.
* ``strict`` Enables ``-frounding-math`` and 
``-ffp-exception-behavior=strict``, and disables contractions (FMA).  All of 
the ``-ffast-math`` enablements are disabled.
* ``fast`` Behaves identically to specifying both ``-ffast-math`` and 
``ffp-contract=fast``
 

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 4424d8e6f72c..a11a5423b0b9 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2525,10 +2525,9 @@ static void RenderFloatingPointOptions(const ToolChain 
&TC, const Driver &D,
 
   llvm::DenormalMode DenormalFPMath = DefaultDenormalFPMath;
   llvm::DenormalMode DenormalFP32Math = DefaultDenormalFP32Math;
-  StringRef FPContract = "";
+  StringRef FPContract = "on";
   bool StrictFPModel = false;
 
-
   if (const Arg *A = Args.getLastArg(options::OPT_flimited_precision_EQ)) {
 CmdArgs.push_back("-mlimit-float-precision");
 CmdArgs.push_back(A->getValue());
@@ -2551,7 +2550,6 @@ static void RenderFloatingPointOptions(const ToolChain 
&TC, const Driver &D,
   SignedZeros = true

[PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-12 Thread Melanie Blower via Phabricator via cfe-commits
mibintc marked 2 inline comments as done.
mibintc added a comment.

some replies to Andy. I'll upload another patch here which passed check-all 
locally. then i'll re-commit it.




Comment at: clang/docs/UsersManual.rst:1388
 
-   * ``precise`` Disables optimizations that are not value-safe on 
floating-point data, although FP contraction (FMA) is enabled 
(``-ffp-contract=fast``).  This is the default behavior.
* ``strict`` Enables ``-frounding-math`` and 
``-ffp-exception-behavior=strict``, and disables contractions (FMA).  All of 
the ``-ffast-math`` enablements are disabled.

lebedev.ri wrote:
> I'm confused. Where in this patch the `This patch establishes the default 
> option for -ffp-model to select "precise".` happens? LHS of diff says it is 
> already default
yes you're right. sorry for the confusion.  i changed the title and description



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:2661
 // the FPContract value has already been set to a string literal
 // and the Val string isn't a pertinent value.
 ;

andrew.w.kaylor wrote:
> Does this mean that "-ffp-model=precise -ffp-contract=off" will leave FP 
> contraction on? That doesn't seem right.
No.  When -ffp-model=precise is on the command line, we end up here because the 
code above changes optID to ffp_contract, and sets FPContract to "on". The Val 
string will be "precise", and it shouldn't be checked. I'll change the comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436



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


[PATCH] D74436: Change clang option -ffp-model=precise to select ffp-contract=on

2020-02-12 Thread Melanie Blower via Phabricator via cfe-commits
mibintc updated this revision to Diff 244178.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74436

Files:
  clang/docs/UsersManual.rst
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/ppc-emmintrin.c
  clang/test/CodeGen/ppc-xmmintrin.c
  clang/test/Driver/fp-model.c

Index: clang/test/Driver/fp-model.c
===
--- clang/test/Driver/fp-model.c
+++ clang/test/Driver/fp-model.c
@@ -27,9 +27,9 @@
 // RUN:   | FileCheck --check-prefix=WARN5 %s
 // WARN5: warning: overriding '-ffp-model=strict' option with '-ffp-contract=fast' [-Woverriding-t-option]
 
-// RUN: %clang -### -ffp-model=strict -ffp-contract=off -c %s 2>&1 \
+// RUN: %clang -### -ffp-model=strict -ffp-contract=fast -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN6 %s
-// WARN6: warning: overriding '-ffp-model=strict' option with '-ffp-contract=off' [-Woverriding-t-option]
+// WARN6: warning: overriding '-ffp-model=strict' option with '-ffp-contract=fast' [-Woverriding-t-option]
 
 // RUN: %clang -### -ffp-model=strict -ffp-contract=on -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN7 %s
@@ -100,13 +100,14 @@
 // RUN: %clang -### -nostdinc -ffp-model=precise -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FPM-PRECISE %s
 // CHECK-FPM-PRECISE: "-cc1"
-// CHECK-FPM-PRECISE: "-ffp-contract=fast"
+// CHECK-FPM-PRECISE: "-ffp-contract=on"
 // CHECK-FPM-PRECISE: "-fno-rounding-math"
 
 // RUN: %clang -### -nostdinc -ffp-model=strict -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-FPM-STRICT %s
 // CHECK-FPM-STRICT: "-cc1"
 // CHECK-FPM-STRICT: "-ftrapping-math"
+// CHECK-FPM-STRICT: "-ffp-contract=off"
 // CHECK-FPM-STRICT: "-frounding-math"
 // CHECK-FPM-STRICT: "-ffp-exception-behavior=strict"
 
Index: clang/test/CodeGen/ppc-xmmintrin.c
===
--- clang/test/CodeGen/ppc-xmmintrin.c
+++ clang/test/CodeGen/ppc-xmmintrin.c
@@ -2,9 +2,9 @@
 // REQUIRES: powerpc-registered-target
 
 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
-// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
+// RUN:   -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
-// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN:   -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
 
 #include 
 
Index: clang/test/CodeGen/ppc-emmintrin.c
===
--- clang/test/CodeGen/ppc-emmintrin.c
+++ clang/test/CodeGen/ppc-emmintrin.c
@@ -2,9 +2,9 @@
 // REQUIRES: powerpc-registered-target
 
 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
-// RUN:  -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
+// RUN:  -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
-// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN:   -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
 
 // CHECK-BE-DAG: @_mm_movemask_pd.perm_mask = internal constant <4 x i32> , align 16
 // CHECK-BE-DAG: @_mm_shuffle_epi32.permute_selectors = internal constant [4 x i32] [i32 66051, i32 67438087, i32 134810123, i32 202182159], align 4
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2525,10 +2525,9 @@
 
   llvm::DenormalMode DenormalFPMath = DefaultDenormalFPMath;
   llvm::DenormalMode DenormalFP32Math = DefaultDenormalFP32Math;
-  StringRef FPContract = "";
+  StringRef FPContract = "on";
   bool StrictFPModel = false;
 
-
   if (const Arg *A = Args.getLastArg(options::OPT_flimited_precision_EQ)) {
 CmdArgs.push_back("-mlimit-float-precision");
 CmdArgs.push_back(A->getValue());
@@ -2551,7 +2550,6 @@
   SignedZeros = true;
   // -fno_fast_math restores default denormal and fpcontract handling
   Denormal

[PATCH] D74385: [ARCMT][NFC] Reduce #include dependencies

2020-02-12 Thread serge via Phabricator via cfe-commits
serge-sans-paille added a comment.

In D74385#1869876 , @nicolas17 wrote:

> I don't have commit access, can someone push this for me?


Sure, can you just confirm that you're this guy: https://github.com/nicolas17 
(I need that for proper email attribution)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74385



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


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea updated this revision to Diff 244172.
aganea marked 7 inline comments as done.
aganea added a comment.

Address @hans' comments.

While it'd be good to have a bot running without `-disable-free`, I concur with 
@thakis. This patch will probably introduce too much (untested) variability for 
release 10.0, if merged.
Let's enable `integrate-cc1` just for one TU for the 10.0, and then we'll see 
if we want to land this patch or not in the trunk for the 11.0.
I'll open another review.


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

https://reviews.llvm.org/D74447

Files:
  clang/include/clang/Driver/Job.h
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/Job.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/cc1-spawnprocess.c
  clang/tools/driver/cc1_main.cpp

Index: clang/tools/driver/cc1_main.cpp
===
--- clang/tools/driver/cc1_main.cpp
+++ clang/tools/driver/cc1_main.cpp
@@ -259,6 +259,7 @@
   // FIXME(ibiryukov): make profilerOutput flush in destructor instead.
   profilerOutput->flush();
   llvm::timeTraceProfilerCleanup();
+  Clang->clearOutputFiles(false);
 }
   }
 
Index: clang/test/Driver/cc1-spawnprocess.c
===
--- clang/test/Driver/cc1-spawnprocess.c
+++ clang/test/Driver/cc1-spawnprocess.c
@@ -20,3 +20,48 @@
 
 // YES: (in-process)
 // NO-NOT: (in-process)
+
+// The following tests ensure that only the last integrated-cc1 has -disable-free
+
+// RUN: echo 'int main() { return f() + g(); }' > %t1.cpp
+// RUN: echo 'int f() { return 1; }' > %t2.cpp
+// RUN: echo 'int g() { return 2; }' > %t3.cpp
+
+// Only one TU, one job, thus no cleanup is needed.
+// RUN: %clang -fintegrated-cc1 -c %t1.cpp -### 2>&1 | FileCheck %s --check-prefix=CLEAN
+// CLEAN: cc1
+// CLEAN-SAME: -disable-free
+
+// Three jobs, only the last invocation will skip clean up.
+// RUN: %clang -fintegrated-cc1 -c %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=NOCLEAN-LAST
+// NOCLEAN-LAST: cc1
+// NOCLEAN-LAST-NOT: -disable-free
+// NOCLEAN-LAST-SAME: {{.*}}1.cpp
+// NOCLEAN-LAST: cc1
+// NOCLEAN-LAST-NOT: -disable-free
+// NOCLEAN-LAST-SAME: {{.*}}2.cpp
+// NOCLEAN-LAST: cc1
+// NOCLEAN-LAST-SAME: -disable-free
+// NOCLEAN-LAST-SAME: {{.*}}3.cpp
+
+// Four jobs, no invocation will skip clean up because the last job is linking.
+// RUN: %clang -fintegrated-cc1 %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=ALL
+// ALL-NOT: -disable-free
+
+// In no-integrated-cc1 mode, no cleanup is needed, because we're running the
+// CC1 tool in a secondary process and the process' heap will be released
+// anyway when the process ends.
+// RUN: %clang -fno-integrated-cc1 -c %t1.cpp -### 2>&1 | FileCheck %s --check-prefix=CLEAN
+
+// RUN: %clang -fno-integrated-cc1 -c %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=CLEANALL
+// CLEANALL: cc1
+// CLEANALL-SAME: -disable-free
+// CLEANALL-SAME: {{.*}}1.cpp
+// CLEANALL: cc1
+// CLEANALL-SAME: -disable-free
+// CLEANALL-SAME: {{.*}}2.cpp
+// CLEANALL: cc1
+// CLEANALL-SAME: -disable-free
+// CLEANALL-SAME: {{.*}}3.cpp
+
+// RUN: %clang -fno-integrated-cc1 %t1.cpp %t2.cpp %t3.cpp -### 2>&1 | FileCheck %s --check-prefix=CLEANALL
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6148,7 +6148,7 @@
   if (Output.getType() == types::TY_Object &&
   Args.hasFlag(options::OPT__SLASH_showFilenames,
options::OPT__SLASH_showFilenames_, false)) {
-C.getJobs().getJobs().back()->setPrintInputFilenames(true);
+C.getJobs().getJobs().back()->PrintInputFilenames = true;
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_pg))
Index: clang/lib/Driver/Job.cpp
===
--- clang/lib/Driver/Job.cpp
+++ clang/lib/Driver/Job.cpp
@@ -40,7 +40,7 @@
  const llvm::opt::ArgStringList &Arguments,
  ArrayRef Inputs)
 : Source(Source), Creator(Creator), Executable(Executable),
-  Arguments(Arguments) {
+  Arguments(Arguments), PrintInputFilenames(false), InProcess(false) {
   for (const auto &II : Inputs)
 if (II.isFilename())
   InputFilenames.push_back(II.getFilename());
@@ -315,6 +315,15 @@
   Environment.push_back(nullptr);
 }
 
+// In some cases when running the calling process, we need to clean up if there
+// are other Commands being executed after us, to prevent bloating the heap.
+void Command::enableFree() {
+  auto RemoveDisableFree = [](const char *A) {
+return StringRef(A).equals("-disable-free");
+  };
+  llvm::erase_if(Arguments, RemoveDisableFree);
+}
+
 void Command::PrintFileNames() const {
   if (PrintInputFilenames) {
 for (const char *Arg : InputFilenames)
@@ -371,6 +380,14 @@
   

[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

2020-02-12 Thread Luboš Luňák via Phabricator via cfe-commits
llunak marked an inline comment as done.
llunak added a comment.

In D73852#1872013 , @lebedev.ri wrote:

> This patch also omitted cfe-commits lists.


That is a Phabricator problem. 
https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface
 says to select 'Clang' as the repository, but after the monorepo switch that 
repository no longer exists and Phabricator says 'Inactive' for it. So I 
(presumably, I don't remember) selected the monorepo and tagged the issue with 
'Clang'. If it's still required to use 'Clang' as the repository, then it 
shouldn't be marked as inactive, or alternatively cfe-commits should be added 
on the 'Clang' tag.




Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:1239
+  llvm::Regex("(/\\*[ \\t]*fall(s | |-)?thr(ough|u)\\.?[ 
\\t]*\\*/)"
+  "|(//[ \\t]*fall(s | |-)?thr(ough|u)\\.?[ \\t]*)",
+  llvm::Regex::IgnoreCase);

aaron.ballman wrote:
> thakis wrote:
> > Also, this adds a regex match for every comment line, yes? Isn't this 
> > terrible for build performance? Did you do any benchmarking of this?
> https://reviews.llvm.org/D73852#inline-671309
As said above, it's on-demand, and in code without unannotated fallthough it'll 
be triggered exactly zero times.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73852



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


[PATCH] D74468: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

2020-02-12 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp:14
+template
+constexpr T pi = T(3.1415926L);

gribozavr2 wrote:
> I would prefer if you could make the test compatible with all language modes 
> after C++11. You can do it by wrapping the variable template in `#if`s on the 
> `__cplusplus` macro that contains the language version.
I'd prefer keep it as it-is. using `__cplusplus` seems a bit hacky to me, and I 
think it only works for non-CHECK-MESSAGES cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74468



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


[PATCH] D74468: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

2020-02-12 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 244184.
hokein marked 2 inline comments as done.
hokein added a comment.

Address review comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74468

Files:
  clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
  clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;


Index: clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74447: [Clang] After integrated-cc1, ignore -disable-free when there are more than one job in the queue

2020-02-12 Thread Alexandre Ganea via Phabricator via cfe-commits
aganea added inline comments.



Comment at: clang/include/clang/Driver/Job.h:90
+  /// Whether the command will be executed in this process or not.
+  bool InProcess : 1;
+

hans wrote:
> I think Reid just meant put the bool fields after each other to minimize 
> padding. Using bitfields is taking it one step further. I think in LLVM we 
> generally use "unsigned" for bitfield types, but I'm not sure using bitfields 
> at all is worth it here.
Reid said "pack" and "field" and my Pavlovian reflex made me think "bitfields". 
Yes, plain bools are just fine.



Comment at: clang/include/clang/Driver/Job.h:134
 
-  /// Set whether to print the input filenames when executing.
-  void setPrintInputFilenames(bool P) { PrintInputFilenames = P; }
+  /// Prevent burying pointers, and ensure we free everything after execution.
+  void forceCleanUp();

hans wrote:
> I hadn't heard the term "burying pointers" before, and the name is also 
> pretty broad: "clean up" could refer to a lot more than just freeing memory.
> 
> Maybe "enableFree()" or something would be a better name?
"burying", as in 
https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/Support/BuryPointer.h

Changed the comment and the function to `enableFree()`.




Comment at: clang/lib/Driver/Job.cpp:325
+  llvm::erase_if(Arguments, RemoveDisableFree);
+}
+

hans wrote:
> I wish it were possible to avoid adding the -disable-free flag to 
> in-process-cc1 jobs in the first place, but I guess maybe that's not 
> practical.
That was my original intent, but the `-disable-free` flag is added by 
`Clang::ConstructJob()` and at that point we don't know yet how many jobs we 
will have, nor their nature.


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

https://reviews.llvm.org/D74447



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


[clang-tools-extra] a45ca67 - [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

2020-02-12 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2020-02-12T16:56:31+01:00
New Revision: a45ca670f5c43253d71018814d1e00443726f23a

URL: 
https://github.com/llvm/llvm-project/commit/a45ca670f5c43253d71018814d1e00443726f23a
DIFF: 
https://github.com/llvm/llvm-project/commit/a45ca670f5c43253d71018814d1e00443726f23a.diff

LOG: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable 
templates.

Reviewers: gribozavr2

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst

clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp 
b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
index 1d41edd2083e..7ff6c0d20f63 100644
--- a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@ void DefinitionsInHeadersCheck::check(const 
MatchFinder::MatchResult &Result) {
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;

diff  --git 
a/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst 
b/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
index 1b6c2cd34438..235e5cd2306d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@ from multiple translation units.
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
index 79fb7bc0bd8a..fd02998a53d5 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@ inline int i = 5; // OK: inline variable definition.
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);



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


[clang] 665dcda - Add missing newlines at EOF; NFC

2020-02-12 Thread Sven van Haastregt via cfe-commits

Author: Sven van Haastregt
Date: 2020-02-12T15:57:25Z
New Revision: 665dcdacc06b056c3279a1fccbcae4660d80f117

URL: 
https://github.com/llvm/llvm-project/commit/665dcdacc06b056c3279a1fccbcae4660d80f117
DIFF: 
https://github.com/llvm/llvm-project/commit/665dcdacc06b056c3279a1fccbcae4660d80f117.diff

LOG: Add missing newlines at EOF; NFC

Added: 


Modified: 
clang/include/clang/AST/ASTConcept.h
clang/include/clang/AST/ExprConcepts.h
clang/lib/AST/DeclTemplate.cpp
clang/lib/DirectoryWatcher/DirectoryScanner.cpp
clang/lib/DirectoryWatcher/DirectoryScanner.h
clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
clang/tools/libclang/FatalErrorHandler.cpp
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeUDT.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
llvm/lib/DebugInfo/PDB/Native/EnumTables.cpp
llvm/lib/DebugInfo/PDB/Native/NativeTypeArray.cpp
llvm/lib/IR/FPEnv.cpp
llvm/lib/Transforms/CFGuard/CFGuard.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTConcept.h 
b/clang/include/clang/AST/ASTConcept.h
index 3ebaad4eafdd..71bf14a87865 100644
--- a/clang/include/clang/AST/ASTConcept.h
+++ b/clang/include/clang/AST/ASTConcept.h
@@ -193,4 +193,4 @@ class TypeConstraint : public ConceptReference {
 
 } // clang
 
-#endif // LLVM_CLANG_AST_ASTCONCEPT_H
\ No newline at end of file
+#endif // LLVM_CLANG_AST_ASTCONCEPT_H

diff  --git a/clang/include/clang/AST/ExprConcepts.h 
b/clang/include/clang/AST/ExprConcepts.h
index 271d487e2fc9..6137e0e4082b 100644
--- a/clang/include/clang/AST/ExprConcepts.h
+++ b/clang/include/clang/AST/ExprConcepts.h
@@ -550,4 +550,4 @@ class RequiresExpr final : public Expr,
 
 } // namespace clang
 
-#endif // LLVM_CLANG_AST_EXPRCONCEPTS_H
\ No newline at end of file
+#endif // LLVM_CLANG_AST_EXPRCONCEPTS_H

diff  --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index b5e4ec2d7f43..e5b90e577f64 100755
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -1430,4 +1430,4 @@ void TypeConstraint::print(llvm::raw_ostream &OS, 
PrintingPolicy Policy) const {
   ArgLoc.getArgument().print(Policy, OS);
 OS << ">";
   }
-}
\ No newline at end of file
+}

diff  --git a/clang/lib/DirectoryWatcher/DirectoryScanner.cpp 
b/clang/lib/DirectoryWatcher/DirectoryScanner.cpp
index ecfec52f459e..1bc286236a0e 100644
--- a/clang/lib/DirectoryWatcher/DirectoryScanner.cpp
+++ b/clang/lib/DirectoryWatcher/DirectoryScanner.cpp
@@ -51,4 +51,4 @@ getAsFileEvents(const std::vector &Scan) {
   return Events;
 }
 
-} // namespace clang
\ No newline at end of file
+} // namespace clang

diff  --git a/clang/lib/DirectoryWatcher/DirectoryScanner.h 
b/clang/lib/DirectoryWatcher/DirectoryScanner.h
index 55731225e251..feb8b4ea861e 100644
--- a/clang/lib/DirectoryWatcher/DirectoryScanner.h
+++ b/clang/lib/DirectoryWatcher/DirectoryScanner.h
@@ -26,4 +26,4 @@ getAsFileEvents(const std::vector &Scan);
 /// \returns llvm::None if \p Path doesn't exist or can't get the status.
 llvm::Optional getFileStatus(llvm::StringRef Path);
 
-} // namespace clang
\ No newline at end of file
+} // namespace clang

diff  --git 
a/clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp 
b/clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
index 200e540624a6..bc410822d7ae 100644
--- a/clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
+++ b/clang/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp
@@ -18,4 +18,4 @@ llvm::Expected> 
clang::DirectoryWatcher::creat
   return llvm::make_error(
   "DirectoryWatcher is not implemented for this platform!",
   llvm::inconvertibleErrorCode());
-}
\ No newline at end of file
+}

diff  --git a/clang/tools/libclang/FatalErrorHandler.cpp 
b/clang/tools/libclang/FatalErrorHandler.cpp
index eab17f3dfac7..6b435fcfcc95 100644
--- a/clang/tools/libclang/FatalErrorHandler.cpp
+++ b/clang/tools/libclang/FatalErrorHandler.cpp
@@ -27,4 +27,4 @@ void clang_install_aborting_llvm_fatal_error_handler(void) {
 void clang_uninstall_llvm_fatal_error_handler(void) {
   llvm::remove_fatal_error_handler();
 }
-}
\ No newline at end of file
+}

diff  --git a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h 
b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
index a7ea287dffc8..358ddf5e2081 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h
@@ -70,4 +70,4 @@ class NativeTypeFunctionSig : public NativeRawSymbol {
 } // namespace pdb
 } // namespace llvm
 
-#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
\ 

[PATCH] D74468: [clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

2020-02-12 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa45ca670f5c4: [clang-tidy] No misc-definitions-in-headers 
warning on C++14 variable templates. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74468

Files:
  clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
  clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;


Index: clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
===
--- clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
+++ clang-tools-extra/test/clang-tidy/checkers/misc-definitions-in-headers-1z.hpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-definitions-in-headers %t -- -- -std=c++1z
+// RUN: %check_clang_tidy -std=c++17-or-later %s misc-definitions-in-headers %t
 
 class CE {
   constexpr static int i = 5; // OK: inline variable definition.
@@ -8,3 +8,7 @@
 
 int b = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'b' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
+
+// OK: C++14 variable template.
+template 
+constexpr T pi = T(3.1415926L);
Index: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -83,6 +83,10 @@
 
constexpr int f10() { return 0; } // OK: constexpr function implies inline.
 
+   // OK: C++14 variable templates are inline.
+   template 
+   constexpr T pi = T(3.1415926L);
+
 Options
 ---
 
Index: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -134,6 +134,9 @@
  DiagnosticIDs::Note)
 << FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
   } else if (const auto *VD = dyn_cast(ND)) {
+// C++14 variable templates are allowed.
+if (VD->getDescribedVarTemplate())
+  return;
 // Static data members of a class template are allowed.
 if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
   return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74433: [llvm-objdump] Print file format in lowercase to match GNU output.

2020-02-12 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 added a comment.

Wasm is not an acronym so we don't usually display it in uppercase.  So yes, I 
think we should change WasmObjectFile::getFileFormatName() to return lowercase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74433



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


[PATCH] D74384: Use std::foo_t rather than std::foo in LLVM.

2020-02-12 Thread Justin Lebar via Phabricator via cfe-commits
jlebar added a comment.

In D74384#1872246 , @thakis wrote:

> Looks like this broke building on windows with clang-cl as host compiler in 
> some situations: http://45.33.8.238/win/8160/step_4.txt


I'm testing out the following fix, which we verified works for Nico.

No idea why this only affects clang-cl.  SFINAE is hard.

  commit 10cf8de244df1402c2b87205f427440fb4c0d7b9
  Author: Justin Lebar 
  Date:   Wed Feb 12 08:05:00 2020 -0800
  
  Fix compilation of Any.h header.
  
  In a previous patch I changed `std::decay::type` to `std::decay`
  rather than `std::decay_t`.  This seems to have broken the build
  *only for clang-cl*.  I don't know why.
  
  diff --git a/llvm/include/llvm/ADT/Any.h b/llvm/include/llvm/ADT/Any.h
  index 9d819841e3f..0aded628cda 100644
  --- a/llvm/include/llvm/ADT/Any.h
  +++ b/llvm/include/llvm/ADT/Any.h
  @@ -74,7 +74,7 @@ public:
   // adopting it to work-around usage of `Any` with types 
that
   // need to be implicitly convertible from an `Any`.
   llvm::negation>>,
  -std::is_copy_constructible>>::value,
  +std::is_copy_constructible>>::value,
   int> = 0>
 Any(T &&Value) {
   Storage =


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74384



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


[PATCH] D74399: [Driver][RISCV] Add RedHat Linux RISC-V triple

2020-02-12 Thread Luís Marques via Phabricator via cfe-commits
luismarques updated this revision to Diff 244187.
luismarques added a comment.
Herald added subscribers: apazos, pzheng, jocewei, the_o, brucehoult, 
MartinMosbeck, edward-jones, zzheng, niosHD, sabuasal, johnrusso, rbar.

Adds a test (using the RISC-V Fedora 31 paths).


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

https://reviews.llvm.org/D74399

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  
clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtbegin.o
  
clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtend.o
  clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crt1.o
  clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crti.o
  clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crtn.o
  clang/test/Driver/linux-ld.c


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -769,6 +769,21 @@
 // CHECK-FEDORA-21-AARCH64: 
"{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|}}crtend.o"
 // CHECK-FEDORA-21-AARCH64: 
"{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|}}crtn.o"
 //
+// Check Fedora 31 on riscv64.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=riscv64-redhat-linux -rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/fedora_31_riscv64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
+// CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crt1.o"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crti.o"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtbegin.o"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
+// CHECK-FEDORA-31-RISCV64: 
"-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtend.o"
+// CHECK-FEDORA-31-RISCV64: 
"{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crtn.o"
+//
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \
 // RUN: --gcc-toolchain="" \
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2090,6 +2090,7 @@
   static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
"riscv64-linux-gnu",
"riscv64-unknown-elf",
+   "riscv64-redhat-linux",
"riscv64-suse-linux"};
 
   static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -769,6 +769,21 @@
 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|}}crtend.o"
 // CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|}}crtn.o"
 //
+// Check Fedora 31 on riscv64.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=riscv64-redhat-linux -rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/fedora_31_riscv64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
+// CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crt1.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crti.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtbegin.o"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|}}crtend.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|}}crtn.o"
+//
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \
 // RUN: --gcc-toolchain="" \
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2090,6 +2090,7 @@
   st

[clang] 60a8a50 - [llvm-objdump] Print file format in lowercase to match GNU output.

2020-02-12 Thread Jordan Rupprecht via cfe-commits

Author: Jordan Rupprecht
Date: 2020-02-12T08:17:01-08:00
New Revision: 60a8a504f16dbbc5f2a6887ecb668ef4cb834949

URL: 
https://github.com/llvm/llvm-project/commit/60a8a504f16dbbc5f2a6887ecb668ef4cb834949
DIFF: 
https://github.com/llvm/llvm-project/commit/60a8a504f16dbbc5f2a6887ecb668ef4cb834949.diff

LOG: [llvm-objdump] Print file format in lowercase to match GNU output.

Summary:
GNU objdump prints the file format in lowercase, e.g. `elf64-x86-64`. 
llvm-objdump prints `ELF64-x86-64` right now, even though piping that into 
llvm-objcopy refuses that as a valid arch to use.

As an example of a problem this causes, see: 
https://github.com/ClangBuiltLinux/linux/issues/779

Reviewers: MaskRay, jhenderson, alexshap

Reviewed By: MaskRay

Subscribers: tpimh, sbc100, grimar, jvesely, nhaehnle, kerbowa, cfe-commits, 
llvm-commits

Tags: #clang, #llvm

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

Added: 


Modified: 
clang/test/Modules/pch_container.m
lld/test/COFF/savetemps.ll
llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
llvm/test/CodeGen/BPF/reloc-btf-2.ll
llvm/test/CodeGen/BPF/reloc-btf.ll
llvm/test/CodeGen/BPF/reloc.ll
llvm/test/Object/AMDGPU/objdump.s
llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
llvm/test/Object/X86/objdump-label.test
llvm/test/Object/X86/objdump-trivial-object.test
llvm/test/Object/dynamic-reloc.test
llvm/test/Object/objdump-symbol-table.test
llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s
llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-labels-exec.test
llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs.test
llvm/test/tools/llvm-objdump/X86/output-ordering.test
llvm/test/tools/llvm-objdump/X86/warn-missing-disasm-func.test
llvm/test/tools/llvm-objdump/all-headers.test
llvm/test/tools/llvm-objdump/archive-headers.test
llvm/test/tools/llvm-objdump/file-headers-coff.test
llvm/test/tools/llvm-objdump/file-headers-elf.test
llvm/test/tools/llvm-objdump/non-archive-object.test
llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
llvm/tools/llvm-objdump/llvm-objdump.cpp

Removed: 




diff  --git a/clang/test/Modules/pch_container.m 
b/clang/test/Modules/pch_container.m
index 77cd5f352bc9..ed13baf2d26c 100644
--- a/clang/test/Modules/pch_container.m
+++ b/clang/test/Modules/pch_container.m
@@ -8,11 +8,11 @@
 
 
 // RUN: llvm-objdump --section-headers %t-MachO/DependsOnModule.pcm 
%t-ELF/DependsOnModule.pcm %t-COFF/DependsOnModule.pcm | FileCheck %s
-// CHECK: file format Mach-O 64-bit x86-64
+// CHECK: file format mach-o 64-bit x86-64
 // CHECK: __clangast   {{[0-9a-f]+}} {{[0-9a-f]+}} DATA
-// CHECK: file format ELF64-x86-64
+// CHECK: file format elf64-x86-64
 // CHECK: __clangast   {{[0-9a-f]+}} {{[0-9a-f]+}} DATA
-// CHECK: file format COFF-x86-64
+// CHECK: file format coff-x86-64
 // CHECK: clangast   {{[0-9a-f]+}} {{[0-9a-f]+}}
 
 // RUN: not llvm-objdump --section-headers %t-raw/DependsOnModule.pcm

diff  --git a/lld/test/COFF/savetemps.ll b/lld/test/COFF/savetemps.ll
index e755ba9920d3..46a4958d2f78 100644
--- a/lld/test/COFF/savetemps.ll
+++ b/lld/test/COFF/savetemps.ll
@@ -19,7 +19,7 @@
 ; RUN: FileCheck --check-prefix=CHECK-OBJDUMP %s
 
 ; CHECK: define i32 @main()
-; CHECK-OBJDUMP: file format COFF
+; CHECK-OBJDUMP: file format coff
 
 target datalayout = 
"e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc"

diff  --git a/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll 
b/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
index 1254365b8205..58691f8ffcd2 100644
--- a/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
@@ -11,7 +11,7 @@ define void @foo() nounwind {
 
   ; Similarly make sure ELF output works and is vaguely sane: aarch64 target
   ; machine with correct section & symbol names.
-; CHECK-ELF: file format ELF64-aarch64
+; CHECK-ELF: file format elf64-aarch64
 
 ; CHECK-ELF: Disassembly of section .text
 ; CHECK-ELF-LABEL: foo:

diff  --git a/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll 
b/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
index a242f39601cb..2d55f218ddce 100644
--- a/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
+++ b/llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -mtriple=thumbv7-windows-gnu -filetype=obj -o - %s | llvm-objdump 
-d - | FileCheck %s
 
 define void @foo() {
-; CHECK: file format COFF-ARM
+; CHECK: file format coff-arm
 
 ; CHECK-LABEL: foo:
 ; CHECK: bx lr

diff  --git a/llvm/test/CodeGen/BPF/reloc-btf-2.ll 
b/llvm/test/CodeGen/BPF/reloc-btf-2.ll
index 2afeb24bae48..68f00081d7d7 100644
--- a/llvm/test/CodeGen/BPF/reloc-btf-2.ll
+++ b/llvm/test/CodeGen/BPF/reloc-btf-2.ll
@@ -21,7 +21,7 @@

[PATCH] D74433: [llvm-objdump] Print file format in lowercase to match GNU output.

2020-02-12 Thread Jordan Rupprecht via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG60a8a504f16d: [llvm-objdump] Print file format in lowercase 
to match GNU output. (authored by rupprecht).

Changed prior to commit:
  https://reviews.llvm.org/D74433?vs=243991&id=244189#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74433

Files:
  clang/test/Modules/pch_container.m
  lld/test/COFF/savetemps.ll
  llvm/test/CodeGen/AArch64/arm64-simplest-elf.ll
  llvm/test/CodeGen/ARM/Windows/trivial-gnu-object.ll
  llvm/test/CodeGen/BPF/reloc-btf-2.ll
  llvm/test/CodeGen/BPF/reloc-btf.ll
  llvm/test/CodeGen/BPF/reloc.ll
  llvm/test/Object/AMDGPU/objdump.s
  llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
  llvm/test/Object/X86/objdump-label.test
  llvm/test/Object/X86/objdump-trivial-object.test
  llvm/test/Object/dynamic-reloc.test
  llvm/test/Object/objdump-symbol-table.test
  llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s
  llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-labels-exec.test
  llvm/test/tools/llvm-objdump/X86/elf-dynamic-relocs.test
  llvm/test/tools/llvm-objdump/X86/output-ordering.test
  llvm/test/tools/llvm-objdump/X86/warn-missing-disasm-func.test
  llvm/test/tools/llvm-objdump/all-headers.test
  llvm/test/tools/llvm-objdump/archive-headers.test
  llvm/test/tools/llvm-objdump/file-headers-coff.test
  llvm/test/tools/llvm-objdump/file-headers-elf.test
  llvm/test/tools/llvm-objdump/non-archive-object.test
  llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
  llvm/tools/llvm-objdump/llvm-objdump.cpp

Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2168,7 +2168,7 @@
   outs() << A->getFileName() << "(" << O->getFileName() << ")";
 else
   outs() << O->getFileName();
-outs() << ":\tfile format " << O->getFileFormatName() << "\n\n";
+outs() << ":\tfile format " << O->getFileFormatName().lower() << "\n\n";
   }
 
   if (StartAddress.getNumOccurrences() || StopAddress.getNumOccurrences())
Index: llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
===
--- llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
+++ llvm/test/tools/llvm-objdump/relocations-in-nonreloc.test
@@ -7,7 +7,7 @@
 # RUN: yaml2obj --docnum=3 %s -o %t3
 # RUN: llvm-objdump -r %t3 | FileCheck %s -DFILE=%t3 --check-prefixes=FMT,REL --implicit-check-not={{.}}
 
-# FMT: [[FILE]]: file format ELF64-x86-64
+# FMT: [[FILE]]: file format elf64-x86-64
 
 # REL:  RELOCATION RECORDS FOR []:
 # REL-NEXT: OFFSET   TYPE VALUE
Index: llvm/test/tools/llvm-objdump/non-archive-object.test
===
--- llvm/test/tools/llvm-objdump/non-archive-object.test
+++ llvm/test/tools/llvm-objdump/non-archive-object.test
@@ -2,7 +2,7 @@
 # RUN: llvm-objdump -a %t | FileCheck %s
 
 # If this test has not crashed, then this test passed.
-# CHECK: file format ELF64-x86-64
+# CHECK: file format elf64-x86-64
 
 !ELF
 FileHeader:
Index: llvm/test/tools/llvm-objdump/file-headers-elf.test
===
--- llvm/test/tools/llvm-objdump/file-headers-elf.test
+++ llvm/test/tools/llvm-objdump/file-headers-elf.test
@@ -10,7 +10,7 @@
   Machine: EM_X86_64
   Entry:   0x123456789abcde
 
-# ELF64: [[FILE]]: file format ELF64-x86-64
+# ELF64: [[FILE]]: file format elf64-x86-64
 # ELF64: architecture: x86_64
 # ELF64: start address: 0x00123456789abcde
 
@@ -18,7 +18,7 @@
 # RUN: llvm-objdump -f %t-i386 | FileCheck -DFILE=%t-i386 %s -check-prefix ELF32
 # RUN: llvm-objdump -file-headers %t-i386 | FileCheck %s -DFILE=%t-i386 -check-prefix ELF32
 
-# ELF32: [[FILE]]: file format ELF32-i386
+# ELF32: [[FILE]]: file format elf32-i386
 # ELF32: architecture: i386
 # ELF32: start address: 0x12345678
 
Index: llvm/test/tools/llvm-objdump/file-headers-coff.test
===
--- llvm/test/tools/llvm-objdump/file-headers-coff.test
+++ llvm/test/tools/llvm-objdump/file-headers-coff.test
@@ -9,6 +9,6 @@
 sections:
 symbols:
 
-# CHECK: [[FILE]]: file format COFF-i386
+# CHECK: [[FILE]]: file format coff-i386
 # CHECK: architecture: i386
 # CHECK: start address: 0x
Index: llvm/test/tools/llvm-objdump/archive-headers.test
===
--- llvm/test/tools/llvm-objdump/archive-headers.test
+++ llvm/test/tools/llvm-objdump/archive-headers.test
@@ -1,21 +1,21 @@
 # RUN: llvm-objdump -a %p/Inputs/liblong_filenames.a | FileCheck %s
 # RUN: llvm-objdump -archive-headers %p/Inputs/liblong_filenames.a | FileCheck %s
 
-# CHECK: {{.*}}liblong_file

  1   2   >