[clang] Revert "Revert "[OpenMP][TR12] change property of map-type modifier."… (PR #91141)

2024-05-08 Thread Tom Weaver via cfe-commits

TomWeaver18 wrote:

Reverted in 
https://github.com/llvm/llvm-project/commit/341aecc2dd0f6debcbe9f251a6d2e8a60d327eea

https://github.com/llvm/llvm-project/pull/91141
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Revert "Revert "[OpenMP][TR12] change property of map-type modifier."… (PR #91141)

2024-05-08 Thread Tom Weaver via cfe-commits

TomWeaver18 wrote:

Greetings and hello from the UK!

 it looks as though this commit caused a test failure on the following build 
bot, is anyone able to take a look see?

https://lab.llvm.org/buildbot/#/builders/139/builds/65066

Will give it an hour for a reply before looking at a revert.

Have a great day all.



https://github.com/llvm/llvm-project/pull/91141
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][dataflow] Don't propagate result objects in unevaluated contexts (PR #90438)

2024-05-02 Thread Tom Weaver via cfe-commits

TomWeaver18 wrote:

Reverted in 2252c5c42b95dd12dda0c7fb1b2811f943b21949

https://github.com/llvm/llvm-project/pull/90438
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][dataflow] Don't propagate result objects in unevaluated contexts (PR #90438)

2024-05-02 Thread Tom Weaver via cfe-commits

cHackz18 wrote:

Hello and good morning from the UK!

It looks as though this change caused a test failure on the following buildbot:
https://lab.llvm.org/buildbot/#/builders/216/builds/38446

Are you able to take a look see?

many thanks for yoru time,
Tom W

https://github.com/llvm/llvm-project/pull/90438
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 7a72ce9 - Revert "[dataflow] Add dedicated representation of boolean formulas"

2023-07-04 Thread Tom Weaver via cfe-commits

Author: Tom Weaver
Date: 2023-07-04T14:05:54+01:00
New Revision: 7a72ce98224be76d9328e65eee472381f7c8e7fe

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

LOG: Revert "[dataflow] Add dedicated representation of boolean formulas"

This reverts commit 2fd614efc1bb9c27f1bc6c3096c60a7fe121e274.

Commit caused failures on the following two build bots:
  http://45.33.8.238/win/80815/step_7.txt
  https://lab.llvm.org/buildbot/#/builders/139/builds/44269

Added: 


Modified: 
clang/include/clang/Analysis/FlowSensitive/Arena.h
clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
clang/include/clang/Analysis/FlowSensitive/Solver.h
clang/include/clang/Analysis/FlowSensitive/WatchedLiteralsSolver.h
clang/lib/Analysis/FlowSensitive/Arena.cpp
clang/lib/Analysis/FlowSensitive/CMakeLists.txt
clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp
clang/unittests/Analysis/FlowSensitive/ArenaTest.cpp
clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp
clang/unittests/Analysis/FlowSensitive/SolverTest.cpp
clang/unittests/Analysis/FlowSensitive/TestingSupport.h

Removed: 
clang/include/clang/Analysis/FlowSensitive/Formula.h
clang/lib/Analysis/FlowSensitive/Formula.cpp



diff  --git a/clang/include/clang/Analysis/FlowSensitive/Arena.h 
b/clang/include/clang/Analysis/FlowSensitive/Arena.h
index b6c62e76246254..83b4ddeec02564 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Arena.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Arena.h
@@ -8,7 +8,6 @@
 #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE__ARENA_H
 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE__ARENA_H
 
-#include "clang/Analysis/FlowSensitive/Formula.h"
 #include "clang/Analysis/FlowSensitive/StorageLocation.h"
 #include "clang/Analysis/FlowSensitive/Value.h"
 #include 
@@ -105,17 +104,7 @@ class Arena {
 return create();
   }
 
-  /// Gets the boolean formula equivalent of a BoolValue.
-  /// Each unique Top values is translated to an Atom.
-  /// TODO: migrate to storing Formula directly in Values instead.
-  const Formula (const BoolValue &);
-
-  /// Returns a new atomic boolean variable, distinct from any other.
-  Atom makeAtom() { return static_cast(NextAtom++); };
-
 private:
-  llvm::BumpPtrAllocator Alloc;
-
   // Storage for the state of a program.
   std::vector> Locs;
   std::vector> Vals;
@@ -133,9 +122,6 @@ class Arena {
   llvm::DenseMap, BiconditionalValue *>
   BiconditionalVals;
 
-  llvm::DenseMap ValToFormula;
-  unsigned NextAtom = 0;
-
   AtomicBoolValue 
   AtomicBoolValue 
 };

diff  --git a/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h 
b/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
index 6b9f3681490af1..360786b02729f2 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
@@ -19,6 +19,7 @@
 
 #include "clang/Analysis/FlowSensitive/Solver.h"
 #include "clang/Analysis/FlowSensitive/Value.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringRef.h"
 
 namespace clang {
@@ -27,9 +28,52 @@ namespace dataflow {
 /// Returns a string representation of a value kind.
 llvm::StringRef debugString(Value::Kind Kind);
 
+/// Returns a string representation of a boolean assignment to true or false.
+llvm::StringRef debugString(Solver::Result::Assignment Assignment);
+
 /// Returns a string representation of the result status of a SAT check.
 llvm::StringRef debugString(Solver::Result::Status Status);
 
+/// Returns a string representation for the boolean value `B`.
+///
+/// Atomic booleans appearing in the boolean value `B` are assigned to labels
+/// either specified in `AtomNames` or created by default rules as B0, B1, ...
+///
+/// Requirements:
+///
+///   Names assigned to atoms should not be repeated in `AtomNames`.
+std::string debugString(
+const BoolValue ,
+llvm::DenseMap AtomNames = {{}});
+
+/// Returns a string representation for `Constraints` - a collection of boolean
+/// formulas.
+///
+/// Atomic booleans appearing in the boolean value `Constraints` are assigned 
to
+/// labels either specified in `AtomNames` or created by default rules as B0,
+/// B1, ...
+///
+/// Requirements:
+///
+///   Names assigned to atoms should not be repeated in `AtomNames`.
+std::string debugString(
+const llvm::ArrayRef Constraints,
+llvm::DenseMap AtomNames = {{}});
+
+/// Returns a string representation for `Constraints` - a collection of boolean
+/// formulas and the `Result` of satisfiability checking.
+///
+/// Atomic booleans appearing in `Constraints` and `Result` are assigned to
+/// labels either specified 

[clang] ea79b3b - Revert "[Sema] `setInvalidDecl` for error deduction declaration"

2023-05-23 Thread Tom Weaver via cfe-commits

Author: Tom Weaver
Date: 2023-05-23T11:44:51+01:00
New Revision: ea79b3bc39700791567796faeeb63d12f49b8c50

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

LOG: Revert "[Sema] `setInvalidDecl` for error deduction declaration"

This reverts commit eb5902ffc97163338bab95d2fd84a953ee76e96f.

Caused buildbot failures on:
  https://lab.llvm.org/buildbot/#/builders/139/builds/41248
  https://lab.llvm.org/buildbot/#/builders/216/builds/21637

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp
clang/test/CXX/temp/temp.res/temp.local/p3.cpp
clang/test/Parser/cxx1z-class-template-argument-deduction.cpp

Removed: 
clang/test/SemaCXX/invalid-deduction-guide-as-template-candidates.cpp



diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 915c9b0cf1014..a55e969fa21c1 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -392,8 +392,6 @@ Bug Fixes in This Version
 - Fix crash when attempting to perform parenthesized initialization of an
   aggregate with a base class with only non-public constructors.
   (`#62296 `_)
-- Fix crash when handling initialization candidates for invalid deduction 
guide.
-  (`#62408 `_)
 - Fix crash when redefining a variable with an invalid type again with an
   invalid type. (`#62447 `_)
 - Fix a stack overflow issue when evaluating ``consteval`` default arguments.

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index cb38329ca73a5..e869117a8ea66 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -7790,7 +7790,7 @@ class Sema final {
   void CheckConversionDeclarator(Declarator , QualType ,
  StorageClass& SC);
   Decl *ActOnConversionDeclarator(CXXConversionDecl *Conversion);
-  bool CheckDeductionGuideDeclarator(Declarator , QualType ,
+  void CheckDeductionGuideDeclarator(Declarator , QualType ,
  StorageClass );
   void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD);
 

diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 27d76db386f3e..adebfe85be45d 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9199,8 +9199,8 @@ static FunctionDecl *CreateNewFunctionDecl(Sema , 
Declarator ,
   SemaRef.Diag(TrailingRequiresClause->getBeginLoc(),
diag::err_trailing_requires_clause_on_deduction_guide)
   << TrailingRequiresClause->getSourceRange();
-if (SemaRef.CheckDeductionGuideDeclarator(D, R, SC))
-  return nullptr;
+SemaRef.CheckDeductionGuideDeclarator(D, R, SC);
+
 return CXXDeductionGuideDecl::Create(SemaRef.Context, DC, D.getBeginLoc(),
  ExplicitSpecifier, NameInfo, R, TInfo,
  D.getEndLoc());

diff  --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 150697302c5e1..e68afaa61ef1c 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -11087,8 +11087,8 @@ struct BadSpecifierDiagnoser {
 /// Check the validity of a declarator that we parsed for a deduction-guide.
 /// These aren't actually declarators in the grammar, so we need to check that
 /// the user didn't specify any pieces that are not part of the deduction-guide
-/// grammar. Return true on invalid deduction-guide.
-bool Sema::CheckDeductionGuideDeclarator(Declarator , QualType ,
+/// grammar.
+void Sema::CheckDeductionGuideDeclarator(Declarator , QualType ,
  StorageClass ) {
   TemplateName GuidedTemplate = D.getName().TemplateName.get().get();
   TemplateDecl *GuidedTemplateDecl = GuidedTemplate.getAsTemplateDecl();
@@ -11138,7 +11138,7 @@ bool Sema::CheckDeductionGuideDeclarator(Declarator , 
QualType ,
   }
 
   if (D.isInvalidType())
-return true;
+return;
 
   // Check the declarator is simple enough.
   bool FoundFunction = false;
@@ -11151,9 +11151,11 @@ bool Sema::CheckDeductionGuideDeclarator(Declarator 
, QualType ,
   << D.getSourceRange();
   break;
 }
-if (!Chunk.Fun.hasTrailingReturnType())
-  return Diag(D.getName().getBeginLoc(),
+if (!Chunk.Fun.hasTrailingReturnType()) {
+  Diag(D.getName().getBeginLoc(),
diag::err_deduction_guide_no_trailing_return_type);
+  break;
+}
 
 // Check that the return type is written as a specialization of
 

[clang] 16f49ea - Revert "[Driver][gcov] Derive .gcno .gcda file names from -o and -dumpdir"

2023-05-17 Thread Tom Weaver via cfe-commits

Author: Tom Weaver
Date: 2023-05-17T11:19:55+01:00
New Revision: 16f49ea2a2fb20d021075337595d6eacafdf6e2b

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

LOG: Revert "[Driver][gcov] Derive .gcno .gcda file names from -o and -dumpdir"

This reverts commit d515b8125364ef85fb100f1430b2174ed816cc18.

Caused buildbot failures:
  https://lab.llvm.org/buildbot/#/builders/197/builds/5464

Please fix before recommitting.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/coverage.c
clang/test/Driver/working-directory.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 108be340e65a..e2c401218a00 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -705,10 +705,10 @@ static void addDashXForInput(const ArgList , const 
InputInfo ,
 }
 
 static void addPGOAndCoverageFlags(const ToolChain , Compilation ,
-   const JobAction , const InputInfo 
,
+   const Driver , const InputInfo ,
const ArgList , SanitizerArgs ,
ArgStringList ) {
-  const Driver  = TC.getDriver();
+
   auto *PGOGenerateArg = Args.getLastArg(options::OPT_fprofile_generate,
  options::OPT_fprofile_generate_EQ,
  options::OPT_fno_profile_generate);
@@ -911,38 +911,32 @@ static void addPGOAndCoverageFlags(const ToolChain , 
Compilation ,
   Args.hasArg(options::OPT_coverage))
 FProfileDir = Args.getLastArg(options::OPT_fprofile_dir);
 
-  // TODO: Don't claim -c/-S to warn about -fsyntax-only -c/-S, -E -c/-S,
-  // like we warn about -fsyntax-only -E.
-  (void)(Args.hasArg(options::OPT_c) || Args.hasArg(options::OPT_S));
-
   // Put the .gcno and .gcda files (if needed) next to the object file or
   // bitcode file in the case of LTO.
-  if (EmitCovNotes || EmitCovData) {
-SmallString<128> CoverageFilename;
-if (Arg *DumpDir = Args.getLastArgNoClaim(options::OPT_dumpdir)) {
-  // Form ${dumpdir}${basename}.gcno. Note that dumpdir may not end with a
-  // path separator.
-  CoverageFilename = DumpDir->getValue();
-  CoverageFilename += llvm::sys::path::filename(Output.getBaseInput());
-} else if (Arg *FinalOutput =
-   C.getArgs().getLastArg(options::OPT__SLASH_Fo)) {
-  CoverageFilename = FinalOutput->getValue();
-} else if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o)) {
-  CoverageFilename = FinalOutput->getValue();
-} else {
-  CoverageFilename = llvm::sys::path::filename(Output.getBaseInput());
-}
+  // FIXME: There should be a simpler way to find the object file for this
+  // input, and this code probably does the wrong thing for commands that
+  // compile and link all at once.
+  if ((Args.hasArg(options::OPT_c) || Args.hasArg(options::OPT_S)) &&
+  (EmitCovNotes || EmitCovData) && Output.isFilename()) {
+SmallString<128> OutputFilename;
+if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT__SLASH_Fo))
+  OutputFilename = FinalOutput->getValue();
+else if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o))
+  OutputFilename = FinalOutput->getValue();
+else
+  OutputFilename = llvm::sys::path::filename(Output.getBaseInput());
+SmallString<128> CoverageFilename = OutputFilename;
+if (llvm::sys::path::is_relative(CoverageFilename))
+  (void)D.getVFS().makeAbsolute(CoverageFilename);
 llvm::sys::path::replace_extension(CoverageFilename, "gcno");
-if (EmitCovNotes) {
-  CmdArgs.push_back("-coverage-notes-file");
-  CmdArgs.push_back(Args.MakeArgString(CoverageFilename));
-}
+
+CmdArgs.push_back("-coverage-notes-file");
+CmdArgs.push_back(Args.MakeArgString(CoverageFilename));
 
 if (EmitCovData) {
   if (FProfileDir) {
-SmallString<128> Gcno = CoverageFilename;
 CoverageFilename = FProfileDir->getValue();
-llvm::sys::path::append(CoverageFilename, Gcno);
+llvm::sys::path::append(CoverageFilename, OutputFilename);
   }
   llvm::sys::path::replace_extension(CoverageFilename, "gcda");
   CmdArgs.push_back("-coverage-data-file");
@@ -5766,7 +5760,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // for sampling, overhead of call arc collection is way too high and there's
   // no way to collect the output.
   if (!Triple.isNVPTX() && !Triple.isAMDGCN())
-addPGOAndCoverageFlags(TC, C, JA, Output, Args, SanitizeArgs, CmdArgs);
+addPGOAndCoverageFlags(TC, C, D, Output, Args, SanitizeArgs, CmdArgs);
 
   Args.AddLastArg(CmdArgs, 

[clang] 79a3803 - [ClangScanDeps] Add UNSUPPORTED: system-windows to test P1689.cppm

2023-02-10 Thread Tom Weaver via cfe-commits

Author: Tom Weaver
Date: 2023-02-10T18:29:41Z
New Revision: 79a3803bb2ccdd852436cd1653017a1159a12157

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

LOG: [ClangScanDeps] Add UNSUPPORTED: system-windows to test P1689.cppm

The revert of
  https://reviews.llvm.org/rG65f9719913eca9c7c72d1abf4eddab767abaebf6

removes a system-windows guard but does not remove the test causing windows
system failures. This patch adds back a guard to prevent further failures.

Added: 


Modified: 
clang/test/ClangScanDeps/P1689.cppm

Removed: 




diff  --git a/clang/test/ClangScanDeps/P1689.cppm 
b/clang/test/ClangScanDeps/P1689.cppm
index 22d7721c2e9bf..3329d1efbfa63 100644
--- a/clang/test/ClangScanDeps/P1689.cppm
+++ b/clang/test/ClangScanDeps/P1689.cppm
@@ -1,3 +1,5 @@
+// UNSUPPORTED: system-windows
+
 // RUN: rm -fr %t
 // RUN: mkdir -p %t
 // RUN: split-file %s %t



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


[clang] 31ff400 - Revert "[Driver] Support for compressed debug info on Fuchsia"

2022-04-27 Thread Tom Weaver via cfe-commits

Author: Tom Weaver
Date: 2022-04-27T12:29:04+01:00
New Revision: 31ff40042d0504a37b443a8e8d5edfd90d54e228

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

LOG: Revert "[Driver] Support for compressed debug info on Fuchsia"

This reverts commit 19190cc651ef153c308d23fb56f064223b144488.

Causes test failures on following build bot:

http://lab.llvm.org:8011/#/builders/216

Added: 


Modified: 
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/test/Driver/fuchsia.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 6fe6f7f82feb..9e0b259dfcae 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -127,7 +127,6 @@ void fuchsia::Linker::ConstructJob(Compilation , const 
JobAction ,
   D.getLTOMode() == LTOK_Thin);
   }
 
-  addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs);
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,

diff  --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index 09bbf5d20b54..888f6b1a2c4b 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -253,13 +253,6 @@
 // CHECK-THINLTO: "-plugin-opt=thinlto"
 // CHECK-THINLTO: "-plugin-opt=jobs=8"
 
-// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform \
-// RUN: -Og -gz 2>&1 \
-// RUN: | FileCheck %s -check-prefix=CHECK-GZ
-// CHECK-GZ: {{.*}}clang{{.*}}" "--compress-debug-sections=zlib"
-// CHECK-GZ: {{.*}}ld.lld{{.*}}" "--compress-debug-sections=zlib"
-
 // RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN: -gsplit-dwarf -g -c %s 2>&1 \
 // RUN: | FileCheck %s -check-prefix=CHECK-SPLIT-DWARF



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


[clang] b86a763 - Revert "Revert "[clang][driver] Only warn once about invalid library values""

2021-02-10 Thread Tom Weaver via cfe-commits

Author: Tom Weaver
Date: 2021-02-10T16:40:07Z
New Revision: b86a763afb9a1f55f4b234ce97320917ead6ac7f

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

LOG: Revert "Revert "[clang][driver] Only warn once about invalid library 
values""

This reverts commit a743702a1f4880e4492196b1ce9a9a63e0b4c075.

Test was fixed in c6a1b16db7dc7a0af8951b39f29ddbe639a98a3b

Added: 


Modified: 
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index 59fdd2997fec..fed688c0f1ce 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -166,6 +166,10 @@ class ToolChain {
 EffectiveTriple = std::move(ET);
   }
 
+  mutable llvm::Optional cxxStdlibType;
+  mutable llvm::Optional runtimeLibType;
+  mutable llvm::Optional unwindLibType;
+
 protected:
   MultilibSet Multilibs;
   Multilib SelectedMultilib;

diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index c83638086048..d0f404d8cbaa 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -884,66 +884,86 @@ void ToolChain::addProfileRTLibs(const llvm::opt::ArgList 
,
 
 ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
 const ArgList ) const {
+  if (runtimeLibType)
+return *runtimeLibType;
+
   const Arg* A = Args.getLastArg(options::OPT_rtlib_EQ);
   StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_RTLIB;
 
   // Only use "platform" in tests to override CLANG_DEFAULT_RTLIB!
   if (LibName == "compiler-rt")
-return ToolChain::RLT_CompilerRT;
+runtimeLibType = ToolChain::RLT_CompilerRT;
   else if (LibName == "libgcc")
-return ToolChain::RLT_Libgcc;
+runtimeLibType = ToolChain::RLT_Libgcc;
   else if (LibName == "platform")
-return GetDefaultRuntimeLibType();
+runtimeLibType = GetDefaultRuntimeLibType();
+  else {
+if (A)
+  getDriver().Diag(diag::err_drv_invalid_rtlib_name)
+  << A->getAsString(Args);
 
-  if (A)
-getDriver().Diag(diag::err_drv_invalid_rtlib_name) << A->getAsString(Args);
+runtimeLibType = GetDefaultRuntimeLibType();
+  }
 
-  return GetDefaultRuntimeLibType();
+  return *runtimeLibType;
 }
 
 ToolChain::UnwindLibType ToolChain::GetUnwindLibType(
 const ArgList ) const {
+  if (unwindLibType)
+return *unwindLibType;
+
   const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ);
   StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_UNWINDLIB;
 
   if (LibName == "none")
-return ToolChain::UNW_None;
+unwindLibType = ToolChain::UNW_None;
   else if (LibName == "platform" || LibName == "") {
 ToolChain::RuntimeLibType RtLibType = GetRuntimeLibType(Args);
 if (RtLibType == ToolChain::RLT_CompilerRT)
-  return ToolChain::UNW_None;
+  unwindLibType = ToolChain::UNW_None;
 else if (RtLibType == ToolChain::RLT_Libgcc)
-  return ToolChain::UNW_Libgcc;
+  unwindLibType = ToolChain::UNW_Libgcc;
   } else if (LibName == "libunwind") {
 if (GetRuntimeLibType(Args) == RLT_Libgcc)
   getDriver().Diag(diag::err_drv_incompatible_unwindlib);
-return ToolChain::UNW_CompilerRT;
+unwindLibType = ToolChain::UNW_CompilerRT;
   } else if (LibName == "libgcc")
-return ToolChain::UNW_Libgcc;
+unwindLibType = ToolChain::UNW_Libgcc;
+  else {
+if (A)
+  getDriver().Diag(diag::err_drv_invalid_unwindlib_name)
+  << A->getAsString(Args);
 
-  if (A)
-getDriver().Diag(diag::err_drv_invalid_unwindlib_name)
-<< A->getAsString(Args);
+unwindLibType = GetDefaultUnwindLibType();
+  }
 
-  return GetDefaultUnwindLibType();
+  return *unwindLibType;
 }
 
 ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList ) 
const{
+  if (cxxStdlibType)
+return *cxxStdlibType;
+
   const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);
   StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB;
 
   // Only use "platform" in tests to override CLANG_DEFAULT_CXX_STDLIB!
   if (LibName == "libc++")
-return ToolChain::CST_Libcxx;
+cxxStdlibType = ToolChain::CST_Libcxx;
   else if (LibName == "libstdc++")
-return ToolChain::CST_Libstdcxx;
+cxxStdlibType = ToolChain::CST_Libstdcxx;
   else if (LibName == "platform")
-return GetDefaultCXXStdlibType();
+cxxStdlibType = GetDefaultCXXStdlibType();
+  else {
+if (A)
+  getDriver().Diag(diag::err_drv_invalid_stdlib_name)
+  << A->getAsString(Args);
 
-  if (A)
-getDriver().Diag(diag::err_drv_invalid_stdlib_name) << 
A->getAsString(Args);
+cxxStdlibType = GetDefaultCXXStdlibType();
+  }
 
-  return GetDefaultCXXStdlibType();
+  return *cxxStdlibType;
 }
 
 /// Utility 

[clang] a743702 - Revert "[clang][driver] Only warn once about invalid library values"

2021-02-10 Thread Tom Weaver via cfe-commits

Author: Tom Weaver
Date: 2021-02-10T16:37:34Z
New Revision: a743702a1f4880e4492196b1ce9a9a63e0b4c075

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

LOG: Revert "[clang][driver] Only warn once about invalid library values"

This reverts commit a6439b52088b1d58d8e7aa9891c9011648710593.

Caused buildbot failure http://lab.llvm.org:8014/#/builders/125/builds/125

Added: 


Modified: 
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/ToolChain.h 
b/clang/include/clang/Driver/ToolChain.h
index fed688c0f1ce..59fdd2997fec 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -166,10 +166,6 @@ class ToolChain {
 EffectiveTriple = std::move(ET);
   }
 
-  mutable llvm::Optional cxxStdlibType;
-  mutable llvm::Optional runtimeLibType;
-  mutable llvm::Optional unwindLibType;
-
 protected:
   MultilibSet Multilibs;
   Multilib SelectedMultilib;

diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index d0f404d8cbaa..c83638086048 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -884,86 +884,66 @@ void ToolChain::addProfileRTLibs(const llvm::opt::ArgList 
,
 
 ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
 const ArgList ) const {
-  if (runtimeLibType)
-return *runtimeLibType;
-
   const Arg* A = Args.getLastArg(options::OPT_rtlib_EQ);
   StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_RTLIB;
 
   // Only use "platform" in tests to override CLANG_DEFAULT_RTLIB!
   if (LibName == "compiler-rt")
-runtimeLibType = ToolChain::RLT_CompilerRT;
+return ToolChain::RLT_CompilerRT;
   else if (LibName == "libgcc")
-runtimeLibType = ToolChain::RLT_Libgcc;
+return ToolChain::RLT_Libgcc;
   else if (LibName == "platform")
-runtimeLibType = GetDefaultRuntimeLibType();
-  else {
-if (A)
-  getDriver().Diag(diag::err_drv_invalid_rtlib_name)
-  << A->getAsString(Args);
+return GetDefaultRuntimeLibType();
 
-runtimeLibType = GetDefaultRuntimeLibType();
-  }
+  if (A)
+getDriver().Diag(diag::err_drv_invalid_rtlib_name) << A->getAsString(Args);
 
-  return *runtimeLibType;
+  return GetDefaultRuntimeLibType();
 }
 
 ToolChain::UnwindLibType ToolChain::GetUnwindLibType(
 const ArgList ) const {
-  if (unwindLibType)
-return *unwindLibType;
-
   const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ);
   StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_UNWINDLIB;
 
   if (LibName == "none")
-unwindLibType = ToolChain::UNW_None;
+return ToolChain::UNW_None;
   else if (LibName == "platform" || LibName == "") {
 ToolChain::RuntimeLibType RtLibType = GetRuntimeLibType(Args);
 if (RtLibType == ToolChain::RLT_CompilerRT)
-  unwindLibType = ToolChain::UNW_None;
+  return ToolChain::UNW_None;
 else if (RtLibType == ToolChain::RLT_Libgcc)
-  unwindLibType = ToolChain::UNW_Libgcc;
+  return ToolChain::UNW_Libgcc;
   } else if (LibName == "libunwind") {
 if (GetRuntimeLibType(Args) == RLT_Libgcc)
   getDriver().Diag(diag::err_drv_incompatible_unwindlib);
-unwindLibType = ToolChain::UNW_CompilerRT;
+return ToolChain::UNW_CompilerRT;
   } else if (LibName == "libgcc")
-unwindLibType = ToolChain::UNW_Libgcc;
-  else {
-if (A)
-  getDriver().Diag(diag::err_drv_invalid_unwindlib_name)
-  << A->getAsString(Args);
+return ToolChain::UNW_Libgcc;
 
-unwindLibType = GetDefaultUnwindLibType();
-  }
+  if (A)
+getDriver().Diag(diag::err_drv_invalid_unwindlib_name)
+<< A->getAsString(Args);
 
-  return *unwindLibType;
+  return GetDefaultUnwindLibType();
 }
 
 ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList ) 
const{
-  if (cxxStdlibType)
-return *cxxStdlibType;
-
   const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);
   StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB;
 
   // Only use "platform" in tests to override CLANG_DEFAULT_CXX_STDLIB!
   if (LibName == "libc++")
-cxxStdlibType = ToolChain::CST_Libcxx;
+return ToolChain::CST_Libcxx;
   else if (LibName == "libstdc++")
-cxxStdlibType = ToolChain::CST_Libstdcxx;
+return ToolChain::CST_Libstdcxx;
   else if (LibName == "platform")
-cxxStdlibType = GetDefaultCXXStdlibType();
-  else {
-if (A)
-  getDriver().Diag(diag::err_drv_invalid_stdlib_name)
-  << A->getAsString(Args);
+return GetDefaultCXXStdlibType();
 
-cxxStdlibType = GetDefaultCXXStdlibType();
-  }
+  if (A)
+getDriver().Diag(diag::err_drv_invalid_stdlib_name) << 
A->getAsString(Args);
 
-  return *cxxStdlibType;
+  return GetDefaultCXXStdlibType();
 }
 
 /// 

[clang] 4f1320b - Revert "[InstrProfiling] Use !associated metadata for counters, data and values"

2021-02-02 Thread Tom Weaver via cfe-commits

Author: Tom Weaver
Date: 2021-02-02T14:19:31Z
New Revision: 4f1320b77d1780dd7532f8ca8b123c13ab55bf1a

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

LOG: Revert "[InstrProfiling] Use !associated metadata for counters, data and 
values"

This reverts commit df3e39f60b356ca9dbfc11e96e5fdda30afa7acb.

introduced failing test instrprof-gc-sections.c
causing build bot to fail:
http://lab.llvm.org:8011/#/builders/53/builds/1184

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp
llvm/include/llvm/Transforms/Instrumentation.h
llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
llvm/test/Instrumentation/InstrProfiling/icall.ll
llvm/test/Instrumentation/InstrProfiling/linkage.ll
llvm/test/Transforms/PGOProfile/counter_promo.ll
llvm/test/Transforms/PGOProfile/counter_promo_mexits.ll

Removed: 
compiler-rt/test/profile/instrprof-gc-sections.c
llvm/test/Transforms/PGOProfile/associated.ll



diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index f995c4702419..52bcd971dc8c 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -615,9 +615,6 @@ getInstrProfOptions(const CodeGenOptions ,
   Options.NoRedZone = CodeGenOpts.DisableRedZone;
   Options.InstrProfileOutput = CodeGenOpts.InstrProfileOutput;
   Options.Atomic = CodeGenOpts.AtomicProfileUpdate;
-  std::pair BinutilsVersion =
-  llvm::TargetMachine::parseBinutilsVersion(CodeGenOpts.BinutilsVersion);
-  Options.CounterLinkOrder = BinutilsVersion >= std::make_pair(2, 36);
   return Options;
 }
 

diff  --git a/compiler-rt/test/profile/instrprof-gc-sections.c 
b/compiler-rt/test/profile/instrprof-gc-sections.c
deleted file mode 100644
index b1f0720846af..
--- a/compiler-rt/test/profile/instrprof-gc-sections.c
+++ /dev/null
@@ -1,91 +0,0 @@
-// REQUIRES: linux, lld-available
-
-// RUN: %clang_profgen=%t.profraw -fuse-ld=lld -fcoverage-mapping -mllvm 
-counter-link-order -mllvm -enable-name-compression=false -DCODE=1 
-ffunction-sections -fdata-sections -Wl,--gc-sections -o %t %s
-// RUN: %run %t
-// RUN: llvm-profdata merge -o %t.profdata %t.profraw
-// RUN: llvm-profdata show --all-functions %t.profdata | FileCheck %s 
-check-prefix=PROF
-// RUN: llvm-cov show %t -instr-profile %t.profdata | FileCheck %s 
-check-prefix=COV
-// RUN: llvm-nm %t | FileCheck %s -check-prefix=NM
-// RUN: llvm-readelf -x __llvm_prf_names %t | FileCheck %s 
-check-prefix=PRF_NAMES
-// RUN: llvm-readelf -x __llvm_prf_cnts %t | FileCheck %s 
-check-prefix=PRF_CNTS
-
-// RUN: %clang_lto_profgen=%t.lto.profraw -fuse-ld=lld -fcoverage-mapping 
-mllvm -counter-link-order -mllvm -enable-name-compression=false -DCODE=1 
-ffunction-sections -fdata-sections -Wl,--gc-sections -flto -o %t.lto %s
-// RUN: %run %t.lto
-// RUN: llvm-profdata merge -o %t.lto.profdata %t.lto.profraw
-// RUN: llvm-profdata show --all-functions %t.lto.profdata | FileCheck %s 
-check-prefix=PROF
-// RUN: llvm-cov show %t.lto -instr-profile %t.lto.profdata | FileCheck %s 
-check-prefix=COV
-// RUN: llvm-nm %t.lto | FileCheck %s -check-prefix=NM
-// RUN: llvm-readelf -x __llvm_prf_names %t.lto | FileCheck %s 
-check-prefix=PRF_NAMES
-// RUN: llvm-readelf -x __llvm_prf_cnts %t.lto | FileCheck %s 
-check-prefix=PRF_CNTS
-
-// Note: We expect foo() and some of the profiling data associated with it to
-// be garbage collected.
-
-// Note: When there is no code in a program, we expect to see the exact same
-// set of external functions provided by the profile runtime.
-
-// RUN: %clang_profgen -fuse-ld=lld -fcoverage-mapping -mllvm 
-counter-link-order -ffunction-sections -fdata-sections -Wl,--gc-sections 
-shared -o %t.nocode.so %s
-// RUN: llvm-nm -jgU %t.nocode.so | grep -vE "__start_.*|__stop_.*" > 
%t.nocode.syms
-// RUN: llvm-nm -jgU %t | grep -vE "main|_start|_IO_stdin_used|__libc_.*" > 
%t.code.syms
-// RUN: 
diff  %t.nocode.syms %t.code.syms
-
-// Note: We also check the IR instrumentation and expect foo() to be garbage
-// collected as well.
-
-// RUN: %clang_pgogen=%t.pgo.profraw -fuse-ld=lld -mllvm -counter-link-order 
-DCODE=1 -ffunction-sections -fdata-sections -Wl,--gc-sections -o %t.pgo %s
-// RUN: %run %t.pgo
-// RUN: llvm-profdata merge -o %t.pgo.profdata %t.pgo.profraw
-// RUN: llvm-profdata show --all-functions %t.pgo.profdata | FileCheck %s 
-check-prefix=PGO
-// RUN: llvm-nm %t.pgo | FileCheck %s -check-prefix=NM
-
-#ifdef CODE
-
-// COV: [[@LINE+1]]{{ *}}|{{ *}}0|void foo()
-void foo() {}
-
-// COV: [[@LINE+1]]{{ *}}|{{ *}}1|int main
-int main() { return 0; }
-
-#endif // CODE
-
-// NM-NOT: foo
-
-// PROF: Counters:
-// PROF-NEXT:   main:
-// PROF-NEXT: Hash:
-// PROF-NEXT: Counters: 1

Re: [PATCH] D54998: [clangd] Build and test IndexBenchmark in check-clangd

2018-11-28 Thread Tom Weaver via cfe-commits
Hiya Haojian,

I've been looking over the build bots recently and believe r347753 may have
caused the following test:

clangd/index-tools.test

to start failing. You can see the failing test in the logs of the following
build bot:

http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/20851/steps/ninja%20check%201/logs/stdio

is there any chance you can take a look?

Kindest regards
Tom W

On Wed, 28 Nov 2018 at 12:02, Haojian Wu via Phabricator via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> hokein created this revision.
> hokein added a reviewer: ilya-biryukov.
> Herald added subscribers: kadircet, arphaman, jkorous, MaskRay, ioeric,
> mgorny.
>
> Include IndexBenchmark in check-clangd to make sure we won't forget to
> update
> it when doing breaking changes; also fix an out-of-date test input.
>
>
> Repository:
>   rCTE Clang Tools Extra
>
> https://reviews.llvm.org/D54998
>
> Files:
>   test/CMakeLists.txt
>   test/clangd/Inputs/requests.json
>   test/clangd/index-tools.test
>
>
> Index: test/clangd/index-tools.test
> ===
> --- test/clangd/index-tools.test
> +++ test/clangd/index-tools.test
> @@ -1,5 +1,4 @@
>  # RUN: clangd-indexer %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs >
> %t.index
> -# FIXME: By default, benchmarks are excluded from the list of default
> targets hence not built. Find a way to depend on benchmarks to run the next
> command.
>  # REQUIRES: shell
>  # RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then
> %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.json
> --benchmark_min_time=0.01 ; fi
>  # Pass invalid JSON file and check that IndexBenchmark fails to parse it.
> Index: test/clangd/Inputs/requests.json
> ===
> --- test/clangd/Inputs/requests.json
> +++ test/clangd/Inputs/requests.json
> @@ -1,7 +1,7 @@
>
> -[{"Limit":100,"ProximityPaths":["/usr/home/user/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp"],"Query":"OMP","RestrictForCodeCompletion":true,"Scopes":["clang::"]},
> -{"Limit":100,"ProximityPaths":[],"Query":"s","RestrictForCodeCompletion":true,"Scopes":["llvm::",
> ""]},
> -{"Limit":100,"ProximityPaths":[],"Query":"sy","RestrictForCodeCompletion":true,"Scopes":["llvm::",
> ""]},
> -{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::",
> ""]},
> -{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::",
> ""]},
> -{"Limit":100,"ProximityPaths":[],"Query":"Dex","RestrictForCodeCompletion":true,"Scopes":["clang::clangd::",
> "clang::", "clang::clangd::dex::"]},
>
> -{"Limit":100,"ProximityPaths":[],"Query":"Variable","RestrictForCodeCompletion":true,"Scopes":[""]}]
> +[{"Limit":100,"ProximityPaths":["/usr/home/user/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp"],"Query":"OMP","RestrictForCodeCompletion":true,"Scopes":["clang::"],
> "AnyScope":false},
> +{"Limit":100,"ProximityPaths":[],"Query":"s","RestrictForCodeCompletion":true,"Scopes":["llvm::",
> ""], "AnyScope":false},
> +{"Limit":100,"ProximityPaths":[],"Query":"sy","RestrictForCodeCompletion":true,"Scopes":["llvm::",
> ""], "AnyScope":false},
> +{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::",
> ""], "AnyScope":false},
> +{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::",
> ""], "AnyScope":false},
> +{"Limit":100,"ProximityPaths":[],"Query":"Dex","RestrictForCodeCompletion":true,"Scopes":["clang::clangd::",
> "clang::", "clang::clangd::dex::"],"AnyScope":false},
> +{"Limit":100,"ProximityPaths":[],"Query":"Variable","RestrictForCodeCompletion":true,"Scopes":[""],
> "AnyScope":false}]
> Index: test/CMakeLists.txt
> ===
> --- test/CMakeLists.txt
> +++ test/CMakeLists.txt
> @@ -72,6 +72,10 @@
>dexp
>)
>
> +if (LLVM_INCLUDE_BENCHMARKS)
> +  list(APPEND CLANGD_TEST_DEPS IndexBenchmark)
> +endif()
> +
>  # Add lit test dependencies.
>  set(LLVM_UTILS_DEPS
>FileCheck count not
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r347675 - [clangd] textDocument/SymbolInfo extension

2018-11-28 Thread Tom Weaver via cfe-commits
thanks for the fix!

TomW

On Wed, 28 Nov 2018 at 11:33, Yvan Roux via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Wed, 28 Nov 2018 at 12:28, Yvan Roux  wrote:
> >
> > On Wed, 28 Nov 2018 at 11:16, Mikael Holmén 
> wrote:
> > >
> > >
> > >
> > > On 11/28/18 11:09 AM, Jan Korous wrote:
> > > > Thanks for the notice and sorry for the delay! I somehow missed the
> > > > failure mails before I went offline yesterday.
> > > >
> > > > I am just running tests on my fix now and hopefully pushing shortly.
> > > >
> > > > Since I didn’t know we are using old compilers for these builds I am
> now
> > > > curious why. Is that intentional? For backward-compatibility?
> > >
> > > I can't speak for the ARM bots, but I myself is doing my development on
> > > ubuntu 14.04 and there I get clang 3.6.0.
> >
> > ARM bots are running inside Ubuntu 16.04.1 LTS containers in which
> > default clang version is 3.8
>
> Bots fixed BTW, Thanks :)
>
> >
> > > And
> > >
> > >
> https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library
> > >
> > > suggests that even clang 3.1 should work.
> > >
> > > /Mikael
> > >
> > > >
> > > > Thanks.
> > > >
> > > > Jan
> > > >
> > > >> On Nov 28, 2018, at 8:59 AM, Yvan Roux  > > >> > wrote:
> > > >>
> > > >> On Wed, 28 Nov 2018 at 09:56, Mikael Holmén via cfe-commits
> > > >> mailto:cfe-commits@lists.llvm.org>>
> wrote:
> > > >>>
> > > >>> Hi Jan,
> > > >>>
> > > >>> This code doesn't compile with clang 3.6.0:
> > > >>
> > > >> And broke ARM bots, logs available here:
> > > >>
> > > >>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/5582/steps/build%20stage%201/logs/stdio
> > > >>
> > > >> Cheers,
> > > >> Yvan
> > > >>
> > > >>> ../tools/clang/tools/extra/clangd/Protocol.cpp:456:10: error: no
> viable
> > > >>> conversion from 'json::Object' to 'llvm::json::Value'
> > > >>>   return result;
> > > >>>  ^~
> > > >>> ../include/llvm/Support/JSON.h:291:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to 'const
> > > >>> llvm::json::Value &' for 1st argument
> > > >>>   Value(const Value ) { copyFrom(M); }
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:292:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to
> 'llvm::json::Value
> > > >>> &&' for 1st argument
> > > >>>   Value(Value &) { moveFrom(std::move(M)); }
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:293:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to
> > > >>> 'std::initializer_list' for 1st argument
> > > >>>   Value(std::initializer_list Elements);
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:294:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to 'json::Array
> &&' for
> > > >>> 1st argument
> > > >>>   Value(json::Array &) : Type(T_Array) {
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:299:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to 'json::Object
> &&' for
> > > >>> 1st argument
> > > >>>   Value(json::Object &) : Type(T_Object) {
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:305:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to 'std::string'
> (aka
> > > >>> 'basic_string') for 1st argument
> > > >>>   Value(std::string V) : Type(T_String) {
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:312:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to 'const
> > > >>> llvm::SmallVectorImpl &' for 1st argument
> > > >>>   Value(const llvm::SmallVectorImpl )
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:314:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to 'const
> > > >>> llvm::formatv_object_base &' for 1st argument
> > > >>>   Value(const llvm::formatv_object_base ) : Value(V.str()){};
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:316:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to
> 'llvm::StringRef' for
> > > >>> 1st argument
> > > >>>   Value(StringRef V) : Type(T_StringRef) {
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:323:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to 'const char *'
> for
> > > >>> 1st argument
> > > >>>   Value(const char *V) : Value(StringRef(V)) {}
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:324:3: note: candidate constructor
> not
> > > >>> viable: no known conversion from 'json::Object' to
> 'std::nullptr_t' (aka
> > > >>> 'nullptr_t') for 1st argument
> > > >>>   Value(std::nullptr_t) : Type(T_Null) {}
> > > >>>   ^
> > > >>> ../include/llvm/Support/JSON.h:298:3: note: candidate template
> ignored:
> > > >>> could not match 'vector > > >>> 

Re: [clang-tools-extra] r345961 - [clang-tidy] Get ClangTidyContext out of the business of storing diagnostics. NFC

2018-11-02 Thread Tom Weaver via cfe-commits
Hiya Sam,

are you aware that r345961 caused a test failure on the following bot and
build

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/21169

is there any chance you could take a look please?

thanks
Tom

On Fri, 2 Nov 2018 at 10:04, Sam McCall via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: sammccall
> Date: Fri Nov  2 03:01:59 2018
> New Revision: 345961
>
> URL: http://llvm.org/viewvc/llvm-project?rev=345961=rev
> Log:
> [clang-tidy] Get ClangTidyContext out of the business of storing
> diagnostics. NFC
>
> Summary:
> Currently ClangTidyContext::diag() sends the diagnostics to a
> DiagnosticsEngine, which probably delegates to a
> ClangTidyDiagnosticsConsumer,
> which is supposed to go back and populate ClangTidyContext::Errors.
>
> After this patch, the diagnostics are stored in the
> ClangTidyDiagnosticsConsumer
> itself and can be retrieved from there.
>
> Why?
>  - the round-trip from context -> engine -> consumer -> context is
> confusing
>and makes it harder to establish layering between these things.
>  - context does too many things, and makes it hard to use clang-tidy as a
> library
>  - everyone who actually wants the diagnostics has access to the
> ClangTidyDiagnosticsConsumer
>
> The most natural implementation (ClangTidyDiagnosticsConsumer::take()
> finalizes diagnostics) causes a test failure:
> clang-tidy-run-with-database.cpp
> asserts that clang-tidy exits successfully when trying to process a file
> that doesn't exist.
> In clang-tidy today, this happens because finish() is never called, so the
> diagnostic is never flushed. This looks like a bug to me.
> For now, this patch carefully preserves that behavior, but I'll ping the
> authors to see whether it's deliberate and worth preserving.
>
> Reviewers: hokein
>
> Subscribers: xazax.hun, cfe-commits, alexfh
>
> Differential Revision: https://reviews.llvm.org/D53953
>
> Modified:
> clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
> clang-tools-extra/trunk/clang-tidy/ClangTidy.h
> clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
> clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
> clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
>
> clang-tools-extra/trunk/test/clang-tidy/clang-tidy-run-with-database.cpp
> clang-tools-extra/trunk/unittests/clang-tidy/ClangTidyTest.h
>
> Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=345961=345960=345961=diff
>
> ==
> --- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
> +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Fri Nov  2 03:01:59
> 2018
> @@ -500,11 +500,12 @@ getCheckOptions(const ClangTidyOptions &
>return Factory.getCheckOptions();
>  }
>
> -void runClangTidy(clang::tidy::ClangTidyContext ,
> -  const CompilationDatabase ,
> -  ArrayRef InputFiles,
> -  llvm::IntrusiveRefCntPtr BaseFS,
> -  bool EnableCheckProfile, llvm::StringRef
> StoreCheckProfile) {
> +std::vector
> +runClangTidy(clang::tidy::ClangTidyContext ,
> + const CompilationDatabase ,
> + ArrayRef InputFiles,
> + llvm::IntrusiveRefCntPtr BaseFS,
> + bool EnableCheckProfile, llvm::StringRef StoreCheckProfile) {
>ClangTool Tool(Compilations, InputFiles,
>   std::make_shared(), BaseFS);
>
> @@ -586,9 +587,11 @@ void runClangTidy(clang::tidy::ClangTidy
>
>ActionFactory Factory(Context);
>Tool.run();
> +  return DiagConsumer.take();
>  }
>
> -void handleErrors(ClangTidyContext , bool Fix,
> +void handleErrors(llvm::ArrayRef Errors,
> +  ClangTidyContext , bool Fix,
>unsigned ,
>llvm::IntrusiveRefCntPtr BaseFS)
> {
>ErrorReporter Reporter(Context, Fix, BaseFS);
> @@ -598,7 +601,7 @@ void handleErrors(ClangTidyContext 
>if (!InitialWorkingDir)
>  llvm::report_fatal_error("Cannot get current working path.");
>
> -  for (const ClangTidyError  : Context.getErrors()) {
> +  for (const ClangTidyError  : Errors) {
>  if (!Error.BuildDirectory.empty()) {
>// By default, the working directory of file system is the current
>// clang-tidy running directory.
>
> Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.h
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.h?rev=345961=345960=345961=diff
>
> ==
> --- clang-tools-extra/trunk/clang-tidy/ClangTidy.h (original)
> +++ clang-tools-extra/trunk/clang-tidy/ClangTidy.h Fri Nov  2 03:01:59 2018
> @@ -230,12 +230,13 @@ getCheckOptions(const ClangTidyOptions &
>  /// \param StoreCheckProfile If provided, and EnableCheckProfile is