Skip to content

Commit bd509b4

Browse files
committed
Explicitly recognize -U and -D arguments as requiring a macro, not a path.
1 parent 5b2e380 commit bd509b4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

generator/main.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ static bool proceedCommand(std::vector<std::string> command, llvm::StringRef Dir
236236
// This code change all the paths to be absolute paths
237237
// FIXME: it is a bit fragile.
238238
bool previousIsDashI = false;
239+
bool previousNeedsMacro = false;
239240
bool hasNoStdInc = false;
240241
for(std::string &A : command) {
241242
if (previousIsDashI && !A.empty() && A[0] != '/') {
@@ -248,6 +249,13 @@ static bool proceedCommand(std::vector<std::string> command, llvm::StringRef Dir
248249
} else if (A == "-nostdinc") {
249250
hasNoStdInc = true;
250251
continue;
252+
} else if (A == "-U" || A == "-D") {
253+
previousNeedsMacro = true;
254+
continue;
255+
}
256+
if (previousNeedsMacro) {
257+
previousNeedsMacro = false;
258+
continue;
251259
}
252260
previousIsDashI = false;
253261
if (A.empty()) continue;

0 commit comments

Comments
 (0)