Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: tools/clang/translation_unit/TranslationUnitGenerator.cpp

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/clang/translation_unit/TranslationUnitGenerator.cpp
diff --git a/tools/clang/translation_unit/TranslationUnitGenerator.cpp b/tools/clang/translation_unit/TranslationUnitGenerator.cpp
index df9eaebb7cb08b280786e0aa784b95cdef245018..5db8d640b74c5c6e5b6328c9ee7ab49e6f8cbe95 100644
--- a/tools/clang/translation_unit/TranslationUnitGenerator.cpp
+++ b/tools/clang/translation_unit/TranslationUnitGenerator.cpp
@@ -18,6 +18,7 @@
#include <string>
#include <vector>
+#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/CompilerInstance.h"
@@ -136,7 +137,13 @@ void IncludeFinderPPCallbacks::InclusionDirective(
// file, and append the relative path.
last_inclusion_directive_ = parent + "/" + relative_path.str();
} else if (!search_path.empty()) {
- last_inclusion_directive_ = string(search_path) + "/" + relative_path.str();
+ // We want to be able to extract the search path relative to which the
+ // include statement is defined. Therefore if search_path is an absolute
+ // path (indicating it is most likely a system header) we use "//" as a
+ // separator between the search path and the relative path.
+ last_inclusion_directive_ = search_path.str() +
+ (llvm::sys::path::is_absolute(search_path) ? "//" : "/") +
+ relative_path.str();
} else {
last_inclusion_directive_ = file_name.str();
}
@@ -184,7 +191,7 @@ void CompilationIndexerAction::Preprocess() {
&getCompilerInstance().getSourceManager(),
&main_source_file_,
&source_file_paths_));
- preprocessor.IgnorePragmas();
+ preprocessor.getDiagnostics().setIgnoreAllWarnings(true);
preprocessor.SetSuppressIncludeNotFoundError(true);
preprocessor.EnterMainSourceFile();
clang::Token token;

Powered by Google App Engine
This is Rietveld 408576698