diff options
author | Angel Garcia Gomez <angelgarcia@google.com> | 2015-09-02 10:20:00 +0000 |
---|---|---|
committer | Angel Garcia Gomez <angelgarcia@google.com> | 2015-09-02 10:20:00 +0000 |
commit | e6035de11ea24b55481886880da400e9e810f599 (patch) | |
tree | 3e3f7d9b1c83a74c0b32cc9267331fdfda429b07 /clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp | |
parent | 1e583704f5cc0c1889e1c2f2140e62cb8020075a (diff) | |
download | bcm5719-llvm-e6035de11ea24b55481886880da400e9e810f599.tar.gz bcm5719-llvm-e6035de11ea24b55481886880da400e9e810f599.zip |
Fix use-auto-check.
Summary: Fix a bug where use-auto check would crash when the definition of a type is in the same statement than its instantiation with new.
Reviewers: alexfh
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D12551
llvm-svn: 246638
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp index 6aa57e907d6..339bc3c2569 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp @@ -298,7 +298,7 @@ void UseAutoCheck::replaceIterators(const DeclStmt *D, ASTContext *Context) { } void UseAutoCheck::replaceNew(const DeclStmt *D, ASTContext *Context) { - const auto *FirstDecl = cast<VarDecl>(*D->decl_begin()); + const auto *FirstDecl = dyn_cast<VarDecl>(*D->decl_begin()); // Ensure that there is at least one VarDecl within the DeclStmt. if (!FirstDecl) return; |