Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lex] Make sure to notify
MultipleIncludeOpt
for "read tokens" duri…
…ng fast dependency directive lexing Otherwise a header may be erroneously marked as having a header macro guard and won't get re-included. Differential Revision: https://reviews.llvm.org/D128772
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// RUN: rm -rf %t | ||
// RUN: split-file %s %t | ||
// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json | ||
|
||
// RUN: clang-scan-deps -compilation-database %t/cdb.json | FileCheck %s | ||
|
||
// CHECK: t.c | ||
// CHECK: top.h | ||
// CHECK: n1.h | ||
// CHECK: n2.h | ||
// CHECK: n3.h | ||
|
||
//--- cdb.json.template | ||
[ | ||
{ | ||
"directory": "DIR", | ||
"command": "clang -fsyntax-only DIR/t.c", | ||
"file": "DIR/t.c" | ||
} | ||
] | ||
|
||
//--- t.c | ||
|
||
#include "top.h" | ||
#define INCLUDE_N3 | ||
#include "top.h" | ||
|
||
//--- top.h | ||
#ifndef _TOP_H_ | ||
#define _TOP_H_ | ||
|
||
#include "n1.h" | ||
|
||
#endif | ||
|
||
// More stuff after following '#endif', should invalidate the macro guard optimization, | ||
// and allow `top.h` to get re-included. | ||
#include "n2.h" | ||
|
||
//--- n1.h | ||
|
||
//--- n2.h | ||
#ifdef INCLUDE_N3 | ||
#include "n3.h" | ||
#endif | ||
|
||
//--- n3.h |