[PATCH] D64301: Use `ln -n` to prevent forming a symlink cycle, instead of rm'ing the source

2019-07-27 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Thanks for sharing! (And for the fix, and apologies for breaking you.)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D64301



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


[PATCH] D65373: [clangd] Update features table in the docs with links to LSP extension proposals

2019-07-27 Thread Nathan Ridge via Phabricator via cfe-commits
nridge marked an inline comment as done.
nridge added inline comments.



Comment at: clang-tools-extra/docs/clangd/Features.rst:266
 +-++--+
-| Organize Includes   | No |   No |
+| Organize Includes   | Yes|   No |
 +-++--+

Note, I changed "Organize Includes" to "Yes" because it doesn't need a new 
protocol: it's meant to use `textDocument/codeAction` (there's even a 
`CodeActionKind` for it, `source.organizeImports`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65373



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


[PATCH] D65233: driver: Don't warn about assembler flags being unused when not assembling; different approach

2019-07-27 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D65233#1603741 , @bjope wrote:

> I made another fixup (similar to https://reviews.llvm.org/rL367176) here 
> https://reviews.llvm.org/rL367182.
>
> Can someone please take a look (a post-commit review) of 
> https://reviews.llvm.org/rL367182 to verify that I did not misunderstand the 
> intention with the test somehow?


Looks good. Thanks much for the fix!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65233



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


[PATCH] D65373: [clangd] Update features table in the docs with links to LSP extension proposals

2019-07-27 Thread Nathan Ridge via Phabricator via cfe-commits
nridge created this revision.
nridge added a reviewer: sammccall.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, 
ilya-biryukov.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65373

Files:
  clang-tools-extra/docs/clangd/Features.rst


Index: clang-tools-extra/docs/clangd/Features.rst
===
--- clang-tools-extra/docs/clangd/Features.rst
+++ clang-tools-extra/docs/clangd/Features.rst
@@ -257,11 +257,15 @@
 +-++--+
 | Gen. Getters/Setters| Yes|   No |
 +-++--+
-| Syntax and Semantic Coloring| No |   No |
+| Syntax and Semantic Coloring|`Proposed`__|   No |
 +-++--+
-| Call hierarchy  | No |   No |
+| Call hierarchy  |`Proposed`__|   No |
 +-++--+
-| Type hierarchy  | No |   Yes|
+| Type hierarchy  |`Proposed`__|   Yes|
 +-++--+
-| Organize Includes   | No |   No |
+| Organize Includes   | Yes|   No |
 +-++--+
+
+__ https://github.com/microsoft/language-server-protocol/issues/18
+__ https://github.com/microsoft/language-server-protocol/issues/468
+__ https://github.com/microsoft/language-server-protocol/issues/136


Index: clang-tools-extra/docs/clangd/Features.rst
===
--- clang-tools-extra/docs/clangd/Features.rst
+++ clang-tools-extra/docs/clangd/Features.rst
@@ -257,11 +257,15 @@
 +-++--+
 | Gen. Getters/Setters| Yes|   No |
 +-++--+
-| Syntax and Semantic Coloring| No |   No |
+| Syntax and Semantic Coloring|`Proposed`__|   No |
 +-++--+
-| Call hierarchy  | No |   No |
+| Call hierarchy  |`Proposed`__|   No |
 +-++--+
-| Type hierarchy  | No |   Yes|
+| Type hierarchy  |`Proposed`__|   Yes|
 +-++--+
-| Organize Includes   | No |   No |
+| Organize Includes   | Yes|   No |
 +-++--+
+
+__ https://github.com/microsoft/language-server-protocol/issues/18
+__ https://github.com/microsoft/language-server-protocol/issues/468
+__ https://github.com/microsoft/language-server-protocol/issues/136
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D64922: [clangd] Added option to enable semantic highlighting via an experimental capability

2019-07-27 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

I believe this is not necessary. You can add text document capabilities in the 
vscode client extension like this:

  class SemanticHighlightingFeature implements vscodelc.StaticFeature {
fillClientCapabilities(capabilities: vscodelc.ClientCapabilities): void {
  const textDocumentCapabilities:
  vscodelc.TextDocumentClientCapabilities & { 
semanticHighlightingCapabilities?: { semanticHighlighting: boolean } }
  = capabilities.textDocument;
  textDocumentCapabilities.semanticHighlightingCapabilities = { 
semanticHighlighting: true };
}
  }
  
  ...
  
  clangdClient.registerFeature(new SemanticHighlightingFeature());


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64922



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


[PATCH] D60943: Delay diagnosing asm constraints that require immediates until after inlining

2019-07-27 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 212072.
void added a comment.

Save checking of immediates until code generation.


Repository:
  rC Clang

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

https://reviews.llvm.org/D60943

Files:
  lib/CodeGen/CGStmt.cpp
  lib/Sema/SemaStmtAsm.cpp
  test/Sema/inline-asm-validate-x86.c


Index: test/Sema/inline-asm-validate-x86.c
===
--- test/Sema/inline-asm-validate-x86.c
+++ test/Sema/inline-asm-validate-x86.c
@@ -147,9 +147,9 @@
   // This offset-from-null pointer can be used as an integer constant 
expression.
   __asm__ __volatile__("\n#define S_B abcd%0\n" : : "n"(&((struct s*)0)->b));
   // This pointer cannot be used as an integer constant expression.
-  __asm__ __volatile__("\n#define GLOBAL_A abcd%0\n" : : "n"()); // 
expected-error{{constraint 'n' expects an integer constant expression}}
+  __asm__ __volatile__("\n#define GLOBAL_A abcd%0\n" : : "e"()); // 
expected-error{{constraint 'e' expects an integer constant expression}}
   // Floating-point is also not okay.
-  __asm__ __volatile__("\n#define PI abcd%0\n" : : "n"(3.14f)); // 
expected-error{{constraint 'n' expects an integer constant expression}}
+  __asm__ __volatile__("\n#define PI abcd%0\n" : : "e"(3.14f)); // 
expected-error{{constraint 'e' expects an integer constant expression}}
 #ifdef AMD64
   // This arbitrary pointer is fine.
   __asm__ __volatile__("\n#define BEEF abcd%0\n" : : 
"n"((int*)0xdeadbeef));
Index: lib/Sema/SemaStmtAsm.cpp
===
--- lib/Sema/SemaStmtAsm.cpp
+++ lib/Sema/SemaStmtAsm.cpp
@@ -383,25 +383,19 @@
 } else if (Info.requiresImmediateConstant() && !Info.allowsRegister()) {
   if (!InputExpr->isValueDependent()) {
 Expr::EvalResult EVResult;
-if (!InputExpr->EvaluateAsRValue(EVResult, Context, true))
-  return StmtError(
-  Diag(InputExpr->getBeginLoc(), diag::err_asm_immediate_expected)
-  << Info.getConstraintStr() << InputExpr->getSourceRange());
-
-// For compatibility with GCC, we also allow pointers that would be
-// integral constant expressions if they were cast to int.
-llvm::APSInt IntResult;
-if (!EVResult.Val.toIntegralConstant(IntResult, InputExpr->getType(),
- Context))
-  return StmtError(
-  Diag(InputExpr->getBeginLoc(), diag::err_asm_immediate_expected)
-  << Info.getConstraintStr() << InputExpr->getSourceRange());
-
-if (!Info.isValidAsmImmediate(IntResult))
-  return StmtError(Diag(InputExpr->getBeginLoc(),
-diag::err_invalid_asm_value_for_constraint)
-   << IntResult.toString(10) << Info.getConstraintStr()
-   << InputExpr->getSourceRange());
+if (InputExpr->EvaluateAsRValue(EVResult, Context, true)) {
+  // For compatibility with GCC, we also allow pointers that would be
+  // integral constant expressions if they were cast to int.
+  llvm::APSInt IntResult;
+  if (EVResult.Val.toIntegralConstant(IntResult, InputExpr->getType(),
+   Context))
+if (!Info.isValidAsmImmediate(IntResult))
+  return StmtError(Diag(InputExpr->getBeginLoc(),
+diag::err_invalid_asm_value_for_constraint)
+   << IntResult.toString(10)
+   << Info.getConstraintStr()
+   << InputExpr->getSourceRange());
+}
   }
 
 } else {
Index: lib/CodeGen/CGStmt.cpp
===
--- lib/CodeGen/CGStmt.cpp
+++ lib/CodeGen/CGStmt.cpp
@@ -1846,11 +1846,9 @@
   InputExpr->EvaluateAsRValue(EVResult, getContext(), true);
 
   llvm::APSInt IntResult;
-  if (!EVResult.Val.toIntegralConstant(IntResult, InputExpr->getType(),
-   getContext()))
-llvm_unreachable("Invalid immediate constant!");
-
-  return llvm::ConstantInt::get(getLLVMContext(), IntResult);
+  if (EVResult.Val.toIntegralConstant(IntResult, InputExpr->getType(),
+  getContext()))
+return llvm::ConstantInt::get(getLLVMContext(), IntResult);
 }
 
 Expr::EvalResult Result;


Index: test/Sema/inline-asm-validate-x86.c
===
--- test/Sema/inline-asm-validate-x86.c
+++ test/Sema/inline-asm-validate-x86.c
@@ -147,9 +147,9 @@
   // This offset-from-null pointer can be used as an integer constant expression.
   __asm__ __volatile__("\n#define S_B abcd%0\n" : : "n"(&((struct s*)0)->b));
   // This pointer cannot be used as an integer constant expression.
-  __asm__ 

[PATCH] D65233: driver: Don't warn about assembler flags being unused when not assembling; different approach

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

In D65233#1603741 , @bjope wrote:

> I made another fixup (similar to https://reviews.llvm.org/rL367176) here 
> https://reviews.llvm.org/rL367182.
>
> Can someone please take a look (a post-commit review) of 
> https://reviews.llvm.org/rL367182 to verify that I did not misunderstand the 
> intention with the test somehow?


That seemed to have helped, thanks!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65233



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


[PATCH] D65270: [CMake] Fix source path generation for install in multi-config (MSBuild)

2019-07-27 Thread Richard Musil via Phabricator via cfe-commits
risa2000 added inline comments.



Comment at: clang/lib/Headers/CMakeLists.txt:190
 
+if(CMAKE_CONFIGURATION_TYPES)
+  string(REPLACE "${CMAKE_CFG_INTDIR}" "$" output_dir "${output_dir}")

beanz wrote:
> I think this will break Xcode
I guess I put it in since it seemed to be already used around:

```
$ grep -r "if(CMAKE_CONFIGURATION_TYPES)" *
compiler-rt/cmake/Modules/AddCompilerRT.cmake:  if(CMAKE_CONFIGURATION_TYPES)
compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake:
if(CMAKE_CONFIGURATION_TYPES)
compiler-rt/CMakeLists.txt:if(CMAKE_CONFIGURATION_TYPES)
lldb/utils/lldb-dotest/CMakeLists.txt:  if(CMAKE_CONFIGURATION_TYPES)
llvm/cmake/modules/AddLLVM.cmake:if(CMAKE_CONFIGURATION_TYPES)
llvm/cmake/modules/AddLLVM.cmake:if(CMAKE_CONFIGURATION_TYPES)
llvm/cmake/modules/CrossCompile.cmake:  if(CMAKE_CONFIGURATION_TYPES)

```
but technically, the generator expression should work equally for single and 
multi-config generators, so the condition is not necessary. What exactly will 
break Xcode?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65270



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


[PATCH] D65233: driver: Don't warn about assembler flags being unused when not assembling; different approach

2019-07-27 Thread Bjorn Pettersson via Phabricator via cfe-commits
bjope added a comment.

I made another fixup (similar to https://reviews.llvm.org/rL367176) here 
https://reviews.llvm.org/rL367182.

Can someone please take a look (a post-commit review) of 
https://reviews.llvm.org/rL367182 to verify that I did not misunderstand the 
intention with the test somehow?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65233



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


r367182 - [Driver] Additional fixup of NOWARN test case from r367165

2019-07-27 Thread Bjorn Pettersson via cfe-commits
Author: bjope
Date: Sat Jul 27 13:22:47 2019
New Revision: 367182

URL: http://llvm.org/viewvc/llvm-project?rev=367182=rev
Log:
[Driver] Additional fixup of NOWARN test case from r367165

Same kind of fix as in r367176, but for "RUN on line 76"
this time.

I'll ask for a post-commit review, to ensure this
matches the intention with the test added in r367165.
But I think this at least will make the buildbots a
little bit happier.

Modified:
cfe/trunk/test/Driver/as-options.s

Modified: cfe/trunk/test/Driver/as-options.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-options.s?rev=367182=367181=367182=diff
==
--- cfe/trunk/test/Driver/as-options.s (original)
+++ cfe/trunk/test/Driver/as-options.s Sat Jul 27 13:22:47 2019
@@ -73,7 +73,7 @@
 
 // -Wa flags shouldn't cause warnings without an assembler stage with
 // -fno-integrated-as either.
-// RUN: %clang -Wa,-mno-warn-deprecated -fno-integrated-as %s -S 2>&1 \
+// RUN: %clang -Wa,-mno-warn-deprecated -fno-integrated-as -x c++ %s -S 2>&1 \
 // RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
 
 // But -m flags for the integrated assembler _should_ warn if the integrated


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


[PATCH] D65233: driver: Don't warn about assembler flags being unused when not assembling; different approach

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

In D65233#1603653 , @thakis wrote:

> phosek: In what config / on what bot?


It's our toolchain linux-x86 builder, see 
https://luci-milo.appspot.com/p/fuchsia/builders/ci/clang-x64-linux/b8906751725919481408,
 mac-x86 has been working fine.

In D65233#1603654 , @thakis wrote:

> phosek: Does r367176 help?


No, it's still failing with the same error, see 
https://luci-milo.appspot.com/p/fuchsia/g/clang/console.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65233



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


[PATCH] D65371: do not emit -Wunused-macros warnings in -frewrite-includes mode (PR15614)

2019-07-27 Thread Luboš Luňák via Phabricator via cfe-commits
llunak created this revision.
llunak added a reviewer: rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is an updated patch from https://bugs.llvm.org/show_bug.cgi?id=15614. See 
there for testcase etc.


Repository:
  rC Clang

https://reviews.llvm.org/D65371

Files:
  clang/lib/Lex/PPDirectives.cpp


Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -2723,7 +2723,8 @@
   // If we need warning for not using the macro, add its location in the
   // warn-because-unused-macro set. If it gets used it will be removed from 
set.
   if (getSourceManager().isInMainFile(MI->getDefinitionLoc()) &&
-  !Diags->isIgnored(diag::pp_macro_not_used, MI->getDefinitionLoc())) {
+  !Diags->isIgnored(diag::pp_macro_not_used, MI->getDefinitionLoc()) &&
+  !MacroExpansionInDirectivesOverride) {
 MI->setIsWarnIfUnused(true);
 WarnUnusedMacroLocs.insert(MI->getDefinitionLoc());
   }


Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -2723,7 +2723,8 @@
   // If we need warning for not using the macro, add its location in the
   // warn-because-unused-macro set. If it gets used it will be removed from set.
   if (getSourceManager().isInMainFile(MI->getDefinitionLoc()) &&
-  !Diags->isIgnored(diag::pp_macro_not_used, MI->getDefinitionLoc())) {
+  !Diags->isIgnored(diag::pp_macro_not_used, MI->getDefinitionLoc()) &&
+  !MacroExpansionInDirectivesOverride) {
 MI->setIsWarnIfUnused(true);
 WarnUnusedMacroLocs.insert(MI->getDefinitionLoc());
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D64656: Ensure placeholder instruction for cleanup is created

2019-07-27 Thread Øystein Dale via Phabricator via cfe-commits
oydale abandoned this revision.
oydale added a comment.

compnerd added a triple to the test case and re-committed the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64656



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


[PATCH] D60943: Delay diagnosing asm constraints that require immediates until after inlining

2019-07-27 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

I understand, but the current version just doesn't work anyway to delay it.


Repository:
  rC Clang

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

https://reviews.llvm.org/D60943



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


[PATCH] D59555: [analyzer] Add yaml parser to GenericTaintChecker

2019-07-27 Thread Borsik Gábor via Phabricator via cfe-commits
boga95 updated this revision to Diff 212065.
boga95 marked 16 inline comments as done.

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

https://reviews.llvm.org/D59555

Files:
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
  lib/StaticAnalyzer/Checkers/Yaml.h
  test/Analysis/Inputs/taint-generic-config-ill-formed.yaml
  test/Analysis/Inputs/taint-generic-config-invalid-arg.yaml
  test/Analysis/Inputs/taint-generic-config.yaml
  test/Analysis/taint-generic.c

Index: test/Analysis/taint-generic.c
===
--- test/Analysis/taint-generic.c
+++ test/Analysis/taint-generic.c
@@ -1,5 +1,49 @@
-// RUN: %clang_analyze_cc1  -analyzer-checker=alpha.security.taint,core,alpha.security.ArrayBoundV2 -Wno-format-security -verify %s
-// RUN: %clang_analyze_cc1  -DFILE_IS_STRUCT -analyzer-checker=alpha.security.taint,core,alpha.security.ArrayBoundV2 -Wno-format-security -verify %s
+// RUN: %clang_analyze_cc1 -Wno-format-security -verify %s \
+// RUN:   -analyzer-checker=alpha.security.taint \
+// RUN:   -analyzer-checker=core \
+// RUN:   -analyzer-checker=alpha.security.ArrayBoundV2 \
+// RUN:   -analyzer-config \
+// RUN: alpha.security.taint.TaintPropagation:Config=%S/Inputs/taint-generic-config.yaml
+
+// RUN: %clang_analyze_cc1 -Wno-format-security -verify %s \
+// RUN:   -DFILE_IS_STRUCT \
+// RUN:   -analyzer-checker=alpha.security.taint \
+// RUN:   -analyzer-checker=core \
+// RUN:   -analyzer-checker=alpha.security.ArrayBoundV2 \
+// RUN:   -analyzer-config \
+// RUN: alpha.security.taint.TaintPropagation:Config=%S/Inputs/taint-generic-config.yaml
+
+// RUN: not %clang_analyze_cc1 -verify %s \
+// RUN:   -analyzer-checker=alpha.security.taint \
+// RUN:   -analyzer-config \
+// RUN: alpha.security.taint.TaintPropagation:Config=justguessit \
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-FILE
+
+// CHECK-INVALID-FILE: (frontend): invalid input for checker option
+// CHECK-INVALID-FILE-SAME:'alpha.security.taint.TaintPropagation:Config',
+// CHECK-INVALID-FILE-SAME:that expects a valid filename instead of
+// CHECK-INVALID-FILE-SAME:'justguessit'
+
+// RUN: not %clang_analyze_cc1 -verify %s \
+// RUN:   -analyzer-checker=alpha.security.taint \
+// RUN:   -analyzer-config \
+// RUN: alpha.security.taint.TaintPropagation:Config=%S/Inputs/taint-generic-config-ill-formed.yaml \
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-ILL-FORMED
+
+// CHECK-ILL-FORMED: (frontend): invalid input for checker option
+// CHECK-ILL-FORMED-SAME:'alpha.security.taint.TaintPropagation:Config',
+// CHECK-ILL-FORMED-SAME:that expects a valid yaml file: Invalid argument
+
+// RUN: not %clang_analyze_cc1 -verify %s \
+// RUN:   -analyzer-checker=alpha.security.taint \
+// RUN:   -analyzer-config \
+// RUN: alpha.security.taint.TaintPropagation:Config=%S/Inputs/taint-generic-config-invalid-arg.yaml \
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-ARG
+
+// CHECK-INVALID-ARG: (frontend): invalid input for checker option
+// CHECK-INVALID-ARG-SAME:'alpha.security.taint.TaintPropagation:Config',
+// CHECK-INVALID-ARG-SAME:that expects an argument number for propagation
+// CHECK-INVALID-ARG-SAME:rules greater or equal to -1
 
 int scanf(const char *restrict format, ...);
 char *gets(char *str);
Index: test/Analysis/Inputs/taint-generic-config.yaml
===
--- /dev/null
+++ test/Analysis/Inputs/taint-generic-config.yaml
@@ -0,0 +1,50 @@
+# A list of source/propagation function
+Propagations:
+  # int x = mySource1(); // x is tainted
+  - Name: mySource1
+DstArgs:  [-1] # Index for return value
+
+  # int x;
+  # mySource2(); // x is tainted
+  - Name: mySource2
+DstArgs:  [0]
+
+  # int x, y;
+  # myScanf("%d %d", , ); // x and y are tainted
+  - Name:  myScanf
+VariadicType:  Dst
+VariadicIndex: 1
+
+  # int x; // x is tainted
+  # int y;
+  # myPropagator(x, ); // y is tainted
+  - Name: myPropagator
+SrcArgs:  [0]
+DstArgs:  [1]
+
+  # constexpr unsigned size = 100;
+  # char buf[size];
+  # int x, y;
+  # int n = mySprintf(buf, size, "%d %d", x, y); // If size, x or y is tainted
+  # // the return value and the buf will be tainted
+  - Name:  mySnprintf
+SrcArgs:   [1]
+DstArgs:   [0, -1]
+VariadicType:  Src
+VariadicIndex: 3
+
+# A list of filter functions
+Filters:
+  # int x; // x is tainted
+  # myFilter(); // x is not tainted anymore
+  - Name: myFilter
+Args: [0]
+
+# A list of sink functions
+Sinks:
+  # int x, y; // x and y are tainted
+  # mySink(x, 0, 1); // It will warn
+  # mySink(0, 1, y); // It will warn
+  # mySink(0, x, 1); // It won't warn
+  - Name: mySink
+Args: [0, 2]
Index: test/Analysis/Inputs/taint-generic-config-invalid-arg.yaml

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

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

Ping.

Seems like @rsmith is busy, so I added @jfb as a reviewer.


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

https://reviews.llvm.org/D63082



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


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

2019-07-27 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a subscriber: jfb.
xbolva00 added a comment.

Adding @jfb as reviewer to get more opinions what should be done next..


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

https://reviews.llvm.org/D63139



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


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

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

Ping again

Is ‘CaseStmt´ AST C++ issue is a blocker for this patch or not?

I would like to move forward - either land it or (if blocker) abandon it.

If it is blocking issue, I can enable it for C only (better than nothing)..


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

https://reviews.llvm.org/D63139



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


[PATCH] D63276: [AST] Add FunctionDecl::getParametersSourceRange()

2019-07-27 Thread Nicolas Manichon via Phabricator via cfe-commits
nicolas updated this revision to Diff 212061.
nicolas added a comment.

Add a default value for `FunctionProtoType::getEllipsisLoc`


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

https://reviews.llvm.org/D63276

Files:
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/Type.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaType.cpp
  clang/unittests/AST/SourceLocationTest.cpp

Index: clang/unittests/AST/SourceLocationTest.cpp
===
--- clang/unittests/AST/SourceLocationTest.cpp
+++ clang/unittests/AST/SourceLocationTest.cpp
@@ -648,6 +648,112 @@
   Language::Lang_CXX11));
 }
 
+class FunctionDeclParametersRangeVerifier : public RangeVerifier {
+protected:
+  SourceRange getRange(const FunctionDecl ) override {
+return Function.getParametersSourceRange();
+  }
+};
+
+TEST(FunctionDeclParameters, FunctionDeclOnlyVariadic) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 10);
+  EXPECT_TRUE(Verifier.match("void f(...);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclVariadic) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 17);
+  EXPECT_TRUE(Verifier.match("void f(int a, ...);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclMacroVariadic) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(2, 8, 1, 18);
+  EXPECT_TRUE(Verifier.match("#define VARIADIC ...\n"
+ "void f(int a, VARIADIC);\n",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclMacroParams) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 16, 2, 20);
+  EXPECT_TRUE(Verifier.match("#define PARAMS int a, int b\n"
+ "void f(PARAMS, int c);",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclSingleParameter) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 12);
+  EXPECT_TRUE(Verifier.match("void f(int a);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, MemberFunctionDecl) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(2, 8, 2, 12);
+  EXPECT_TRUE(Verifier.match("class A{\n"
+ "void f(int a);\n"
+ "};",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, MemberFunctionDeclVariadic) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(2, 8, 2, 17);
+  EXPECT_TRUE(Verifier.match("class A{\n"
+ "void f(int a, ...);\n"
+ "};",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, StaticFunctionDecl) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(2, 15, 2, 19);
+  EXPECT_TRUE(Verifier.match("class A{\n"
+ "static void f(int a);\n"
+ "};",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclMultipleParameters) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 28);
+  EXPECT_TRUE(
+  Verifier.match("void f(int a, int b, char *c);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithDefaultValue) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 16);
+  EXPECT_TRUE(Verifier.match("void f(int a = 5);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithVolatile) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 22);
+  EXPECT_TRUE(Verifier.match("void f(volatile int *i);", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithConstParam) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 19);
+  EXPECT_TRUE(Verifier.match("void f(const int *i);", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithConstVolatileParam) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 28);
+  EXPECT_TRUE(Verifier.match("void f(const volatile int *i);", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithParamAttribute) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 36);
+  EXPECT_TRUE(Verifier.match("void f(__attribute__((unused)) int a) {}",
+ functionDecl()));
+}
+
 TEST(CXXMethodDecl, CXXMethodDeclWithThrowSpecification) {
   RangeVerifier Verifier;
   Verifier.expectRange(2, 1, 2, 16);
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -4755,6 +4755,7 @@
 FunctionProtoType::ExtProtoInfo 

[clang-tools-extra] r367178 - [clangd] Fix NDEBUG build problem introduced by rL366698

2019-07-27 Thread Bjorn Pettersson via cfe-commits
Author: bjope
Date: Sat Jul 27 10:09:15 2019
New Revision: 367178

URL: http://llvm.org/viewvc/llvm-project?rev=367178=rev
Log:
[clangd] Fix NDEBUG build problem introduced by rL366698

Sprinkled some #ifndef NDEBUG in Selection.cpp to make
it possible to build with NDEBUG defined.

The problem was introduced in rL366698 when using dlog
for some debug printouts. The dlog macro expands to
DEBUG_WITH_TYPE, which isn't using it's arguments in
optimized builds (when NDEBUG is defined).

Modified:
clang-tools-extra/trunk/clangd/Selection.cpp

Modified: clang-tools-extra/trunk/clangd/Selection.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Selection.cpp?rev=367178=367177=367178=diff
==
--- clang-tools-extra/trunk/clangd/Selection.cpp (original)
+++ clang-tools-extra/trunk/clangd/Selection.cpp Sat Jul 27 10:09:15 2019
@@ -77,6 +77,7 @@ void printNodeKind(llvm::raw_ostream 
   }
 }
 
+#ifndef NDEBUG
 std::string printNodeToString(const DynTypedNode , const PrintingPolicy ) 
{
   std::string S;
   llvm::raw_string_ostream OS(S);
@@ -84,6 +85,7 @@ std::string printNodeToString(const DynT
   OS << " ";
   return std::move(OS.str());
 }
+#endif
 
 // We find the selection by visiting written nodes in the AST, looking for 
nodes
 // that intersect with the selected character range.
@@ -177,7 +179,10 @@ private:
   SelectionVisitor(ASTContext , const PrintingPolicy , unsigned 
SelBegin,
unsigned SelEnd, FileID SelFile)
   : SM(AST.getSourceManager()), LangOpts(AST.getLangOpts()),
-PrintPolicy(PP), SelBegin(SelBegin), SelEnd(SelEnd), SelFile(SelFile),
+#ifndef NDEBUG
+PrintPolicy(PP),
+#endif
+SelBegin(SelBegin), SelEnd(SelEnd), SelFile(SelFile),
 SelBeginTokenStart(SM.getFileOffset(Lexer::GetBeginningOfToken(
 SM.getComposedLoc(SelFile, SelBegin), SM, LangOpts))) {
 // Ensure we have a node for the TU decl, regardless of traversal scope.
@@ -348,7 +353,9 @@ private:
 
   SourceManager 
   const LangOptions 
+#ifndef NDEBUG
   const PrintingPolicy 
+#endif
   std::stack Stack;
   RangeSet Claimed;
   std::deque Nodes; // Stable pointers as we add more nodes.


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


r367177 - [Driver] Fix "unannotated fall-through between switch labels". NFC

2019-07-27 Thread Bjorn Pettersson via cfe-commits
Author: bjope
Date: Sat Jul 27 10:09:08 2019
New Revision: 367177

URL: http://llvm.org/viewvc/llvm-project?rev=367177=rev
Log:
[Driver] Fix "unannotated fall-through between switch labels". NFC

Just a simple fix of Werror problem after r367165.

Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=367177=367176=367177=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Sat Jul 27 10:09:08 2019
@@ -3567,6 +3567,7 @@ void Clang::ConstructJob(Compilation ,
   case llvm::Triple::thumb:
   case llvm::Triple::thumbeb:
 Args.ClaimAllArgs(options::OPT_mimplicit_it_EQ);
+break;
   default:
 break;
   }


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


r367176 - Attempt to make test in r367165 more robust.

2019-07-27 Thread Nico Weber via cfe-commits
Author: nico
Date: Sat Jul 27 09:57:19 2019
New Revision: 367176

URL: http://llvm.org/viewvc/llvm-project?rev=367176=rev
Log:
Attempt to make test in r367165 more robust.

Some people were seeing this failure:

```
: 'RUN: at line 83';   clang -mrelax-all -fno-integrated-as 
/b/s/w/ir/k/llvm-project/clang/test/Driver/as-options.s -S 2>&1 \
 | /FileCheck --check-prefix=WARN --allow-empty 
clang/test/Driver/as-options.s
--
Exit Code: 1

Command Output (stderr):
--
clang/test/Driver/as-options.s:66:16: error: NOWARN-NOT: excluded string found 
in input
// NOWARN-NOT: unused
   ^
:1:95: note: found here
clang-10: warning: clang/test/Driver/as-options.s: 'assembler' input unused 
[-Wunused-command-line-argument]
```

Maybe this helps with that.

Modified:
cfe/trunk/test/Driver/as-options.s

Modified: cfe/trunk/test/Driver/as-options.s
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-options.s?rev=367176=367175=367176=diff
==
--- cfe/trunk/test/Driver/as-options.s (original)
+++ cfe/trunk/test/Driver/as-options.s Sat Jul 27 09:57:19 2019
@@ -78,8 +78,8 @@
 
 // But -m flags for the integrated assembler _should_ warn if the integrated
 // assembler is not in use.
-// RUN: %clang -mrelax-all -fintegrated-as %s -S 2>&1 \
+// RUN: %clang -mrelax-all -fintegrated-as -x c++ %s -S 2>&1 \
 // RUN:   | FileCheck --check-prefix=NOWARN --allow-empty %s
-// RUN: %clang -mrelax-all -fno-integrated-as %s -S 2>&1 \
+// RUN: %clang -mrelax-all -fno-integrated-as -x c++ %s -S 2>&1 \
 // RUN:   | FileCheck --check-prefix=WARN --allow-empty %s
 // WARN: unused


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


[PATCH] D63276: [AST] Add FunctionDecl::getParametersSourceRange()

2019-07-27 Thread Bruno Ricci via Phabricator via cfe-commits
riccibruno added inline comments.



Comment at: clang/include/clang/AST/Type.h:4048
+return *getTrailingObjects();
+  }
+

And what if there is no ellipsis ? Shouldn't you do something like `return 
isVariadic() ? *getTrailingObjects() : SourceLocation();` 
instead ?


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

https://reviews.llvm.org/D63276



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


[PATCH] D63276: [AST] Add FunctionDecl::getParametersSourceRange()

2019-07-27 Thread Nicolas Manichon via Phabricator via cfe-commits
nicolas updated this revision to Diff 212055.
nicolas edited the summary of this revision.
nicolas added a comment.

- `getEllipsisSourceRange` -> `getEllipsisLoc`
- Updated the doc comment
- Removed `auto` where necessary


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

https://reviews.llvm.org/D63276

Files:
  clang/include/clang/AST/Decl.h
  clang/include/clang/AST/Type.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaType.cpp
  clang/unittests/AST/SourceLocationTest.cpp

Index: clang/unittests/AST/SourceLocationTest.cpp
===
--- clang/unittests/AST/SourceLocationTest.cpp
+++ clang/unittests/AST/SourceLocationTest.cpp
@@ -648,6 +648,112 @@
   Language::Lang_CXX11));
 }
 
+class FunctionDeclParametersRangeVerifier : public RangeVerifier {
+protected:
+  SourceRange getRange(const FunctionDecl ) override {
+return Function.getParametersSourceRange();
+  }
+};
+
+TEST(FunctionDeclParameters, FunctionDeclOnlyVariadic) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 10);
+  EXPECT_TRUE(Verifier.match("void f(...);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclVariadic) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 17);
+  EXPECT_TRUE(Verifier.match("void f(int a, ...);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclMacroVariadic) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(2, 8, 1, 18);
+  EXPECT_TRUE(Verifier.match("#define VARIADIC ...\n"
+ "void f(int a, VARIADIC);\n",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclMacroParams) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 16, 2, 20);
+  EXPECT_TRUE(Verifier.match("#define PARAMS int a, int b\n"
+ "void f(PARAMS, int c);",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclSingleParameter) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 12);
+  EXPECT_TRUE(Verifier.match("void f(int a);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, MemberFunctionDecl) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(2, 8, 2, 12);
+  EXPECT_TRUE(Verifier.match("class A{\n"
+ "void f(int a);\n"
+ "};",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, MemberFunctionDeclVariadic) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(2, 8, 2, 17);
+  EXPECT_TRUE(Verifier.match("class A{\n"
+ "void f(int a, ...);\n"
+ "};",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, StaticFunctionDecl) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(2, 15, 2, 19);
+  EXPECT_TRUE(Verifier.match("class A{\n"
+ "static void f(int a);\n"
+ "};",
+ functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclMultipleParameters) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 28);
+  EXPECT_TRUE(
+  Verifier.match("void f(int a, int b, char *c);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithDefaultValue) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 16);
+  EXPECT_TRUE(Verifier.match("void f(int a = 5);\n", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithVolatile) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 22);
+  EXPECT_TRUE(Verifier.match("void f(volatile int *i);", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithConstParam) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 19);
+  EXPECT_TRUE(Verifier.match("void f(const int *i);", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithConstVolatileParam) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 28);
+  EXPECT_TRUE(Verifier.match("void f(const volatile int *i);", functionDecl()));
+}
+
+TEST(FunctionDeclParameters, FunctionDeclWithParamAttribute) {
+  FunctionDeclParametersRangeVerifier Verifier;
+  Verifier.expectRange(1, 8, 1, 36);
+  EXPECT_TRUE(Verifier.match("void f(__attribute__((unused)) int a) {}",
+ functionDecl()));
+}
+
 TEST(CXXMethodDecl, CXXMethodDeclWithThrowSpecification) {
   RangeVerifier Verifier;
   Verifier.expectRange(2, 1, 2, 16);
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++