summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/Lex/Pragma.cpp8
-rw-r--r--clang/Lex/Preprocessor.cpp13
-rw-r--r--clang/include/clang/Lex/Preprocessor.h4
3 files changed, 11 insertions, 14 deletions
diff --git a/clang/Lex/Pragma.cpp b/clang/Lex/Pragma.cpp
index cef71b22872..a535cc456a2 100644
--- a/clang/Lex/Pragma.cpp
+++ b/clang/Lex/Pragma.cpp
@@ -255,12 +255,12 @@ void Preprocessor::HandlePragmaDependency(LexerToken &DependencyTok) {
// Find out whether the filename is <x> or "x".
bool isAngled = Filename[0] == '<';
- // Remove the quotes.
- Filename = std::string(Filename.begin()+1, Filename.end()-1);
-
// Search include directories for this file.
const DirectoryLookup *CurDir;
- const FileEntry *File = LookupFile(Filename, isAngled, 0, CurDir);
+
+ // Remove the quotes.
+ const FileEntry *File = LookupFile(&Filename[1], &Filename[Filename.size()-1],
+ isAngled, 0, CurDir);
if (File == 0)
return Diag(FilenameTok, diag::err_pp_file_not_found);
diff --git a/clang/Lex/Preprocessor.cpp b/clang/Lex/Preprocessor.cpp
index 661785c1b8b..8ee524f5b93 100644
--- a/clang/Lex/Preprocessor.cpp
+++ b/clang/Lex/Preprocessor.cpp
@@ -251,7 +251,8 @@ CreateString(const char *Buf, unsigned Len, SourceLocation SLoc) {
/// LookupFile - Given a "foo" or <foo> reference, look up the indicated file,
/// return null on failure. isAngled indicates whether the file reference is
/// for system #include's or not (i.e. using <> instead of "").
-const FileEntry *Preprocessor::LookupFile(const std::string &Filename,
+const FileEntry *Preprocessor::LookupFile(const char *FilenameStart,
+ const char *FilenameEnd,
bool isAngled,
const DirectoryLookup *FromDir,
const DirectoryLookup *&CurDir) {
@@ -263,9 +264,6 @@ const FileEntry *Preprocessor::LookupFile(const std::string &Filename,
CurFileEnt = SourceMgr.getFileEntryForFileID(TheFileID);
}
- const char *FilenameStart = &Filename[0];
- const char *FilenameEnd = FilenameStart+Filename.size();
-
// Do a standard file entry lookup.
CurDir = CurDirLookup;
const FileEntry *FE =
@@ -1502,12 +1500,11 @@ void Preprocessor::HandleIncludeDirective(LexerToken &IncludeTok,
// Find out whether the filename is <x> or "x".
bool isAngled = Filename[0] == '<';
- // Remove the quotes.
- Filename = std::string(Filename.begin()+1, Filename.end()-1);
-
// Search include directories.
const DirectoryLookup *CurDir;
- const FileEntry *File = LookupFile(Filename, isAngled, LookupFrom, CurDir);
+ // Remove the quotes from the filename.
+ const FileEntry *File = LookupFile(&Filename[1], &Filename[Filename.size()-1],
+ isAngled, LookupFrom, CurDir);
if (File == 0)
return Diag(FilenameTok, diag::err_pp_file_not_found);
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index 9aedb91d023..e999a8b63e5 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -406,8 +406,8 @@ private:
/// LookupFile - Given a "foo" or <foo> reference, look up the indicated file,
/// return null on failure. isAngled indicates whether the file reference is
/// for system #include's or not (i.e. using <> instead of "").
- const FileEntry *LookupFile(const std::string &Filename, bool isAngled,
- const DirectoryLookup *FromDir,
+ const FileEntry *LookupFile(const char *FilenameStart,const char *FilenameEnd,
+ bool isAngled, const DirectoryLookup *FromDir,
const DirectoryLookup *&CurDir);
//===--------------------------------------------------------------------===//
OpenPOWER on IntegriCloud