[PATCH] D84814: [clang-tidy] readability-identifier-naming checks configs for included files

2020-08-01 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 282379.
njames93 marked 4 inline comments as done.
njames93 added a comment.

- Address comments.
- Added test case for when this behaviour is disabled.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84814

Files:
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.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/Inputs/readability-identifier-naming/global-style-disabled/.clang-tidy
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style-disabled/header.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style1/.clang-tidy
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style1/header.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/.clang-tidy
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/header.h
  
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
@@ -0,0 +1,67 @@
+// Setup header directory
+
+// RUN: rm -rf %theaders
+// RUN: mkdir %theaders
+// RUN: cp -R %S/Inputs/readability-identifier-naming/. %theaders
+
+// C++11 isn't explicitly required, but failing to specify a standard means the
+// check will run multiple times for different standards. This will cause the
+// second test to fail as the header file will be changed during the first run.
+// InheritParentConfig is needed to look for the clang-tidy configuration files.
+
+// RUN: %check_clang_tidy -check-suffixes=ENABLED,SHARED -std=c++11 %s \
+// RUN: readability-identifier-naming %t -- \
+// RUN:  -config='{ InheritParentConfig: true, CheckOptions: [ \
+// RUN:   {key: readability-identifier-naming.FunctionCase, value: camelBack}, \
+// RUN:   {key: readability-identifier-naming.GetConfigPerFile, value: true} \
+// RUN:  ]}' -header-filter='.*' -- -I%theaders
+
+
+// RUN: rm -rf %theaders
+// RUN: mkdir %theaders
+// RUN: cp -R %S/Inputs/readability-identifier-naming/. %theaders
+// RUN: %check_clang_tidy -check-suffixes=DISABLED,SHARED -std=c++11 %s \
+// RUN: readability-identifier-naming %t -- \
+// RUN:  -config='{ InheritParentConfig: true, CheckOptions: [ \
+// RUN:   {key: readability-identifier-naming.FunctionCase, value: camelBack}, \
+// RUN:   {key: readability-identifier-naming.GetConfigPerFile, value: false} \
+// RUN:  ]}' -header-filter='.*' -- -I%theaders
+
+// On DISABLED run, everything should be made 'camelBack'
+
+#include "global-style-disabled/header.h"
+#include "global-style1/header.h"
+#include "global-style2/header.h"
+// CHECK-MESSAGES-ENABLED-DAG: global-style1/header.h:5:6: warning: invalid case style for global function 'styleFirstBad'
+// CHECK-MESSAGES-ENABLED-DAG: global-style2/header.h:5:6: warning: invalid case style for global function 'styleSecondBad'
+// CHECK-MESSAGES-DISABLED-DAG: global-style1/header.h:3:6: warning: invalid case style for function 'style_first_good'
+// CHECK-MESSAGES-DISABLED-DAG: global-style2/header.h:3:6: warning: invalid case style for function 'STYLE_SECOND_GOOD'
+// CHECK-MESSAGES-DISABLED-DAG: global-style-disabled/header.h:1:6: warning: invalid case style for function 'disabled_style_1'
+// CHECK-MESSAGES-DISABLED-DAG: global-style-disabled/header.h:3:6: warning: invalid case style for function 'DISABLED_STYLE_3'
+
+void goodStyle() {
+  style_first_good();
+  STYLE_SECOND_GOOD();
+  //  CHECK-FIXES-DISABLED: styleFirstGood();
+  // CHECK-FIXES-DISABLED-NEXT: styleSecondGood();
+}
+// CHECK-MESSAGES-SHARED-DAG: :[[@LINE+1]]:6: warning: invalid case style for function 'bad_style'
+void bad_style() {
+  styleFirstBad();
+  styleSecondBad();
+}
+//CHECK-FIXES-SHARED: void badStyle() {
+// CHECK-FIXES-DISABLED-NEXT:   styleFirstBad();
+//  CHECK-FIXES-ENABLED-NEXT:   style_first_bad();
+// CHECK-FIXES-DISABLED-NEXT:   styleSecondBad();
+//  CHECK-FIXES-ENABLED-NEXT:   STYLE_SECOND_BAD();
+//   CHECK-FIXES-SHARED-NEXT: }
+
+void expectNoStyle() {
+  disabled_style_1();
+  disabledStyle2();
+  DISABLED_STYLE_3();
+  //  CHECK-FIXES-DISABLED: disabledStyle1();
+  // CHECK-FIXES-DISABLED-NEXT: disabledStyle2();
+  // CHECK-FIXES-DISABLED-NEXT: disabledStyle3();
+}
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/header.h
=

[PATCH] D84814: [clang-tidy] readability-identifier-naming checks configs for included files

2020-08-01 Thread Nathan James via Phabricator via cfe-commits
njames93 updated this revision to Diff 282380.
njames93 added a comment.

Fix unpunctuated comment and simplify second check command.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84814

Files:
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.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/Inputs/readability-identifier-naming/global-style-disabled/.clang-tidy
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style-disabled/header.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style1/.clang-tidy
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style1/header.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/.clang-tidy
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/header.h
  
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
@@ -0,0 +1,64 @@
+// Setup header directory
+
+// RUN: rm -rf %theaders
+// RUN: mkdir %theaders
+// RUN: cp -R %S/Inputs/readability-identifier-naming/. %theaders
+
+// C++11 isn't explicitly required, but failing to specify a standard means the
+// check will run multiple times for different standards. This will cause the
+// second test to fail as the header file will be changed during the first run.
+// InheritParentConfig is needed to look for the clang-tidy configuration files.
+
+// RUN: %check_clang_tidy -check-suffixes=ENABLED,SHARED -std=c++11 %s \
+// RUN: readability-identifier-naming %t -- \
+// RUN:  -config='{ InheritParentConfig: true, CheckOptions: [ \
+// RUN:   {key: readability-identifier-naming.FunctionCase, value: camelBack}, \
+// RUN:   {key: readability-identifier-naming.GetConfigPerFile, value: true} \
+// RUN:  ]}' -header-filter='.*' -- -I%theaders
+
+// On DISABLED run, everything should be made 'camelBack'.
+
+// RUN: cp -R %S/Inputs/readability-identifier-naming/. %theaders
+// RUN: %check_clang_tidy -check-suffixes=DISABLED,SHARED -std=c++11 %s \
+// RUN: readability-identifier-naming %t -- \
+// RUN:  -config='{ InheritParentConfig: true, CheckOptions: [ \
+// RUN:   {key: readability-identifier-naming.FunctionCase, value: camelBack}, \
+// RUN:   {key: readability-identifier-naming.GetConfigPerFile, value: false} \
+// RUN:  ]}' -header-filter='.*' -- -I%theaders
+
+#include "global-style-disabled/header.h"
+#include "global-style1/header.h"
+#include "global-style2/header.h"
+// CHECK-MESSAGES-ENABLED-DAG: global-style1/header.h:5:6: warning: invalid case style for global function 'styleFirstBad'
+// CHECK-MESSAGES-ENABLED-DAG: global-style2/header.h:5:6: warning: invalid case style for global function 'styleSecondBad'
+// CHECK-MESSAGES-DISABLED-DAG: global-style1/header.h:3:6: warning: invalid case style for function 'style_first_good'
+// CHECK-MESSAGES-DISABLED-DAG: global-style2/header.h:3:6: warning: invalid case style for function 'STYLE_SECOND_GOOD'
+// CHECK-MESSAGES-DISABLED-DAG: global-style-disabled/header.h:1:6: warning: invalid case style for function 'disabled_style_1'
+// CHECK-MESSAGES-DISABLED-DAG: global-style-disabled/header.h:3:6: warning: invalid case style for function 'DISABLED_STYLE_3'
+
+void goodStyle() {
+  style_first_good();
+  STYLE_SECOND_GOOD();
+  //  CHECK-FIXES-DISABLED: styleFirstGood();
+  // CHECK-FIXES-DISABLED-NEXT: styleSecondGood();
+}
+// CHECK-MESSAGES-SHARED-DAG: :[[@LINE+1]]:6: warning: invalid case style for function 'bad_style'
+void bad_style() {
+  styleFirstBad();
+  styleSecondBad();
+}
+//CHECK-FIXES-SHARED: void badStyle() {
+// CHECK-FIXES-DISABLED-NEXT:   styleFirstBad();
+//  CHECK-FIXES-ENABLED-NEXT:   style_first_bad();
+// CHECK-FIXES-DISABLED-NEXT:   styleSecondBad();
+//  CHECK-FIXES-ENABLED-NEXT:   STYLE_SECOND_BAD();
+//   CHECK-FIXES-SHARED-NEXT: }
+
+void expectNoStyle() {
+  disabled_style_1();
+  disabledStyle2();
+  DISABLED_STYLE_3();
+  //  CHECK-FIXES-DISABLED: disabledStyle1();
+  // CHECK-FIXES-DISABLED-NEXT: disabledStyle2();
+  // CHECK-FIXES-DISABLED-NEXT: disabledStyle3();
+}
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/header.h
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identif

[PATCH] D85071: [VE] Extend integer arguments and return values smaller than 64 bits

2020-08-01 Thread Kazushi Marukawa via Phabricator via cfe-commits
kaz7 created this revision.
kaz7 added reviewers: simoll, k-ishizaka.
kaz7 added projects: clang, VE.
Herald added a subscriber: cfe-commits.
kaz7 requested review of this revision.

In order to follow NEC Aurora SX VE ABI correctly, change to sign/zero
extend integer arguments and return values smaller than 64 bits in clang.
Also update regression test.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85071

Files:
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/ve-abi.c

Index: clang/test/CodeGen/ve-abi.c
===
--- clang/test/CodeGen/ve-abi.c
+++ clang/test/CodeGen/ve-abi.c
@@ -1,14 +1,96 @@
+/// Check that ABI is correctly implemented.
+///
+///   1. Check that all integer arguments and return values less than 64 bits
+///  are sign/zero extended.
+///   2. Check that all complex arguments and return values are placed in
+///  registers if it is possible.  Not treat it as aggregate.
+///   3. Check that a function declared without argument type declarations is
+///  treated as VARARGS (in order to place arguments in both registers and
+///  memory locations in the back end)
+
 // RUN: %clang_cc1 -triple ve-linux-gnu -emit-llvm %s -o - | FileCheck %s
 
-// CHECK-LABEL: define { float, float } @p(float %a.coerce0, float %a.coerce1, float %b.coerce0, float %b.coerce1) #0 {
-float __complex__ p(float __complex__ a, float __complex__ b) {
+// CHECK-LABEL: define signext i8 @fun_si8(i8 signext %a, i8 signext %b) #0 {
+char fun_si8(char a, char b) {
+  return a;
+}
+
+// CHECK-LABEL: define zeroext i8 @fun_zi8(i8 zeroext %a, i8 zeroext %b) #0 {
+unsigned char fun_zi8(unsigned char a, unsigned char b) {
+  return a;
+}
+
+// CHECK-LABEL: define signext i16 @fun_si16(i16 signext %a, i16 signext %b) #0 {
+short fun_si16(short a, short b) {
+  return a;
+}
+
+// CHECK-LABEL: define zeroext i16 @fun_zi16(i16 zeroext %a, i16 zeroext %b) #0 {
+unsigned short fun_zi16(unsigned short a, unsigned short b) {
+  return a;
+}
+
+// CHECK-LABEL: define signext i32 @fun_si32(i32 signext %a, i32 signext %b) #0 {
+int fun_si32(int a, int b) {
+  return a;
+}
+
+// CHECK-LABEL: define zeroext i32 @fun_zi32(i32 zeroext %a, i32 zeroext %b) #0 {
+unsigned int fun_zi32(unsigned int a, unsigned int b) {
+  return a;
+}
+
+// CHECK-LABEL: define i64 @fun_si64(i64 %a, i64 %b) #0 {
+long fun_si64(long a, long b) {
+  return a;
+}
+
+// CHECK-LABEL: define i64 @fun_zi64(i64 %a, i64 %b) #0 {
+unsigned long fun_zi64(unsigned long a, unsigned long b) {
+  return a;
+}
+
+// CHECK-LABEL: define i128 @fun_si128(i128 %a, i128 %b) #0 {
+__int128 fun_si128(__int128 a, __int128 b) {
+}
+
+// CHECK-LABEL: define i128 @fun_zi128(i128 %a, i128 %b) #0 {
+unsigned __int128 fun_zi128(unsigned __int128 a, unsigned __int128 b) {
+  return a;
+}
+
+// CHECK-LABEL: define float @fun_float(float %a, float %b) #0 {
+float fun_float(float a, float b) {
+  return a;
+}
+
+// CHECK-LABEL: define double @fun_double(double %a, double %b) #0 {
+double fun_double(double a, double b) {
+  return a;
+}
+
+// CHECK-LABEL: define fp128 @fun_quad(fp128 %a, fp128 %b) #0 {
+long double fun_quad(long double a, long double b) {
+  return a;
+}
+
+// CHECK-LABEL: define { float, float } @fun_fcomplex(float %a.coerce0, float %a.coerce1, float %b.coerce0, float %b.coerce1) #0 {
+float __complex__ fun_fcomplex(float __complex__ a, float __complex__ b) {
+  return a;
+}
+
+// CHECK-LABEL: define { double, double } @fun_dcomplex(double %a.coerce0, double %a.coerce1, double %b.coerce0, double %b.coerce1) #0 {
+double __complex__ fun_dcomplex(double __complex__ a, double __complex__ b) {
+  return a;
 }
 
-// CHECK-LABEL: define { double, double } @q(double %a.coerce0, double %a.coerce1, double %b.coerce0, double %b.coerce1) #0 {
-double __complex__ q(double __complex__ a, double __complex__ b) {
+// CHECK-LABEL: define { fp128, fp128 } @fun_qcomplex(fp128 %a.coerce0, fp128 %a.coerce1, fp128 %b.coerce0, fp128 %b.coerce1) #0 {
+long double __complex__ fun_qcomplex(long double __complex__ a, long double __complex__ b) {
+  return a;
 }
 
+extern int hoge();
 void func() {
-  // CHECK-LABEL: %call = call i32 (i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @hoge to i32 (i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7)
+  // CHECK: %call = call signext i32 (i32, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @hoge to i32 (i32, i32, i32, i32, i32, i32, i32, ...)*)(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, i32 signext 7)
   hoge(1, 2, 3, 4, 5, 6, 7);
 }
Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -10745,21 +10745,24 @@
 } // end anonymous namespace
 
 ABIArgInfo VEABIInfo::classifyReturnType(QualType Ty) const {
-  if (Ty->isAnyComplexTyp

[PATCH] D84814: [clang-tidy] readability-identifier-naming checks configs for included files

2020-08-01 Thread Nathan James via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4888c9ce97d8: [clang-tidy] readability-identifier-naming 
checks configs for included files (authored by njames93).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84814

Files:
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.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/Inputs/readability-identifier-naming/global-style-disabled/.clang-tidy
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style-disabled/header.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style1/.clang-tidy
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style1/header.h
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/.clang-tidy
  
clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/header.h
  
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp
@@ -0,0 +1,64 @@
+// Setup header directory
+
+// RUN: rm -rf %theaders
+// RUN: mkdir %theaders
+// RUN: cp -R %S/Inputs/readability-identifier-naming/. %theaders
+
+// C++11 isn't explicitly required, but failing to specify a standard means the
+// check will run multiple times for different standards. This will cause the
+// second test to fail as the header file will be changed during the first run.
+// InheritParentConfig is needed to look for the clang-tidy configuration files.
+
+// RUN: %check_clang_tidy -check-suffixes=ENABLED,SHARED -std=c++11 %s \
+// RUN: readability-identifier-naming %t -- \
+// RUN:  -config='{ InheritParentConfig: true, CheckOptions: [ \
+// RUN:   {key: readability-identifier-naming.FunctionCase, value: camelBack}, \
+// RUN:   {key: readability-identifier-naming.GetConfigPerFile, value: true} \
+// RUN:  ]}' -header-filter='.*' -- -I%theaders
+
+// On DISABLED run, everything should be made 'camelBack'.
+
+// RUN: cp -R %S/Inputs/readability-identifier-naming/. %theaders
+// RUN: %check_clang_tidy -check-suffixes=DISABLED,SHARED -std=c++11 %s \
+// RUN: readability-identifier-naming %t -- \
+// RUN:  -config='{ InheritParentConfig: true, CheckOptions: [ \
+// RUN:   {key: readability-identifier-naming.FunctionCase, value: camelBack}, \
+// RUN:   {key: readability-identifier-naming.GetConfigPerFile, value: false} \
+// RUN:  ]}' -header-filter='.*' -- -I%theaders
+
+#include "global-style-disabled/header.h"
+#include "global-style1/header.h"
+#include "global-style2/header.h"
+// CHECK-MESSAGES-ENABLED-DAG: global-style1/header.h:5:6: warning: invalid case style for global function 'styleFirstBad'
+// CHECK-MESSAGES-ENABLED-DAG: global-style2/header.h:5:6: warning: invalid case style for global function 'styleSecondBad'
+// CHECK-MESSAGES-DISABLED-DAG: global-style1/header.h:3:6: warning: invalid case style for function 'style_first_good'
+// CHECK-MESSAGES-DISABLED-DAG: global-style2/header.h:3:6: warning: invalid case style for function 'STYLE_SECOND_GOOD'
+// CHECK-MESSAGES-DISABLED-DAG: global-style-disabled/header.h:1:6: warning: invalid case style for function 'disabled_style_1'
+// CHECK-MESSAGES-DISABLED-DAG: global-style-disabled/header.h:3:6: warning: invalid case style for function 'DISABLED_STYLE_3'
+
+void goodStyle() {
+  style_first_good();
+  STYLE_SECOND_GOOD();
+  //  CHECK-FIXES-DISABLED: styleFirstGood();
+  // CHECK-FIXES-DISABLED-NEXT: styleSecondGood();
+}
+// CHECK-MESSAGES-SHARED-DAG: :[[@LINE+1]]:6: warning: invalid case style for function 'bad_style'
+void bad_style() {
+  styleFirstBad();
+  styleSecondBad();
+}
+//CHECK-FIXES-SHARED: void badStyle() {
+// CHECK-FIXES-DISABLED-NEXT:   styleFirstBad();
+//  CHECK-FIXES-ENABLED-NEXT:   style_first_bad();
+// CHECK-FIXES-DISABLED-NEXT:   styleSecondBad();
+//  CHECK-FIXES-ENABLED-NEXT:   STYLE_SECOND_BAD();
+//   CHECK-FIXES-SHARED-NEXT: }
+
+void expectNoStyle() {
+  disabled_style_1();
+  disabledStyle2();
+  DISABLED_STYLE_3();
+  //  CHECK-FIXES-DISABLED: disabledStyle1();
+  // CHECK-FIXES-DISABLED-NEXT: disabledStyle2();
+  // CHECK-FIXES-DISABLED-NEXT: disabledStyle3();
+}
Index: clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/header.h
===
--- /dev/null

[clang-tools-extra] 4888c9c - [clang-tidy] readability-identifier-naming checks configs for included files

2020-08-01 Thread Nathan James via cfe-commits

Author: Nathan James
Date: 2020-08-01T10:35:32+01:00
New Revision: 4888c9ce97d8c20d988212b10f1045e3c4022b8e

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

LOG: [clang-tidy] readability-identifier-naming checks configs for included 
files

When checking for the style of a decl that isn't in the main file, the check 
will now search for the configuration that the included files uses to gather 
the style for its decls.

This can be useful to silence warnings in header files that follow a different 
naming convention without using header-filter to silence all warnings(even from 
other checks) in the header file.

Reviewed By: aaron.ballman, gribozavr2

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

Added: 

clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style-disabled/.clang-tidy

clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style-disabled/header.h

clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style1/.clang-tidy

clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style1/header.h

clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/.clang-tidy

clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/global-style2/header.h

clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-multiple-styles.cpp

Modified: 
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index c885aac89072..e004ce6fbd20 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -8,6 +8,7 @@
 
 #include "IdentifierNamingCheck.h"
 
+#include "../GlobList.h"
 #include "clang/AST/CXXInheritance.h"
 #include "clang/Lex/PPCallbacks.h"
 #include "clang/Lex/Preprocessor.h"
@@ -15,7 +16,8 @@
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Support/Format.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/Regex.h"
 
 #define DEBUG_TYPE "clang-tidy"
@@ -119,41 +121,47 @@ static StringRef const StyleNames[] = {
 #undef NAMING_KEYS
 // clang-format on
 
+static std::vector>
+getNamingStyles(const ClangTidyCheck::OptionsView &Options) {
+  std::vector> Styles;
+  Styles.reserve(StyleNames->size());
+  for (auto const &StyleName : StyleNames) {
+auto CaseOptional = Options.getOptional(
+(StyleName + "Case").str());
+auto Prefix = Options.get((StyleName + "Prefix").str(), "");
+auto Postfix = Options.get((StyleName + "Suffix").str(), "");
+
+if (CaseOptional || !Prefix.empty() || !Postfix.empty())
+  Styles.emplace_back(IdentifierNamingCheck::NamingStyle{
+  std::move(CaseOptional), std::move(Prefix), std::move(Postfix)});
+else
+  Styles.emplace_back(llvm::None);
+  }
+  return Styles;
+}
+
 IdentifierNamingCheck::IdentifierNamingCheck(StringRef Name,
  ClangTidyContext *Context)
-: RenamerClangTidyCheck(Name, Context),
+: RenamerClangTidyCheck(Name, Context), Context(Context), CheckName(Name),
+  GetConfigPerFile(Options.get("GetConfigPerFile", true)),
   IgnoreFailedSplit(Options.get("IgnoreFailedSplit", false)),
   IgnoreMainLikeFunctions(Options.get("IgnoreMainLikeFunctions", false)) {
 
-  for (auto const &Name : StyleNames) {
-auto CaseOptional = [&]() -> llvm::Optional {
-  auto ValueOr = Options.get((Name + "Case").str());
-  if (ValueOr)
-return *ValueOr;
-  llvm::logAllUnhandledErrors(
-  llvm::handleErrors(ValueOr.takeError(),
- [](const MissingOptionError &) -> llvm::Error {
-   return llvm::Error::success();
- }),
-  llvm::errs(), "warning: ");
-  return llvm::None;
-}();
-
-auto prefix = Options.get((Name + "Prefix").str(), "");
-auto postfix = Options.get((Name + "Suffix").str(), "");
-
-if (CaseOptional || !prefix.empty() || !postfix.empty()) {
-  NamingStyles.push_back(NamingStyle(CaseOptional, prefix, postfix));
-} else {
-  NamingStyles.push_back(llvm::None);
-}
-  }
+  auto IterAndInserted 

[clang-tools-extra] 9f21947 - [clang-tidy][NFC] Small refactor

2020-08-01 Thread Nathan James via cfe-commits

Author: Nathan James
Date: 2020-08-01T11:04:29+01:00
New Revision: 9f21947a331203ee2579db87f1d1ec22a949e20a

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

LOG: [clang-tidy][NFC] Small refactor

Added: 


Modified: 
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index e004ce6fbd20..e7fe25d8e221 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -162,17 +162,16 @@ void 
IdentifierNamingCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   RenamerClangTidyCheck::storeOptions(Opts);
   ArrayRef> NamingStyles =
   getStyleForFile(Context->getCurrentFile());
-  for (size_t i = 0; i < SK_Count; ++i) {
-if (NamingStyles[i]) {
-  if (NamingStyles[i]->Case) {
-Options.store(Opts, (StyleNames[i] + "Case").str(),
-  *NamingStyles[i]->Case);
-  }
-  Options.store(Opts, (StyleNames[i] + "Prefix").str(),
-NamingStyles[i]->Prefix);
-  Options.store(Opts, (StyleNames[i] + "Suffix").str(),
-NamingStyles[i]->Suffix);
-}
+  for (size_t I = 0; I < SK_Count; ++I) {
+if (!NamingStyles[I])
+  continue;
+if (NamingStyles[I]->Case)
+  Options.store(Opts, (StyleNames[I] + "Case").str(),
+*NamingStyles[I]->Case);
+Options.store(Opts, (StyleNames[I] + "Prefix").str(),
+  NamingStyles[I]->Prefix);
+Options.store(Opts, (StyleNames[I] + "Suffix").str(),
+  NamingStyles[I]->Suffix);
   }
   Options.store(Opts, "GetConfigPerFile", GetConfigPerFile);
   Options.store(Opts, "IgnoreFailedSplit", IgnoreFailedSplit);
@@ -191,14 +190,9 @@ static bool matchesStyle(StringRef Name,
   llvm::Regex("^[a-z]([a-z0-9]*(_[A-Z])?)*"),
   };
 
-  if (Name.startswith(Style.Prefix))
-Name = Name.drop_front(Style.Prefix.size());
-  else
+  if (!Name.consume_front(Style.Prefix))
 return false;
-
-  if (Name.endswith(Style.Suffix))
-Name = Name.drop_back(Style.Suffix.size());
-  else
+  if (!Name.consume_back(Style.Suffix))
 return false;
 
   // Ensure the name doesn't have any extra underscores beyond those specified
@@ -221,9 +215,10 @@ static std::string fixupWithCase(StringRef Name,
   Name.split(Substrs, "_", -1, false);
 
   SmallVector Words;
+  SmallVector Groups;
   for (auto Substr : Substrs) {
 while (!Substr.empty()) {
-  SmallVector Groups;
+  Groups.clear();
   if (!Splitter.match(Substr, &Groups))
 break;
 
@@ -241,12 +236,12 @@ static std::string fixupWithCase(StringRef Name,
   }
 
   if (Words.empty())
-return std::string(Name);
+return Name.str();
 
-  std::string Fixup;
+  SmallString<128> Fixup;
   switch (Case) {
   case IdentifierNamingCheck::CT_AnyCase:
-Fixup += Name;
+return Name.str();
 break;
 
   case IdentifierNamingCheck::CT_LowerCase:
@@ -267,7 +262,7 @@ static std::string fixupWithCase(StringRef Name,
 
   case IdentifierNamingCheck::CT_CamelCase:
 for (auto const &Word : Words) {
-  Fixup += Word.substr(0, 1).upper();
+  Fixup += toupper(Word.front());
   Fixup += Word.substr(1).lower();
 }
 break;
@@ -277,7 +272,7 @@ static std::string fixupWithCase(StringRef Name,
   if (&Word == &Words.front()) {
 Fixup += Word.lower();
   } else {
-Fixup += Word.substr(0, 1).upper();
+Fixup += toupper(Word.front());
 Fixup += Word.substr(1).lower();
   }
 }
@@ -287,7 +282,7 @@ static std::string fixupWithCase(StringRef Name,
 for (auto const &Word : Words) {
   if (&Word != &Words.front())
 Fixup += "_";
-  Fixup += Word.substr(0, 1).upper();
+  Fixup += toupper(Word.front());
   Fixup += Word.substr(1).lower();
 }
 break;
@@ -296,16 +291,16 @@ static std::string fixupWithCase(StringRef Name,
 for (auto const &Word : Words) {
   if (&Word != &Words.front()) {
 Fixup += "_";
-Fixup += Word.substr(0, 1).upper();
+Fixup += toupper(Word.front());
   } else {
-Fixup += Word.substr(0, 1).lower();
+Fixup += tolower(Word.front());
   }
   Fixup += Word.substr(1).lower();
 }
 break;
   }
 
-  return Fixup;
+  return Fixup.str().str();
 }
 
 static bool isParamInMainLikeFunction(const ParmVarDecl &ParmDecl,
@@ -715,8 +710,8 @@ RenamerClangTidyCheck::DiagInfo
 IdentifierNamingCheck::GetDiagInfo(const NamingCheckId &ID,
const NamingCheckFailure &Failure) const {
   return DiagInfo{"invali

[PATCH] D85033: [clang] Provide a better pretty-printed name for unnamed parameters, lambda classes and lambda captures.

2020-08-01 Thread Bruno Ricci via Phabricator via cfe-commits
riccibruno updated this revision to Diff 282391.
riccibruno edited the summary of this revision.
riccibruno added a comment.

Don't forget to increment the field iterator in the loop of 
`maybePrintFieldForLambdaCapture`, and modify the tests to test this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85033

Files:
  clang/lib/AST/Decl.cpp
  clang/test/AST/ast-dump-record-definition-data-json.cpp
  clang/test/Analysis/explain-svals.cpp
  clang/test/Index/annotate-tokens.cpp
  clang/test/Index/linkage.c
  clang/test/Index/load-decls.c
  clang/test/Index/load-namespaces.cpp
  clang/test/Index/preamble.c
  clang/test/Index/print-type.c
  clang/test/Index/print-type.cpp
  clang/test/Index/recursive-cxx-member-calls.cpp
  clang/test/Index/usrs.m
  clang/test/Modules/module-private.cpp
  clang/test/SemaCXX/lambda-expressions.cpp
  clang/test/SemaCXX/warn-large-by-value-copy.cpp
  clang/test/Tooling/clang-diff-ast.cpp
  clang/unittests/AST/ASTTraverserTest.cpp
  clang/unittests/AST/NamedDeclPrinterTest.cpp

Index: clang/unittests/AST/NamedDeclPrinterTest.cpp
===
--- clang/unittests/AST/NamedDeclPrinterTest.cpp
+++ clang/unittests/AST/NamedDeclPrinterTest.cpp
@@ -6,7 +6,8 @@
 //
 //===--===//
 //
-// This file contains tests for NamedDecl::printQualifiedName().
+// This file contains tests for NamedDecl::printName()
+// and NamedDecl::printQualifiedName().
 //
 // These tests have a coding convention:
 // * declaration to be printed is named 'A' unless it should have some special
@@ -93,11 +94,10 @@
   return ::testing::AssertionSuccess();
 }
 
-::testing::AssertionResult
-PrintedNamedDeclMatches(StringRef Code, const std::vector &Args,
-bool SuppressUnwrittenScope,
-const DeclarationMatcher &NodeMatch,
-StringRef ExpectedPrinted, StringRef FileName) {
+::testing::AssertionResult PrintedQualifiedNamedDeclMatches(
+StringRef Code, const std::vector &Args,
+bool SuppressUnwrittenScope, const DeclarationMatcher &NodeMatch,
+StringRef ExpectedPrinted, StringRef FileName) {
   return PrintedDeclMatches(Code, Args, NodeMatch, ExpectedPrinted, FileName,
 [=](llvm::raw_ostream &Out, const NamedDecl *ND) {
   auto Policy =
@@ -108,34 +108,43 @@
 });
 }
 
+::testing::AssertionResult PrintedUnqualifiedNamedDeclMatches(
+StringRef Code, const std::vector &Args,
+const DeclarationMatcher &NodeMatch, StringRef ExpectedPrinted,
+StringRef FileName) {
+  return PrintedDeclMatches(
+  Code, Args, NodeMatch, ExpectedPrinted, FileName,
+  [=](llvm::raw_ostream &Out, const NamedDecl *ND) { ND->printName(Out); });
+}
+
 ::testing::AssertionResult
-PrintedNamedDeclCXX98Matches(StringRef Code, StringRef DeclName,
- StringRef ExpectedPrinted) {
+PrintedQualifiedNamedDeclCXX98Matches(StringRef Code, StringRef DeclName,
+  StringRef ExpectedPrinted) {
   std::vector Args(1, "-std=c++98");
-  return PrintedNamedDeclMatches(Code, Args,
- /*SuppressUnwrittenScope*/ false,
- namedDecl(hasName(DeclName)).bind("id"),
- ExpectedPrinted, "input.cc");
+  return PrintedQualifiedNamedDeclMatches(
+  Code, Args,
+  /*SuppressUnwrittenScope*/ false, namedDecl(hasName(DeclName)).bind("id"),
+  ExpectedPrinted, "input.cc");
 }
 
 ::testing::AssertionResult
-PrintedWrittenNamedDeclCXX11Matches(StringRef Code, StringRef DeclName,
-StringRef ExpectedPrinted) {
+PrintedWrittenQualifiedNamedDeclCXX11Matches(StringRef Code, StringRef DeclName,
+ StringRef ExpectedPrinted) {
   std::vector Args(1, "-std=c++11");
-  return PrintedNamedDeclMatches(Code, Args,
- /*SuppressUnwrittenScope*/ true,
- namedDecl(hasName(DeclName)).bind("id"),
- ExpectedPrinted, "input.cc");
+  return PrintedQualifiedNamedDeclMatches(
+  Code, Args,
+  /*SuppressUnwrittenScope*/ true, namedDecl(hasName(DeclName)).bind("id"),
+  ExpectedPrinted, "input.cc");
 }
 
-::testing::AssertionResult
-PrintedWrittenPropertyDeclObjCMatches(StringRef Code, StringRef DeclName,
-   StringRef ExpectedPrinted) {
+::testing::AssertionResult PrintedWrittenQualifiedPropertyDeclObjCMatches(
+StringRef Code, StringRef DeclName, StringRef ExpectedPrinted) {
   std::vector Args{"-std=c++11", "-xobjective-c++"};
-  return PrintedNamedDeclMatches(Code, Args,
- /*SuppressUnwrittenScope*/ true,
-

[PATCH] D85074: [WebAssembly] Use "signed char" instead of "char" in SIMD intrinsics.

2020-08-01 Thread Dan Gohman via Phabricator via cfe-commits
sunfish created this revision.
sunfish added a reviewer: tlively.
Herald added subscribers: jgravelle-google, sbc100, dschuff.
Herald added a project: clang.
sunfish requested review of this revision.
Herald added a subscriber: aheejin.

This allows people to use `int8_t` instead of `char`, -funsigned-char,
and generally decouples SIMD from the specialness of `char`.

And it makes intrinsics like `__builtin_wasm_add_saturate_s_i8x16`
and `__builtin_wasm_add_saturate_u_i8x16` use signed and unsigned
element types, respectively.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85074

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/lib/Headers/wasm_simd128.h

Index: clang/lib/Headers/wasm_simd128.h
===
--- clang/lib/Headers/wasm_simd128.h
+++ clang/lib/Headers/wasm_simd128.h
@@ -18,8 +18,7 @@
 
 // Internal types determined by clang builtin definitions
 typedef int32_t __v128_u __attribute__((__vector_size__(16), __aligned__(1)));
-typedef char __i8x16 __attribute__((__vector_size__(16), __aligned__(16)));
-typedef signed char __s8x16
+typedef signed char __i8x16
 __attribute__((__vector_size__(16), __aligned__(16)));
 typedef unsigned char __u8x16
 __attribute__((__vector_size__(16), __aligned__(16)));
@@ -340,17 +339,17 @@
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_eq(v128_t __a,
   v128_t __b) {
-  return (v128_t)((__s8x16)__a == (__s8x16)__b);
+  return (v128_t)((__i8x16)__a == (__i8x16)__b);
 }
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_ne(v128_t __a,
   v128_t __b) {
-  return (v128_t)((__s8x16)__a != (__s8x16)__b);
+  return (v128_t)((__i8x16)__a != (__i8x16)__b);
 }
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_lt(v128_t __a,
   v128_t __b) {
-  return (v128_t)((__s8x16)__a < (__s8x16)__b);
+  return (v128_t)((__i8x16)__a < (__i8x16)__b);
 }
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_lt(v128_t __a,
@@ -360,7 +359,7 @@
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_gt(v128_t __a,
   v128_t __b) {
-  return (v128_t)((__s8x16)__a > (__s8x16)__b);
+  return (v128_t)((__i8x16)__a > (__i8x16)__b);
 }
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_gt(v128_t __a,
@@ -370,7 +369,7 @@
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_le(v128_t __a,
   v128_t __b) {
-  return (v128_t)((__s8x16)__a <= (__s8x16)__b);
+  return (v128_t)((__i8x16)__a <= (__i8x16)__b);
 }
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_le(v128_t __a,
@@ -380,7 +379,7 @@
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_ge(v128_t __a,
   v128_t __b) {
-  return (v128_t)((__s8x16)__a >= (__s8x16)__b);
+  return (v128_t)((__i8x16)__a >= (__i8x16)__b);
 }
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_ge(v128_t __a,
@@ -602,7 +601,7 @@
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_i8x16_shr(v128_t __a,
int32_t __b) {
-  return (v128_t)((__s8x16)__a >> __b);
+  return (v128_t)((__i8x16)__a >> __b);
 }
 
 static __inline__ v128_t __DEFAULT_FN_ATTRS wasm_u8x16_shr(v128_t __a,
Index: clang/include/clang/Basic/BuiltinsWebAssembly.def
===
--- clang/include/clang/Basic/BuiltinsWebAssembly.def
+++ clang/include/clang/Basic/BuiltinsWebAssembly.def
@@ -66,67 +66,67 @@
 TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i64_f64, "LLid", "nc", "nontrapping-fptoint")
 
 // SIMD builtins
-TARGET_BUILTIN(__builtin_wasm_swizzle_v8x16, "V16cV16cV16c", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_swizzle_v8x16, "V16ScV16ScV16Sc", "nc", "simd128")
 
-TARGET_BUILTIN(__builtin_wasm_extract_lane_s_i8x16, "iV16cIi", "nc", "simd128")
-TARGET_BUILTIN(__builtin_wasm_extract_lane_u_i8x16, "iV16cIi", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_extract_lane_s_i8x16, "iV16ScIi", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_extract_lane_u_i8x16, "iV16UcIUi", "nc", "simd128")
 TARGET_BUILTIN(__builtin_wasm_extract_lane_s_i16x8, "iV8sIi", "nc", "simd128")
-TARGET_BUILTIN(__builtin_wasm_extract_lane_u_i16x8, "iV8sIi", "nc", "simd128")
+TARGET_BUILTIN(__builtin_wasm_extract_lane_u_i16x8, "iV8UsIUi", "nc", "simd128")
 TARGET_BUILTIN(__builtin_wasm_extract_lane_i32x4, "iV4iIi", "nc", "simd128")
 TARGET_BUILTIN(__builtin_wasm_extract_lane_i64x2, "LLiV2LLiIi", "nc", "simd128")
 TARGET_BUILTIN(__builtin_wasm_extract_lane_f32x4, "fV4fIi", "nc", "simd128")
 TARGET_BUILTIN(__builtin_wasm_extract_lane_f64x2, "dV2dIi", "nc", "simd128")
 
-TARGET_BUILTIN(__builtin_wasm_replace_lane_i8x16, "V16cV16cI

[PATCH] D84898: [clang-tidy] Add new checker for complex conditions with no meaning

2020-08-01 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

In D84898#2184931 , @vabridgers wrote:

> I believe all review comments have been address, except for the discussion on 
> implementing this in the CFE or as a tidy check.

Could try firing off an RFC to cfe-dev see if other people want to weigh in.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84898

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


[PATCH] D85028: [clangd] Support new/deleta operator in TargetFinder.

2020-08-01 Thread Nathan James via Phabricator via cfe-commits
njames93 added inline comments.



Comment at: clang-tools-extra/clangd/FindTarget.cpp:466-467
+  }
+  void VisitCXXDeleteExpr(const CXXDeleteExpr *CNE) {
+Outer.add(CNE->getOperatorDelete(), Flags);
+  }

nit:


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85028

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


[PATCH] D82317: [Clang/Test]: Update tests where `noundef` attribute is necessary

2020-08-01 Thread Gui Andrade via Phabricator via cfe-commits
guiand updated this revision to Diff 282328.
guiand added a comment.

Rebased; all tests passing again. Removed the change to the `ppc-*mmintrin.c` 
tests, instead I just use the -disable-noundef-args flag`. Cleaned up typos.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82317

Files:
  clang/test/ARCMT/objcmt-instancetype.m
  clang/test/ARCMT/objcmt-instancetype.m.result
  clang/test/ARCMT/objcmt-numeric-literals.m
  clang/test/ARCMT/objcmt-numeric-literals.m.result
  clang/test/CXX/except/except.spec/p14-ir.cpp
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks-irgen.mm
  clang/test/CXX/modules-ts/codegen-basics.cppm
  clang/test/CXX/special/class.copy/p3.cpp
  clang/test/CodeGen/2006-05-19-SingleEltReturn.c
  clang/test/CodeGen/2007-06-18-SextAttrAggregate.c
  clang/test/CodeGen/2009-02-13-zerosize-union-field.c
  clang/test/CodeGen/2009-05-04-EnumInreg.c
  clang/test/CodeGen/64bit-swiftcall.c
  clang/test/CodeGen/aapcs-align.cpp
  clang/test/CodeGen/aapcs-bitfield.c
  clang/test/CodeGen/aapcs64-align.cpp
  clang/test/CodeGen/aarch64-args.cpp
  clang/test/CodeGen/aarch64-bf16-getset-intrinsics.c
  clang/test/CodeGen/aarch64-byval-temp.c
  clang/test/CodeGen/aarch64-neon-3v.c
  clang/test/CodeGen/aarch64-neon-across.c
  clang/test/CodeGen/aarch64-neon-dot-product.c
  clang/test/CodeGen/aarch64-neon-extract.c
  clang/test/CodeGen/aarch64-neon-fcvt-intrinsics.c
  clang/test/CodeGen/aarch64-neon-fma.c
  clang/test/CodeGen/aarch64-neon-fp16fml.c
  clang/test/CodeGen/aarch64-neon-ldst-one.c
  clang/test/CodeGen/aarch64-neon-scalar-copy.c
  clang/test/CodeGen/aarch64-neon-scalar-x-indexed-elem.c
  clang/test/CodeGen/aarch64-neon-tbl.c
  clang/test/CodeGen/aarch64-neon-vcombine.c
  clang/test/CodeGen/aarch64-neon-vget-hilo.c
  clang/test/CodeGen/aarch64-neon-vget.c
  clang/test/CodeGen/aarch64-poly128.c
  clang/test/CodeGen/aarch64-poly64.c
  clang/test/CodeGen/aarch64-varargs.c
  clang/test/CodeGen/address-space-avr.c
  clang/test/CodeGen/address-space-field1.c
  clang/test/CodeGen/address-space.c
  clang/test/CodeGen/aggregate-assign-call.c
  clang/test/CodeGen/aix-return.c
  clang/test/CodeGen/aix-struct-arg.c
  clang/test/CodeGen/aix-vaargs.c
  clang/test/CodeGen/alias.c
  clang/test/CodeGen/align_value.cpp
  clang/test/CodeGen/alloc-align-attr.c
  clang/test/CodeGen/arc/arguments.c
  clang/test/CodeGen/arm-aapcs-vfp.c
  clang/test/CodeGen/arm-abi-vector.c
  clang/test/CodeGen/arm-arguments.c
  clang/test/CodeGen/arm-bf16-params-returns.c
  clang/test/CodeGen/arm-byval-align.c
  clang/test/CodeGen/arm-cmse-attr.c
  clang/test/CodeGen/arm-cmse-call.c
  clang/test/CodeGen/arm-float-helpers.c
  clang/test/CodeGen/arm-fp16-arguments.c
  clang/test/CodeGen/arm-homogenous.c
  clang/test/CodeGen/arm-mangle-bf16.cpp
  clang/test/CodeGen/arm-mve-intrinsics/vld24.c
  clang/test/CodeGen/arm-neon-directed-rounding.c
  clang/test/CodeGen/arm-neon-dot-product.c
  clang/test/CodeGen/arm-neon-fma.c
  clang/test/CodeGen/arm-neon-numeric-maxmin.c
  clang/test/CodeGen/arm-neon-vcvtX.c
  clang/test/CodeGen/arm-swiftcall.c
  clang/test/CodeGen/arm-varargs.c
  clang/test/CodeGen/arm-vector-arguments.c
  clang/test/CodeGen/arm-vfp16-arguments.c
  clang/test/CodeGen/arm-vfp16-arguments2.cpp
  clang/test/CodeGen/arm64-aapcs-arguments.c
  clang/test/CodeGen/arm64-abi-vector.c
  clang/test/CodeGen/arm64-arguments.c
  clang/test/CodeGen/arm64-microsoft-arguments.cpp
  clang/test/CodeGen/arm64_32-vaarg.c
  clang/test/CodeGen/arm64_32.c
  clang/test/CodeGen/arm64_vcopy.c
  clang/test/CodeGen/arm64_vdupq_n_f64.c
  clang/test/CodeGen/armv7k-abi.c
  clang/test/CodeGen/asm-label.c
  clang/test/CodeGen/assume-aligned-and-alloc-align-attributes.c
  clang/test/CodeGen/atomic-arm64.c
  clang/test/CodeGen/atomic-ops-libcall.c
  clang/test/CodeGen/atomic-ops.c
  clang/test/CodeGen/atomic_ops.c
  clang/test/CodeGen/atomics-inlining.c
  clang/test/CodeGen/attr-func-def.c
  clang/test/CodeGen/attr-naked.c
  clang/test/CodeGen/attr-no-tail.c
  clang/test/CodeGen/attr-nomerge.cpp
  clang/test/CodeGen/attr-target-mv-func-ptrs.c
  clang/test/CodeGen/attr-target-mv-va-args.c
  clang/test/CodeGen/attr-target-mv.c
  clang/test/CodeGen/attr-x86-interrupt.c
  clang/test/CodeGen/attributes.c
  clang/test/CodeGen/available-externally-hidden.cpp
  clang/test/CodeGen/available-externally-suppress.c
  clang/test/CodeGen/avx2-builtins.c
  clang/test/CodeGen/avx512-reduceMinMaxIntrin.c
  clang/test/CodeGen/big-atomic-ops.c
  clang/test/CodeGen/bittest-intrin.c
  clang/test/CodeGen/blocks.c
  clang/test/CodeGen/bool-convert.c
  clang/test/CodeGen/builtin-align-array.c
  clang/test/CodeGen/builtin-align.c
  clang/test/CodeGen/builtin-assume-aligned.c
  clang/test/CodeGen/builtin-attributes.c
  clang/test/CodeGen/builtin-memfns.c
  clang/test/CodeGen/builtin-sqrt.c
  clang/test/CodeGen/builtins-arm.c
  clang/test/CodeGen/builtins-memcpy-inline.c
  clang/test/CodeGen/builtins-ms

[PATCH] D85076: [clang][Tooling] Fix addTargetAndModeForProgramName to use correct flag names

2020-08-01 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
kadircet added a reviewer: hokein.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
kadircet requested review of this revision.

The logic was using incorrect flag versions. For example:

- `-target=` can't be a prefix, it must be `--target=`.
- `--driver-mode` can't appear on its own, value must be attached to it.

While fixing those, also changes the append logic to make use of new
`--target=X` format instead of the legacy `-target X` version.

In addition to that makes use of the OPTTable instead of hardcoded strings to
make sure helper also gets updated if clang's options are modified.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85076

Files:
  clang/lib/Tooling/Tooling.cpp
  clang/unittests/Tooling/ToolingTest.cpp

Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -621,7 +621,7 @@
   addTargetAndModeForProgramName(Args, "");
   EXPECT_EQ((std::vector{"clang", "-foo"}), Args);
   addTargetAndModeForProgramName(Args, Target + "-g++");
-  EXPECT_EQ((std::vector{"clang", "-target", Target,
+  EXPECT_EQ((std::vector{"clang", "--target=" + Target,
   "--driver-mode=g++", "-foo"}),
 Args);
 }
@@ -635,7 +635,7 @@
 
   std::vector Args = {"clang", "-foo"};
   addTargetAndModeForProgramName(Args, ToolPath);
-  EXPECT_EQ((std::vector{"clang", "-target", Target,
+  EXPECT_EQ((std::vector{"clang", "--target=" + Target,
   "--driver-mode=g++", "-foo"}),
 Args);
 }
@@ -650,10 +650,10 @@
   "-target", "something"}),
 Args);
 
-  std::vector ArgsAlt = {"clang", "-foo", "-target=something"};
+  std::vector ArgsAlt = {"clang", "-foo", "--target=something"};
   addTargetAndModeForProgramName(ArgsAlt, Target + "-g++");
   EXPECT_EQ((std::vector{"clang", "--driver-mode=g++", "-foo",
-  "-target=something"}),
+  "--target=something"}),
 ArgsAlt);
 }
 
@@ -663,15 +663,9 @@
 
   std::vector Args = {"clang", "-foo", "--driver-mode=abc"};
   addTargetAndModeForProgramName(Args, Target + "-g++");
-  EXPECT_EQ((std::vector{"clang", "-target", Target, "-foo",
+  EXPECT_EQ((std::vector{"clang", "--target=" + Target, "-foo",
   "--driver-mode=abc"}),
 Args);
-
-  std::vector ArgsAlt = {"clang", "-foo", "--driver-mode", "abc"};
-  addTargetAndModeForProgramName(ArgsAlt, Target + "-g++");
-  EXPECT_EQ((std::vector{"clang", "-target", Target, "-foo",
-  "--driver-mode", "abc"}),
-ArgsAlt);
 }
 
 #ifndef _WIN32
Index: clang/lib/Tooling/Tooling.cpp
===
--- clang/lib/Tooling/Tooling.cpp
+++ clang/lib/Tooling/Tooling.cpp
@@ -245,27 +245,37 @@
 
 void addTargetAndModeForProgramName(std::vector &CommandLine,
 StringRef InvokedAs) {
-  if (!CommandLine.empty() && !InvokedAs.empty()) {
-bool AlreadyHasTarget = false;
-bool AlreadyHasMode = false;
-// Skip CommandLine[0].
-for (auto Token = ++CommandLine.begin(); Token != CommandLine.end();
- ++Token) {
-  StringRef TokenRef(*Token);
-  AlreadyHasTarget |=
-  (TokenRef == "-target" || TokenRef.startswith("-target="));
-  AlreadyHasMode |= (TokenRef == "--driver-mode" ||
- TokenRef.startswith("--driver-mode="));
-}
-auto TargetMode =
-driver::ToolChain::getTargetAndModeFromProgramName(InvokedAs);
-if (!AlreadyHasMode && TargetMode.DriverMode) {
-  CommandLine.insert(++CommandLine.begin(), TargetMode.DriverMode);
-}
-if (!AlreadyHasTarget && TargetMode.TargetIsValid) {
-  CommandLine.insert(++CommandLine.begin(), {"-target",
- TargetMode.TargetPrefix});
-}
+  if (CommandLine.empty() || InvokedAs.empty())
+return;
+  const auto &Table = driver::getDriverOptTable();
+  // --target=X
+  const std::string TargetOPT =
+  Table.getOption(driver::options::OPT_target).getPrefixedName();
+  // -target X
+  const std::string TargetOPTLegacy =
+  Table.getOption(driver::options::OPT_target_legacy_spelling)
+  .getPrefixedName();
+  // --driver-mode=X
+  const std::string DriverModeOPT =
+  Table.getOption(driver::options::OPT_driver_mode).getPrefixedName();
+  bool AlreadyHasTarget = false;
+  bool AlreadyHasMode = false;
+  // Skip CommandLine[0].
+  for (auto Token = ++CommandLine.begin(); Token != CommandLine.end();
+   ++Token) {
+StringRef TokenRef(*Token);
+AlreadyHasTarget |=
+TokenRef.startswith(TargetOPT) || TokenRef.equals(TargetOPTLegacy);
+AlreadyHasM

[PATCH] D85077: [clang][Tooling] Optimize addTargetAndMode in case of invalid modes

2020-08-01 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
kadircet added a reviewer: hokein.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
kadircet requested review of this revision.

This skips searching for `target` related flags in the existing args if
we don't have a valid target to insert.

Depends on D85076 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85077

Files:
  clang/lib/Tooling/Tooling.cpp


Index: clang/lib/Tooling/Tooling.cpp
===
--- clang/lib/Tooling/Tooling.cpp
+++ clang/lib/Tooling/Tooling.cpp
@@ -258,7 +258,10 @@
   // --driver-mode=X
   const std::string DriverModeOPT =
   Table.getOption(driver::options::OPT_driver_mode).getPrefixedName();
-  bool AlreadyHasTarget = false;
+  auto TargetMode =
+  driver::ToolChain::getTargetAndModeFromProgramName(InvokedAs);
+  // No need to search for target args if we don't have a mode to insert.
+  bool AlreadyHasTarget = !TargetMode.TargetIsValid;
   bool AlreadyHasMode = false;
   // Skip CommandLine[0].
   for (auto Token = ++CommandLine.begin(); Token != CommandLine.end();
@@ -268,12 +271,10 @@
 TokenRef.startswith(TargetOPT) || TokenRef.equals(TargetOPTLegacy);
 AlreadyHasMode |= TokenRef.startswith(DriverModeOPT);
   }
-  auto TargetMode =
-  driver::ToolChain::getTargetAndModeFromProgramName(InvokedAs);
   if (!AlreadyHasMode && TargetMode.DriverMode) {
 CommandLine.insert(++CommandLine.begin(), TargetMode.DriverMode);
   }
-  if (!AlreadyHasTarget && TargetMode.TargetIsValid) {
+  if (!AlreadyHasTarget) {
 CommandLine.insert(++CommandLine.begin(),
TargetOPT + TargetMode.TargetPrefix);
   }


Index: clang/lib/Tooling/Tooling.cpp
===
--- clang/lib/Tooling/Tooling.cpp
+++ clang/lib/Tooling/Tooling.cpp
@@ -258,7 +258,10 @@
   // --driver-mode=X
   const std::string DriverModeOPT =
   Table.getOption(driver::options::OPT_driver_mode).getPrefixedName();
-  bool AlreadyHasTarget = false;
+  auto TargetMode =
+  driver::ToolChain::getTargetAndModeFromProgramName(InvokedAs);
+  // No need to search for target args if we don't have a mode to insert.
+  bool AlreadyHasTarget = !TargetMode.TargetIsValid;
   bool AlreadyHasMode = false;
   // Skip CommandLine[0].
   for (auto Token = ++CommandLine.begin(); Token != CommandLine.end();
@@ -268,12 +271,10 @@
 TokenRef.startswith(TargetOPT) || TokenRef.equals(TargetOPTLegacy);
 AlreadyHasMode |= TokenRef.startswith(DriverModeOPT);
   }
-  auto TargetMode =
-  driver::ToolChain::getTargetAndModeFromProgramName(InvokedAs);
   if (!AlreadyHasMode && TargetMode.DriverMode) {
 CommandLine.insert(++CommandLine.begin(), TargetMode.DriverMode);
   }
-  if (!AlreadyHasTarget && TargetMode.TargetIsValid) {
+  if (!AlreadyHasTarget) {
 CommandLine.insert(++CommandLine.begin(),
TargetOPT + TargetMode.TargetPrefix);
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D84839: Add document outline symbols from unnamed contexts, e.g. extern "C".

2020-08-01 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks, lgtm!

let me know if i should land this for you


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84839

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


[PATCH] D85028: [clangd] Support new/deleta operator in TargetFinder.

2020-08-01 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment.

please note that this might require special handling for go-to-def. as 
go-to-def only jumps to canonical decl and in operator new's case the user 
provided one might not be canonical, whereas the canonical one is likely 
builtin without a source info.

also you have a typo in the review's title s/deleta/delete.

LGTM if you are not planning to make this work with go-to-def now (or ever), 
please LMK.




Comment at: clang-tools-extra/clangd/unittests/FindTargetTests.cpp:564
+  Code = R"cpp(
+struct X {
+  static void *operator new(unsigned long s);

nit: you can simplify to (same for delete)

```cpp
void *operator new(unsigned long);
void foo() { new int; }
```



Comment at: clang-tools-extra/clangd/unittests/FindTargetTests.cpp:565
+struct X {
+  static void *operator new(unsigned long s);
+};

you might want to set --target to a fix triplet to ensure `size_t == unsigned 
long`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85028

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


[PATCH] D84839: Add document outline symbols from unnamed contexts, e.g. extern "C".

2020-08-01 Thread Ilya Golovenko via Phabricator via cfe-commits
ilya-golovenko added a comment.

In D84839#2189120 , @kadircet wrote:

> thanks, lgtm!
>
> let me know if i should land this for you

Thank you much for the review.

I don't have commit access so could you please land it for me:
Ilya Golovenko 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84839

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


[PATCH] D84600: [Analyzer] Support note tags for smart ptr checker

2020-08-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:408-412
+SmallString<128> Msg;
+llvm::raw_svector_ostream Out(Msg);
+TagDetails.trackValidExpr(BR);
+TagDetails.explainSmartPtrAction(Out);
+return std::string(Out.str());

vrnithinkumar wrote:
> NoQ wrote:
> > NoQ wrote:
> > > vrnithinkumar wrote:
> > > > NoQ wrote:
> > > > > NoQ wrote:
> > > > > > Ok, note that note tags are attached to nodes independently of bug 
> > > > > > reports; when the report is thrown, only then we know what are the 
> > > > > > smart pointers that should be explained.
> > > > > > 
> > > > > > So there are two checks that you should do here:
> > > > > > 
> > > > > > 1. Check that the bug report is emitted by your checker (eg., by 
> > > > > > comparing bug types). If not, don't add notes.
> > > > > > 
> > > > > > 2. Check that the region about which the note speaks is related to 
> > > > > > your report (i.e., it's not a completely unrelated smart pointer). 
> > > > > > You can do that by marking the smart pointer as "interesting" 
> > > > > > (i.e., `PathSensitiveBugReport::markIntersting()`) when you emit 
> > > > > > the report, and then in the lambda you check whether the smart 
> > > > > > pointer is interesting before you emit a note. Additionally, you 
> > > > > > can carry over interestingness when smart pointers are copied.
> > > > > > 
> > > > > > This is what i was trying to accomplish with this code snippet that 
> > > > > > i included in the examples in the other comment:
> > > > > > ```lang=c++
> > > > > >   if (&BR.getBugType() != &NullDereferenceBugType || 
> > > > > > !R->isInteresting())
> > > > > > return "";
> > > > > > ```
> > > > > (i strongly recommend having test cases for both of these issues)
> > > > I was stuck on how to check the 2 cases from `SmartPtrModeling`.
> > > > 
> > > > 1. I was not able to figure out how to access `NullDereferenceBugType` 
> > > > defined in the `SmartPtrChecker` in `SmartPtrModeling` to check 
> > > > `&BR.getBugType() != &NullDereferenceBugType`. Since 
> > > > `NullDereferenceBugType` is part of the `SmartPtrChecker` I could not 
> > > > access it from `PathSensitiveBugReport`.  One way I figured out is to 
> > > > use `getCheckerName()` on BugType and compare the string. I feel this 
> > > > one as little hacky.
> > > > 
> > > > 
> > > > 2. I got stuck on how will we implement the `!R->isInteresting()` in 
> > > > case of the bug report is added by some other checker on some other 
> > > > region. For below test case, bug report is added on a raw pointer by 
> > > > `CallAndMessageChecker` and the `!R->isInteresting()` will not satisfy 
> > > > and we will not be adding note tags where `unique_ptr` is released. I 
> > > > tried getting the LHS region for `A *AP = P.release();` assignment 
> > > > operation and check if the region is interesting but not sure whether 
> > > > its gonna work for some complex assignment cases.
> > > > 
> > > > ```
> > > > void derefOnReleasedNullRawPtr() {
> > > >   std::unique_ptr P;
> > > >   A *AP = P.release(); // expected-note {{'AP' initialized to a null 
> > > > pointer value}}
> > > >   // expected-note@-1 {{Smart pointer 'P' is released and set to null}}
> > > >   AP->foo(); // expected-warning {{Called C++ object pointer is null 
> > > > [core.CallAndMessage]}}
> > > >   // expected-note@-1{{Called C++ object pointer is null}}
> > > > }
> > > > ```
> > > > Since `NullDereferenceBugType` is part of the `SmartPtrChecker` I could 
> > > > not access it from `PathSensitiveBugReport`.
> > > 
> > > You shouldn't be accessing it from the bug report, you should be 
> > > accessing it from the lambda. See the example code snippets in 
> > > D84600#inline-779418
> > > 
> > > > For below test case, bug report is added on a raw pointer by 
> > > > `CallAndMessageChecker` and the `!R->isInteresting()` will not satisfy 
> > > > and we will not be adding note tags where `unique_ptr` is released.
> > > 
> > > That's an interesting question (no pun intended). The way i imagine this 
> > > working is: the note tag for `.release()` should try to figure out 
> > > whether the raw pointer is tracked and mark the smart pointer as 
> > > interesting based on that. If the raw pointer was a symbol that would 
> > > have been easy (either null dereference checker or 
> > > `trackExpressionValue()` could mark it as interesting). But for concrete 
> > > null pointer this won't work.
> > > 
> > > Maybe we should consider introducing interesting expressions. I.e., when 
> > > `trackExpressionValue()` reaches the call-expression `P.release()`, it 
> > > has to stop there. But if it also marked the call-expression as 
> > > interesting, the note tag provided by the checker could read that 
> > > interestingness information and act upon it by marking the smart pointer 
> > > region as interesting.
> > >  That's an interesting question
> > 
> > 

[PATCH] D84898: [clang-tidy] Add new checker for complex conditions with no meaning

2020-08-01 Thread Vince Bridgers via Phabricator via cfe-commits
vabridgers added a comment.

@njames93, I'll take a crack at implementing a cfe diagnostic for this, see how 
far I get. Cheers :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84898

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


[PATCH] D84987: Pass bugreport URL to standalone clang build

2020-08-01 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D84987#2186639 , @mgorny wrote:

> In D84987#2186113 , @MaskRay wrote:
>
>> I am not familiar with the standalone clang build. Can you share a command?
>
> You install LLVM first, then run `cmake /clang` and build 
> it.

Can you elaborate? The so-called "standalone build" isn't documented anywhere. 
My llvm-config is in `/tmp/RelA/bin/llvm-config`. I run 
`PATH=/tmp/RelA/bin:$PATH cmake -GNinja -H/path/to//clang -BTest`, it fails:

  -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed
  CMake Error at /tmp/RelA/lib/cmake/llvm/AddLLVM.cmake:823 (add_executable):
add_executable cannot create target "clang-tblgen" because an imported
target with the same name already exists.
  Call Stack (most recent call first):
/tmp/RelA/lib/cmake/llvm/TableGen.cmake:148 (add_llvm_executable)
utils/TableGen/CMakeLists.txt:3 (add_tablegen)
  
  
  CMake Error at /tmp/RelA/lib/cmake/llvm/LLVM-Config.cmake:105 
(target_link_libraries):
Cannot specify link libraries for target "clang-tblgen" which is not built
by this project.
  Call Stack (most recent call first):
/tmp/RelA/lib/cmake/llvm/LLVM-Config.cmake:93 (explicit_llvm_config)
/tmp/RelA/lib/cmake/llvm/AddLLVM.cmake:867 (llvm_config)
/tmp/RelA/lib/cmake/llvm/TableGen.cmake:148 (add_llvm_executable)
utils/TableGen/CMakeLists.txt:3 (add_tablegen)
  
  
  -- Configuring incomplete, errors occurred!
  See also "/tmp/c/Test/CMakeFiles/CMakeOutput.log".
  See also "/tmp/c/Test/CMakeFiles/CMakeError.log".


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

https://reviews.llvm.org/D84987

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


[clang] 25af353 - [NewPM][LVI] Abandon LVI after CVP

2020-08-01 Thread Nikita Popov via cfe-commits

Author: Nikita Popov
Date: 2020-08-01T23:47:46+02:00
New Revision: 25af353b0e74907d5d50c8616b885bd1f73a68b3

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

LOG: [NewPM][LVI] Abandon LVI after CVP

As mentioned on D70376, LVI can currently cause performance issues
when running under NewPM. The problem is that, unlike the legacy
pass manager, NewPM will not immediately discard the LVI analysis
if the following pass does not need it. This is a problem, because
LVI has a high memory requirement, and mass invalidation of LVI
values is very inefficient. LVI should only be alive during passes
that actively interact with it.

This patch addresses the issue by explicitly abandoning LVI after CVP,
which gets us back to the LegacyPM behavior.

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

Added: 


Modified: 
clang/test/CodeGen/thinlto-distributed-newpm.ll
llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
llvm/test/Other/new-pm-defaults.ll
llvm/test/Other/new-pm-thinlto-defaults.ll
llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll

Removed: 




diff  --git a/clang/test/CodeGen/thinlto-distributed-newpm.ll 
b/clang/test/CodeGen/thinlto-distributed-newpm.ll
index caf294df8eb8..9f9a8bec4ef5 100644
--- a/clang/test/CodeGen/thinlto-distributed-newpm.ll
+++ b/clang/test/CodeGen/thinlto-distributed-newpm.ll
@@ -97,6 +97,7 @@
 ; CHECK-O: Running pass: JumpThreadingPass on main
 ; CHECK-O: Running analysis: LazyValueAnalysis on main
 ; CHECK-O: Running pass: CorrelatedValuePropagationPass on main
+; CHECK-O: Invalidating analysis: LazyValueAnalysis on main
 ; CHECK-O: Running pass: SimplifyCFGPass on main
 ; CHECK-O3: Running pass: AggressiveInstCombinePass on main
 ; CHECK-O: Running pass: InstCombinePass on main
@@ -144,7 +145,6 @@
 ; CHECK-O: Invalidating analysis: BasicAA on main
 ; CHECK-O: Invalidating analysis: AAManager on main
 ; CHECK-O: Invalidating analysis: MemorySSAAnalysis on main
-; CHECK-O: Invalidating analysis: LazyValueAnalysis on main
 ; CHECK-O: Invalidating analysis: LoopAnalysis on main
 ; CHECK-O: Invalidating analysis: PhiValuesAnalysis on main
 ; CHECK-O: Invalidating analysis: MemoryDependenceAnalysis on main

diff  --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp 
b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index 48968166c605..397d62a5d21d 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -973,11 +973,19 @@ CorrelatedValuePropagationPass::run(Function &F, 
FunctionAnalysisManager &AM) {
 
   bool Changed = runImpl(F, LVI, DT, getBestSimplifyQuery(AM, F));
 
-  if (!Changed)
-return PreservedAnalyses::all();
   PreservedAnalyses PA;
-  PA.preserve();
-  PA.preserve();
-  PA.preserve();
+  if (!Changed) {
+PA = PreservedAnalyses::all();
+  } else {
+PA.preserve();
+PA.preserve();
+PA.preserve();
+  }
+
+  // Keeping LVI alive is expensive, both because it uses a lot of memory, and
+  // because invalidating values in LVI is expensive. While CVP does preserve
+  // LVI, we know that passes after JumpThreading+CVP will not need the result
+  // of this analysis, so we forcefully discard it early.
+  PA.abandon();
   return PA;
 }

diff  --git a/llvm/test/Other/new-pm-defaults.ll 
b/llvm/test/Other/new-pm-defaults.ll
index 8f75e3ce0bf3..59c24acb17f0 100644
--- a/llvm/test/Other/new-pm-defaults.ll
+++ b/llvm/test/Other/new-pm-defaults.ll
@@ -147,6 +147,7 @@
 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
+; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
 ; CHECK-O3-NEXT: AggressiveInstCombinePass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
@@ -200,7 +201,9 @@
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
+; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
+; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
 ; CHECK-O23SZ-NEXT: Starting llvm::Function pass manager run.
 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass

diff  --git a/llvm/test/Other/new-pm-thinlto-defaults.ll 
b/llvm/test/Other/new-pm-thinlto-defaults.ll
index a39656cd26f6..0b9b52a57e2a 100644
--- a/llvm/test/Other/new-pm-t

[PATCH] D84959: [NewPM][LVI] Abandon LVI after CVP

2020-08-01 Thread Nikita Popov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG25af353b0e74: [NewPM][LVI] Abandon LVI after CVP (authored 
by nikic).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84959

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll

Index: llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
@@ -93,6 +93,7 @@
 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
+; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
 ; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
@@ -152,7 +153,9 @@
 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
+; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
+; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
 ; CHECK-O23SZ-NEXT: Starting {{.*}}Function pass manager run
 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
Index: llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
@@ -127,6 +127,7 @@
 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
 ; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
+; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
 ; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
 ; CHECK-O-NEXT: Running pass: InstCombinePass
@@ -196,7 +197,9 @@
 ; CHECK-O-NEXT: Running analysis: DemandedBitsAnalysis
 ; CHECK-O-NEXT: Running pass: InstCombinePass
 ; CHECK-O23SZ-NEXT: Running pass: JumpThreadingPass
+; CHECK-O23SZ-NEXT: Running analysis: LazyValueAnalysis
 ; CHECK-O23SZ-NEXT: Running pass: CorrelatedValuePropagationPass
+; CHECK-O23SZ-NEXT: Invalidating analysis: LazyValueAnalysis
 ; CHECK-O23SZ-NEXT: Running pass: DSEPass
 ; CHECK-O23SZ-NEXT: Starting {{.*}}Function pass manager run
 ; CHECK-O23SZ-NEXT: Running pass: LoopSimplifyPass
@@ -213,10 +216,26 @@
 ; CHECK-O-NEXT: Finished CGSCC pass manager run.
 ; CHECK-O-NEXT: Finished {{.*}}Module pass manager run.
 ; CHECK-O-NEXT: Finished {{.*}}Module pass manager run.
+; CHECK-O23SZ-NEXT: Clearing all analysis results for: 
+; CHECK-O23SZ-NEXT: Invalidating analysis: DominatorTreeAnalysis
+; CHECK-O23SZ-NEXT: Invalidating analysis: MemorySSAAnalysis
+; CHECK-O23SZ-NEXT: Invalidating analysis: LoopAnalysis
+; CHECK-O23SZ-NEXT: Invalidating analysis: PostDominatorTreeAnalysis
+; CHECK-O23SZ-NEXT: Invalidating analysis: BranchProbabilityAnalysis
+; CHECK-O23SZ-NEXT: Invalidating analysis: BlockFrequencyAnalysis
+; CHECK-O23SZ-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
+; CHECK-O23SZ-NEXT: Invalidating analysis: InnerAnalysisManagerProxy
+; CHECK-O23SZ-NEXT: Invalidating analysis: PhiValuesAnalysis
+; CHECK-O23SZ-NEXT: Invalidating analysis: MemoryDependenceAnalysis
+; CHECK-O23SZ-NEXT: Invalidating analysis: DemandedBitsAnalysis
+; CHECK-O3-NEXT: Invalidating analysis: DominanceFrontierAnalysis
+; CHECK-O3-NEXT: Invalidating analysis: RegionInfoAnalysis
+; CHECK-O23SZ-NEXT: Clearing all analysis results for: foo
 ; CHECK-O-NEXT: Running pass: GlobalOptPass
 ; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis on bar
 ; CHECK-EXT: Running pass: {{.*}}::Bye
 ; CHECK-O-NEXT: Finished {{.*}}Module pass manager run.
+; CHECK-O23SZ-NEXT: Clearing all analysis results for: foo
 ; CHECK-O-NEXT: Running pass: NameAnonGlobalPass
 ; CHECK-O-NEXT: Running pass: PrintModulePass
 
Index: llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
===
--- llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
+++ llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
@@ -94,6 +94,7 @@
 ; CHEC

[PATCH] D84987: Pass bugreport URL to standalone clang build

2020-08-01 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Is `RelA` an actual result of `install` target, or just the build tree? I think 
it needs to be the former.


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

https://reviews.llvm.org/D84987

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


[clang] 8dd4e3c - Updated the -I option description.

2020-08-01 Thread Andrei Lebedev via cfe-commits

Author: Andrei Lebedev
Date: 2020-08-01T15:54:11-07:00
New Revision: 8dd4e3ceb804a58bcf25e6856fc6fde5e1995a66

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

LOG: Updated the -I option description.

Added: 


Modified: 
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Options.td

Removed: 




diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 699a0be72036..8eb010eae265 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -1014,9 +1014,9 @@ Include path management
 
 Flags controlling how ``#include``\s are resolved to files.
 
-.. option:: -I, --include-directory , --include-directory=
+.. option:: -I, --include-directory , --include-directory=
 
-Add directory  to the list of include files search paths. If there are 
multiple -I options, these directories are searched in the order they are given 
before the standard system directories are searched. If the same directory is 
in the SYSTEM include search paths, for example if also specified with 
-isystem, the -I option will be ignored
+Add directory to include search path. If there are multiple -I options, these 
directories are searched in the order they are given before the standard system 
directories are searched. If the same directory is in the SYSTEM include search 
paths, for example if also specified with -isystem, the -I option will be 
ignored
 
 .. option:: -I-, --include-barrier
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 889035a0815e..16051934c1e0 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -395,7 +395,12 @@ def I_ : Flag<["-"], "I-">, Group,
  "remove current directory from include path">;
 def I : JoinedOrSeparate<["-"], "I">, Group,
 Flags<[CC1Option,CC1AsOption]>, MetaVarName<"">,
-HelpText<"Add directory to include search path">;
+HelpText<"Add directory to include search path. If there are multiple -I "
+ "options, these directories are searched in the order they are "
+ "given before the standard system directories are searched. "
+ "If the same directory is in the SYSTEM include search paths, for 
"
+ "example if also specified with -isystem, the -I option will be "
+ "ignored">;
 def L : JoinedOrSeparate<["-"], "L">, Flags<[RenderJoined]>, Group,
 MetaVarName<"">, HelpText<"Add directory to library search path">;
 def MD : Flag<["-"], "MD">, Group,
@@ -1244,7 +1249,7 @@ def finline_functions : Flag<["-"], "finline-functions">, 
Group,
 def finline_hint_functions: Flag<["-"], "finline-hint-functions">, 
Group, Flags<[CC1Option]>,
   HelpText<"Inline functions which are (explicitly or implicitly) marked 
inline">;
 def finline : Flag<["-"], "finline">, Group;
-def fglobal_isel : Flag<["-"], "fglobal-isel">, Group, 
+def fglobal_isel : Flag<["-"], "fglobal-isel">, Group,
   HelpText<"Enables the global instruction selector">;
 def fexperimental_isel : Flag<["-"], "fexperimental-isel">, 
Group,
   Alias;



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


[PATCH] D85084: [modules] Repro for pure virtual base class method crash

2020-08-01 Thread Andrew Gallagher via Phabricator via cfe-commits
andrewjcg created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
andrewjcg requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85084

Files:
  clang/test/Modules/Inputs/set-pure-crash/a.h
  clang/test/Modules/Inputs/set-pure-crash/b.h
  clang/test/Modules/Inputs/set-pure-crash/c.h
  clang/test/Modules/Inputs/set-pure-crash/module.modulemap
  clang/test/Modules/set-pure-crash.cpp


Index: clang/test/Modules/set-pure-crash.cpp
===
--- /dev/null
+++ clang/test/Modules/set-pure-crash.cpp
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -O0 -emit-llvm -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -x c++ -I %S/Inputs/set-pure-crash -verify %s -o %t
+
+// expected-no-diagnostics
+
+#include "b.h"
+#include "c.h"
+
+auto t = func();
Index: clang/test/Modules/Inputs/set-pure-crash/module.modulemap
===
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/module.modulemap
@@ -0,0 +1,11 @@
+module a {
+  header "a.h"
+}
+
+module b {
+  header "b.h"
+}
+
+module c {
+  header "c.h"
+}
Index: clang/test/Modules/Inputs/set-pure-crash/c.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/c.h
@@ -0,0 +1,5 @@
+#pragma once
+
+template 
+struct func {
+};
Index: clang/test/Modules/Inputs/set-pure-crash/b.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/b.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "a.h"
+#include "c.h"
+
+template >
+void foo(Fun) {}
+
+class Child : public Base {
+public:
+  void func() {
+foo([]() {});
+  }
+};
Index: clang/test/Modules/Inputs/set-pure-crash/a.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/a.h
@@ -0,0 +1,11 @@
+#pragma once
+
+struct Tag {};
+
+template 
+class Base {
+public:
+  virtual void func() = 0;
+};
+
+Base bar();


Index: clang/test/Modules/set-pure-crash.cpp
===
--- /dev/null
+++ clang/test/Modules/set-pure-crash.cpp
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -O0 -emit-llvm -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I %S/Inputs/set-pure-crash -verify %s -o %t
+
+// expected-no-diagnostics
+
+#include "b.h"
+#include "c.h"
+
+auto t = func();
Index: clang/test/Modules/Inputs/set-pure-crash/module.modulemap
===
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/module.modulemap
@@ -0,0 +1,11 @@
+module a {
+  header "a.h"
+}
+
+module b {
+  header "b.h"
+}
+
+module c {
+  header "c.h"
+}
Index: clang/test/Modules/Inputs/set-pure-crash/c.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/c.h
@@ -0,0 +1,5 @@
+#pragma once
+
+template 
+struct func {
+};
Index: clang/test/Modules/Inputs/set-pure-crash/b.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/b.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "a.h"
+#include "c.h"
+
+template >
+void foo(Fun) {}
+
+class Child : public Base {
+public:
+  void func() {
+foo([]() {});
+  }
+};
Index: clang/test/Modules/Inputs/set-pure-crash/a.h
===
--- /dev/null
+++ clang/test/Modules/Inputs/set-pure-crash/a.h
@@ -0,0 +1,11 @@
+#pragma once
+
+struct Tag {};
+
+template 
+class Base {
+public:
+  virtual void func() = 0;
+};
+
+Base bar();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D84987: Pass bugreport URL to standalone clang build

2020-08-01 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Verified. I added `CMAKE_PREFIX_PATH` to my `/tmp/RelA/CMakeCache.txt` and 
invoked `ninja install` (this installed a bunch of unrelated files. I don't 
know know how to just install-cmake-exports and files it requires (.e.g 
LLVMDemangler.a)).

A standalone build of clang prints: `PLEASE submit a bug report to  and include 
the crash backtrace, preprocessed source , and associated run script.` running 
on a file with `#pragma clang __debug parser_crash`

This patch fixes it.


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

https://reviews.llvm.org/D84987

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


[PATCH] D84898: [clang-tidy] Add new checker for complex conditions with no meaning

2020-08-01 Thread Vince Bridgers via Phabricator via cfe-commits
vabridgers added a comment.

Looks like this can be implemented as a warning in the cfe (as @lebedev.ri 
suggested). I'll probably abandon this review, but will keep it active until I 
have the alternative cfe warning patch prepared.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84898

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


[clang] 21c165d - [CMake] Pass bugreport URL to standalone clang build

2020-08-01 Thread Michał Górny via cfe-commits

Author: Michał Górny
Date: 2020-08-02T08:32:05+02:00
New Revision: 21c165de2a1bcca9dceb452f637d9e8959fba113

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

LOG: [CMake] Pass bugreport URL to standalone clang build

BUG_REPORT_URL is currently used both in LLVM and in Clang but declared
only in the latter.  This means that it's missing in standalone clang
builds and the driver ends up outputting:

  PLEASE submit a bug report to  and include [...]

(note the missing URL)

To fix this, include LLVM_PACKAGE_BUGREPORT in LLVMConfig.cmake
(similarly to how we pass PACKAGE_VERSION) and use it to fill
BUG_REPORT_URL when building clang standalone.

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

Added: 


Modified: 
clang/CMakeLists.txt
llvm/cmake/modules/LLVMConfig.cmake.in

Removed: 




diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 0f08538495fc..c487e506cae1 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -121,6 +121,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
   include(LLVMDistributionSupport)
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
+  set(BUG_REPORT_URL "${LLVM_PACKAGE_BUGREPORT}" CACHE STRING
+"Default URL where bug reports are to be submitted.")
 
   if (NOT DEFINED LLVM_INCLUDE_TESTS)
 set(LLVM_INCLUDE_TESTS ON)

diff  --git a/llvm/cmake/modules/LLVMConfig.cmake.in 
b/llvm/cmake/modules/LLVMConfig.cmake.in
index 17cc5eacc57b..a5c370bbc25e 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -7,6 +7,7 @@ set(LLVM_VERSION_MINOR @LLVM_VERSION_MINOR@)
 set(LLVM_VERSION_PATCH @LLVM_VERSION_PATCH@)
 set(LLVM_VERSION_SUFFIX @LLVM_VERSION_SUFFIX@)
 set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@)
+set(LLVM_PACKAGE_BUGREPORT @PACKAGE_BUGREPORT@)
 
 set(LLVM_BUILD_TYPE @CMAKE_BUILD_TYPE@)
 



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


[PATCH] D84987: [CMake] Pass bugreport URL to standalone clang build

2020-08-01 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Thanks!


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

https://reviews.llvm.org/D84987

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


[PATCH] D84987: [CMake] Pass bugreport URL to standalone clang build

2020-08-01 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG21c165de2a1b: [CMake] Pass bugreport URL to standalone clang 
build (authored by mgorny).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84987

Files:
  clang/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in


Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -7,6 +7,7 @@
 set(LLVM_VERSION_PATCH @LLVM_VERSION_PATCH@)
 set(LLVM_VERSION_SUFFIX @LLVM_VERSION_SUFFIX@)
 set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@)
+set(LLVM_PACKAGE_BUGREPORT @PACKAGE_BUGREPORT@)
 
 set(LLVM_BUILD_TYPE @CMAKE_BUILD_TYPE@)
 
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -121,6 +121,8 @@
   include(LLVMDistributionSupport)
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
+  set(BUG_REPORT_URL "${LLVM_PACKAGE_BUGREPORT}" CACHE STRING
+"Default URL where bug reports are to be submitted.")
 
   if (NOT DEFINED LLVM_INCLUDE_TESTS)
 set(LLVM_INCLUDE_TESTS ON)


Index: llvm/cmake/modules/LLVMConfig.cmake.in
===
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -7,6 +7,7 @@
 set(LLVM_VERSION_PATCH @LLVM_VERSION_PATCH@)
 set(LLVM_VERSION_SUFFIX @LLVM_VERSION_SUFFIX@)
 set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@)
+set(LLVM_PACKAGE_BUGREPORT @PACKAGE_BUGREPORT@)
 
 set(LLVM_BUILD_TYPE @CMAKE_BUILD_TYPE@)
 
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -121,6 +121,8 @@
   include(LLVMDistributionSupport)
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
+  set(BUG_REPORT_URL "${LLVM_PACKAGE_BUGREPORT}" CACHE STRING
+"Default URL where bug reports are to be submitted.")
 
   if (NOT DEFINED LLVM_INCLUDE_TESTS)
 set(LLVM_INCLUDE_TESTS ON)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits