On Sat, Dec 14, 2013 at 5:44 AM, Will Wilson <[email protected]> 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 <[email protected]>*/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to