[clang] ca044f5 - Revert "[clang-format][NFC] Code Tidies in UnwrappedLineFormatter"

2022-01-04 Thread Alexander Belyaev via cfe-commits

Author: Alexander Belyaev
Date: 2022-01-04T12:10:52+01:00
New Revision: ca044f5369c7c156c1c7d35601b09fe610cc73d3

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

LOG: Revert "[clang-format][NFC] Code Tidies in UnwrappedLineFormatter"

This reverts commit f014ab933f35805159021d2d0c856a3c9af21a85.

These tests are failing with asan:

clang/unittests:format_tests
clang/unittests:format_tests
clang-tools-extra/unittests:clang_move_tests
clang/unittests:tooling_tests
clang-tools-extra/test/clang-move:move-template-class.cpp.test
clang-tools-extra/test/clang-move:move-multiple-classes.cpp.test
clang-tools-extra/test/clang-move:move-used-helper-decls.cpp.test
clang-tools-extra/clangd/unittests:clangd_tests
clang/test/Format:access-modifiers.cpp.test
clang/unittests:rename_tests
clang/unittests:rename_tests

Added: 


Modified: 
clang/lib/Format/UnwrappedLineFormatter.cpp

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineFormatter.cpp 
b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 303150348ad8d..5ba5958fbd53d 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -211,12 +211,10 @@ class LineJoiner {
 const AnnotatedLine *TheLine = *I;
 if (TheLine->Last->is(TT_LineComment))
   return 0;
-const auto  = *I[1];
-const auto  = *I[-1];
-if (NextLine.Type == LT_Invalid || NextLine.First->MustBreakBefore)
+if (I[1]->Type == LT_Invalid || I[1]->First->MustBreakBefore)
   return 0;
 if (TheLine->InPPDirective &&
-(!NextLine.InPPDirective || NextLine.First->HasUnescapedNewline))
+(!I[1]->InPPDirective || I[1]->First->HasUnescapedNewline))
   return 0;
 
 if (Style.ColumnLimit > 0 && Indent > Style.ColumnLimit)
@@ -233,15 +231,15 @@ class LineJoiner {
 if (TheLine->Last->is(TT_FunctionLBrace) &&
 TheLine->First == TheLine->Last &&
 !Style.BraceWrapping.SplitEmptyFunction &&
-NextLine.First->is(tok::r_brace))
+I[1]->First->is(tok::r_brace))
   return tryMergeSimpleBlock(I, E, Limit);
 
 // Handle empty record blocks where the brace has already been wrapped
 if (TheLine->Last->is(tok::l_brace) && TheLine->First == TheLine->Last &&
 I != AnnotatedLines.begin()) {
-  bool EmptyBlock = NextLine.First->is(tok::r_brace);
+  bool EmptyBlock = I[1]->First->is(tok::r_brace);
 
-  const FormatToken *Tok = PreviousLine.First;
+  const FormatToken *Tok = I[-1]->First;
   if (Tok && Tok->is(tok::comment))
 Tok = Tok->getNextNonComment();
 
@@ -269,7 +267,7 @@ class LineJoiner {
 bool MergeShortFunctions =
 Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_All ||
 (Style.AllowShortFunctionsOnASingleLine >= FormatStyle::SFS_Empty &&
- NextLine.First->is(tok::r_brace)) ||
+ I[1]->First->is(tok::r_brace)) ||
 (Style.AllowShortFunctionsOnASingleLine & FormatStyle::SFS_InlineOnly 
&&
  TheLine->Level != 0);
 
@@ -314,75 +312,73 @@ class LineJoiner {
   return MergeShortFunctions ? tryMergeSimpleBlock(I, E, Limit) : 0;
 }
 // Try to merge a control statement block with left brace unwrapped
-if (TheLine->Last->is(tok::l_brace) &&
+if (TheLine->Last->is(tok::l_brace) && TheLine->First != TheLine->Last &&
 TheLine->First->isOneOf(tok::kw_if, tok::kw_while, tok::kw_for)) {
   return Style.AllowShortBlocksOnASingleLine != FormatStyle::SBS_Never
  ? tryMergeSimpleBlock(I, E, Limit)
  : 0;
 }
 // Try to merge a control statement block with left brace wrapped
-if (NextLine.First->is(tok::l_brace)) {
-  if ((TheLine->First->isOneOf(tok::kw_if, tok::kw_else, tok::kw_while,
-   tok::kw_for, tok::kw_switch, tok::kw_try,
-   tok::kw_do, TT_ForEachMacro) ||
-   (TheLine->First->is(tok::r_brace) && TheLine->First->Next &&
-TheLine->First->Next->isOneOf(tok::kw_else, tok::kw_catch))) &&
-  Style.BraceWrapping.AfterControlStatement ==
-  FormatStyle::BWACS_MultiLine) {
-// If possible, merge the next line's wrapped left brace with the
-// current line. Otherwise, leave it on the next line, as this is a
-// multi-line control statement.
-return (Style.ColumnLimit == 0 ||
-TheLine->Last->TotalLength <= Style.ColumnLimit)
-   ? 1
-   : 0;
-  }
-  if (TheLine->First->isOneOf(tok::kw_if, tok::kw_else, tok::kw_while,
-  tok::kw_for)) {
-return (Style.BraceWrapping.AfterControlStatement ==
-FormatStyle::BWACS_Always)
-   ? 

[clang] 9c4b222 - Revert "Revert "Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."""""

2021-01-08 Thread Alexander Belyaev via cfe-commits

Author: Alexander Belyaev
Date: 2021-01-08T14:17:18+01:00
New Revision: 9c4b2225b24de07a728715ce20238803370413ea

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

LOG: Revert "Revert "Revert "Revert "Revert "[analyzer] NFC: Move path 
diagnostic consumer implementations to libAnalysis."

This reverts commit 6b0ee02747ed22d41e175d15f27025183341e6f8.

Circular dependency again.

Added: 
clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp

Modified: 
clang/include/clang/CrossTU/CrossTranslationUnit.h
clang/include/clang/StaticAnalyzer/Core/Analyses.def
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
clang/include/clang/module.modulemap
clang/lib/Analysis/CMakeLists.txt
clang/lib/CrossTU/CrossTranslationUnit.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/StaticAnalyzer/Core/CMakeLists.txt
clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Removed: 
clang/include/clang/Analysis/CrossTUAnalysisHelper.h
clang/include/clang/Analysis/PathDiagnosticConsumers.def
clang/include/clang/Analysis/PathDiagnosticConsumers.h
clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp
clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp
clang/lib/Analysis/TextPathDiagnosticConsumer.cpp



diff  --git a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h 
b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
deleted file mode 100644
index 500e78ddedcf..
--- a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//===- CrossTUAnalysisHelper.h - Abstraction layer for CTU --*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-#ifndef LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
-#define LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
-
-#include "llvm/ADT/Optional.h"
-#include "clang/Basic/SourceManager.h"
-
-namespace clang {
-
-class ASTUnit;
-
-/// This class is an abstract interface acting as a bridge between
-/// an analysis that requires lookups across translation units (a user
-/// of that interface) and the facility that implements such lookups
-/// (an implementation of that interface). This is useful to break direct
-/// link-time dependencies between the (possibly shared) libraries in which
-/// the user and the implementation live.
-class CrossTUAnalysisHelper {
-public:
-  /// Determine the original source location in the original TU for an
-  /// imported source location.
-  /// \p ToLoc Source location in the imported-to AST.
-  /// \return Source location in the imported-from AST and the corresponding
-  /// ASTUnit object (the AST was loaded from a file using an internal ASTUnit
-  /// object that is returned here).
-  /// If any error happens (ToLoc is a non-imported source location) empty is
-  /// returned.
-  virtual llvm::Optional>
-  getImportedFromSourceLocationWithPreprocessor(SourceLocation ToLoc) const = 
0;
-
-  virtual ~CrossTUAnalysisHelper() {}
-};
-} // namespace clang
-
-#endif // LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H

diff  --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.def 
b/clang/include/clang/Analysis/PathDiagnosticConsumers.def
deleted file mode 100644
index 33d2072fcf31..
--- a/clang/include/clang/Analysis/PathDiagnosticConsumers.def
+++ /dev/null
@@ -1,50 +0,0 @@
-//===-- PathDiagnosticConsumers.def - Visualizing warnings --*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-//
-// This file defines the set of path diagnostic consumers - objects that
-// implement 
diff erent representations of static analysis results.
-//
-//===--===//
-
-#ifndef ANALYSIS_DIAGNOSTICS
-#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN)
-#endif
-
-ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML",
- 

[clang] 2a36f29 - [clang] Re-add deleted forward declaration.

2020-07-02 Thread Alexander Belyaev via cfe-commits

Author: Alexander Belyaev
Date: 2020-07-02T08:57:48+02:00
New Revision: 2a36f29fce91b6242ebd926d7c08381c31138d2c

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

LOG: [clang] Re-add deleted forward declaration.

Added: 


Modified: 
clang/lib/CodeGen/ABIInfo.h

Removed: 




diff  --git a/clang/lib/CodeGen/ABIInfo.h b/clang/lib/CodeGen/ABIInfo.h
index 474e5c1e4c6a..bb40dace8a84 100644
--- a/clang/lib/CodeGen/ABIInfo.h
+++ b/clang/lib/CodeGen/ABIInfo.h
@@ -28,6 +28,7 @@ namespace clang {
 
 namespace CodeGen {
   class ABIArgInfo;
+  class Address;
   class CGCXXABI;
   class CGFunctionInfo;
   class CodeGenFunction;



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


[clang] df48e39 - [Clang] Fix clang-tidy errors.

2020-03-25 Thread Alexander Belyaev via cfe-commits

Author: Alexander Belyaev
Date: 2020-03-25T20:13:43+01:00
New Revision: df48e3920a56b128ad691c258372c641b076f21c

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

LOG: [Clang] Fix clang-tidy errors.

Added: 


Modified: 
clang/include/clang/AST/Expr.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/Expr.cpp
llvm/unittests/IR/KnowledgeRetentionTest.cpp

Removed: 




diff  --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index fa4918272819..e566e3c6ab89 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -2026,7 +2026,8 @@ class PredefinedExpr final
 
   static StringRef getIdentKindName(IdentKind IK);
   static std::string ComputeName(IdentKind IK, const Decl *CurrentDecl);
-  static std::string ComputeName(ASTContext , IdentKind IK, const QualType 
Ty);
+  static std::string ComputeName(ASTContext , IdentKind IK,
+ const QualType Ty);
 
   SourceLocation getBeginLoc() const { return getLocation(); }
   SourceLocation getEndLoc() const { return getLocation(); }

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 841c030cecdb..b09b4eb0de1b 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -4824,7 +4824,7 @@ class Sema final {
SourceLocation RParen, ParsedType Ty);
   ExprResult ActOnUniqueStableNameExpr(SourceLocation OpLoc,
SourceLocation LParen,
-   SourceLocation RParen, Expr *Operand);
+   SourceLocation RParen, Expr *E);
 
   bool CheckLoopHintExpr(Expr *E, SourceLocation Loc);
 

diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index b603d2ab29ee..f0f22b6e4690 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -522,7 +522,7 @@ PredefinedExpr::PredefinedExpr(SourceLocation L, QualType 
FnTy, IdentKind IK,
 }
 
 PredefinedExpr::PredefinedExpr(SourceLocation L, QualType FnTy, IdentKind IK,
-   Expr *Info)
+   Expr *E)
 : Expr(PredefinedExprClass, FnTy, VK_LValue, OK_Ordinary) {
   PredefinedExprBits.Kind = IK;
   assert((getIdentKind() == IK) &&
@@ -531,7 +531,7 @@ PredefinedExpr::PredefinedExpr(SourceLocation L, QualType 
FnTy, IdentKind IK,
  "Constructor only valid with UniqueStableNameExpr");
   PredefinedExprBits.HasFunctionName = false;
   PredefinedExprBits.Loc = L;
-  setExpr(Info);
+  setExpr(E);
   setDependence(computeDependence(this));
 }
 

diff  --git a/llvm/unittests/IR/KnowledgeRetentionTest.cpp 
b/llvm/unittests/IR/KnowledgeRetentionTest.cpp
index 2ed90b8b4e1e..2c923aaa7fbd 100644
--- a/llvm/unittests/IR/KnowledgeRetentionTest.cpp
+++ b/llvm/unittests/IR/KnowledgeRetentionTest.cpp
@@ -476,8 +476,7 @@ static void RunRandTest(uint64_t Seed, int Size, int 
MinCount, int MaxCount,
   }
 
   auto *Assume = cast(IntrinsicInst::Create(
-  FnAssume, ArrayRef({ConstantInt::getTrue(C)}),
-  std::move(OpBundle)));
+  FnAssume, ArrayRef({ConstantInt::getTrue(C)}), OpBundle));
   Assume->insertBefore(>begin()->front());
   RetainedKnowledgeMap Map;
   fillMapFromAssume(*Assume, Map);



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


[clang] 10bd842 - [ARM][CMSE] Fix clang/test/Driver/save-temps.c test.

2020-03-24 Thread Alexander Belyaev via cfe-commits

Author: Alexander Belyaev
Date: 2020-03-24T15:24:14+01:00
New Revision: 10bd8422d041e2964c146a38b5514d9d92fc458d

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

LOG: [ARM][CMSE] Fix clang/test/Driver/save-temps.c test.

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

Added: 


Modified: 
clang/test/Driver/save-temps.c

Removed: 




diff  --git a/clang/test/Driver/save-temps.c b/clang/test/Driver/save-temps.c
index ae46f1e6b565..b0cfa4fd814a 100644
--- a/clang/test/Driver/save-temps.c
+++ b/clang/test/Driver/save-temps.c
@@ -83,9 +83,9 @@
 // CHECK-SAVE-TEMPS: "-cc1as"
 // CHECK-SAVE-TEMPS: "-dwarf-version={{.}}"
 
-// RUN: %clang --target=arm-arm-none-eabi -march=armv8-m.main -mcmse 
-save-temps -c -v %s 2>&1 \
+// RUN: %clang --target=arm-arm-none-eabi -march=armv8-m.main -mcmse 
-save-temps -c -v %s -### 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=CHECK-SAVE-TEMPS-CMSE
-// RUN: %clang --target=arm-arm-none-eabi -march=armv8-m.main -mcmse -x 
assembler -c -v %s 2>&1 \
+// RUN: %clang --target=arm-arm-none-eabi -march=armv8-m.main -mcmse -x 
assembler -c -v %s -### 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=CHECK-SAVE-TEMPS-CMSE
 // CHECK-SAVE-TEMPS-CMSE: -cc1as
 // CHECK-SAVE-TEMPS-CMSE: +8msecext



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