Szelethus added a comment.

  $ cat orig.cpp
  #define a(b) switch (b) {
  #define c(b) \
  b:
  int d;
  e() {
  a(d) c(2);
  c(3)

  $ debugBuild/bin/clang-tidy orig.cpp -checks=bugprone-branch-clone --
  clang-tidy: ../extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:200: 
clang::DiagnosticBuilder clang::tidy::ClangTidyContext::diag(llvm::StringRef, 
clang::SourceLocation, llvm::StringRef, DiagnosticIDs::Level): Assertion 
`Loc.isValid()' failed.
  #0 0x00007f263c30ee79 llvm::sys::PrintStackTrace(llvm::raw_ostream&) 
debugBuild/../llvm/lib/Support/Unix/Signals.inc:494:11 #1 0x00007f263c30f029 
PrintStackTraceSignalHandler(void*) 
debugBuild/../llvm/lib/Support/Unix/Signals.inc:558:1
  #2 0x00007f263c30d936 llvm::sys::RunSignalHandlers() 
debugBuild/../llvm/lib/Support/Signals.cpp:67:5 
  #3 0x00007f263c30f6db SignalHandler(int) 
debugBuild/../llvm/lib/Support/Unix/Signals.inc:357:1 #4 0x00007f263bd64890 
__restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
  #5 0x00007f2637aefe97 gsignal 
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0 
  #6 0x00007f2637af1801 abort 
/build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0 
  #7 0x00007f2637ae139a __assert_fail_base 
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0 
  #8 0x00007f2637ae1412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412) 
  #9 0x00007f263a64c623 clang::tidy::ClangTidyContext::diag(llvm::StringRef, 
clang::SourceLocation, llvm::StringRef, clang::DiagnosticIDs::Level) 
debugBuild/../extra/clang-tidy/Cl
  angTidyDiagnosticConsumer.cpp:201:17 #10 0x00007f263a647baf 
clang::tidy::ClangTidyCheck::diag(clang::SourceLocation, llvm::StringRef, 
clang::DiagnosticIDs::Level) 
debugBuild/../extra/clang-tidy/ClangTidyCheck.cpp:23
  :3 #11 0x00007f263a28671e 
clang::tidy::bugprone::BranchCloneCheck::check(clang::ast_matchers::MatchFinder::MatchResult
 const&) debugBuild/../extra/clang-tidy/bugprone/BranchCloneCheck.cpp:200:9 
  #12 0x00007f263a647be9 
clang::tidy::ClangTidyCheck::run(clang::ast_matchers::MatchFinder::MatchResult 
const&) debugBuild/../extra/clang-tidy/ClangTidyCheck.cpp:31:1 #13 
0x00007f263ae60174 clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor::MatchVisitor::visitMatch(clang::ast_matchers::BoundNodes
 const&) debugBuild/../clang
  /lib/ASTMatchers/ASTMatchFinder.cpp:742:7 
  #14 0x00007f263af4e699 
clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*)
 debugBuild/../clang/lib/
  ASTMatchers/ASTMatchersInternal.cpp:75:5 #15 0x00007f263ae5fe66 
clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor::matchWithFilter(clang::ast_type_traits::DynTypedNode
 const&) debugBuild/../clang/lib
  /ASTMatchers/ASTMatchFinder.cpp:574:7 
  #16 0x00007f263ae601c5 clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor::matchDispatch(clang::Stmt const*) 
debugBuild/../clang/lib/ASTMatchers/ASTMatchFinder
  .cpp:597:5
  #17 0x00007f263ae5fa7d void clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor::match<clang::Stmt>(clang::Stmt const&) 
debugBuild/../clang/lib/ASTMatchers/ASTMatchFinder.cpp:499:3
  #18 0x00007f263ae6dedd clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor::TraverseStmt(clang::Stmt*, 
llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, 
llvm::PointerLikeTypeTraits<clang::Stmt*>, 
llvm::PointerIntPairInfo<clang::Stmt*, 1u, 
llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) 
debugBuild/../clang/lib/ASTMatchers/ASTMatchFinder.cpp:868:48
  #19 0x00007f263ae904b5 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::TraverseCompoundStmt(clang::CompoundStmt*, 
llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, 
llvm::PointerLikeTypeTraits<clang::Stmt*>, 
llvm::PointerIntPairInfo<clang::Stmt*, 1u, 
llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) 
debugBuild/../clang/include/clang/AST/RecursiveASTVisitor.h:2175:1
  #20 0x00007f263ae806a2 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::dataTraverseNode(clang::Stmt*, 
llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, 
llvm::PointerLikeTypeTraits<clang::Stmt*>, 
llvm::PointerIntPairInfo<clang::Stmt*, 1u, 
llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) 
debugBuild/tools/clang/include/clang/AST/StmtNodes.inc:73:1
  #21 0x00007f263ae7c95e 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::TraverseStmt(clang::Stmt*, 
llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, 
llvm::PointerLikeTypeTraits<clang::Stmt*>, 
llvm::PointerIntPairInfo<clang::Stmt*, 1u, 
llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) 
debugBuild/../clang/include/clang/AST/RecursiveASTVisitor.h:655:7
  #22 0x00007f263ae6def9 clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor::TraverseStmt(clang::Stmt*, 
llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, 
llvm::PointerLikeTypeTraits<clang::Stmt*>, 
llvm::PointerIntPairInfo<clang::Stmt*, 1u, 
llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) 
debugBuild/../clang/lib/ASTMatchers/ASTMatchFinder.cpp:868:3
  #23 0x00007f263aeb71ca 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::TraverseFunctionHelper(clang::FunctionDecl*) 
debugBuild/../clang/include/clang/AST/RecursiveASTVisitor.h:2020:5
  #24 0x00007f263ae677be 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::TraverseFunctionDecl(clang::FunctionDecl*) 
debugBuild/../clang/include/clang/AST/RecursiveASTVisitor.h:2025:1
  #25 0x00007f263ae61df3 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) 
debugBuild/tools/clang/include/clang/AST/DeclNodes.inc:389:1
  #26 0x00007f263ae61281 clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) 
debugBuild/../clang/lib/ASTMatchers/ASTMatchFinder.cpp:860:3
  #27 0x00007f263ae6dc58 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::TraverseDeclContextHelper(clang::DeclContext*) 
debugBuild/../clang/include/clang/AST/RecursiveASTVisitor.h:1387:7
  #28 0x00007f263ae6a3a8 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::TraverseTranslationUnitDecl(clang::TranslationUnitDecl*)
 debugBuild/../clang/include/clang/AST/RecursiveASTVisitor.h:1479:1
  #29 0x00007f263ae623f6 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::TraverseDecl(clang::Decl*) 
debugBuild/tools/clang/include/clang/AST/DeclNodes.inc:571:1
  #30 0x00007f263ae61281 clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor::TraverseDecl(clang::Decl*) 
debugBuild/../clang/lib/ASTMatchers/ASTMatchFinder.cpp:860:3
  #31 0x00007f263adf7e73 
clang::RecursiveASTVisitor<clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTVisitor>::TraverseAST(clang::ASTContext&) 
debugBuild/../clang/include/clang/AST/RecursiveASTVisitor.h:183:11
  #32 0x00007f263adf7c8d 
clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) 
debugBuild/../clang/lib/ASTMatchers/ASTMatchFinder.cpp:1037:11
  #33 0x00007f263ae60d05 clang::ast_matchers::internal::(anonymous 
namespace)::MatchASTConsumer::HandleTranslationUnit(clang::ASTContext&) 
debugBuild/../clang/lib/ASTMatchers/ASTMatchFinder.cpp:930:3
  #34 0x00007f263608220b 
clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) 
debugBuild/../clang/lib/Frontend/MultiplexConsumer.cpp:291:23
  #35 0x00007f263253655e clang::ParseAST(clang::Sema&, bool, bool) 
debugBuild/../clang/lib/Parse/ParseAST.cpp:178:12
  #36 0x00007f26360432c2 clang::ASTFrontendAction::ExecuteAction() 
debugBuild/../clang/lib/Frontend/FrontendAction.cpp:1037:1
  #37 0x00007f2636042ce0 clang::FrontendAction::Execute() 
debugBuild/../clang/lib/Frontend/FrontendAction.cpp:938:7
  #38 0x00007f2635fbf6ae 
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) 
debugBuild/../clang/lib/Frontend/CompilerInstance.cpp:945:7
  #39 0x00007f2638998382 
clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>,
 clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, 
clang::DiagnosticConsumer*) debugBuild/../clang/lib/Tooling/Tooling.cpp:369:14
  #40 0x00007f263a5f48d1 
clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, 
clang::tooling::CompilationDatabase const&, 
llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > >, 
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, 
llvm::StringRef)::ActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>,
 clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, 
clang::DiagnosticConsumer*) debugBuild/../extra/clang-tidy/ClangTidy.cpp:540:7
  #41 0x00007f2638998218 clang::tooling::ToolInvocation::runInvocation(char 
const*, clang::driver::Compilation*, 
std::shared_ptr<clang::CompilerInvocation>, 
std::shared_ptr<clang::PCHContainerOperations>) 
debugBuild/../clang/lib/Tooling/Tooling.cpp:344:3
  #42 0x00007f2638997385 clang::tooling::ToolInvocation::run() 
debugBuild/../clang/lib/Tooling/Tooling.cpp:329:3
  #43 0x00007f2638999577 
clang::tooling::ClangTool::run(clang::tooling::ToolAction*) 
debugBuild/../clang/lib/Tooling/Tooling.cpp:518:11
  #44 0x00007f263a5f283a 
clang::tidy::runClangTidy(clang::tidy::ClangTidyContext&, 
clang::tooling::CompilationDatabase const&, 
llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > >, 
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>, bool, llvm::StringRef) 
debugBuild/../extra/clang-tidy/ClangTidy.cpp:562:23
  #45 0x0000000000243db8 clang::tidy::clangTidyMain(int, char const**) 
debugBuild/../extra/clang-tidy/tool/ClangTidyMain.cpp:430:7
  #46 0x0000000000243342 main 
debugBuild/../extra/clang-tidy/tool/ClangTidyMain.cpp:491:3
  #47 0x00007f2637ad2b97 __libc_start_main 
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
  #48 0x000000000024302a _start (debugBuild/bin/clang-tidy+0x24302a)


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D54757



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

Reply via email to