[clang-tools-extra] 2f8da95 - [clangd][nfc] cleanup of remaining clang-tidy findings

2022-02-03 Thread Christian Kühnel via cfe-commits

Author: Christian Kühnel
Date: 2022-02-03T12:05:25Z
New Revision: 2f8da95e070e0f6b8c3d3310de51b016176e840a

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

LOG: [clangd][nfc] cleanup of remaining clang-tidy findings

There were some left-overs (or new things) from the previous patches.

This will get us down to 0 open findings except:
clang-tidy is complaining in some files about
`warning: #includes are not sorted properly [llvm-include-order]`
however, clang-format does revert these changes.
It looks like clang-tidy and clang-format disagree there.

Not sure how we can fix that...

Reviewed By: sammccall

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

Added: 


Modified: 
clang-tools-extra/clangd/ConfigYAML.cpp
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/ConfigYAML.cpp 
b/clang-tools-extra/clangd/ConfigYAML.cpp
index 0c758b6d296d4..9015de26c91f4 100644
--- a/clang-tools-extra/clangd/ConfigYAML.cpp
+++ b/clang-tools-extra/clangd/ConfigYAML.cpp
@@ -349,8 +349,7 @@ class Parser {
 if (auto Scalar = scalarValue(N, Desc)) {
   if (auto Bool = llvm::yaml::parseBool(**Scalar))
 return Located(*Bool, Scalar->Range);
-  else
-warning(Desc + " should be a boolean", N);
+  warning(Desc + " should be a boolean", N);
 }
 return llvm::None;
   }

diff  --git a/clang-tools-extra/clangd/XRefs.cpp 
b/clang-tools-extra/clangd/XRefs.cpp
index fea143e67824b..be1361f8bd278 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -1928,9 +1928,9 @@ static QualType unwrapFindType(QualType T) {
   // FIXME: use HeuristicResolver to unwrap smart pointers?
 
   // Function type => return type.
-  if (auto FT = T->getAs())
+  if (auto *FT = T->getAs())
 return unwrapFindType(FT->getReturnType());
-  if (auto CRD = T->getAsCXXRecordDecl()) {
+  if (auto *CRD = T->getAsCXXRecordDecl()) {
 if (CRD->isLambda())
   return unwrapFindType(CRD->getLambdaCallOperator()->getReturnType());
 // FIXME: more cases we'd prefer the return type of the call operator?

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp 
b/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
index eee64d84fda63..2b67034da8d48 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
@@ -254,8 +254,9 @@ bool AddUsing::prepare(const Selection ) {
 if (auto *T = Node->ASTNode.get()) {
   if (T->getAs()) {
 break;
-  } else if (Node->Parent->ASTNode.get() ||
- Node->Parent->ASTNode.get()) {
+  }
+  if (Node->Parent->ASTNode.get() ||
+  Node->Parent->ASTNode.get()) {
 // Node is TypeLoc, but it's parent is either TypeLoc or
 // NestedNameSpecifier. In both cases, we want to go up, to find
 // the outermost TypeLoc.

diff  --git a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp 
b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
index b060935145999..7de3746d22511 100644
--- a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -42,7 +42,6 @@ using ::testing::IsEmpty;
 using ::testing::Pair;
 using ::testing::SizeIs;
 using ::testing::UnorderedElementsAre;
-using testing::UnorderedElementsAreArray;
 
 ::testing::Matcher withFix(::testing::Matcher FixMatcher) {
   return Field(::Fixes, ElementsAre(FixMatcher));



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


[clang-tools-extra] c0e3c89 - [NFC][clangd] cleaning up llvm-qualified-auto

2022-01-25 Thread Christian Kühnel via cfe-commits

Author: Christian Kühnel
Date: 2022-01-25T13:26:33Z
New Revision: c0e3c893aa095c78156900ef11f68042aff83839

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

LOG: [NFC][clangd] cleaning up llvm-qualified-auto

This is a cleanup of all llvm-qualified-auto findings.
This patch was created by automatically applying the fixes from
clang-tidy.

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

Added: 


Modified: 
clang-tools-extra/clangd/AST.cpp
clang-tools-extra/clangd/CodeComplete.cpp
clang-tools-extra/clangd/ExpectedTypes.cpp
clang-tools-extra/clangd/FindSymbols.cpp
clang-tools-extra/clangd/HeaderSourceSwitch.cpp
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/index/IndexAction.cpp
clang-tools-extra/clangd/index/SymbolCollector.cpp
clang-tools-extra/clangd/index/dex/Iterator.cpp
clang-tools-extra/clangd/refactor/tweaks/AnnotateHighlightings.cpp
clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp
clang-tools-extra/clangd/refactor/tweaks/ExpandMacro.cpp
clang-tools-extra/clangd/unittests/ClangdTests.cpp
clang-tools-extra/clangd/unittests/FileIndexTests.cpp
clang-tools-extra/clangd/unittests/HoverTests.cpp
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/AST.cpp 
b/clang-tools-extra/clangd/AST.cpp
index 53b55e1579ec4..b970325098c65 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -456,7 +456,7 @@ class DeducedTypeVisitor : public 
RecursiveASTVisitor {
 const AutoType *AT = D->getReturnType()->getContainedAutoType();
 if (AT && !AT->getDeducedType().isNull()) {
   DeducedType = AT->getDeducedType();
-} else if (auto DT = dyn_cast(D->getReturnType())) {
+} else if (auto *DT = dyn_cast(D->getReturnType())) {
   // auto in a trailing return type just points to a DecltypeType and
   // getContainedAutoType does not unwrap it.
   if (!DT->getUnderlyingType().isNull())

diff  --git a/clang-tools-extra/clangd/CodeComplete.cpp 
b/clang-tools-extra/clangd/CodeComplete.cpp
index d9165599fb9ab..43f35232270a3 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -453,7 +453,7 @@ struct CodeCompletionBuilder {
   template 
   const std::string *onlyValue() const {
 auto B = Bundled.begin(), E = Bundled.end();
-for (auto I = B + 1; I != E; ++I)
+for (auto *I = B + 1; I != E; ++I)
   if (I->*Member != B->*Member)
 return nullptr;
 return &(B->*Member);
@@ -461,7 +461,7 @@ struct CodeCompletionBuilder {
 
   template  const bool *onlyValue() const {
 auto B = Bundled.begin(), E = Bundled.end();
-for (auto I = B + 1; I != E; ++I)
+for (auto *I = B + 1; I != E; ++I)
   if (I->*Member != B->*Member)
 return nullptr;
 return &(B->*Member);

diff  --git a/clang-tools-extra/clangd/ExpectedTypes.cpp 
b/clang-tools-extra/clangd/ExpectedTypes.cpp
index e0a4e472f3496..01a08c8589c18 100644
--- a/clang-tools-extra/clangd/ExpectedTypes.cpp
+++ b/clang-tools-extra/clangd/ExpectedTypes.cpp
@@ -53,7 +53,7 @@ typeOfCompletion(const CodeCompletionResult ) {
   auto T = VD->getType();
   if (T.isNull())
 return llvm::None;
-  if (auto FuncT = T->getAs()) {
+  if (auto *FuncT = T->getAs()) {
 // Functions are a special case. They are completed as 'foo()' and we want
 // to match their return type rather than the function type itself.
 // FIXME(ibiryukov): in some cases, we might want to avoid completing `()`

diff  --git a/clang-tools-extra/clangd/FindSymbols.cpp 
b/clang-tools-extra/clangd/FindSymbols.cpp
index edbeeed9e2ca6..75961d3a6ea17 100644
--- a/clang-tools-extra/clangd/FindSymbols.cpp
+++ b/clang-tools-extra/clangd/FindSymbols.cpp
@@ -483,7 +483,7 @@ class DocumentOutline {
 if (!llvm::isa(D))
   return VisitKind::No;
 
-if (auto Func = llvm::dyn_cast(D)) {
+if (auto *Func = llvm::dyn_cast(D)) {
   // Some functions are implicit template instantiations, those should be
   // ignored.
   if (auto *Info = Func->getTemplateSpecializationInfo()) {

diff  --git a/clang-tools-extra/clangd/HeaderSourceSwitch.cpp 
b/clang-tools-extra/clangd/HeaderSourceSwitch.cpp
index e3e2ab3ea8694..ed86c2eb0d12d 100644
--- a/clang-tools-extra/clangd/HeaderSourceSwitch.cpp
+++ b/clang-tools-extra/clangd/HeaderSourceSwitch.cpp
@@ -25,13 +25,13 @@ llvm::Optional getCorrespondingHeaderOrSource(
   llvm::StringRef PathExt = llvm::sys::path::extension(OriginalFile);
 
   // Lookup in a list of known 

[clang-tools-extra] 5bd643d - [clangd] cleanup of header guard names

2021-12-02 Thread Christian Kühnel via cfe-commits

Author: Christian Kühnel
Date: 2021-12-02T15:58:35Z
New Revision: 5bd643d31d11e96bcae833025b241681370e527c

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

LOG: [clangd] cleanup of header guard names

Renaming header guards to match the LLVM convention.
This patch was created by automatically applying the fixes from
clang-tidy.

I've removed the [NFC]  tag from the title, as we're adding header guards in 
some files and thus might trigger behavior changes.

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

Added: 


Modified: 
clang-tools-extra/clangd/CollectMacros.h
clang-tools-extra/clangd/ExpectedTypes.h
clang-tools-extra/clangd/FindTarget.h
clang-tools-extra/clangd/HeaderSourceSwitch.h
clang-tools-extra/clangd/HeuristicResolver.h
clang-tools-extra/clangd/IncludeCleaner.h
clang-tools-extra/clangd/IncludeFixer.h
clang-tools-extra/clangd/InlayHints.h
clang-tools-extra/clangd/PathMapping.h
clang-tools-extra/clangd/URI.h
clang-tools-extra/clangd/index/BackgroundIndexLoader.h
clang-tools-extra/clangd/index/BackgroundRebuild.h
clang-tools-extra/clangd/index/CanonicalIncludes.h
clang-tools-extra/clangd/index/IndexAction.h
clang-tools-extra/clangd/index/ProjectAware.h
clang-tools-extra/clangd/index/Serialization.h
clang-tools-extra/clangd/index/SymbolCollector.h
clang-tools-extra/clangd/index/SymbolLocation.h
clang-tools-extra/clangd/index/SymbolOrigin.h
clang-tools-extra/clangd/index/dex/Token.h
clang-tools-extra/clangd/index/dex/Trigram.h
clang-tools-extra/clangd/index/remote/Client.h
clang-tools-extra/clangd/refactor/Tweak.h
clang-tools-extra/clangd/unittests/Annotations.h
clang-tools-extra/clangd/unittests/LSPClient.h
clang-tools-extra/clangd/unittests/Matchers.h
clang-tools-extra/clangd/unittests/SyncAPI.h
clang-tools-extra/clangd/unittests/TestFS.h
clang-tools-extra/clangd/unittests/TestIndex.h
clang-tools-extra/clangd/unittests/TestTU.h
clang-tools-extra/clangd/unittests/TestWorkspace.h
clang-tools-extra/clangd/unittests/support/TestTracer.h
clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h

Removed: 
clang-tools-extra/clangd/unittests/TestScheme.h



diff  --git a/clang-tools-extra/clangd/CollectMacros.h 
b/clang-tools-extra/clangd/CollectMacros.h
index 2167ebe2e3560..f8df9f9a20cc4 100644
--- a/clang-tools-extra/clangd/CollectMacros.h
+++ b/clang-tools-extra/clangd/CollectMacros.h
@@ -6,8 +6,8 @@
 //
 
//===--===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTEDMACROS_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTEDMACROS_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTMACROS_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTMACROS_H
 
 #include "AST.h"
 #include "Protocol.h"
@@ -114,4 +114,4 @@ collectPragmaMarksCallback(const SourceManager &, 
std::vector );
 } // namespace clangd
 } // namespace clang
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTEDMACROS_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTMACROS_H

diff  --git a/clang-tools-extra/clangd/ExpectedTypes.h 
b/clang-tools-extra/clangd/ExpectedTypes.h
index 36b7cce170234..873b106b91d17 100644
--- a/clang-tools-extra/clangd/ExpectedTypes.h
+++ b/clang-tools-extra/clangd/ExpectedTypes.h
@@ -15,8 +15,8 @@
 // the index. Similar types (such as `int` and `long`) are folded together,
 // forming equivalence classes with the same encoding.
 
//===--===//
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_EXPECTED_TYPES_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_EXPECTED_TYPES_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_EXPECTEDTYPES_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_EXPECTEDTYPES_H
 
 #include "clang/AST/Type.h"
 #include "llvm/ADT/StringRef.h"

diff  --git a/clang-tools-extra/clangd/FindTarget.h 
b/clang-tools-extra/clangd/FindTarget.h
index 3e4cf8b0c9a0a..756fe1d6458f9 100644
--- a/clang-tools-extra/clangd/FindTarget.h
+++ b/clang-tools-extra/clangd/FindTarget.h
@@ -19,8 +19,8 @@
 //
 
//===--===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_FINDTARGET_H
-#define LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_FINDTARGET_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FINDTARGET_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FINDTARGET_H
 
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTTypeTraits.h"
@@ -220,4 +220,4 @@ llvm::raw_ostream <<(llvm::raw_ostream &, 
DeclRelationSet);
 } // namespace clangd
 } // namespace clang
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_FINDTARGET_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_FINDTARGET_H

diff  --git 

[clang-tools-extra] 7aa2ce0 - [NFC][clangd] fix clang-tidy finding on isa_and_nonnull

2021-11-18 Thread Christian Kühnel via cfe-commits

Author: Christian Kühnel
Date: 2021-11-18T09:16:54Z
New Revision: 7aa2ce0fab3c21cf87c5884f6bf8bdece1b6fe1c

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

LOG: [NFC][clangd] fix clang-tidy finding on isa_and_nonnull

This is a cleanup of the only llvm-prefer-isa-or-dyn-cast-in-conditionals 
finding in the clangd code base. This patch was created by automatically 
applying the fixes from clang-tidy.

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

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/Selection.cpp 
b/clang-tools-extra/clangd/Selection.cpp
index e945f5d79b2c..0b10c7a3a6f9 100644
--- a/clang-tools-extra/clangd/Selection.cpp
+++ b/clang-tools-extra/clangd/Selection.cpp
@@ -500,7 +500,7 @@ class SelectionVisitor : public 
RecursiveASTVisitor {
   //  - those without source range information, we don't record those
   //  - those that can't be stored in DynTypedNode.
   bool TraverseDecl(Decl *X) {
-if (X && isa(X))
+if (llvm::isa_and_nonnull(X))
   return Base::TraverseDecl(X); // Already pushed by constructor.
 // Base::TraverseDecl will suppress children, but not this node itself.
 if (X && X->isImplicit())



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


[clang-tools-extra] ec4a2c9 - [NFC][clangd] cleanup llvm-else-after-return findings

2021-11-17 Thread Christian Kühnel via cfe-commits

Author: Christian Kühnel
Date: 2021-11-17T14:37:03Z
New Revision: ec4a2c956591e97904eae5102022f343dadfb8f1

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

LOG: [NFC][clangd] cleanup llvm-else-after-return findings

Cleanup of clang-tidy findings: removing "else" after a return statement
to improve readability of the code.

This patch was created by applying the clang-tidy fixes automatically.

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

Added: 


Modified: 
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/FuzzyMatch.cpp
clang-tools-extra/clangd/Hover.cpp
clang-tools-extra/clangd/JSONTransport.cpp
clang-tools-extra/clangd/PathMapping.cpp
clang-tools-extra/clangd/Protocol.cpp
clang-tools-extra/clangd/Selection.cpp
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/index/Serialization.cpp
clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp 
b/clang-tools-extra/clangd/ClangdLSPServer.cpp
index c01a4286884b8..6c000d3290fda 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -929,8 +929,7 @@ void ClangdLSPServer::onDocumentSymbol(const 
DocumentSymbolParams ,
 adjustSymbolKinds(*Items, SupportedSymbolKinds);
 if (SupportsHierarchicalDocumentSymbol)
   return Reply(std::move(*Items));
-else
-  return Reply(flattenSymbolHierarchy(*Items, FileURI));
+return Reply(flattenSymbolHierarchy(*Items, FileURI));
   });
 }
 

diff  --git a/clang-tools-extra/clangd/FuzzyMatch.cpp 
b/clang-tools-extra/clangd/FuzzyMatch.cpp
index 57f9554a7d0cf..2a908fd684da3 100644
--- a/clang-tools-extra/clangd/FuzzyMatch.cpp
+++ b/clang-tools-extra/clangd/FuzzyMatch.cpp
@@ -320,8 +320,9 @@ llvm::SmallString<256> 
FuzzyMatcher::dumpLast(llvm::raw_ostream ) const {
   if (!WordContainsPattern) {
 OS << "Substring check failed.\n";
 return Result;
-  } else if (isAwful(std::max(Scores[PatN][WordN][Match].Score,
-  Scores[PatN][WordN][Miss].Score))) {
+  }
+  if (isAwful(std::max(Scores[PatN][WordN][Match].Score,
+   Scores[PatN][WordN][Miss].Score))) {
 OS << "Substring check passed, but all matches are forbidden\n";
   }
   if (!(PatTypeSet & 1 << Upper))

diff  --git a/clang-tools-extra/clangd/Hover.cpp 
b/clang-tools-extra/clangd/Hover.cpp
index 4285b3595059f..faea812712ab2 100644
--- a/clang-tools-extra/clangd/Hover.cpp
+++ b/clang-tools-extra/clangd/Hover.cpp
@@ -74,7 +74,7 @@ std::string getLocalScope(const Decl *D) {
   // - Classes, categories, and protocols: "MyClass(Category)"
   if (const ObjCMethodDecl *MD = dyn_cast(DC))
 return printObjCMethod(*MD);
-  else if (const ObjCContainerDecl *CD = dyn_cast(DC))
+  if (const ObjCContainerDecl *CD = dyn_cast(DC))
 return printObjCContainer(*CD);
 
   auto GetName = [](const TypeDecl *D) {

diff  --git a/clang-tools-extra/clangd/JSONTransport.cpp 
b/clang-tools-extra/clangd/JSONTransport.cpp
index fd405c192591b..ecf6c67d8ae4a 100644
--- a/clang-tools-extra/clangd/JSONTransport.cpp
+++ b/clang-tools-extra/clangd/JSONTransport.cpp
@@ -194,8 +194,7 @@ bool JSONTransport::handleMessage(llvm::json::Value Message,
 
   if (ID)
 return Handler.onCall(*Method, std::move(Params), std::move(*ID));
-  else
-return Handler.onNotify(*Method, std::move(Params));
+  return Handler.onNotify(*Method, std::move(Params));
 }
 
 // Tries to read a line up to and including \n.
@@ -254,14 +253,14 @@ bool JSONTransport::readStandardMessage(std::string 
) {
   }
   llvm::getAsUnsignedInteger(LineRef.trim(), 0, ContentLength);
   continue;
-} else if (!LineRef.trim().empty()) {
-  // It's another header, ignore it.
-  continue;
-} else {
-  // An empty line indicates the end of headers.
-  // Go ahead and read the JSON.
-  break;
 }
+
+// An empty line indicates the end of headers.
+// Go ahead and read the JSON.
+if (LineRef.trim().empty())
+  break;
+
+// It's another header, ignore it.
   }
 
   // The fuzzer likes crashing us by sending "Content-Length: "

diff  --git a/clang-tools-extra/clangd/PathMapping.cpp 
b/clang-tools-extra/clangd/PathMapping.cpp
index cc98025393841..882e3fba50810 100644
--- a/clang-tools-extra/clangd/PathMapping.cpp
+++ b/clang-tools-extra/clangd/PathMapping.cpp
@@ -151,7 +151,8 @@ llvm::Expected parsePath(llvm::StringRef Path) 
{
   namespace path = llvm::sys::path;
   if (path::is_absolute(Path, path::Style::posix)) {
 return 

[clang-tools-extra] 75a0784 - [NFC] disabling clang-tidy check readability-identifier-naming in Protocol.h

2021-11-16 Thread Christian Kühnel via cfe-commits

Author: Christian Kühnel
Date: 2021-11-16T15:25:43Z
New Revision: 75a078455fc71cddc5e04b709b349125b610e1bb

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

LOG: [NFC] disabling clang-tidy check readability-identifier-naming in 
Protocol.h

The file follows the LSP syntax, so we're intentially deviating
from the LLVM coding standard.

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

Added: 


Modified: 
clang-tools-extra/clangd/Protocol.h

Removed: 




diff  --git a/clang-tools-extra/clangd/Protocol.h 
b/clang-tools-extra/clangd/Protocol.h
index 3a1eae587554..5ce7b4e4da73 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -36,6 +36,11 @@
 #include 
 #include 
 
+// This file is using the LSP syntax for identifier names which is 
diff erent
+// from the LLVM coding standard. To avoid the clang-tidy warnings, we're
+// disabling one check here.
+// NOLINTBEGIN(readability-identifier-naming)
+
 namespace clang {
 namespace clangd {
 
@@ -1794,4 +1799,6 @@ template <> struct 
format_provider {
 };
 } // namespace llvm
 
+// NOLINTEND(readability-identifier-naming)
+
 #endif



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


[clang-tools-extra] 274f12a - [NFC][clangd] fix llvm-namespace-comment finding

2021-11-16 Thread Christian Kühnel via cfe-commits

Author: Christian Kühnel
Date: 2021-11-16T15:10:32Z
New Revision: 274f12a44c606ecd20152f3e63c4f186793d9a8c

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

LOG: [NFC][clangd] fix llvm-namespace-comment finding

Fixing the clang-tidy finding.

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

Added: 


Modified: 
clang-tools-extra/clangd/xpc/XPCTransport.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/xpc/XPCTransport.cpp 
b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
index 9eb083953b965..4c6308b3acae7 100644
--- a/clang-tools-extra/clangd/xpc/XPCTransport.cpp
+++ b/clang-tools-extra/clangd/xpc/XPCTransport.cpp
@@ -47,7 +47,7 @@ Error decodeError(const json::Object ) {
 // C "closure" for XPCTransport::loop() method
 namespace xpcClosure {
 void connection_handler(xpc_connection_t clientConnection);
-}
+} // namespace xpcClosure
 
 class XPCTransport : public Transport {
 public:



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


[clang-tools-extra] d2da1a2 - [NFC][clangd] cleaning up unused "using"

2021-11-16 Thread Christian Kühnel via cfe-commits

Author: Christian Kühnel
Date: 2021-11-16T13:09:49Z
New Revision: d2da1a2f400ab54a874c1ba5430adc07a5249563

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

LOG: [NFC][clangd] cleaning up unused "using"

Cleaning up unused "using" declarations.
This patch was generated from automatically applyning clang-tidy fixes.

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

Added: 


Modified: 
clang-tools-extra/clangd/index/YAMLSerialization.cpp
clang-tools-extra/clangd/unittests/ClangdTests.cpp
clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
clang-tools-extra/clangd/unittests/HeadersTests.cpp
clang-tools-extra/clangd/unittests/IndexTests.cpp
clang-tools-extra/clangd/unittests/RIFFTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/index/YAMLSerialization.cpp 
b/clang-tools-extra/clangd/index/YAMLSerialization.cpp
index d269a3b36eb48..86293aba13297 100644
--- a/clang-tools-extra/clangd/index/YAMLSerialization.cpp
+++ b/clang-tools-extra/clangd/index/YAMLSerialization.cpp
@@ -73,7 +73,6 @@ using clang::clangd::SymbolOrigin;
 using clang::index::SymbolInfo;
 using clang::index::SymbolKind;
 using clang::index::SymbolLanguage;
-using clang::index::SymbolRole;
 using clang::tooling::CompileCommand;
 
 // Helper to (de)serialize the SymbolID. We serialize it as a hex string.

diff  --git a/clang-tools-extra/clangd/unittests/ClangdTests.cpp 
b/clang-tools-extra/clangd/unittests/ClangdTests.cpp
index 4a2cba52f93ab..9a4727d32b459 100644
--- a/clang-tools-extra/clangd/unittests/ClangdTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ClangdTests.cpp
@@ -54,10 +54,8 @@ namespace clangd {
 namespace {
 
 using ::testing::AllOf;
-using ::testing::Contains;
 using ::testing::ElementsAre;
 using ::testing::Field;
-using ::testing::Gt;
 using ::testing::IsEmpty;
 using ::testing::Pair;
 using ::testing::SizeIs;

diff  --git 
a/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp 
b/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
index 9c02f697d46c6..fcb2e68f6f2a6 100644
--- a/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
+++ b/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
@@ -40,7 +40,6 @@ using ::testing::EndsWith;
 using ::testing::HasSubstr;
 using ::testing::IsEmpty;
 using ::testing::Not;
-using ::testing::StartsWith;
 using ::testing::UnorderedElementsAre;
 
 TEST(GlobalCompilationDatabaseTest, FallbackCommand) {

diff  --git a/clang-tools-extra/clangd/unittests/HeadersTests.cpp 
b/clang-tools-extra/clangd/unittests/HeadersTests.cpp
index fabdd26382a17..85c3e88ae05bb 100644
--- a/clang-tools-extra/clangd/unittests/HeadersTests.cpp
+++ b/clang-tools-extra/clangd/unittests/HeadersTests.cpp
@@ -33,7 +33,6 @@ using ::testing::ElementsAre;
 using ::testing::IsEmpty;
 using ::testing::Not;
 using ::testing::UnorderedElementsAre;
-using ::testing::UnorderedElementsAreArray;
 
 class HeadersTest : public ::testing::Test {
 public:

diff  --git a/clang-tools-extra/clangd/unittests/IndexTests.cpp 
b/clang-tools-extra/clangd/unittests/IndexTests.cpp
index 5b6223a0ddc56..18eedcb7498b9 100644
--- a/clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ b/clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -22,7 +22,6 @@
 
 using ::testing::_;
 using ::testing::AllOf;
-using ::testing::AnyOf;
 using ::testing::ElementsAre;
 using ::testing::IsEmpty;
 using ::testing::Pair;

diff  --git a/clang-tools-extra/clangd/unittests/RIFFTests.cpp 
b/clang-tools-extra/clangd/unittests/RIFFTests.cpp
index 4cd54f401d5bb..004918b68db5c 100644
--- a/clang-tools-extra/clangd/unittests/RIFFTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RIFFTests.cpp
@@ -13,7 +13,6 @@
 namespace clang {
 namespace clangd {
 namespace {
-using ::testing::ElementsAre;
 
 TEST(RIFFTest, File) {
   riff::File File{riff::fourCC("test"),



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


Re: [llvm-dev] Phabricator Creator Pulling the Plug

2021-10-01 Thread Christian Kühnel via cfe-commits
Hi folks,

Arcanist not working any longer is really unfortunate. Phroge also has a
fork of Arcanist, however I haven't seen any SSL-related patches:
https://we.phorge.it/source/arcanist/browse/master/

1) Replacement for Herald rules.


I suppose the notification problem is solvable. I just took a quick look at
the GitHub APIs and wrote a proposal for a quick-and-dirty solution:
https://github.com/ChristianKuehnel/llvm-iwg/blob/gerald_design/pull_request_migration/gerald_design.md

Concerning privacy and storing user emails this solution is less than
ideal. However contributors are already sharing their email addresses in
the git logs. If we want to hide all personal information, a simple config
file is not enough, then we would need to have some UI where users
configure their rules. However this would be an even larger effort (web UI,
database, user authentication, Github SSO, ...).

I just checked GitHUb's public roadmap and did not find anything that
sounds like Herald:
https://github.com/github/roadmap/projects/1

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


Re: [llvm-dev] Phabricator Creator Pulling the Plug

2021-10-01 Thread Christian Kühnel via cfe-commits
I would like to add a third blocker to Mehdi's list:

3) We first would need to finish our ongoing Bugzilla to GitHub Issues
migration: At the moment the plan is to use the old bug ID in bugzilla as
issue ID on GitHub. However issues and Pull Requests share the same
namespace. So once we start using Pull Requests this would eat up the
numbers for the bugs/issues.

This is certainly not a show stopper, but something to decide on. I see two
options here:

1) We delay using Pull Requests until the Bugzilla to Issues migration is
completed.
2) We give up the requirement to keep the bug IDs and assign the new IDs as
they are available.


Best,
Christian


On Fri, Oct 1, 2021 at 12:56 AM Mehdi AMINI via llvm-dev <
llvm-...@lists.llvm.org> wrote:

> We talked about this with the IWG (Infrastructure Working Group) just
> last week coincidentally.
> Two major blocking tracks that were identified at the roundtable
> during the LLVM Dev Meeting exactly 2 years ago are still an issue
> today:
>
> 1) Replacement for Herald rules. This is what allows us to subscribe
> and track new revisions or commits based on paths in the repo or other
> criteria. We could build a replacement based on GitHub action or any
> other kind of service, but this is a bit tricky (how do you store
> emails privately? etc.). I have looked around online but I didn't find
> another OSS project (or external company) providing a similar service
> for GitHub unfortunately, does anyone know of any?
>
> 2) Support for stacked commits. I can see how to structure this
> somehow assuming we would push pull-request branches in the main repo
> (with one new commit per branch and cascading the pull-requests from
> one branch to the other), otherwise this will be a major regression
> compared to the current workflow.
>
> What remains unknown to me is the current state of GitHub management
> of comments across `git commit --amend` and force push to update a
> branch.
>
> Others may have other items to add!
>
> --
> Mehdi
>
> On Thu, Sep 30, 2021 at 3:39 PM Brian Cain via llvm-dev
>  wrote:
> >
> > How far are we from a workflow that leverages Github's Pull Requests?
> Is there some consensus that it's a desired end goal, but some features are
> missing?  Or do we prefer to use a workflow like this for the long term?
> >
> > On Thu, Sep 30, 2021, 4:54 PM Chris Tetreault via llvm-dev <
> llvm-...@lists.llvm.org> wrote:
> >>
> >> As I, and others have noticed, it seems that as of today, there’s some
> certificate issue with arcanist. (See:
> https://lists.llvm.org/pipermail/llvm-dev/2021-September/153019.html) The
> fix seems simple, and a PR is up, but looking through the PR activity, it
> seems that the PR will not be accepted because Phabricator is no longer
> being maintained. It seems that arc has become the first casualty of the
> discontinuation of maintenance of phabricator.
> >>
> >>
> >>
> >> I know that arc is not universally used, but I think it’s a serious
> blow to many people’s workflows. I think that MyDeveloperDay’s question
> might have just become a bit more urgent.
> >>
> >>
> >>
> >> I suppose in the short-term, we could fork the phabricator repos in
> order to fix little issues like this. Alternately, we should probably stop
> recommending arcanist (unless we want to provide instructions on how to fix
> any breakages that come along).
> >>
> >>
> >>
> >> Thanks,
> >>
> >>Chris Tetreault
> >>
> >>
> >>
> >> From: llvm-dev  On Behalf Of
> MyDeveloper Day via llvm-dev
> >> Sent: Wednesday, August 18, 2021 10:17 AM
> >> To: llvm-dev ; cfe-commits <
> cfe-commits@lists.llvm.org>
> >> Subject: [llvm-dev] Phabricator Creator Pulling the Plug
> >>
> >>
> >>
> >> WARNING: This email originated from outside of Qualcomm. Please be wary
> of any links or attachments, and do not enable macros.
> >>
> >> All
> >>
> >>
> >>
> >> I'm a massive fan of Phabricator, and I know there is often lots of
> contentious discussion about its relative merits vs github,
> >>
> >>
> >>
> >> But unless I missed this, was there any discussion regarding the recent
> "Winding Down" announcement of Phabricator? and what it might mean for us
> in LLVM
> >>
> >>
> >>
> >> See:
> >>
> >>
> https://admin.phacility.com/phame/post/view/11/phacility_is_winding_down_operations/
> >>
> >> https://www.phacility.com/phabricator/
> >>
> >>
> >>
> >> Personally I'm excited by the concept of a community driven replacement
> ( https://we.phorge.it/) .
> >>
> >> epriestley did a truly amazing job, it wasn't open to public
> contributions. Perhaps more open development could lead to closing some of
> the github gaps that were of concern.
> >>
> >>
> >>
> >> MyDeveloperDay
> >>
> >> ___
> >> LLVM Developers mailing list
> >> llvm-...@lists.llvm.org
> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >
> > ___
> > LLVM Developers mailing list
> > llvm-...@lists.llvm.org
> > 

[clang] f3cc4df - Revert "[CMake] Simplify CMake handling for zlib"

2020-08-07 Thread Christian Kühnel via cfe-commits

Author: Christian Kühnel
Date: 2020-08-07T09:36:49+02:00
New Revision: f3cc4df51da4331b170065e01a6a80ee05ed0c23

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

LOG: Revert "[CMake] Simplify CMake handling for zlib"

This reverts commit 1adc494bce44f6004994deed61b30d4b71fe1d05.
This patch broke the Windows compilation on buildbot and pre-merge testing:
http://lab.llvm.org:8011/builders/mlir-windows/builds/5945
https://buildkite.com/llvm-project/llvm-master-build/builds/780

Added: 


Modified: 
clang/test/CMakeLists.txt
clang/test/lit.site.cfg.py.in
compiler-rt/test/lit.common.configured.in
lld/test/CMakeLists.txt
lld/test/lit.site.cfg.py.in
lldb/cmake/modules/LLDBStandalone.cmake
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
llvm/cmake/config-ix.cmake
llvm/cmake/modules/LLVMConfig.cmake.in
llvm/include/llvm/Config/config.h.cmake
llvm/lib/Support/CMakeLists.txt
llvm/lib/Support/CRC.cpp
llvm/lib/Support/Compression.cpp
llvm/test/CMakeLists.txt
llvm/test/lit.site.cfg.py.in
llvm/unittests/Support/CompressionTest.cpp
llvm/utils/gn/secondary/clang/test/BUILD.gn
llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
llvm/utils/gn/secondary/lld/test/BUILD.gn
llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
llvm/utils/gn/secondary/llvm/test/BUILD.gn

Removed: 




diff  --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 334a90498d0d..38bbc5be90d5 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -9,6 +9,15 @@ endif ()
 
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR 
${LLVM_RUNTIME_OUTPUT_INTDIR})
 
+if(CLANG_BUILT_STANDALONE)
+  # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This
+  # value is forced to 0 if zlib was not found, so it is fine to use it
+  # instead of HAVE_LIBZ (not recorded).
+  if(LLVM_ENABLE_ZLIB)
+set(HAVE_LIBZ 1)
+  endif()
+endif()
+
 llvm_canonicalize_cmake_booleans(
   CLANG_BUILD_EXAMPLES
   CLANG_ENABLE_ARCMT
@@ -16,7 +25,7 @@ llvm_canonicalize_cmake_booleans(
   CLANG_SPAWN_CC1
   ENABLE_BACKTRACES
   ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
-  LLVM_ENABLE_ZLIB
+  HAVE_LIBZ
   LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
   LLVM_ENABLE_PLUGINS
   LLVM_ENABLE_THREADS)

diff  --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index 286ea06d798c..d9b5b2f2592e 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -16,7 +16,7 @@ config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.host_cxx = "@CMAKE_CXX_COMPILER@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.have_zlib = @LLVM_ENABLE_ZLIB@
+config.have_zlib = @HAVE_LIBZ@
 config.clang_arcmt = @CLANG_ENABLE_ARCMT@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@

diff  --git a/compiler-rt/test/lit.common.configured.in 
b/compiler-rt/test/lit.common.configured.in
index 000bf9b98470..1f746c067b84 100644
--- a/compiler-rt/test/lit.common.configured.in
+++ b/compiler-rt/test/lit.common.configured.in
@@ -57,7 +57,7 @@ elif config.android:
 else:
   set_default("target_suffix", "-%s" % config.target_arch)
 
-set_default("have_zlib", "@LLVM_ENABLE_ZLIB@")
+set_default("have_zlib", "@HAVE_LIBZ@")
 set_default("libcxx_used", "@LLVM_LIBCXX_USED@")
 
 # LLVM tools dir can be passed in lit parameters, so try to

diff  --git a/lld/test/CMakeLists.txt b/lld/test/CMakeLists.txt
index 52e6118ba876..74b29f5d65b8 100644
--- a/lld/test/CMakeLists.txt
+++ b/lld/test/CMakeLists.txt
@@ -4,8 +4,17 @@ set(LLVM_BUILD_MODE "%(build_mode)s")
 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
 set(LLVM_LIBS_DIR 
"${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/%(build_config)s")
 
+if(LLD_BUILT_STANDALONE)
+  # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This
+  # value is forced to 0 if zlib was not found, so it is fine to use it
+  # instead of HAVE_LIBZ (not recorded).
+  if(LLVM_ENABLE_ZLIB)
+set(HAVE_LIBZ 1)
+  endif()
+endif()
+
 llvm_canonicalize_cmake_booleans(
-  LLVM_ENABLE_ZLIB
+  HAVE_LIBZ
   LLVM_LIBXML2_ENABLED
   )
 

diff  --git a/lld/test/lit.site.cfg.py.in b/lld/test/lit.site.cfg.py.in
index 3d4c51f4ab64..4aa2fcda73bb 100644
--- a/lld/test/lit.site.cfg.py.in
+++ b/lld/test/lit.site.cfg.py.in
@@ -14,7 +14,7 @@ config.lld_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
 config.lld_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
-config.have_zlib = @LLVM_ENABLE_ZLIB@
+config.have_zlib =