From: Saleem Abdulrasool Date: Wed, 12 Mar 2014 02:26:08 +0000 (+0000) Subject: Lex: reduce buffer size, add a test X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afd5279cd9356bdb3a71723f0c7b8b94fd23e2da;p=clang Lex: reduce buffer size, add a test Reduce the stack usage as hopefully include paths are usually not too long. Add a test case for the path normalisation behaviour. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203632 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index b3d766a759..17b9b09d3e 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1450,7 +1450,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // the path. ModuleMap::KnownHeader SuggestedModule; SourceLocation FilenameLoc = FilenameTok.getLocation(); - SmallString<1024> NormalizedPath; + SmallString<128> NormalizedPath; if (LangOpts.MSVCCompat) { NormalizedPath = Filename.str(); llvm::sys::fs::normalize_separators(NormalizedPath); diff --git a/test/Lexer/Inputs/success.h b/test/Lexer/Inputs/success.h new file mode 100644 index 0000000000..5fdf5aae75 --- /dev/null +++ b/test/Lexer/Inputs/success.h @@ -0,0 +1 @@ +#error success diff --git a/test/Lexer/cross-windows-on-linux.cpp b/test/Lexer/cross-windows-on-linux.cpp new file mode 100644 index 0000000000..142640c165 --- /dev/null +++ b/test/Lexer/cross-windows-on-linux.cpp @@ -0,0 +1,14 @@ +// RUN: not %clang_cc1 -fsyntax-only -triple i686-win32 %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix CHECK-NO-COMPAT +// XFAIL: win32 + +// RUN: not %clang_cc1 -fsyntax-only -fms-compatibility -triple i686-win32 %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix CHECK-COMPAT + +#include "Inputs\success.h" + +// CHECK-NO-COMPAT: error: 'Inputs\success.h' file not found +// CHECK-NO-COMPAT: #include "Inputs\success.h" +// CHECK-NO-COMPAT: ^ + +// CHECK-COMPAT: error: success