From a2900fd254dc4595d17ac5df3c6643e345a47e31 Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 8 Oct 2013 01:28:26 +0100 Subject: [PATCH] Fixed parser not to call GetPreviousDeclInContext if the declaration context has no previous declarations. --- src/Parser/Parser.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Parser/Parser.cpp b/src/Parser/Parser.cpp index 85b438b2..2d428e5e 100644 --- a/src/Parser/Parser.cpp +++ b/src/Parser/Parser.cpp @@ -314,6 +314,9 @@ static clang::SourceLocation GetDeclStartLocation(clang::CompilerInstance* C, auto lineBeginOffset = SM.getFileOffset(lineBeginLoc); assert(lineBeginOffset <= startOffset); + if (D->getLexicalDeclContext()->decls_empty()) + return lineBeginLoc; + auto prevDecl = GetPreviousDeclInContext(D); if(!prevDecl) return lineBeginLoc;