r203632 - Lex: reduce buffer size, add a test

Saleem Abdulrasool compnerd at compnerd.org
Tue Mar 11 19:26:09 PDT 2014


Author: compnerd
Date: Tue Mar 11 21:26:08 2014
New Revision: 203632

URL: http://llvm.org/viewvc/llvm-project?rev=203632&view=rev
Log:
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.

Added:
    cfe/trunk/test/Lexer/Inputs/success.h
    cfe/trunk/test/Lexer/cross-windows-on-linux.cpp
Modified:
    cfe/trunk/lib/Lex/PPDirectives.cpp

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=203632&r1=203631&r2=203632&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Mar 11 21:26:08 2014
@@ -1450,7 +1450,7 @@ void Preprocessor::HandleIncludeDirectiv
   // 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);

Added: cfe/trunk/test/Lexer/Inputs/success.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/Inputs/success.h?rev=203632&view=auto
==============================================================================
--- cfe/trunk/test/Lexer/Inputs/success.h (added)
+++ cfe/trunk/test/Lexer/Inputs/success.h Tue Mar 11 21:26:08 2014
@@ -0,0 +1 @@
+#error success

Added: cfe/trunk/test/Lexer/cross-windows-on-linux.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cross-windows-on-linux.cpp?rev=203632&view=auto
==============================================================================
--- cfe/trunk/test/Lexer/cross-windows-on-linux.cpp (added)
+++ cfe/trunk/test/Lexer/cross-windows-on-linux.cpp Tue Mar 11 21:26:08 2014
@@ -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





More information about the cfe-commits mailing list