Skip to content

Commit 250d52d

Browse files
committed
Making sure the scanning CompilerInvocation's -Ds are canonicalized.
1 parent ed16523 commit 250d52d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,13 @@ class DependencyScanningAction {
391391
IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
392392
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
393393
DiagnosticConsumer *DiagConsumer) {
394+
// Making sure that we canonicalize the defines before we create the deep
395+
// copy.
396+
if (any(Service.getOptimizeArgs() & ScanningOptimizations::Macros))
397+
canonicalizeDefines(Invocation->getPreprocessorOpts());
398+
394399
// Make a deep copy of the original Clang invocation.
395400
CompilerInvocation OriginalInvocation(*Invocation);
396-
if (any(Service.getOptimizeArgs() & ScanningOptimizations::Macros))
397-
canonicalizeDefines(OriginalInvocation.getPreprocessorOpts());
398401

399402
if (Scanned) {
400403
// Scanning runs once for the first -cc1 invocation in a chain of driver

0 commit comments

Comments
 (0)