BaseDirectoryAsWritten = Blob;
assert(!F.ModuleName.empty() &&
"MODULE_DIRECTORY found before MODULE_NAME");
+ F.BaseDirectory = std::string(Blob);
+ if (!PP.getPreprocessorOpts().ModulesCheckRelocated)
+ break;
// If we've already loaded a module map file covering this module, we may
// have a better path for it (relative to the current build).
Module *M = PP.getHeaderSearchInfo().lookupModule(
}
}
F.BaseDirectory = std::string(M->Directory->getName());
- } else {
- F.BaseDirectory = std::string(Blob);
}
break;
}
// usable header search context.
assert(!F.ModuleName.empty() &&
"MODULE_NAME should come before MODULE_MAP_FILE");
- if (F.Kind == MK_ImplicitModule && ModuleMgr.begin()->Kind != MK_MainFile) {
+ if (PP.getPreprocessorOpts().ModulesCheckRelocated &&
+ F.Kind == MK_ImplicitModule && ModuleMgr.begin()->Kind != MK_MainFile) {
// An implicitly-loaded module file should have its module listed in some
// module map file that we've already loaded.
Module *M =
// CHECK: ],
// CHECK-NEXT: "context-hash": "[[HASH_X:.*]]",
// CHECK-NEXT: "file-deps": [
-// CHECK-NEXT: "[[PREFIX]]/./X.h",
-// CHECK-NEXT: "[[PREFIX]]/./module.modulemap"
+// CHECK-NEXT: "[[PREFIX]]/X.h",
+// CHECK-NEXT: "[[PREFIX]]/module.modulemap"
// CHECK-NEXT: ],
// CHECK-NEXT: "name": "X"
// CHECK-NEXT: },
// CHECK: ],
// CHECK-NEXT: "context-hash": "[[HASH_Y_WITH_A]]",
// CHECK-NEXT: "file-deps": [
-// CHECK-NEXT: "[[PREFIX]]/./Y.h",
-// CHECK-NEXT: "[[PREFIX]]/./a/a.h",
-// CHECK-NEXT: "[[PREFIX]]/./begin/begin.h",
-// CHECK-NEXT: "[[PREFIX]]/./end/end.h",
-// CHECK-NEXT: "[[PREFIX]]/./module.modulemap"
+// CHECK-NEXT: "[[PREFIX]]/Y.h",
+// CHECK-NEXT: "[[PREFIX]]/a/a.h",
+// CHECK-NEXT: "[[PREFIX]]/begin/begin.h",
+// CHECK-NEXT: "[[PREFIX]]/end/end.h",
+// CHECK-NEXT: "[[PREFIX]]/module.modulemap"
// CHECK-NEXT: ],
// CHECK-NEXT: "name": "Y"
// CHECK-NEXT: }
// also has a different context hash from the first version of module X.
// CHECK-NOT: "context-hash": "[[HASH_X]]",
// CHECK: "file-deps": [
-// CHECK-NEXT: "[[PREFIX]]/./X.h",
-// CHECK-NEXT: "[[PREFIX]]/./module.modulemap"
+// CHECK-NEXT: "[[PREFIX]]/X.h",
+// CHECK-NEXT: "[[PREFIX]]/module.modulemap"
// CHECK-NEXT: ],
// CHECK-NEXT: "name": "X"
// CHECK-NEXT: },
// CHECK: ],
// CHECK-NEXT: "context-hash": "[[HASH_Y_WITHOUT_A]]",
// CHECK-NEXT: "file-deps": [
-// CHECK-NEXT: "[[PREFIX]]/./Y.h",
-// CHECK-NEXT: "[[PREFIX]]/./begin/begin.h",
-// CHECK-NEXT: "[[PREFIX]]/./end/end.h",
-// CHECK-NEXT: "[[PREFIX]]/./module.modulemap"
+// CHECK-NEXT: "[[PREFIX]]/Y.h",
+// CHECK-NEXT: "[[PREFIX]]/begin/begin.h",
+// CHECK-NEXT: "[[PREFIX]]/end/end.h",
+// CHECK-NEXT: "[[PREFIX]]/module.modulemap"
// CHECK-NEXT: ],
// CHECK-NEXT: "name": "Y"
// CHECK-NEXT: }