mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-23 16:06:24 +00:00
When remapping a virtual file, also make an entry for the file with
its absolute path on disk. Also, introduce a fun test for the precompiled preamble, which almost works... llvm-svn: 109470
This commit is contained in:
parent
c698417e52
commit
81c000fb6d
@ -365,6 +365,18 @@ FileManager::getVirtualFile(llvm::StringRef Filename, off_t Size,
|
||||
UFE->ModTime = ModificationTime;
|
||||
UFE->Dir = DirInfo;
|
||||
UFE->UID = NextFileUID++;
|
||||
|
||||
// If this virtual file resolves to a file, also map that file to the
|
||||
// newly-created file entry.
|
||||
const char *InterndFileName = NamedFileEnt.getKeyData();
|
||||
struct stat StatBuf;
|
||||
if (!stat_cached(InterndFileName, &StatBuf) &&
|
||||
!S_ISDIR(StatBuf.st_mode)) {
|
||||
llvm::sys::Path FilePath(InterndFileName);
|
||||
FilePath.makeAbsolute();
|
||||
FileEntries[FilePath.str()] = UFE;
|
||||
}
|
||||
|
||||
return UFE;
|
||||
}
|
||||
|
||||
|
1
clang/test/Index/Inputs/preamble.h
Normal file
1
clang/test/Index/Inputs/preamble.h
Normal file
@ -0,0 +1 @@
|
||||
int bar(int);
|
4
clang/test/Index/Inputs/prefix.h
Normal file
4
clang/test/Index/Inputs/prefix.h
Normal file
@ -0,0 +1,4 @@
|
||||
#ifndef PREFIX_H
|
||||
#define PREFIX_H
|
||||
int foo(int);
|
||||
#endif
|
13
clang/test/Index/preamble.c
Normal file
13
clang/test/Index/preamble.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include "prefix.h"
|
||||
#include "preamble.h"
|
||||
int wibble(int);
|
||||
|
||||
// FIXME: Turn on use of preamble files
|
||||
|
||||
// RUN: %clang -x c-header -o %t.pch %S/Inputs/prefix.h
|
||||
// RUN: c-index-test -test-load-source-reparse 5 local -I %S/Inputs -include %t %s | FileCheck %s
|
||||
|
||||
// CHECK: preamble.h:1:5: FunctionDecl=bar:1:5 Extent=[1:5 - 1:13]
|
||||
// CHECK: preamble.h:1:12: ParmDecl=:1:12 (Definition) Extent=[1:9 - 1:13]
|
||||
// CHECK: preamble.c:3:5: FunctionDecl=wibble:3:5 Extent=[3:5 - 3:16]
|
||||
// CHECK: preamble.c:3:15: ParmDecl=:3:15 (Definition) Extent=[3:12 - 3:16]
|
Loading…
Reference in New Issue
Block a user