Index: cmake/modules/HandleLLVMOptions.cmake =================================================================== --- cmake/modules/HandleLLVMOptions.cmake (revision 126745) +++ cmake/modules/HandleLLVMOptions.cmake (working copy) @@ -71,6 +71,12 @@ endif(UNIX) endif(WIN32) +if( LLVM_ENABLE_MSVC_STYLE_DIAGNOSTICS ) + set(LLVM_MSVC_STYLE_DIAGNOSTICS 1) +else( LLVM_ENABLE_MSVC_STYLE_DIAGNOSTICS ) + set(LLVM_MSVC_STYLE_DIAGNOSTICS 0) +endif( LLVM_ENABLE_MSVC_STYLE_DIAGNOSTICS ) + if( LLVM_ENABLE_PIC ) if( XCODE ) # Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 126745) +++ CMakeLists.txt (working copy) @@ -131,6 +131,12 @@ set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm) +if( MSVC ) + option(LLVM_ENABLE_MSVC_STYLE_DIAGNOSTICS "Diagnostic output for tools is in MSVC style" ON) +else( MSVC ) + option(LLVM_ENABLE_MSVC_STYLE_DIAGNOSTICS "Diagnostic output for tools is in MSVC style" OFF) +endif( MSVC ) + include(AddLLVMDefinitions) option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) Index: include/llvm/Config/config.h.cmake =================================================================== --- include/llvm/Config/config.h.cmake (revision 126745) +++ include/llvm/Config/config.h.cmake (working copy) @@ -560,6 +560,9 @@ /* Define if this is Win32ish platform */ #cmakedefine LLVM_ON_WIN32 ${LLVM_ON_WIN32} +/* Define if diagnostics should be in msvc format */ +#cmakedefine LLVM_MSVC_STYLE_DIAGNOSTICS ${LLVM_MSVC_STYLE_DIAGNOSTICS} + /* Define to path to circo program if found or 'echo circo' otherwise */ #cmakedefine LLVM_PATH_CIRCO "${LLVM_PATH_CIRCO}" Index: include/llvm/Config/llvm-config.h.cmake =================================================================== --- include/llvm/Config/llvm-config.h.cmake (revision 126745) +++ include/llvm/Config/llvm-config.h.cmake (working copy) @@ -67,6 +67,9 @@ /* Define if this is Win32ish platform */ #cmakedefine LLVM_ON_WIN32 ${LLVM_ON_WIN32} +/* Define if diagnostics should be in msvc format */ +#cmakedefine LLVM_MSVC_STYLE_DIAGNOSTICS ${LLVM_MSVC_STYLE_DIAGNOSTICS} + /* Define to path to circo program if found or 'echo circo' otherwise */ #cmakedefine LLVM_PATH_CIRCO "${LLVM_PATH_CIRCO}" Index: lib/Support/SourceMgr.cpp =================================================================== --- lib/Support/SourceMgr.cpp (revision 126745) +++ lib/Support/SourceMgr.cpp (working copy) @@ -127,9 +127,14 @@ PrintIncludeStack(getBufferInfo(CurBuf).IncludeLoc, OS); +#if LLVM_MSVC_STYLE_DIAGNOSTICS + OS << getBufferInfo(CurBuf).Buffer->getBufferIdentifier() + << "(" << FindLineNumber(IncludeLoc, CurBuf) << "): Included from here\n"; +#else OS << "Included from " << getBufferInfo(CurBuf).Buffer->getBufferIdentifier() << ":" << FindLineNumber(IncludeLoc, CurBuf) << ":\n"; +#endif } @@ -207,11 +212,20 @@ else S << Filename; +#if LLVM_MSVC_STYLE_DIAGNOSTICS if (LineNo != -1) { + S << '(' << LineNo; + if (ColumnNo != -1) + S << ',' << (ColumnNo); + S << ")"; + } +#else + if (LineNo != -1) { S << ':' << LineNo; if (ColumnNo != -1) S << ':' << (ColumnNo+1); } +#endif S << ": "; } Index: test/MC/AsmParser/macros-parsing.s =================================================================== --- test/MC/AsmParser/macros-parsing.s (revision 126745) +++ test/MC/AsmParser/macros-parsing.s (working copy) @@ -5,7 +5,7 @@ .endmacro .macros_off -// CHECK-ERRORS: 9:1: warning: ignoring directive for now +// CHECK-ERRORS: warning: ignoring directive for now .test0 .macros_on Index: test/MC/AsmParser/macros.s =================================================================== --- test/MC/AsmParser/macros.s (revision 126745) +++ test/MC/AsmParser/macros.s (working copy) @@ -9,13 +9,13 @@ .endmacro .test1 -// CHECK-ERRORS: :1:1: warning: ignoring directive for now +// CHECK-ERRORS: warning: ignoring directive for now // CHECK-ERRORS-NEXT: macrobody0 // CHECK-ERRORS-NEXT: ^ -// CHECK-ERRORS: :1:1: note: while in macro instantiation +// CHECK-ERRORS: note: while in macro instantiation // CHECK-ERRORS-NEXT: .test0 // CHECK-ERRORS-NEXT: ^ -// CHECK-ERRORS: 11:1: note: while in macro instantiation +// CHECK-ERRORS: note: while in macro instantiation // CHECK-ERRORS-NEXT: .test1 // CHECK-ERRORS-NEXT: ^