[PATCH] Implement MSVC header search algorithm in MicrosoftMode
Dmitri Gribenko
gribozavr at gmail.com
Mon Dec 16 18:05:20 PST 2013
On Sat, Dec 14, 2013 at 5:44 AM, Will Wilson <will at indefiant.com> wrote:
> Hi All,
>
> Here's a patch to implement the MSVC header search algorithm for quoted
> #includes. MSVC doesn't just search the #includer's directory (the existing
> clang/GCC behaviour) but also searches the directories of all parent
> includers before falling back on the standard search paths. I implemented
> this after being bitten a few times by clang including different files to
> MSVC within existing MSVC targeted codebases.
+ typedef ArrayRef<const FileEntry *>::iterator Iter;
+ for (Iter I(Includers.begin()), E(Includers.end()); I != E; ++I) {
This is not the usual LLVM style; the type Iter is not reused
anywhere, so this should be probably spelled as:
for (ArrayRef<const FileEntry *>::iterator I = Includers.begin(), E =
Includers.end(); I != E; ++I)
+ // If the header lookup mechanism may be relative to the current inclusion
+ // stack,
+ // record the parent #includes.
Comment formatting is a bit strange here.
+ if (!FileEnt)
+ FileEnt = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID());
+
+ if (FileEnt)
+ Includers.push_back(FileEnt);
Is the second if statement needed? Could we assert(FileEnt); here?
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list