]> granicus.if.org Git - clang/commitdiff
Lex: reduce buffer size, add a test
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 12 Mar 2014 02:26:08 +0000 (02:26 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 12 Mar 2014 02:26:08 +0000 (02:26 +0000)
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

lib/Lex/PPDirectives.cpp
test/Lexer/Inputs/success.h [new file with mode: 0644]
test/Lexer/cross-windows-on-linux.cpp [new file with mode: 0644]

index b3d766a759caec76e6fbe913fefafba52e3af9d6..17b9b09d3e3cd5155ebf994207d34470374cdaf3 100644 (file)
@@ -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 (file)
index 0000000..5fdf5aa
--- /dev/null
@@ -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 (file)
index 0000000..142640c
--- /dev/null
@@ -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