1 // Copyright (C) 2016 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "dumper/frontend_action.h"
16 
17 #include "dumper/ast_processing.h"
18 
19 #include <clang/AST/ASTConsumer.h>
20 // FIXME: ASTFrontendAction depends on DenseMapInfo<clang::QualType>.
21 #include <clang/AST/TypeOrdering.h>
22 #include <clang/Frontend/CompilerInstance.h>
23 
24 #include <utility>
25 
26 
27 namespace header_checker {
28 namespace dumper {
29 
30 
HeaderCheckerFrontendAction(HeaderCheckerOptions & options)31 HeaderCheckerFrontendAction::HeaderCheckerFrontendAction(
32     HeaderCheckerOptions &options)
33     : options_(options) {}
34 
35 std::unique_ptr<clang::ASTConsumer>
CreateASTConsumer(clang::CompilerInstance & ci,llvm::StringRef header_file)36 HeaderCheckerFrontendAction::CreateASTConsumer(clang::CompilerInstance &ci,
37                                                llvm::StringRef header_file) {
38   // Create AST consumers.
39   return std::make_unique<HeaderASTConsumer>(&ci, options_);
40 }
41 
42 
43 }  // dumper
44 }  // header_checker
45