aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Basic/SourceManagerTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Basic/SourceManagerTest.cpp')
-rw-r--r--clang/unittests/Basic/SourceManagerTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Basic/SourceManagerTest.cpp b/clang/unittests/Basic/SourceManagerTest.cpp
index f4bdd9c..850a08b 100644
--- a/clang/unittests/Basic/SourceManagerTest.cpp
+++ b/clang/unittests/Basic/SourceManagerTest.cpp
@@ -294,10 +294,16 @@ TEST_F(SourceManagerTest, getMacroArgExpandedLocation) {
TrivialModuleLoader ModLoader;
HeaderSearch HeaderInfo(std::make_shared<HeaderSearchOptions>(), SourceMgr,
Diags, LangOpts, &*Target);
+
Preprocessor PP(std::make_shared<PreprocessorOptions>(), Diags, LangOpts,
SourceMgr, HeaderInfo, ModLoader,
/*IILookup =*/nullptr,
/*OwnsHeaderSearch =*/false);
+ // Ensure we can get expanded locations in presence of implicit includes.
+ // These are different than normal includes since predefines buffer doesn't
+ // have a valid insertion location.
+ PP.setPredefines("#include \"/implicit-header.h\"");
+ FileMgr.getVirtualFile("/implicit-header.h", 0, 0);
PP.Initialize(*Target);
PP.EnterMainSourceFile();