[LLVMbugs] [Bug 19688] New: Preprocessor leaks MacroInfo when completing macros

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 8 11:50:13 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19688

            Bug ID: 19688
           Summary: Preprocessor leaks MacroInfo when completing macros
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Repro:

 DYLD_LIBRARY_PATH=lib ./bin/c-index-test
-code-completion-at=../llvm-svn/tools/clang/test/Index/complete-preprocessor.m:9:8
../llvm-svn/tools/clang/test/Index/complete-preprocessor.m

with asan.

This allocates 3 MacroArgs objects, but frees only 2. This is the stack that
allocates the MacroArgs that aren't free'd:

    frame #1: 0x000000010031546b
libclang.3.5.dylib`clang::MacroArgs::create(clang::MacroInfo const*,
llvm::ArrayRef<clang::Token>, bool, clang::Preprocessor&) + 251
    frame #2: 0x0000000100343d34
libclang.3.5.dylib`clang::Preprocessor::ReadFunctionLikeMacroArgs(clang::Token&,
clang::MacroInfo*, clang::SourceLocation&) + 5956
    frame #3: 0x000000010033fdcd
libclang.3.5.dylib`clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&,
clang::MacroDirective*) + 173
    frame #4: 0x00000001003577a2
libclang.3.5.dylib`clang::Preprocessor::HandleIdentifier(clang::Token&) + 1186
    frame #5: 0x0000000100307819
libclang.3.5.dylib`clang::Lexer::LexIdentifier(clang::Token&, char const*) +
265
    frame #6: 0x000000010030e8fc
libclang.3.5.dylib`clang::Lexer::LexTokenInternal(clang::Token&, bool) + 8476
    frame #7: 0x000000010030b711
libclang.3.5.dylib`clang::Lexer::Lex(clang::Token&) + 113
    frame #8: 0x00000001003578b4
libclang.3.5.dylib`clang::Preprocessor::Lex(clang::Token&) + 68
    frame #9: 0x00000001008a2898
libclang.3.5.dylib`clang::ParseAST(clang::Sema&, bool, bool) + 200
    frame #10: 0x00000001002c5757
libclang.3.5.dylib`clang::FrontendAction::Execute() + 71
    frame #11: 0x0000000100290b65
libclang.3.5.dylib`clang::ASTUnit::CodeComplete(llvm::StringRef, unsigned int,
unsigned int, llvm::ArrayRef<std::__1::pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >, llvm::MemoryBuffer
const*> >, bool, bool, bool, clang::CodeCompleteConsumer&,
clang::DiagnosticsEngine&, clang::LangOptions&, clang::SourceManager&,
clang::FileManager&, llvm::SmallVectorImpl<clang::StoredDiagnostic>&,
llvm::SmallVectorImpl<llvm::MemoryBuffer const*>&) + 3637
    frame #12: 0x0000000100045504 libclang.3.5.dylib`clang_codeCompleteAt_Impl
+ 1924
    frame #13: 0x0000000100767329
libclang.3.5.dylib`llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void
()>) + 233
    frame #14: 0x000000010076747c
libclang.3.5.dylib`RunSafelyOnThread_Dispatch(void*) + 28
    frame #15: 0x000000010079dc2d
libclang.3.5.dylib`ExecuteOnThread_Dispatch(void*) + 13
    frame #16: 0x00007fff90bcc899 libsystem_pthread.dylib`_pthread_body + 138
    frame #17: 0x00007fff90bcc72a libsystem_pthread.dylib`_pthread_start + 137

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140508/5a65bc3a/attachment.html>


More information about the llvm-bugs mailing list